aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/goodgenerator
diff options
context:
space:
mode:
authorBucketBrigade <138534411+CookieBrigade@users.noreply.github.com>2024-11-02 20:02:37 -0500
committerGitHub <noreply@github.com>2024-11-03 02:02:37 +0100
commit8d84f1d1a01802b1d092ef9063578dd7e908ca67 (patch)
tree5732cc8dc67083213408779ad95677c5d57c6ffe /src/main/java/goodgenerator
parent43ec017ec01272b613bb59cda0e3846c03d9b8b1 (diff)
downloadGT5-Unofficial-8d84f1d1a01802b1d092ef9063578dd7e908ca67.tar.gz
GT5-Unofficial-8d84f1d1a01802b1d092ef9063578dd7e908ca67.tar.bz2
GT5-Unofficial-8d84f1d1a01802b1d092ef9063578dd7e908ca67.zip
Reduce Bounding Box allocations (#3447)
Diffstat (limited to 'src/main/java/goodgenerator')
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/render/TileAntimatter.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/render/TileAntimatter.java b/src/main/java/goodgenerator/blocks/tileEntity/render/TileAntimatter.java
index 80b36ab01b..e1f4fe84cf 100644
--- a/src/main/java/goodgenerator/blocks/tileEntity/render/TileAntimatter.java
+++ b/src/main/java/goodgenerator/blocks/tileEntity/render/TileAntimatter.java
@@ -17,6 +17,7 @@ import com.gtnewhorizon.structurelib.alignment.enumerable.Rotation;
public class TileAntimatter extends TileEntity {
public boolean shouldRender = true;
+ private AxisAlignedBB boundingBox;
// Antimatter Core settings
public static final float spikeR = 0.153f, spikeG = 0.435f, spikeB = 1f;
@@ -85,13 +86,16 @@ public class TileAntimatter extends TileEntity {
@Override
public AxisAlignedBB getRenderBoundingBox() {
- return AxisAlignedBB.getBoundingBox(
- xCoord - maximalRadius - 1,
- yCoord - maximalRadius - 1,
- zCoord - maximalRadius - 1,
- xCoord + maximalRadius + 1,
- yCoord + maximalRadius + 1,
- zCoord + maximalRadius + 1);
+ if (boundingBox == null) {
+ boundingBox = AxisAlignedBB.getBoundingBox(
+ xCoord - maximalRadius - 1,
+ yCoord - maximalRadius - 1,
+ zCoord - maximalRadius - 1,
+ xCoord + maximalRadius + 1,
+ yCoord + maximalRadius + 1,
+ zCoord + maximalRadius + 1);
+ }
+ return boundingBox;
}
@Override