Added ftank support for waila

This commit is contained in:
Robert S 2014-04-26 12:55:49 -04:00
parent 1b19d4428b
commit 62875487da
3 changed files with 61 additions and 2 deletions

View file

@ -25,8 +25,8 @@ public class WailaCrate implements IWailaDataProvider
int cap = ((TileCrate) tile).getSlotCount() * 64; int cap = ((TileCrate) tile).getSlotCount() * 64;
if (stored != null) if (stored != null)
{ {
currenttip.add(LanguageUtility.getLocal("info.waila.crate.stack") + stored.getDisplayName()); currenttip.add(LanguageUtility.getLocal("info.waila.crate.stack") + " " + stored.getDisplayName());
currenttip.add(LanguageUtility.getLocal("info.waila.crate.stored") + stored.stackSize + " / " + cap); currenttip.add(LanguageUtility.getLocal("info.waila.crate.stored") + " " + stored.stackSize + " / " + cap);
} }
else else
{ {

View file

@ -0,0 +1,57 @@
package resonantinduction.archaic.waila;
import java.util.List;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.FluidTank;
import resonantinduction.archaic.fluid.tank.TileTank;
import calclavia.lib.utility.LanguageUtility;
/** Waila support for tanks
*
* @author Darkguardsman */
public class WailaFluidTank implements IWailaDataProvider
{
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
{
TileEntity tile = accessor.getTileEntity();
if (tile instanceof TileTank)
{
FluidTank tank = ((TileTank) tile).getInternalTank();
if (tank != null && tank.getFluid() != null)
{
currenttip.add(LanguageUtility.getLocal("info.waila.tank.fluid") + " " + tank.getFluid().getFluid().getLocalizedName());
currenttip.add(LanguageUtility.getLocal("info.waila.tank.vol") + " " + tank.getFluidAmount() + " / " + tank.getCapacity());
}
else
{
currenttip.add(LanguageUtility.getLocal("info.waila.tank.empty"));
}
}
return currenttip;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
{
return currenttip;
}
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config)
{
return null;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
{
return currenttip;
}
}

View file

@ -2,11 +2,13 @@ package resonantinduction.archaic.waila;
import mcp.mobius.waila.api.IWailaRegistrar; import mcp.mobius.waila.api.IWailaRegistrar;
import resonantinduction.archaic.crate.TileCrate; import resonantinduction.archaic.crate.TileCrate;
import resonantinduction.archaic.fluid.tank.TileTank;
public class WailaRegistrar public class WailaRegistrar
{ {
public static void wailaCallBack(IWailaRegistrar registrar) public static void wailaCallBack(IWailaRegistrar registrar)
{ {
registrar.registerBodyProvider(new WailaCrate(), TileCrate.class); registrar.registerBodyProvider(new WailaCrate(), TileCrate.class);
registrar.registerBodyProvider(new WailaFluidTank(), TileTank.class);
} }
} }