diff --git a/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityFluidHatch.java b/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityFluidHatch.java index 2c857cbc58..8455931585 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityFluidHatch.java +++ b/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityFluidHatch.java @@ -4,6 +4,7 @@ import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.FluidTankList; +import gregtech.api.capability.impl.NotifiableItemStackHandler; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; import gregtech.api.gui.ModularUI.Builder; @@ -36,14 +37,14 @@ public class MetaTileEntityFluidHatch extends MetaTileEntityMultiblockPart imple private static final int INITIAL_INVENTORY_SIZE = 8000; private ItemStackHandler containerInventory; - private FluidTank fluidTank; + private NotifiableFluidTank fluidTank; private boolean isExportHatch; public MetaTileEntityFluidHatch(ResourceLocation metaTileEntityId, int tier, boolean isExportHatch) { super(metaTileEntityId, tier); this.containerInventory = new ItemStackHandler(2); this.isExportHatch = isExportHatch; - this.fluidTank = new FluidTank(getInventorySize()); + this.fluidTank = new NotifiableFluidTank(getInventorySize(), this, isExportHatch); initializeInventory(); } @@ -118,6 +119,20 @@ public void registerAbilities(List abilityList) { abilityList.addAll(isExportHatch ? this.exportFluids.getFluidTanks() : this.importFluids.getFluidTanks()); } + @Override + public void setupNotifiableMetaTileEntity(MetaTileEntity metaTileEntity) { + NotifiableFluidTank handler = null; + if (isExportHatch) { + handler = (NotifiableFluidTank) getExportFluids().getTankAt(0); + } else { + handler = (NotifiableFluidTank) getImportFluids().getTankAt(0); + } + if (handler != null) { + handler.setNotifiableMetaTileEntity(metaTileEntity); + handler.addToNotifiedList(this, handler, isExportHatch); + } + } + @Override protected ModularUI createUI(EntityPlayer entityPlayer) { return createTankUI((isExportHatch ? exportFluids : importFluids).getTankAt(0), containerInventory, getMetaFullName(), entityPlayer)