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:
Nicholas Ignoffo 2016-10-31 00:07:59 -07:00
parent 3feb19a22d
commit 6c4fe34152
2 changed files with 10 additions and 2 deletions

View file

@ -22,6 +22,7 @@ public class WailaCallbackHandler
public static void callbackRegister(IWailaRegistrar registrar)
{
registrar.registerBodyProvider(new DataProviderBloodAltar(), BlockAltar.class);
registrar.registerNBTProvider(new DataProviderBloodAltar(), BlockAltar.class);
registrar.registerBodyProvider(new DataProviderTeleposer(), BlockTeleposer.class);
registrar.registerBodyProvider(new DataProviderRitualController(), BlockRitualController.class);
registrar.registerBodyProvider(new DataProviderAlchemyArray(), BlockAlchemyArray.class);

View file

@ -88,7 +88,12 @@ public class DataProviderBloodAltar implements IWailaDataProvider
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
@ -108,7 +113,9 @@ public class DataProviderBloodAltar implements IWailaDataProvider
@Override
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)