Posted May 3, 201510 yr I'm attempting to follow the instructions laid out by "Sams Teach Yourself Minecraft Mod Development in 24 Hours" that allows the player to throw eggs when they right click with an empty hand if they're wearing certain armor. Unfortunately, when I attempt to use this function in-game, it only works if the player is targeting a block. RIGHT_CLICK_AIR and RIGHT_CLICK_BLOCK are located in the same part of my code, so what's going on? Method inside of FerretEventHandler: @SubscribeEvent public void throwEggs(PlayerInteractEvent event) { if(!event.world.isRemote) { if(event.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR || event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { if(event.entityPlayer.getCurrentEquippedItem() == null) { boolean hasFullSuit = true; for(int i = 0; i < 4; i++) { if(event.entityPlayer.getCurrentArmor(i) == null) { hasFullSuit = false; return; } else if(!(event.entityPlayer.getCurrentArmor(i).getItem() instanceof ItemLightArmor)) { hasFullSuit = false; } if(hasFullSuit) { event.entityPlayer.worldObj.spawnEntityInWorld(new EntityEgg(event.entityPlayer.getEntityWorld(), event.entityPlayer)); } } } } } }
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.