Posted June 10, 20196 yr Hello, so i've been recently working on some special armor. If you press a keybind, your armor slots automatically fill up with the armor. I am using player.inventory.armorInventory.set to replace the slots. I am probably doing something really wrong, but whenever i press the keybind, everybody in the world gets the armor. Is there any way i can fix this? Any help would be greatly appreciated, thanks. Here is the code: @SubscribeEvent public void armorTick(LivingEvent.LivingUpdateEvent event) { if (event.getEntityLiving() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.getEntityLiving(); if(permanentArmor) { if(player.inventory.armorItemInSlot(3).getItem() != ModItems.QUICK_HELMET) { player.inventory.armorInventory.set(3, new ItemStack(ModItems.QUICK_HELMET)); } if(player.inventory.armorItemInSlot(2).getItem() != ModItems.QUICK_CHESTPLATE) { player.inventory.armorInventory.set(2, new ItemStack(ModItems.QUICK_CHESTPLATE)); } if(player.inventory.armorItemInSlot(1).getItem() != ModItems.QUICK_LEGGINGS) { player.inventory.armorInventory.set(1, new ItemStack(ModItems.QUICK_LEGGINGS)); } if(player.inventory.armorItemInSlot(0).getItem() != ModItems.QUICK_BOOTS) { player.inventory.armorInventory.set(0, new ItemStack(ModItems.QUICK_BOOTS)); } } } } EDIT: Here is "permanentarmor": public static void togglePermanentArmor(EntityPlayer player) { if (MAP.containsKey(player) && MAP.get(player)) { MAP.remove(player); permanentArmor = false; player.sendStatusMessage(new TextComponentString("Permanent Armor: Off"), true); } else { MAP.put(player, true); permanentArmor = true; player.sendStatusMessage(new TextComponentString("Permanent Armor: On"), true); } } } Edited June 10, 20196 yr by TesterTesting135 Needed to add more information
June 10, 20196 yr Author Ok, i think i've figured it out now. I just used different parameters and it seems to work now.l
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.