diff options
| author | Mary <33456283+FourIsTheNumber@users.noreply.github.com> | 2024-10-20 09:08:15 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-20 13:08:15 +0000 |
| commit | 25f01262c6de6a25078ca97822de2b068b23c212 (patch) | |
| tree | 8bfa30bec1391ff4719af4fffe395544e9d5ca87 /src/main/java/gregtech/common/tileentities/render | |
| parent | c9dd559aa1cc5d1a3659fb11e48bcb4bc22d7214 (diff) | |
| download | GT5-Unofficial-25f01262c6de6a25078ca97822de2b068b23c212.tar.gz GT5-Unofficial-25f01262c6de6a25078ca97822de2b068b23c212.tar.bz2 GT5-Unofficial-25f01262c6de6a25078ca97822de2b068b23c212.zip | |
Blackhole render enhancement (#3390)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Diffstat (limited to 'src/main/java/gregtech/common/tileentities/render')
| -rw-r--r-- | src/main/java/gregtech/common/tileentities/render/TileEntityBlackhole.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main/java/gregtech/common/tileentities/render/TileEntityBlackhole.java b/src/main/java/gregtech/common/tileentities/render/TileEntityBlackhole.java index f15aa45eee..2f7114e405 100644 --- a/src/main/java/gregtech/common/tileentities/render/TileEntityBlackhole.java +++ b/src/main/java/gregtech/common/tileentities/render/TileEntityBlackhole.java @@ -10,12 +10,17 @@ public class TileEntityBlackhole extends TileEntity { // Should run from 0 to 1, >.5 starts showing changes private float stability = 1; + // true = growing, false = shrinking + private boolean scaling = true; + private long startTime = 0; private float laserR = 0.318f, laserG = 0.157f, laserB = 0.533f; private boolean laserRender = false; private static final String NBT_TAG = "BLACKHOLE"; private static final String STABILITY_NBT_TAG = NBT_TAG + "STABILITY"; + private static final String START_TIME_NBT_TAG = NBT_TAG + "START_TIME"; + private static final String SCALING_NBT_TAG = NBT_TAG + "SCALING"; private static final String COLOR_RED_NBT_TAG = NBT_TAG + "COLOR_RED"; private static final String COLOR_GREEN_NBT_TAG = NBT_TAG + "COLOR_GREEN"; private static final String COLOR_BLUE_NBT_TAG = NBT_TAG + "COLOR_BLUE"; @@ -53,6 +58,22 @@ public class TileEntityBlackhole extends TileEntity { return laserRender; } + public void startScaleChange(boolean scaling) { + if (!worldObj.isRemote) { + this.startTime = worldObj.getTotalWorldTime(); + this.scaling = scaling; + updateToClient(); + } + } + + public long getStartTime() { + return startTime; + } + + public boolean getScaling() { + return scaling; + } + public void setStability(float stability) { // Can probably be simplified, maps stability > .5 as 1, and stability <.5 from 0 to 1 if (!worldObj.isRemote) { @@ -68,6 +89,8 @@ public class TileEntityBlackhole extends TileEntity { public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); compound.setFloat(STABILITY_NBT_TAG, stability); + compound.setBoolean(SCALING_NBT_TAG, scaling); + compound.setLong(START_TIME_NBT_TAG, startTime); compound.setFloat(COLOR_RED_NBT_TAG, laserR); compound.setFloat(COLOR_GREEN_NBT_TAG, laserG); compound.setFloat(COLOR_BLUE_NBT_TAG, laserB); @@ -77,6 +100,8 @@ public class TileEntityBlackhole extends TileEntity { @Override public void readFromNBT(NBTTagCompound compound) { stability = compound.getFloat(STABILITY_NBT_TAG); + scaling = compound.getBoolean(SCALING_NBT_TAG); + startTime = compound.getLong(START_TIME_NBT_TAG); laserR = compound.getFloat(COLOR_RED_NBT_TAG); laserG = compound.getFloat(COLOR_GREEN_NBT_TAG); laserB = compound.getFloat(COLOR_BLUE_NBT_TAG); |
