Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuclear fission #2093

Open
wants to merge 199 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 119 commits
Commits
Show all changes
199 commits
Select commit Hold shift + click to select a range
b98199e
Start of work on nuclear fission
Zalgo239 Apr 7, 2023
55a7c49
Start implementation of reactor states
Zalgo239 Apr 7, 2023
12d255d
Smoother transitions and better logic
Zalgo239 Apr 11, 2023
2164c9d
More reactor states
Zalgo239 Apr 16, 2023
58fa6ba
Reorganising packages
Zalgo239 Apr 19, 2023
427ee94
Other nuclear components
Zalgo239 Apr 19, 2023
7a40ca4
New material properties
Zalgo239 Apr 19, 2023
3796bf6
Basic stats for nuclear properties
Zalgo239 Apr 19, 2023
47f03ad
Keys for the new properties
Zalgo239 Apr 19, 2023
0f819dc
Large amount of reactor calculations
Zalgo239 Apr 24, 2023
376db84
Significantly improved and simplified logic
Zalgo239 May 2, 2023
2ce07e4
Reactor stats calculation cleanup
Zalgo239 May 5, 2023
66c1e66
Fission Reactor meta tile entity
Zalgo239 May 5, 2023
7c64a23
Fission reactor rebase
Zalgo239 May 10, 2023
563ebc6
Start of work on reactor multiblock structure logic
Zalgo239 May 11, 2023
d45e1f1
Proper handling of minimum and maximum dimensions
Zalgo239 May 11, 2023
29475f2
More reactor structure logic
Zalgo239 May 12, 2023
48c434f
Fixed height calculation and extra tricorder info
Zalgo239 May 12, 2023
a1f12bc
Reactor dimensions NBT saving
Zalgo239 May 14, 2023
8391e90
Extra structure pattern checks
Zalgo239 May 14, 2023
3d11fe6
Rebase and fixes due to changes to IMaterialProperty
Zalgo239 May 29, 2023
b511e55
Start work on custom hatches for fission reactor
Zalgo239 May 31, 2023
b757ae2
Added UI for the fuel rod hatch
Zalgo239 Jun 1, 2023
1837229
Added fuel rod output hatch
Zalgo239 Jun 6, 2023
2490741
API fixes and fuel rod hatch rendering
Zalgo239 Jun 6, 2023
8fd6ce9
Fix fuel rod hatches orientations
Zalgo239 Jun 13, 2023
d30c627
Add coolant hatches and control rod port
Zalgo239 Jun 13, 2023
2dd3455
Fission reactor component names localisation
Zalgo239 Jun 13, 2023
2849604
Add hatches to the fission reactor's structure
bruberu Jun 19, 2023
e1b99a3
Fuel rod hatch, coolant hatch, and control rod hatch checks put in place
bruberu Jun 20, 2023
3378111
Allow coolant import and fuel rod import hatches to be locked
bruberu Jun 20, 2023
2354360
Basic work on actually constructing the reactor (doesn't compile)
bruberu Jun 21, 2023
231e42c
Complete nuclear reactor checks (but apparently locking needs to be c…
bruberu Jun 25, 2023
115b531
Proper server-to-client locking sync
bruberu Jun 28, 2023
7ae3ca3
Start thinking about how to actually update the fission reactor
bruberu Jul 5, 2023
e91338e
Reactor state update order
Zalgo239 Jul 13, 2023
9f22688
Reactor failiure checks
Zalgo239 Jul 13, 2023
6d1b8d6
Fix MTE ID conflicts
Zalgo239 Aug 16, 2023
8b68afa
Refactor logic to remove coolant headaches
Zalgo239 Aug 16, 2023
d7b3ac5
Coolant consumption logic
Zalgo239 Aug 17, 2023
0d2ef18
Remove unecessary variable
Zalgo239 Aug 17, 2023
71b59e7
Make reactor consume the fuel
Zalgo239 Aug 31, 2023
5485f70
Add components for gas centrifuges and spent fuel pool
Zalgo239 Aug 31, 2023
7b47128
Added spent fuel pool multiblock
Zalgo239 Sep 2, 2023
fe95377
Added totally original and not copied from susycore heat exchanger code
Zalgo239 Sep 3, 2023
489b0d3
New epic paneling for spent fuel pools and other decor
Zalgo239 Sep 4, 2023
95bb585
Spent fuel pool structure changes and light on spent fuel casings
Zalgo239 Sep 7, 2023
6a83a95
Blocks cleanup
Zalgo239 Sep 7, 2023
5c2b982
Structure fixes
Zalgo239 Sep 7, 2023
a526688
Remove unused import
Zalgo239 Sep 7, 2023
7f33913
Textures for the empty fuel casings variant
Zalgo239 Sep 15, 2023
061a63d
Remove light from nuclear casings
Zalgo239 Sep 16, 2023
ca2d6a7
Fix inactive variant being emissive
Zalgo239 Sep 16, 2023
57307e1
Remove unused defaults
Zalgo239 Sep 16, 2023
291a117
Added gas centrifuge multiblock
Zalgo239 Sep 16, 2023
8674b03
fixes
serenibyss Dec 7, 2023
6a7a914
spotless
serenibyss Dec 7, 2023
b8983a2
a couple spotless cleanups
serenibyss Dec 7, 2023
ae9d20e
Added consequences for failures
Zalgo239 Dec 23, 2023
080d303
Hot coolant output logic
Zalgo239 Dec 28, 2023
f12a5a3
Radiation damage from items and fuel rods
Zalgo239 Dec 28, 2023
ae5ef45
Add item models and textures
Zalgo239 Dec 30, 2023
7ea3a66
Add coolant properties to material builder
Zalgo239 Dec 30, 2023
abbfc6e
Fix reactor not outputting the correct coolant
Zalgo239 Dec 31, 2023
54eaf68
Fix U238 being used as natural uranium
Zalgo239 Dec 31, 2023
2aa56b1
Added more nuclear materials
Zalgo239 Dec 31, 2023
5b4f9b1
attempt test prerelease script
serenibyss Jan 5, 2024
c30b7f0
try to make github run the action
serenibyss Jan 5, 2024
41507a1
spotless
serenibyss Jan 5, 2024
c5ef04b
fix compilation issues
serenibyss Jan 5, 2024
4f48a50
Various Fission Reactor fixes (#2338)
loxoDev Jan 8, 2024
785b3ff
Almost workable fission reactor (#2433)
bruberu Jun 2, 2024
f5ac934
fix: merge oops
bruberu Jun 2, 2024
dbdb2da
feat: couple textures I forgot
bruberu Jun 3, 2024
20b1b3f
feat: a few more radiation damage functions
bruberu Jun 3, 2024
97156ca
feat: coolant config as requested by Zalgo
bruberu Jun 4, 2024
765ca05
fix: I love getting spotless'd
bruberu Jun 4, 2024
73eb670
feat: resolve some TODOs
bruberu Jun 5, 2024
0e96dcf
fix: sbob
bruberu Jun 5, 2024
15a80c8
fix: reviews part 1
bruberu Jun 6, 2024
eff79de
fix: reviews part 2
bruberu Jun 6, 2024
2f2b003
fix: splotlam 49oianuhwsegrd
bruberu Jun 6, 2024
a258bf2
fix: how did I not notice that
bruberu Jun 6, 2024
a852a37
fix: revert gas centrifuge shenanigans
bruberu Jun 7, 2024
63540f7
feat: more documentation
bruberu Jun 7, 2024
d396ba8
fix: one fuel rod doesn't literally break things anymore
bruberu Jun 7, 2024
b252975
fix: the daily spotless :)
bruberu Jun 7, 2024
42ffe41
fix: better structural feedback
bruberu Jun 7, 2024
403bb1b
fix: better coolant saving
bruberu Jun 7, 2024
a129bfa
fix: useless layers now actually mean something
bruberu Jun 7, 2024
f441101
fix: spotless last files
bruberu Jun 7, 2024
06ed766
fix: water being OP
bruberu Jun 7, 2024
f5a1eee
fix: plateZircaloy and anode basket
bruberu Jun 8, 2024
5d10f41
fix: missing high-grade MOX spent fuel recipe
bruberu Jun 8, 2024
0d289f8
fix: stainless steel round
bruberu Jun 8, 2024
35a17f2
fix: min instead of max, and another structure bug
bruberu Jun 8, 2024
c0149d6
feat: maintenance
bruberu Jun 8, 2024
a7d798c
fix: remove error type that might not mean anything important
bruberu Jun 9, 2024
bba511e
feat: start on half life
bruberu Jun 9, 2024
ccf7fae
fix: composition
bruberu Jun 18, 2024
a9bbe40
Nuclear fission intermediate work (#2507)
bruberu Jun 18, 2024
3eeab88
fix: circuits
bruberu Jun 19, 2024
ba409b9
feat: UX 101
bruberu Jun 21, 2024
3d2d711
feat: I should probably push these textures too
bruberu Jun 21, 2024
b744940
feat: UX 102
bruberu Jun 21, 2024
feb237d
feat: a friendly nuclear engineer
bruberu Jun 23, 2024
e59b5b8
fix: flow rate + UI calculations
bruberu Jun 23, 2024
8d3ec09
fix: NPE
bruberu Jun 23, 2024
3224647
fix: more NPEs :weary:
bruberu Jun 23, 2024
5bf6c45
fix: non-updating block
bruberu Jun 23, 2024
fd5e965
fix: now consumes fuel on first place
bruberu Jun 23, 2024
ea1cb8b
feat: describe EU/t for water a little better
bruberu Jun 24, 2024
4ecacb0
fix: recheck fuel if work check failed before
bruberu Jun 24, 2024
b7d6031
feat: partial fuel rods (I want to boil myself alive in glyoxylic acid)
bruberu Jun 24, 2024
d3fa666
feat: base fuel rods on partial fuel
bruberu Jun 26, 2024
9440009
fix: remove a beautiful progress bar
bruberu Jun 26, 2024
b766dfa
fix: "pathIsClear"
bruberu Jun 26, 2024
040258d
fix: villager feedback
bruberu Jun 27, 2024
d43d9c7
fix: 7-9 is now 7/16-9/16
bruberu Jun 28, 2024
24252ef
fix: it is NPE sunday today
bruberu Jun 30, 2024
d3e09f8
fix: potential floating point errors
bruberu Jun 30, 2024
da4c015
fix: remove debug depletion
bruberu Jun 30, 2024
aa7f289
feat: display max power limitation better
bruberu Jul 1, 2024
6e3e340
feat: critical rod insertion -> generation rate
bruberu Jul 3, 2024
d365547
fix: temperature min limit & control rod normalization
bruberu Jul 4, 2024
7f4535b
fix: prevent NaN
bruberu Jul 4, 2024
4ca352e
fix: more things I can technically blame on Zalgo
bruberu Jul 4, 2024
43ebbf7
feat: fuel and coolant tooltips
bruberu Jul 5, 2024
e44911e
feat: gas centrifuge column recipe
bruberu Jul 6, 2024
f09661a
fix: material-registry-agnostic
bruberu Jul 7, 2024
491b064
feat: try to lower reactor volatility
bruberu Jul 7, 2024
7c00bfb
feat: ok that was a bad idea
bruberu Jul 7, 2024
9ad1287
fix: reactor meltdown NPE #1234798
bruberu Jul 7, 2024
9e71ba6
Merge remote-tracking branch 'refs/remotes/origin/master' into nuclea…
bruberu Jul 7, 2024
b80623b
feat: upstream merge and deal with fluidstoragekeys
bruberu Jul 7, 2024
41d7bd7
feat: fluid tooltips now work only with the right storage key
bruberu Jul 7, 2024
20d3f9f
More nuclear fission stuff (#2533)
vrejhead Jul 8, 2024
3c4c888
feat: spotless + power overhaul
bruberu Jul 8, 2024
41cc55f
feat: rebalance a little
bruberu Jul 8, 2024
4e126df
feat: logarithmic power
bruberu Jul 8, 2024
44a0b02
feat: mean generation time time
bruberu Jul 8, 2024
395c450
fix: temperature spikes
bruberu Jul 9, 2024
f310069
feat: add k_eff to reactor NBT
bruberu Jul 9, 2024
d9d7e45
fix: zbodlezz
bruberu Jul 9, 2024
1c720f2
feat: redo control rod regulation
bruberu Jul 9, 2024
23dbfd9
fix: that is not the right array
bruberu Jul 9, 2024
af08d1b
feat: large reactor stability
bruberu Jul 9, 2024
554ddb5
fix: more robust shutdown
bruberu Jul 9, 2024
2d7ad90
fix: I want to say a curse word to spotless
bruberu Jul 9, 2024
002c9b5
feat: smiley lobotomy procedure #1
bruberu Jul 9, 2024
56c90c4
fix: sseltops
bruberu Jul 9, 2024
a4b0b20
feat: delta temperature (lobotomy #2)
bruberu Jul 10, 2024
7786b20
feat: fuel rod danger levels
bruberu Jul 10, 2024
8ad1990
Assorted fission fixes (#2536)
loxoDev Jul 10, 2024
537300f
feat: extended facing
bruberu Jul 10, 2024
baf6243
feat: coolant calculations
bruberu Jul 12, 2024
0e9772c
fix: spptptptpppttptppt
bruberu Jul 12, 2024
44a5c06
fix: partialCoolant actually works, maybe
bruberu Jul 12, 2024
a3601f0
feat: set default balancing to 14, thanks to whatsapp2
bruberu Jul 13, 2024
e1506eb
feat: refactor PrimitiveRecipeLogic
bruberu Jul 13, 2024
19240f0
feat: all review comments responded to
bruberu Jul 13, 2024
b872d3b
feat: parallel tooltip (accidentally missed it)
bruberu Jul 13, 2024
91e62e5
fix: custom preview relative directions
bruberu Jul 17, 2024
f51c30b
feat: better spent fuel pool structure
bruberu Jul 17, 2024
39398e6
feat: making even better fuel pool structure when I have a job to get…
bruberu Jul 17, 2024
61e8149
fix: https://www.youtube.com/watch?v=ClUxYeWXnLY
bruberu Jul 17, 2024
1a12ced
feat: double nuclear reprocessing speeds
bruberu Jul 18, 2024
ae14020
fix: stoich
bruberu Jul 18, 2024
1be5dc7
feat: LowEnrichedUraniumDioxide use
bruberu Jul 18, 2024
bef429f
fix: alson's comments
bruberu Jul 20, 2024
7d67e3a
fix: spitless
bruberu Jul 20, 2024
bb01459
feat: the overhaul, part one
bruberu Jul 20, 2024
259db88
feat: primitive multiblocks plan C plus homogenousmore
bruberu Jul 21, 2024
c144c74
feat: overhaul part 2 so I can see more review comments
bruberu Jul 21, 2024
5e0974d
feat: overhaul part 3
bruberu Jul 21, 2024
eb5b6a5
feat: overhaul part 4
bruberu Jul 21, 2024
69751b3
feat: overhaul part 5: panelling edition
bruberu Jul 21, 2024
52a55db
fix: sporkless again
bruberu Jul 21, 2024
43767a6
feat: gas centrifuge columns now look OK
bruberu Jul 21, 2024
9abbc5c
feat: the great refactor
bruberu Jul 21, 2024
f2f18dc
feat: JEI integration
bruberu Jul 21, 2024
b2f41c2
feat: revert the en-enterprisation
bruberu Jul 21, 2024
6270fad
fix: plutonium localization + structure checking + geometry hiccups
bruberu Jul 21, 2024
200c314
fix: setPartialFuel skill issue
bruberu Jul 21, 2024
a98dd0f
feat: balance conversation part 1
bruberu Jul 21, 2024
644941a
feat: balance conversation part 2
bruberu Jul 21, 2024
cda4923
feat: JEI improvements
bruberu Jul 21, 2024
4e7eb53
fix: colors
bruberu Jul 21, 2024
e467afa
feat: widget locking displays
bruberu Jul 21, 2024
fc96413
fix: spotless? more like feckless
bruberu Jul 22, 2024
da6c02b
feat: tellurium in LowGradeMOX
bruberu Jul 22, 2024
f3d9428
feat: rebalance for realism *and* gameplay
bruberu Jul 23, 2024
60c1570
fix: forgor promethium
bruberu Jul 23, 2024
a409d62
feat: config to bump down heat exchanger efficiency
bruberu Jul 24, 2024
d75dbd6
fix: JEI pages + GUI scaling
bruberu Jul 27, 2024
4c9fa32
fix: oh right spotless exists
bruberu Jul 27, 2024
d94ff6c
feat: use block/block
bruberu Jul 28, 2024
be22a9d
feat: set to ZPM (whatsapp2 recommendation)
bruberu Jul 30, 2024
7715045
refactor: hashed map -> string-indexed map
bruberu Aug 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/nuclear_test_release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Nuclear Test Release
name: Java CI with Gradle on main Commit

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to remove this workflow before merging this PR. Not something to do quite yet though, writing this as a reminder for later.

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ modGroup = gregtech

# Version of your mod.
# This field can be left empty if you want your mod's version to be determined by the latest git tag instead.
modVersion = 2.8.7-beta
modVersion = 2.9.0-beta
bruberu marked this conversation as resolved.
Show resolved Hide resolved

# Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version)
includeMCVersionJar = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ public static int assignId() {
public static final int LOCK_OBJECT_HOLDER = assignId();
public static final int CACHED_CWU = assignId();

// Fission Hatches
public static final int LOCK_UPDATE = assignId();
bruberu marked this conversation as resolved.
Show resolved Hide resolved

// NBT Keys

// From MetaTileEntityHolder
Expand All @@ -170,6 +173,10 @@ public static int assignId() {
public static final int UPDATE_SOUND = assignId();
public static final int UPDATE_RADIUS = assignId();

// Fission Reactor
public static int SYNC_REACTOR_STATS = assignId();
public static int SYNC_LOCKING_STATE = assignId();

// ME Parts
public static final int UPDATE_AUTO_PULL = assignId();
public static final int UPDATE_ONLINE_STATUS = assignId();
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/gregtech/api/capability/ICoolantHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package gregtech.api.capability;

import gregtech.api.capability.impl.LockableFluidTank;
import gregtech.api.unification.material.Material;

import net.minecraftforge.fluids.Fluid;

public interface ICoolantHandler extends ILockableHandler<Fluid> {

Material getCoolant();

void setCoolant(Material material);
bruberu marked this conversation as resolved.
Show resolved Hide resolved

LockableFluidTank getFluidTank();
}
24 changes: 24 additions & 0 deletions src/main/java/gregtech/api/capability/IFuelRodHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package gregtech.api.capability;

import gregtech.api.items.itemhandlers.LockableItemStackHandler;
import gregtech.api.nuclear.fission.components.FuelRod;
import gregtech.api.unification.material.Material;

import net.minecraft.item.ItemStack;

public interface IFuelRodHandler extends ILockableHandler<ItemStack> {

Material getFuel();

void setFuel(Material material);

Material getPartialFuel();
bruberu marked this conversation as resolved.
Show resolved Hide resolved

// Set the fuel type that's currently being processed by the reactor, and succeeds in doing so only if it is a
// fission fuel. Returns true if the partial fuel changed.
boolean setPartialFuel(Material material);
bruberu marked this conversation as resolved.
Show resolved Hide resolved

void setInternalFuelRod(FuelRod rod);

LockableItemStackHandler getStackHandler();
}
10 changes: 10 additions & 0 deletions src/main/java/gregtech/api/capability/ILockableHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package gregtech.api.capability;

public interface ILockableHandler<T> {

void setLock(boolean isLocked);

boolean isLocked();

T getLockedObject();
bruberu marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package gregtech.api.capability.impl;

import gregtech.api.capability.ILockableHandler;
import gregtech.api.metatileentity.MetaTileEntity;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;

public class LockableFluidTank extends NotifiableFluidTank implements ILockableHandler<Fluid> {

private boolean locked;
private Fluid lockedFluid;

public LockableFluidTank(int capacity, MetaTileEntity entityToNotify, boolean isExport) {
super(capacity, entityToNotify, isExport);
}

@Override
public Fluid getLockedObject() {
return lockedFluid;
}

@Override
public void setLock(boolean isLocked) {
locked = isLocked;
}

@Override
public int fill(FluidStack resource, boolean doFill) {
int filled = super.fill(resource, doFill);
if (doFill && this.fluid != null && this.fluid.amount != 0) {
this.lockedFluid = this.fluid.getFluid();
}
return filled;
}

@Override
public void setFluid(FluidStack fluid) {
super.setFluid(fluid);
if (this.fluid != null && this.fluid.amount != 0) {
this.lockedFluid = this.fluid.getFluid();
}
}

@Override
public boolean isLocked() {
return locked;
}

@Override
public boolean canFillFluidType(FluidStack fluid) {
if (locked && fluid.getFluid() != lockedFluid) {
return false;
}
return super.canFillFluidType(fluid);
}

@Override
public FluidTank readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
if (nbt.hasKey("LockedFluid")) {
this.lockedFluid = FluidRegistry.getFluid(nbt.getString("LockedFluid"));
} else if (this.fluid != null && this.fluid.amount != 0) {
this.lockedFluid = this.fluid.getFluid();
}
return this;
}

@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
if (lockedFluid != null) {
nbt.setString("LockedFluid", lockedFluid.getName());
}
return nbt;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package gregtech.api.capability.impl;

import gregtech.api.GTValues;
import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController;
import gregtech.api.recipes.logic.OverclockingLogic;
import gregtech.api.recipes.recipeproperties.IRecipePropertyStorage;

import org.jetbrains.annotations.NotNull;

public class NoEnergyMultiblockRecipeLogic extends MultiblockRecipeLogic {
bruberu marked this conversation as resolved.
Show resolved Hide resolved

public NoEnergyMultiblockRecipeLogic(RecipeMapMultiblockController tileEntity) {
super(tileEntity);
}

protected long getEnergyInputPerSecond() {
return 2147483647L;
}

protected long getEnergyStored() {
return 0L;
}

protected long getEnergyCapacity() {
return 2147483647L;
}

protected boolean drawEnergy(int recipeEUt, boolean simulate) {
return true;
}

public long getMaxVoltage() {
return 1L;
}

protected int[] runOverclockingLogic(@NotNull IRecipePropertyStorage propertyStorage, int recipeEUt,
long maxVoltage, int recipeDuration, int amountOC) {
return OverclockingLogic.standardOverclockingLogic(1, this.getMaxVoltage(), recipeDuration, amountOC,
this.getOverclockingDurationDivisor(), this.getOverclockingVoltageMultiplier());
}

public long getMaximumOverclockVoltage() {
return GTValues.V[1];
}

public void invalidate() {
this.previousRecipe = null;
this.progressTime = 0;
this.maxProgressTime = 0;
this.recipeEUt = 0;
this.fluidOutputs = null;
this.itemOutputs = null;
this.setActive(false);
}
}
13 changes: 13 additions & 0 deletions src/main/java/gregtech/api/gui/GuiTextures.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ public class GuiTextures {
.fullImage("textures/gui/widget/button_throttle_minus.png");
public static final TextureArea BUTTON_THROTTLE_PLUS = TextureArea
.fullImage("textures/gui/widget/button_throttle_plus.png");
public static final TextureArea BUTTON_CONTROL_ROD_HELPER = TextureArea
.fullImage("textures/gui/widget/button_control_rod_helper.png");

// INDICATORS & ICONS
public static final TextureArea INDICATOR_NO_ENERGY = TextureArea
Expand All @@ -139,6 +141,11 @@ public class GuiTextures {
public static final TextureArea SLIDER_BACKGROUND_VERTICAL = TextureArea
.fullImage("textures/gui/widget/slider_background_vertical.png");
public static final TextureArea SLIDER_ICON = TextureArea.fullImage("textures/gui/widget/slider.png");
public static final TextureArea DARK_SLIDER_BACKGROUND = TextureArea
.fullImage("textures/gui/widget/dark_slider_background.png");
public static final TextureArea DARK_SLIDER_BACKGROUND_VERTICAL = TextureArea
.fullImage("textures/gui/widget/dark_slider_background_vertical.png");
public static final TextureArea DARK_SLIDER_ICON = TextureArea.fullImage("textures/gui/widget/dark_slider.png");
public static final TextureArea MAINTENANCE_ICON = TextureArea
.fullImage("textures/gui/widget/button_maintenance.png");

Expand Down Expand Up @@ -411,6 +418,12 @@ public class GuiTextures {
.fullImage("textures/gui/progress_bar/progress_bar_turbine_rotor_durability.png");
public static final TextureArea PROGRESS_BAR_FLUID_RIG_DEPLETION = TextureArea
.fullImage("textures/gui/progress_bar/progress_bar_fluid_rig_depletion.png");
public static final TextureArea PROGRESS_BAR_FISSION_HEAT = TextureArea
.fullImage("textures/gui/progress_bar/progress_bar_fission_heat.png");
public static final TextureArea PROGRESS_BAR_FISSION_PRESSURE = TextureArea
.fullImage("textures/gui/progress_bar/progress_bar_fission_pressure.png");
public static final TextureArea PROGRESS_BAR_FISSION_ENERGY = TextureArea
.fullImage("textures/gui/progress_bar/progress_bar_fission_energy.png");

// Fusion reactor diagram progress bar parts
public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_BL = TextureArea
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class AdvancedTextWidget extends Widget {

protected final Consumer<List<ITextComponent>> textSupplier;
protected BiConsumer<String, ClickData> clickHandler;
private List<ITextComponent> displayText = new ArrayList<>();
protected List<ITextComponent> displayText = new ArrayList<>();
bruberu marked this conversation as resolved.
Show resolved Hide resolved
private final int color;

public AdvancedTextWidget(int xPosition, int yPosition, Consumer<List<ITextComponent>> text, int color) {
Expand Down
61 changes: 61 additions & 0 deletions src/main/java/gregtech/api/gui/widgets/RecolorableTextWidget.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package gregtech.api.gui.widgets;

import gregtech.api.gui.IRenderContext;
import gregtech.api.util.Position;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.List;
import java.util.function.Consumer;
import java.util.function.IntSupplier;

/**
* Represents a text-component based widget, which obtains
* text from server and automatically synchronizes it with clients
*/
public class RecolorableTextWidget extends AdvancedTextWidget {
bruberu marked this conversation as resolved.
Show resolved Hide resolved

private final IntSupplier colorSupplier;
private int color;

public RecolorableTextWidget(int xPosition, int yPosition, Consumer<List<ITextComponent>> text,
IntSupplier colorSupplier) {
super(xPosition, yPosition, text, 0);
this.colorSupplier = colorSupplier;
}

@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
int color = colorSupplier.getAsInt();
if (this.color != color) {
this.color = color;
writeUpdateInfo(2, buf -> buf.writeVarInt(color));
}
}

@Override
public void readUpdateInfo(int id, PacketBuffer buffer) {
super.readUpdateInfo(id, buffer);
if (id == 2) {
color = buffer.readVarInt();
}
}

@Override
@SideOnly(Side.CLIENT)
public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) {
super.drawInBackground(mouseX, mouseY, partialTicks, context);
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
Position position = getPosition();
for (int i = 0; i < displayText.size(); i++) {
fontRenderer.drawString(displayText.get(i).getFormattedText(), position.x,
position.y + i * (fontRenderer.FONT_HEIGHT + 2), color);
}
}
}
16 changes: 8 additions & 8 deletions src/main/java/gregtech/api/gui/widgets/SliderWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@ public class SliderWidget extends Widget {
public static final BiFunction<String, Float, String> DEFAULT_TEXT_SUPPLIER = (name, value) -> I18n.format(name,
value.intValue());

private int sliderWidth = 8;
private TextureArea backgroundArea = GuiTextures.SLIDER_BACKGROUND;
private TextureArea sliderIcon = GuiTextures.SLIDER_ICON;
protected int sliderWidth = 8;
protected TextureArea backgroundArea = GuiTextures.SLIDER_BACKGROUND;
protected TextureArea sliderIcon = GuiTextures.SLIDER_ICON;
private final BiFunction<String, Float, String> textSupplier = DEFAULT_TEXT_SUPPLIER;
private int textColor = 0xFFFFFF;
protected int textColor = 0xFFFFFF;

private final float min;
private final float max;
protected final float min;
protected final float max;
private final String name;

private final FloatConsumer responder;
private boolean isPositionSent;

private String displayString;
private float sliderPosition;
protected String displayString;
protected float sliderPosition;
public boolean isMouseDown;

public SliderWidget(String name, int xPosition, int yPosition, int width, int height, float min, float max,
Expand Down
Loading
Loading