77import net .minecraft .client .resources .I18n ;
88import net .minecraft .entity .player .EntityPlayer ;
99import net .minecraft .item .ItemStack ;
10+ import net .minecraft .nbt .NBTTagCompound ;
1011import net .minecraft .util .ResourceLocation ;
1112import net .minecraft .world .World ;
1213import net .minecraftforge .fluids .FluidStack ;
1920import gregtech .api .capability .IEnergyContainer ;
2021import gregtech .api .capability .impl .FluidTankList ;
2122import gregtech .api .capability .impl .FuelRecipeLogic ;
22- import gregtech .api .capability .impl .NotifiableFilteredFluidHandler ;
2323import gregtech .api .capability .impl .NotifiableFluidTank ;
2424import gregtech .api .gui .GuiTextures ;
2525import gregtech .api .gui .ModularUI ;
2626import gregtech .api .gui .widgets .ImageWidget ;
2727import gregtech .api .gui .widgets .LabelWidget ;
28- import gregtech .api .gui .widgets .TankWidget ;
2928import gregtech .api .metatileentity .MetaTileEntity ;
3029import gregtech .api .metatileentity .interfaces .IGregTechTileEntity ;
3130import gregtech .api .recipes .Recipe ;
3231import gregtech .api .recipes .RecipeMap ;
3332import gregtech .client .renderer .ICubeRenderer ;
3433import gregtech .common .metatileentities .electric .MetaTileEntitySingleCombustion ;
3534import supersymmetry .api .capability .impl .SuSyFluidFilters ;
35+ import supersymmetry .api .fluids .FilteredTankWidget ;
36+ import supersymmetry .api .fluids .SuSyFluidTankHandler ;
3637import supersymmetry .api .util .SuSyUtility ;
3738
3839public class SuSyMetaTileEntitySingleCombustion extends MetaTileEntitySingleCombustion {
@@ -45,8 +46,8 @@ public class SuSyMetaTileEntitySingleCombustion extends MetaTileEntitySingleComb
4546
4647 private boolean sufficientFluids ;
4748
48- private FluidTank lubricantTank ;
49- private FluidTank coolantTank ;
49+ private SuSyFluidTankHandler lubricantTank ;
50+ private SuSyFluidTankHandler coolantTank ;
5051
5152 private FluidTankList displayedTankList ;
5253
@@ -63,24 +64,43 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) {
6364 }
6465
6566 @ Override
66- // Handle fluid imports
67+ public NBTTagCompound writeToNBT (NBTTagCompound data ) {
68+ super .writeToNBT (data );
69+ if (lubricantTank != null )
70+ data .setTag ("LubricantTank" , lubricantTank .writeToNBT (new NBTTagCompound ()));
71+ if (coolantTank != null )
72+ data .setTag ("CoolantTank" , coolantTank .writeToNBT (new NBTTagCompound ()));
73+ return data ;
74+ }
75+
76+ @ Override
77+ public void readFromNBT (NBTTagCompound data ) {
78+ super .readFromNBT (data );
79+ if (lubricantTank != null && data .hasKey ("LubricantTank" ))
80+ lubricantTank .readFromNBT (data .getCompoundTag ("LubricantTank" ));
81+ if (coolantTank != null && data .hasKey ("CoolantTank" ))
82+ coolantTank .readFromNBT (data .getCompoundTag ("CoolantTank" ));
83+ }
84+
85+ @ Override
6786 protected FluidTankList createImportFluidHandler () {
6887 if (workable == null ) return new FluidTankList (false );
69- FluidTank [] fluidImports = new FluidTank [workable .getRecipeMap ().getMaxFluidInputs () + 2 ];
88+
89+ // Only recipe fluid inputs go here — no lubricant/coolant
90+ FluidTank [] fluidImports = new FluidTank [workable .getRecipeMap ().getMaxFluidInputs ()];
7091 FluidTank [] displayedTanks = new FluidTank [workable .getRecipeMap ().getMaxFluidInputs ()];
71- for (int i = 0 ; i < fluidImports .length - 2 ; i ++) {
72- NotifiableFluidTank filteredFluidHandler = new NotifiableFluidTank (
92+ for (int i = 0 ; i < fluidImports .length ; i ++) {
93+ NotifiableFluidTank tank = new NotifiableFluidTank (
7394 this .getTankScalingFunction ().apply (this .getTier ()), this , false );
74- fluidImports [i ] = filteredFluidHandler ;
75- displayedTanks [i ] = filteredFluidHandler ;
95+ fluidImports [i ] = tank ;
96+ displayedTanks [i ] = tank ;
7697 }
7798
78- this .lubricantTank = new NotifiableFilteredFluidHandler (1000 , this , false )
99+ // Lubricant/coolant tanks are standalone — NOT part of the import handler
100+ this .lubricantTank = (SuSyFluidTankHandler ) new SuSyFluidTankHandler (1000 , this , false )
79101 .setFilter (SuSyFluidFilters .LUBRICANT );
80- fluidImports [fluidImports .length - 2 ] = lubricantTank ;
81-
82- this .coolantTank = new NotifiableFilteredFluidHandler (1000 , this , false ).setFilter (SuSyFluidFilters .COOLANT );
83- fluidImports [fluidImports .length - 1 ] = coolantTank ;
102+ this .coolantTank = (SuSyFluidTankHandler ) new SuSyFluidTankHandler (1000 , this , false )
103+ .setFilter (SuSyFluidFilters .COOLANT );
84104
85105 this .displayedTankList = new FluidTankList (false , displayedTanks );
86106 return new FluidTankList (false , fluidImports );
@@ -97,7 +117,7 @@ public void update() {
97117 super .update ();
98118 if (!getWorld ().isRemote ) {
99119 updateSufficientFluids ();
100- isFull = energyContainer .getEnergyStored () - energyContainer .getEnergyCapacity () == 0 ;
120+ isFull = energyContainer .getEnergyStored () >= energyContainer .getEnergyCapacity ();
101121
102122 if (workable .isWorking () && !isFull ) workCounter += 1 ;
103123 if (workCounter == 600 ) {
@@ -138,14 +158,14 @@ protected ModularUI.Builder createGuiTemplate(EntityPlayer player) {
138158 builder .widget (new LabelWidget (6 , 6 , getMetaFullName ()))
139159 .bindPlayerInventory (player .inventory , GuiTextures .SLOT , yOffset );
140160
141- builder .widget (new TankWidget (lubricantTank , 110 , 21 , 10 , 54 )
161+ builder .widget (new FilteredTankWidget (lubricantTank , 110 , 21 , 10 , 54 )
142162 .setBackgroundTexture (GuiTextures .PROGRESS_BAR_BOILER_EMPTY .get (true ))
143163 .setAlwaysShowFull (false )
144- .setContainerClicking (true , true )); // Enable container clicking
145- builder .widget (new TankWidget (coolantTank , 124 , 21 , 10 , 54 )
164+ .setContainerClicking (true , true )); // both directions, filter guards filling
165+ builder .widget (new FilteredTankWidget (coolantTank , 124 , 21 , 10 , 54 )
146166 .setBackgroundTexture (GuiTextures .PROGRESS_BAR_BOILER_EMPTY .get (true ))
147167 .setAlwaysShowFull (false )
148- .setContainerClicking (true , true )); // Enable container clicking
168+ .setContainerClicking (true , true ));
149169 builder .widget (new ImageWidget (152 , 63 + yOffset , 17 , 17 ,
150170 GTValues .XMAS .get () ? GuiTextures .GREGTECH_LOGO_XMAS : GuiTextures .GREGTECH_LOGO )
151171 .setIgnoreColor (true ));
@@ -169,12 +189,12 @@ public CombustionRecipeLogic(SuSyMetaTileEntitySingleCombustion metaTileEntity,
169189
170190 @ Override
171191 public boolean checkRecipe (@ NotNull Recipe recipe ) {
172- return sufficientFluids ;
192+ return sufficientFluids && ! isFull ;
173193 }
174194
175195 @ Override
176196 public boolean isWorking () {
177- return sufficientFluids && super .isWorking ();
197+ return sufficientFluids && ! isFull && super .isWorking ();
178198 }
179199
180200 @ Override
0 commit comments