Stopped using deprecated methods

This commit is contained in:
Ellpeck 2015-12-27 21:56:32 +01:00
parent b15a2d0bba
commit b1b05a89fe
6 changed files with 15 additions and 10 deletions

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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();
}
}