|
4 | 4 | import codechicken.lib.render.pipeline.IVertexOperation; |
5 | 5 | import codechicken.lib.vec.Matrix4; |
6 | 6 | import gregtech.api.capability.impl.FluidTankList; |
| 7 | +import gregtech.api.capability.impl.NotifiableItemStackHandler; |
7 | 8 | import gregtech.api.gui.GuiTextures; |
8 | 9 | import gregtech.api.gui.ModularUI; |
9 | 10 | import gregtech.api.gui.ModularUI.Builder; |
@@ -36,14 +37,14 @@ public class MetaTileEntityFluidHatch extends MetaTileEntityMultiblockPart imple |
36 | 37 |
|
37 | 38 | private static final int INITIAL_INVENTORY_SIZE = 8000; |
38 | 39 | private ItemStackHandler containerInventory; |
39 | | - private FluidTank fluidTank; |
| 40 | + private NotifiableFluidTank fluidTank; |
40 | 41 | private boolean isExportHatch; |
41 | 42 |
|
42 | 43 | public MetaTileEntityFluidHatch(ResourceLocation metaTileEntityId, int tier, boolean isExportHatch) { |
43 | 44 | super(metaTileEntityId, tier); |
44 | 45 | this.containerInventory = new ItemStackHandler(2); |
45 | 46 | this.isExportHatch = isExportHatch; |
46 | | - this.fluidTank = new FluidTank(getInventorySize()); |
| 47 | + this.fluidTank = new NotifiableFluidTank(getInventorySize(), this, isExportHatch); |
47 | 48 | initializeInventory(); |
48 | 49 | } |
49 | 50 |
|
@@ -118,6 +119,20 @@ public void registerAbilities(List<IFluidTank> abilityList) { |
118 | 119 | abilityList.addAll(isExportHatch ? this.exportFluids.getFluidTanks() : this.importFluids.getFluidTanks()); |
119 | 120 | } |
120 | 121 |
|
| 122 | + @Override |
| 123 | + public void setupNotifiableMetaTileEntity(MetaTileEntity metaTileEntity) { |
| 124 | + NotifiableFluidTank handler = null; |
| 125 | + if (isExportHatch) { |
| 126 | + handler = (NotifiableFluidTank) getExportFluids().getTankAt(0); |
| 127 | + } else { |
| 128 | + handler = (NotifiableFluidTank) getImportFluids().getTankAt(0); |
| 129 | + } |
| 130 | + if (handler != null) { |
| 131 | + handler.setNotifiableMetaTileEntity(metaTileEntity); |
| 132 | + handler.addToNotifiedList(this, handler, isExportHatch); |
| 133 | + } |
| 134 | + } |
| 135 | + |
121 | 136 | @Override |
122 | 137 | protected ModularUI createUI(EntityPlayer entityPlayer) { |
123 | 138 | return createTankUI((isExportHatch ? exportFluids : importFluids).getTankAt(0), containerInventory, getMetaFullName(), entityPlayer) |
|
0 commit comments