Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update CastingChannelDataProvider.java
Un-derping the Casting Channel
- Loading branch information
1 parent
8330ee6
commit 95cc714
Showing
1 changed file
with
56 additions
and
34 deletions.
There are no files selected for viewing
90 changes: 56 additions & 34 deletions
90
src/main/java/tconstruct/plugins/waila/CastingChannelDataProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,71 @@ | ||
package tconstruct.plugins.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.util.StatCollector; | ||
import net.minecraftforge.common.ForgeDirection; | ||
import net.minecraftforge.fluids.FluidStack; | ||
import net.minecraftforge.fluids.FluidTankInfo; | ||
import tconstruct.blocks.logic.CastingChannelLogic; | ||
|
||
import java.util.List; | ||
|
||
public class CastingChannelDataProvider implements IWailaDataProvider | ||
{ | ||
|
||
@Override | ||
public ItemStack getWailaStack (IWailaDataAccessor accessor, IWailaConfigHandler config) | ||
{ | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<String> getWailaHead (ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) | ||
{ | ||
return currenttip; | ||
} | ||
|
||
@Override | ||
public List<String> getWailaBody (ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) | ||
{ | ||
if (accessor.getTileEntity() instanceof CastingChannelLogic) | ||
{ | ||
CastingChannelLogic te = (CastingChannelLogic) accessor.getTileEntity(); | ||
if (te.liquid != null && te.liquid.amount > 0) | ||
{ | ||
FluidStack fs = te.liquid; | ||
currenttip.add(StatCollector.translateToLocal("tconstruct.waila.liquidtag") + WailaRegistrar.fluidNameHelper(fs)); | ||
currenttip.add(StatCollector.translateToLocal("tconstruct.waila.amounttag") + fs.amount + "/" + te.getCapacity()); | ||
} | ||
else | ||
{ | ||
currenttip.add("§o" + StatCollector.translateToLocal("tconstruct.waila.empty")); // "§o" == Italics | ||
} | ||
} | ||
|
||
return currenttip; | ||
} | ||
@Override | ||
public ItemStack getWailaStack (IWailaDataAccessor accessor, IWailaConfigHandler config) | ||
{ | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<String> getWailaHead (ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) | ||
{ | ||
return currenttip; | ||
} | ||
|
||
@Override | ||
public List<String> getWailaBody (ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) | ||
{ | ||
if (accessor.getTileEntity() instanceof CastingChannelLogic) | ||
{ | ||
CastingChannelLogic te = (CastingChannelLogic) accessor.getTileEntity(); | ||
FluidTankInfo internalTank = te.getTankInfo(null)[0]; | ||
FluidTankInfo northTank = te.getTankInfo(ForgeDirection.NORTH)[0]; | ||
FluidTankInfo southTank = te.getTankInfo(ForgeDirection.SOUTH)[0]; | ||
FluidTankInfo westTank = te.getTankInfo(ForgeDirection.WEST)[0]; | ||
FluidTankInfo eastTank = te.getTankInfo(ForgeDirection.EAST)[0]; | ||
|
||
if(internalTank.fluid != null && internalTank.fluid.amount > 0) | ||
{ | ||
FluidStack fs = internalTank.fluid; | ||
currenttip.add(StatCollector.translateToLocal("tconstruct.waila.liquidtag") + WailaRegistrar.fluidNameHelper(fs)); | ||
currenttip.add(StatCollector.translateToLocal("tconstruct.waila.amounttag") + fs.amount + "/" + internalTank.capacity); | ||
} | ||
else | ||
{ | ||
currenttip.add("§o" + StatCollector.translateToLocal("tconstruct.waila.empty")); // "§o" == Italics | ||
} | ||
|
||
currenttip.add(StatCollector.translateToLocal("tconstruct.waila.subtanks")); | ||
String s1, s2, s3, s4; | ||
s1 = s2 = s3 = s4 = "§o" + StatCollector.translateToLocal("tconstruct.waila.empty"); | ||
|
||
if(northTank.fluid != null) | ||
s1 = northTank.fluid.amount + " / " + northTank.capacity; | ||
if(southTank.fluid != null) | ||
s2 = southTank.fluid.amount + " / " + southTank.capacity; | ||
if(westTank.fluid != null) | ||
s3 = westTank.fluid.amount + " / " + westTank.capacity; | ||
if(eastTank.fluid != null) | ||
s4 = eastTank.fluid.amount + " / " + eastTank.capacity; | ||
currenttip.add(s1 +"; " + s2 +"; " + s3 +"; " + s4); | ||
} | ||
|
||
return currenttip; | ||
} | ||
|
||
} |