List of usage examples for net.minecraftforge.event.entity.player PlayerInteractEvent.LeftClickEmpty getHand
@Nonnull
public Hand getHand()
From source file:org.blockartistry.DynSurround.client.handlers.PlayerActionHandler.java
License:MIT License
@SubscribeEvent public void onItemSwing(@Nonnull final PlayerInteractEvent.LeftClickEmpty event) { if (event.getEntityPlayer() == null || event.getEntityPlayer().world == null) return;/* ww w.j a va 2s .c om*/ if (event.getEntityPlayer().world.isRemote && EnvironState.isPlayer(event.getEntityPlayer())) { final ItemStack currentItem = event.getEntityPlayer().getHeldItem(event.getHand()); final SoundEffect soundEffect = this.itemRegistry.getSwingSound(currentItem); if (soundEffect != null) { final BasicSound<?> sound = soundEffect.createSound(EnvironState.getPlayer()); sound.setRoutable(DSurround.isInstalledOnServer()); SoundEffectHandler.INSTANCE.playSound(sound); } } }