fix slime boots (#95)

* onItemRightClick() endlessly created the boots on the client side
This commit is contained in:
Quetz4l authored and GitHub committed 2023-09-13 14:29:49 +02:00
1 parent f7c6a9ecaf
commit 46dabb9f90
1 file changed
+7 -8
@@ -7,6 +7,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.client.resources.I18n;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -59,16 +60,14 @@ public class ItemSlimeBoots extends ItemArmor implements ISpecialArmor {
// equipping with right click
@Override
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) {
int slot = 1; // 0 = current item, 1 = feet
ItemStack itemstack = playerIn.getEquipmentInSlot(slot);
int i = EntityLiving.getArmorPosition(itemStackIn) - 1;
ItemStack itemstack = playerIn.getCurrentArmor(i);
if (itemstack == null) {
playerIn.setCurrentItemOrArmor(slot, itemStackIn.copy());
} else {
itemstack = itemstack.copy();
playerIn.setCurrentItemOrArmor(1, itemStackIn.copy());
playerIn.entityDropItem(itemstack, 0);
playerIn.setCurrentItemOrArmor(i + 1, itemStackIn.copy());
itemStackIn.stackSize = 0;
}
itemStackIn.stackSize--;
return itemStackIn;
}