aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/core
diff options
context:
space:
mode:
authorAlexdoru <57050655+Alexdoru@users.noreply.github.com>2024-10-25 19:57:25 +0200
committerGitHub <noreply@github.com>2024-10-25 17:57:25 +0000
commit4b855e815f5584313254151d36b168d53668400b (patch)
treed390306d5f837aef8d71856b0eabea7eae82272d /src/main/java/gtPlusPlus/core
parent5304c190cf303c4c355ebeafdb63f84470be350e (diff)
downloadGT5-Unofficial-4b855e815f5584313254151d36b168d53668400b.tar.gz
GT5-Unofficial-4b855e815f5584313254151d36b168d53668400b.tar.bz2
GT5-Unofficial-4b855e815f5584313254151d36b168d53668400b.zip
Fix World leak caused by BlockPos class from GT++ (#3414)
Diffstat (limited to 'src/main/java/gtPlusPlus/core')
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java44
1 files changed, 14 insertions, 30 deletions
diff --git a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java b/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java
index cf6ad5b663..61e0e1569a 100644
--- a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java
+++ b/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java
@@ -21,7 +21,6 @@ import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import gtPlusPlus.api.objects.minecraft.BTF_FluidTank;
-import gtPlusPlus.api.objects.minecraft.BlockPos;
import gtPlusPlus.core.tileentities.base.TileEntityBase;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.FluidUtils;
@@ -33,7 +32,6 @@ public abstract class TileEntityBaseFluidCollector extends TileEntityBase implem
private boolean needsUpdate = false;
private int updateTimer = 0;
private long internalTickCounter = 0;
- private BlockPos internalBlockLocation;
public TileEntityBaseFluidCollector(int aInvSlotCount, int aTankCapcity) {
super(aInvSlotCount);
@@ -158,39 +156,25 @@ public abstract class TileEntityBaseFluidCollector extends TileEntityBase implem
return;
}
if (internalTickCounter % getBaseTickRate() == 0) {
- if (internalBlockLocation == null) {
- internalBlockLocation = new BlockPos(this);
- }
- BlockPos p = internalBlockLocation;
- if (p != null) {
- if (p.world != null) {
- World w = this.worldObj;
- if (w == null) {
- return;
- }
- Chunk c = w.getChunkFromBlockCoords(p.xPos, p.zPos);
- if (c != null) {
- if (c.isChunkLoaded) {
- int startX = p.xPos - 2;
- int startY = p.yPos;
- int startZ = p.zPos - 2;
- int endX = p.xPos + 3;
- int endY = p.yPos + 5;
- int endZ = p.zPos + 3;
- AxisAlignedBB box = AxisAlignedBB.getBoundingBox(startX, startY, startZ, endX, endY, endZ);
- if (box != null) {
- for (Class c2 : aThingsToLookFor()) {
- tickEntityType(w, box, c2);
- }
- } else {
- return;
- }
+ final World w = this.getWorldObj();
+ if (w != null) {
+ Chunk c = w.getChunkFromBlockCoords(this.xCoord, this.zCoord);
+ if (c != null) {
+ if (c.isChunkLoaded) {
+ int startX = this.xCoord - 2;
+ int startY = this.yCoord;
+ int startZ = this.zCoord - 2;
+ int endX = this.xCoord + 3;
+ int endY = this.yCoord + 5;
+ int endZ = this.zCoord + 3;
+ AxisAlignedBB box = AxisAlignedBB.getBoundingBox(startX, startY, startZ, endX, endY, endZ);
+ for (Class c2 : aThingsToLookFor()) {
+ tickEntityType(w, box, c2);
}
}
}
}
}
-
internalTickCounter++;
}