diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCanolaPress.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCanolaPress.java index 68e02e795..f9dd9bc04 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCanolaPress.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCanolaPress.java @@ -12,11 +12,11 @@ package ellpeck.actuallyadditions.inventory.gui; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.inventory.ContainerCanolaPress; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityCanolaPress; import ellpeck.actuallyadditions.util.AssetUtil; +import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; @@ -45,7 +45,7 @@ public class GuiCanolaPress extends GuiContainer{ this.func_146283_a(Collections.singletonList(text1), x, y); } - String text2 = this.press.tank.getFluidAmount()+"/"+this.press.tank.getCapacity()+" mB "+InitBlocks.fluidCanolaOil.getLocalizedName(); + String text2 = StringUtil.getFluidInfo(this.press.tank); if(x >= guiLeft+117 && y >= guiTop+6 && x <= guiLeft+132 && y <= guiTop+88){ this.func_146283_a(Collections.singletonList(text2), x, y); } diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCoffeeMachine.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCoffeeMachine.java index 0682ed980..81a317340 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCoffeeMachine.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCoffeeMachine.java @@ -26,7 +26,6 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; -import net.minecraftforge.fluids.FluidRegistry; import org.lwjgl.opengl.GL11; import java.util.Collections; @@ -69,7 +68,7 @@ public class GuiCoffeeMachine extends GuiContainer{ if(x >= guiLeft+16 && y >= guiTop+5 && x <= guiLeft+23 && y <= guiTop+89){ this.func_146283_a(Collections.singletonList(text1), x, y); } - String text3 = this.machine.tank.getFluidAmount()+"/"+this.machine.tank.getCapacity()+" mB "+FluidRegistry.WATER.getLocalizedName(this.machine.tank.getFluid()); + String text3 = StringUtil.getFluidInfo(this.machine.tank); if(x >= guiLeft+27 && y >= guiTop+5 && x <= guiLeft+33 && y <= guiTop+70){ this.func_146283_a(Collections.singletonList(text3), x, y); } diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiFermentingBarrel.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiFermentingBarrel.java index 6031d1a0e..7be9d4c62 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiFermentingBarrel.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiFermentingBarrel.java @@ -12,11 +12,11 @@ package ellpeck.actuallyadditions.inventory.gui; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.inventory.ContainerFermentingBarrel; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityFermentingBarrel; import ellpeck.actuallyadditions.util.AssetUtil; +import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; @@ -41,12 +41,12 @@ public class GuiFermentingBarrel extends GuiContainer{ public void drawScreen(int x, int y, float f){ super.drawScreen(x, y, f); - String text1 = this.press.canolaTank.getFluidAmount()+"/"+this.press.canolaTank.getCapacity()+" mB "+InitBlocks.fluidCanolaOil.getLocalizedName(); + String text1 = StringUtil.getFluidInfo(this.press.canolaTank); if(x >= guiLeft+61 && y >= guiTop+6 && x <= guiLeft+76 && y <= guiTop+88){ this.func_146283_a(Collections.singletonList(text1), x, y); } - String text2 = this.press.oilTank.getFluidAmount()+"/"+this.press.oilTank.getCapacity()+" mB "+InitBlocks.fluidOil.getLocalizedName(); + String text2 = StringUtil.getFluidInfo(this.press.oilTank); if(x >= guiLeft+99 && y >= guiTop+6 && x <= guiLeft+114 && y <= guiTop+88){ this.func_146283_a(Collections.singletonList(text2), x, y); } diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiFluidCollector.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiFluidCollector.java index 01a03bc10..11356d7d2 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiFluidCollector.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiFluidCollector.java @@ -16,6 +16,7 @@ import ellpeck.actuallyadditions.inventory.ContainerFluidCollector; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityFluidCollector; import ellpeck.actuallyadditions.util.AssetUtil; +import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; @@ -40,7 +41,7 @@ public class GuiFluidCollector extends GuiContainer{ public void drawScreen(int x, int y, float f){ super.drawScreen(x, y, f); - String text2 = this.collector.tank.getFluidAmount()+"/"+this.collector.tank.getCapacity()+" mB "+(this.collector.tank.getFluidAmount() > 0 ? this.collector.tank.getFluid().getLocalizedName() : ""); + String text2 = StringUtil.getFluidInfo(this.collector.tank); if(x >= guiLeft+68 && y >= guiTop+6 && x <= guiLeft+83 && y <= guiTop+88){ this.func_146283_a(Collections.singletonList(text2), x, y); } diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiOilGenerator.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiOilGenerator.java index f5c4ae607..7e37ee706 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiOilGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiOilGenerator.java @@ -12,11 +12,11 @@ package ellpeck.actuallyadditions.inventory.gui; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.inventory.ContainerOilGenerator; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityOilGenerator; import ellpeck.actuallyadditions.util.AssetUtil; +import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; @@ -44,7 +44,7 @@ public class GuiOilGenerator extends GuiContainer{ if(x >= guiLeft+43 && y >= guiTop+6 && x <= guiLeft+58 && y <= guiTop+88){ this.func_146283_a(Collections.singletonList(text1), x, y); } - String text2 = this.generator.tank.getFluidAmount()+"/"+this.generator.tank.getCapacity()+" mB "+InitBlocks.fluidOil.getLocalizedName(); + String text2 = StringUtil.getFluidInfo(this.generator.tank); if(x >= guiLeft+117 && y >= guiTop+6 && x <= guiLeft+132 && y <= guiTop+88){ this.func_146283_a(Collections.singletonList(text2), x, y); } diff --git a/src/main/java/ellpeck/actuallyadditions/util/StringUtil.java b/src/main/java/ellpeck/actuallyadditions/util/StringUtil.java index 359557eab..6b251fde8 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/StringUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/StringUtil.java @@ -12,6 +12,7 @@ package ellpeck.actuallyadditions.util; import net.minecraft.client.gui.FontRenderer; import net.minecraft.util.StatCollector; +import net.minecraftforge.fluids.FluidTank; import java.util.List; import java.util.Locale; @@ -58,4 +59,8 @@ public class StringUtil{ renderer.drawString(s1, x, y+(i*renderer.FONT_HEIGHT), color, shadow); } } + + public static String getFluidInfo(FluidTank tank){ + return tank.getFluid() == null || tank.getFluid().getFluid() == null ? "0/"+tank.getCapacity()+" mB" : tank.getFluidAmount()+"/"+tank.getCapacity()+" mB "+tank.getFluid().getLocalizedName(); + } }