mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-25 14:34:22 +00:00
Show casting progress for casting basins & tables
This commit is contained in:
1 parent
7a05a56577
commit
2eb7c67a34
4 files changed
+30
-6
No files matched your search
@@ -1,12 +1,16 @@
|
||||
package tconstruct.plugins.waila;
|
||||
|
||||
import java.util.List;
|
||||
import mcp.mobius.waila.api.*;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.SpecialChars;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import tconstruct.smeltery.logic.CastingBasinLogic;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BasinDataProvider implements IWailaDataProvider
|
||||
{
|
||||
|
||||
@@ -37,6 +41,8 @@ public class BasinDataProvider implements IWailaDataProvider
|
||||
FluidStack fs = te.getFluid();
|
||||
currenttip.add(StatCollector.translateToLocal("tconstruct.waila.liquidtag") + WailaRegistrar.fluidNameHelper(fs));
|
||||
currenttip.add(StatCollector.translateToLocal("tconstruct.waila.amounttag") + fs.amount + "/" + te.getCapacity());
|
||||
final int progress = te.getProgress();
|
||||
currenttip.add(StatCollector.translateToLocal("tconstruct.waila.progress") + progress + "%");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package tconstruct.plugins.waila;
|
||||
|
||||
import java.util.List;
|
||||
import mcp.mobius.waila.api.*;
|
||||
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 tconstruct.smeltery.logic.CastingTableLogic;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TableDataProvider implements IWailaDataProvider
|
||||
{
|
||||
|
||||
@@ -40,6 +43,8 @@ public class TableDataProvider implements IWailaDataProvider
|
||||
{
|
||||
currenttip.add(StatCollector.translateToLocal("tconstruct.waila.liquidtag") + WailaRegistrar.fluidNameHelper(te.getFluid()));
|
||||
currenttip.add(StatCollector.translateToLocal("tconstruct.waila.amounttag") + te.getFluidAmount() + "/" + te.getCapacity());
|
||||
final int progress = te.getProgress();
|
||||
currenttip.add(StatCollector.translateToLocal("tconstruct.waila.progress") + progress + "%");
|
||||
}
|
||||
}
|
||||
return currenttip;
|
||||
|
||||
@@ -22,6 +22,7 @@ import tconstruct.library.util.IPattern;
|
||||
public abstract class CastingBlockLogic extends InventoryLogic implements IFluidTank, IFluidHandler, ISidedInventory
|
||||
{
|
||||
public FluidStack liquid;
|
||||
protected int maxCastingDelay = 0;
|
||||
protected int castingDelay = 0;
|
||||
protected int renderOffset = 0;
|
||||
protected int capacity = 0;
|
||||
@@ -195,7 +196,7 @@ public abstract class CastingBlockLogic extends InventoryLogic implements IFluid
|
||||
{
|
||||
if (copyLiquid.amount == this.capacity)
|
||||
{
|
||||
castingDelay = recipe.coolTime;
|
||||
maxCastingDelay= castingDelay = recipe.coolTime;
|
||||
}
|
||||
renderOffset = copyLiquid.amount;
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
@@ -217,7 +218,7 @@ public abstract class CastingBlockLogic extends InventoryLogic implements IFluid
|
||||
if (doFill && roomInTank > 0)
|
||||
{
|
||||
renderOffset = roomInTank;
|
||||
castingDelay = liquidCasting.getCastingDelay(this.liquid, inventory[0]);
|
||||
maxCastingDelay = castingDelay = liquidCasting.getCastingDelay(this.liquid, inventory[0]);
|
||||
this.liquid.amount = this.capacity;
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
needsUpdate = true;
|
||||
@@ -447,6 +448,7 @@ public abstract class CastingBlockLogic extends InventoryLogic implements IFluid
|
||||
{
|
||||
SmelteryCastedEvent event = getCastedEvent(recipe, recipe.getResult());
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
maxCastingDelay = 0;
|
||||
|
||||
inventory[1] = event.output;
|
||||
if (event.consumeCast)
|
||||
@@ -485,6 +487,7 @@ public abstract class CastingBlockLogic extends InventoryLogic implements IFluid
|
||||
else
|
||||
this.capacity = updateCapacity();
|
||||
this.castingDelay = tags.getInteger("castingDelay");
|
||||
this.maxCastingDelay = tags.getInteger("maxCastingDelay");
|
||||
this.renderOffset = tags.getInteger("RenderOffset");
|
||||
}
|
||||
|
||||
@@ -507,6 +510,7 @@ public abstract class CastingBlockLogic extends InventoryLogic implements IFluid
|
||||
tags.setBoolean("Initialized", init);
|
||||
tags.setInteger("Capacity", capacity);
|
||||
tags.setInteger("castingDelay", castingDelay);
|
||||
tags.setInteger("maxCastingDelay", maxCastingDelay);
|
||||
tags.setInteger("RenderOffset", renderOffset);
|
||||
}
|
||||
|
||||
@@ -525,4 +529,12 @@ public abstract class CastingBlockLogic extends InventoryLogic implements IFluid
|
||||
readFromNBT(packet.func_148857_g());
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
if(castingDelay == 0 || maxCastingDelay == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (int)(( (maxCastingDelay - castingDelay) / (double)maxCastingDelay) * 100);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user