Fix Waila altar progress percent (#796)
After rewriting half of Waila, I understand how these things should be done, now
This commit is contained in:
parent
3feb19a22d
commit
6c4fe34152
|
@ -22,6 +22,7 @@ public class WailaCallbackHandler
|
||||||
public static void callbackRegister(IWailaRegistrar registrar)
|
public static void callbackRegister(IWailaRegistrar registrar)
|
||||||
{
|
{
|
||||||
registrar.registerBodyProvider(new DataProviderBloodAltar(), BlockAltar.class);
|
registrar.registerBodyProvider(new DataProviderBloodAltar(), BlockAltar.class);
|
||||||
|
registrar.registerNBTProvider(new DataProviderBloodAltar(), BlockAltar.class);
|
||||||
registrar.registerBodyProvider(new DataProviderTeleposer(), BlockTeleposer.class);
|
registrar.registerBodyProvider(new DataProviderTeleposer(), BlockTeleposer.class);
|
||||||
registrar.registerBodyProvider(new DataProviderRitualController(), BlockRitualController.class);
|
registrar.registerBodyProvider(new DataProviderRitualController(), BlockRitualController.class);
|
||||||
registrar.registerBodyProvider(new DataProviderAlchemyArray(), BlockAlchemyArray.class);
|
registrar.registerBodyProvider(new DataProviderAlchemyArray(), BlockAlchemyArray.class);
|
||||||
|
|
|
@ -88,7 +88,12 @@ public class DataProviderBloodAltar implements IWailaDataProvider
|
||||||
|
|
||||||
if (hasSeer)
|
if (hasSeer)
|
||||||
{
|
{
|
||||||
currenttip.add(TextHelper.localizeEffect("tooltip.BloodMagic.sigil.seer.currentAltarProgress.percent", ((int) ((double) altar.getProgress() / (double) altar.getLiquidRequired() * 100)) + "%"));
|
int progress = accessor.getNBTData().getCompoundTag("bloodAltar").getInteger(Constants.NBT.ALTAR_PROGRESS);
|
||||||
|
int liquidRequired = accessor.getNBTData().getCompoundTag("bloodAltar").getInteger(Constants.NBT.ALTAR_LIQUID_REQ);
|
||||||
|
int craftAmount = 1;
|
||||||
|
if (accessor.getNBTData().getTagList("Items", 10).get(0).getId() == 10)
|
||||||
|
craftAmount = ((NBTTagCompound)accessor.getNBTData().getTagList("Items", 10).get(0)).getByte("Count");
|
||||||
|
currenttip.add(TextHelper.localizeEffect("tooltip.BloodMagic.sigil.seer.currentAltarProgress.percent", (int) (((double) progress / (double) liquidRequired * 100) / craftAmount) + "%"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -108,7 +113,9 @@ public class DataProviderBloodAltar implements IWailaDataProvider
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos)
|
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos)
|
||||||
{
|
{
|
||||||
return null;
|
if (te != null)
|
||||||
|
te.writeToNBT(tag);
|
||||||
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasStack(ItemStack stack, EntityPlayer player)
|
public static boolean hasStack(ItemStack stack, EntityPlayer player)
|
||||||
|
|
Loading…
Reference in a new issue