Skip to content

Commit

Permalink
Fix fluid storage bus does full reset on every neighbor change
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroscho committed Oct 3, 2024
1 parent eda554a commit 2d55935
Showing 1 changed file with 1 addition and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Vec3;
import net.minecraftforge.fluids.IFluidHandler;

import com.glodblock.github.client.textures.FCPartsTexture;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.common.tile.TileFluidInterface;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.MEMonitorIFluidHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.util.BlockPos;
import com.glodblock.github.util.ModAndClassUtil;

import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
Expand All @@ -47,7 +44,6 @@
import appeng.api.networking.ticking.ITickManager;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartRenderHelper;
import appeng.api.storage.ICellContainer;
Expand All @@ -70,14 +66,12 @@
import appeng.parts.automation.PartUpgradeable;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.tile.inventory.InvOperation;
import appeng.tile.networking.TileCableBus;
import appeng.util.IterationCounter;
import appeng.util.Platform;
import appeng.util.item.AEFluidStack;
import appeng.util.prioitylist.PrecisePriorityList;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import extracells.tileentity.TileEntityFluidInterface;

public class PartFluidStorageBus extends PartUpgradeable
implements IGridTickable, ICellContainer, IMEMonitorHandlerReceiver<IAEFluidStack>, IPriorityHost {
Expand Down Expand Up @@ -291,38 +285,7 @@ public void getBoxes(final IPartCollisionHelper bch) {

@Override
public void onNeighborChanged() {
TileEntity tile = this.getTile();
if (tile == null || this.getProxy() == null || !this.getProxy().isActive()) return;
BlockPos neighbor = new BlockPos(tile).getOffSet(this.getSide());
final TileEntity te = neighbor.getTileEntity();
// In case the TE was destroyed, we have to do a full reset immediately.
if (te instanceof TileCableBus) {
IPart iPart = ((TileCableBus) te).getPart(this.getSide().getOpposite());
if (iPart == null || iPart instanceof PartFluidInterface) {
this.resetCache(true);
this.resetCache();
}
if (ModAndClassUtil.EC2) {
if (iPart == null || iPart instanceof extracells.part.PartFluidInterface) {
this.resetCache(true);
this.resetCache();
}
}
} else if (te == null || te instanceof TileFluidInterface) {
this.resetCache(true);
this.resetCache();
} else if (ModAndClassUtil.EC2) {
if (te instanceof TileEntityFluidInterface) {
this.resetCache(true);
this.resetCache();
}
} else if (te instanceof IFluidHandler) {
this.resetCache(true);
this.resetCache();
} else {
this.resetCache(false);
}

this.resetCache(false);
}

@Override
Expand Down

0 comments on commit 2d55935

Please sign in to comment.