@Override public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity, EnumHand hand) { if(entity instanceof EntityLiving) { EntityLiving living = (EntityLiving) entity; SoundEvent sound = null; if(living instanceof EntityCreeper) sound = SoundEvents.ENTITY_CREEPER_PRIMED; else if(living instanceof EntitySlime) sound = ((EntitySlime) living).isSmallSlime() ? SoundEvents.ENTITY_SMALL_SLIME_SQUISH : SoundEvents.ENTITY_SLIME_SQUISH; else { try { sound = (SoundEvent) ReflectionHelper.findMethod(EntityLiving.class, LibObfuscation.GET_LIVING_SOUND[0], LibObfuscation.GET_LIVING_SOUND[1]).invoke(living); } catch (InvocationTargetException | IllegalAccessException ignored) { Botania.LOGGER.debug("Couldn't get living sound"); } } if(sound != null) { String s = EntityList.getEntityString(entity); if(s == null) s = "generic"; ItemNBTHelper.setString(stack, TAG_SOUND, sound.getRegistryName().toString()); ItemNBTHelper.setString(stack, TAG_SOUND_NAME, "entity." + s + ".name"); player.setHeldItem(hand, stack); if(player.world.isRemote) player.swingArm(hand); return true; } } return false; }