aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMary <33456283+FourIsTheNumber@users.noreply.github.com>2024-10-25 17:22:37 -0400
committerGitHub <noreply@github.com>2024-10-25 21:22:37 +0000
commit14f86046a0a88a69560f4604c17b57ea4ccd06c5 (patch)
treea54a058e850a1c1943dd04909a1869b34405f100 /src
parent24c9dea0a41226204d4c8f62214be57313c9e5cb (diff)
downloadGT5-Unofficial-14f86046a0a88a69560f4604c17b57ea4ccd06c5.tar.gz
GT5-Unofficial-14f86046a0a88a69560f4604c17b57ea4ccd06c5.tar.bz2
GT5-Unofficial-14f86046a0a88a69560f4604c17b57ea4ccd06c5.zip
Render fixes (#3409)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java2
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java19
-rw-r--r--src/main/java/gregtech/common/tileentities/render/TileEntityLaser.java7
3 files changed, 22 insertions, 6 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java
index e8785bc7f4..49fdd29257 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java
@@ -217,7 +217,7 @@ public class MTEIndustrialLaserEngraver extends MTEExtendedPowerMultiBlockBase<M
return true;
} else {
if (renderer != null) {
- renderer.realism = !renderer.realism;
+ renderer.toggleRealism();
PlayerUtils.messagePlayer(aPlayer, "Toggling realism!");
return true;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java
index 2d84f032af..4558c732c8 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java
@@ -45,6 +45,7 @@ import net.minecraftforge.fluids.FluidStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits;
import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
@@ -630,9 +631,10 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl
} else blackHoleStatus = 3;
if (shouldRender) {
- if (rendererTileEntity == null) createRenderBlock();
- rendererTileEntity.toggleLaser(didDrain);
- rendererTileEntity.setStability(blackHoleStability / 100F);
+ if (rendererTileEntity != null || createRenderBlock()) {
+ rendererTileEntity.toggleLaser(didDrain);
+ rendererTileEntity.setStability(Math.max(0, blackHoleStability / 100F));
+ }
}
blackHoleStability -= stabilityDecrease;
@@ -702,6 +704,11 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl
}
@Override
+ protected IAlignmentLimits getInitialAlignmentLimits() {
+ return (d, r, f) -> d != ForgeDirection.UP && d != ForgeDirection.DOWN;
+ }
+
+ @Override
public void onBlockDestroyed() {
destroyRenderBlock();
super.onBlockDestroyed();
@@ -715,8 +722,9 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl
private boolean shouldRender = true;
private TileEntityBlackhole rendererTileEntity = null;
- private void createRenderBlock() {
- if (!shouldRender) return;
+ // Returns true if render was actually created
+ private boolean createRenderBlock() {
+ if (!shouldRender || !mMachine) return false;
IGregTechTileEntity base = this.getBaseMetaTileEntity();
ForgeDirection opposite = getDirection().getOpposite();
int x = 7 * opposite.offsetX;
@@ -732,6 +740,7 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl
rendererTileEntity.startScaleChange(true);
rendererTileEntity.setStability(blackHoleStability / 100F);
+ return true;
}
private void destroyRenderBlock() {
diff --git a/src/main/java/gregtech/common/tileentities/render/TileEntityLaser.java b/src/main/java/gregtech/common/tileentities/render/TileEntityLaser.java
index dfbb771785..49ef60c71c 100644
--- a/src/main/java/gregtech/common/tileentities/render/TileEntityLaser.java
+++ b/src/main/java/gregtech/common/tileentities/render/TileEntityLaser.java
@@ -32,6 +32,7 @@ public class TileEntityLaser extends TileEntity {
compound.setDouble("rotAxisY", rotAxisY);
compound.setDouble("rotAxisZ", rotAxisZ);
compound.setDouble("rotationAngle", rotationAngle);
+ compound.setBoolean("realism", realism);
}
@Override
@@ -45,6 +46,7 @@ public class TileEntityLaser extends TileEntity {
rotAxisY = compound.getDouble("rotAxisY");
rotAxisZ = compound.getDouble("rotAxisZ");
rotationAngle = compound.getDouble("rotationAngle");
+ realism = compound.getBoolean("realism");
}
public void setColors(float red, float green, float blue) {
@@ -105,6 +107,11 @@ public class TileEntityLaser extends TileEntity {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
+ public void toggleRealism() {
+ realism = !realism;
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ }
+
public Boolean getShouldRender() {
return shouldRender;
}