Changed LavaCrystal getBinding behaviour, cleaned up JEI hiding

This commit is contained in:
TeamDman 2018-12-07 01:57:41 -05:00 committed by Nick Ignoffo
parent 88e72ee013
commit 002f23c53d
3 changed files with 17 additions and 14 deletions

View file

@ -10,6 +10,9 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.potion.PotionEffect;
import javax.annotation.Nonnull;
@ -59,7 +62,15 @@ public class ItemLavaCrystal extends ItemBindableBase implements IVariantProvide
@Nullable
@Override
public Binding getBinding(ItemStack stack) {
return Binding.fromStack(stack);
if (stack.getTagCompound() == null) // hasTagCompound doesn't work on empty stacks with tags
return null;
NBTBase bindingTag = stack.getTagCompound().getTag("binding");
if (bindingTag == null || bindingTag.getId() != 10 || bindingTag.hasNoTags()) // Make sure it's both a tag compound and that it has actual data.
return null;
NBTTagCompound nbt = (NBTTagCompound) bindingTag;
return new Binding(NBTUtil.getUUIDFromTag(nbt.getCompoundTag("id")),nbt.getString("name"));
}
@Override