Fix Transparent Orb tooltips and rendering on multiplayer (#25)

This commit is contained in:
reobf authored and GitHub committed 2024-12-07 09:24:58 +01:00
1 parent 56589b6f0c
commit 2c84ea7fc8
1 file changed
+13 -1
@@ -32,9 +32,11 @@ public class TransparentOrb extends EnergyBattery {
list.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ itemStack.getTagCompound().getString("ownerName"));
list.add(
StatCollector.translateToLocal("tooltip.energybattery.currentLP") + " "
+ this.getCurrentEssence(itemStack));
+ itemStack.getTagCompound().getInteger("essenceAmount"));
}
}
@@ -43,6 +45,13 @@ public class TransparentOrb extends EnergyBattery {
if (itemStack.getTagCompound() == null) {
return;
}
if (world.isRemote) {
return;// changes of metadata and NBT will be synced to client, no need to proceed on client
}
if (itemStack.getTagCompound().hasKey("ownerName")) {
itemStack.getTagCompound().setInteger("essenceAmount", this.getCurrentEssence(itemStack));
}
int maxEssence = SoulNetworkHandler
.getMaximumForOrbTier(SoulNetworkHandler.getCurrentMaxOrb(SoulNetworkHandler.getOwnerName(itemStack)));
@@ -51,6 +60,9 @@ public class TransparentOrb extends EnergyBattery {
if (currentEssence > 0) {
int metaToBe = (currentEssence / section);
if (metaToBe >= 44) {
metaToBe = 44;
}
itemStack.setItemDamage(metaToBe);
} else {
itemStack.setItemDamage(0);