use of ml.northwestwind.moreboots.init.item.BootsItem in project MoreBoots by North-West-Wind.
the class MoreBootsClientHandler method onKeyInput.
@SubscribeEvent
public static void onKeyInput(final InputEvent.KeyInputEvent event) {
if (Minecraft.getInstance().options.keyShift.consumeClick() && event.getAction() == GLFW.GLFW_PRESS) {
LocalPlayer player = Minecraft.getInstance().player;
if (player == null)
return;
ItemStack boots = player.getItemBySlot(EquipmentSlot.FEET);
if (boots.getItem() instanceof BootsItem)
((BootsItem) boots.getItem()).onShift();
} else if (Minecraft.getInstance().options.keyJump.consumeClick() && event.getAction() == GLFW.GLFW_PRESS) {
LocalPlayer player = Minecraft.getInstance().player;
if (player == null)
return;
ItemStack boots = player.getItemBySlot(EquipmentSlot.FEET);
if (boots.getItem() instanceof BootsItem)
((BootsItem) boots.getItem()).onJump();
} else if (KeybindInit.activate.consumeClick() && event.getAction() == GLFW.GLFW_PRESS) {
Minecraft minecraft = Minecraft.getInstance();
LocalPlayer player = minecraft.player;
if (player == null)
return;
ItemStack boots = player.getItemBySlot(EquipmentSlot.FEET);
if (boots.getItem() instanceof BootsItem)
((BootsItem) boots.getItem()).activateBoots();
}
}
use of ml.northwestwind.moreboots.init.item.BootsItem in project MoreBoots by North-West-Wind.
the class MoreBootsClientHandler method onPlaySound.
@SubscribeEvent
public static void onPlaySound(PlaySoundEvent event) {
LocalPlayer player = Minecraft.getInstance().player;
if (player == null)
return;
ItemStack boots = player.getItemBySlot(EquipmentSlot.FEET);
if (boots.getItem() instanceof BootsItem)
((BootsItem) boots.getItem()).onPlaySound(event);
}
use of ml.northwestwind.moreboots.init.item.BootsItem in project MoreBoots by North-West-Wind.
the class MoreBootsHandler method onLivingHurt.
@SubscribeEvent
public static void onLivingHurt(final LivingHurtEvent event) {
LivingEntity entity = event.getEntityLiving();
Entity attacker = event.getSource().getEntity();
ItemStack boots = entity.getItemBySlot(EquipmentSlot.FEET);
ItemStack atBoots;
if (attacker instanceof LivingEntity && (atBoots = ((LivingEntity) attacker).getItemBySlot(EquipmentSlot.FEET)).getItem() instanceof BootsItem)
((BootsItem) atBoots.getItem()).onLivingAttack(event);
else if (boots.getItem() instanceof BootsItem)
((BootsItem) boots.getItem()).onLivingHurt(event);
}
use of ml.northwestwind.moreboots.init.item.BootsItem in project MoreBoots by North-West-Wind.
the class MoreBootsHandler method onLivingEquipmentChange.
@SubscribeEvent
public static void onLivingEquipmentChange(final LivingEquipmentChangeEvent event) {
ItemStack to = event.getTo();
ItemStack from = event.getFrom();
if (from.getItem().equals(ItemInit.LOKI_BOOTS) && !from.getItem().equals(to.getItem()))
event.getEntityLiving().setInvisible(false);
else {
if (from.getItem() instanceof BootsItem)
((BootsItem) from.getItem()).onLivingEquipmentChange(event);
if (to.getItem() instanceof BootsItem)
((BootsItem) to.getItem()).onLivingEquipmentChange(event);
}
}
Aggregations