@SubscribeEvent public void onEntityInteractEvent(EntityInteract event) { if (event.getEntity() instanceof EntityPlayer == false) { return; } EntityPlayer player = (EntityPlayer) event.getEntity(); // ItemStack held = player.getHeldItemMainhand(); ItemStack itemstack = event.getItemStack(); if (itemstack != null && itemstack.getItem() instanceof ItemAppleLapis && itemstack.getCount() > 0) { if (event.getTarget() instanceof EntityZombieHorse || event.getTarget() instanceof EntitySkeletonHorse) { AbstractHorse h = (AbstractHorse) event.getTarget(); if (h.isTame() == false) { h.setTamedBy(player); h.setEatingHaystack(true); // UtilChat.addChatMessage(player, UtilChat.lang("item.apple_emerald.merchant")); itemstack.shrink(1); if (itemstack.getCount() == 0) { itemstack = ItemStack.EMPTY; } event.setCanceled(true);// stop the GUI inventory opening && horse mounting } } } }
public boolean shouldExecute() { EntityLivingBase entity = this.attacker.getAttackTarget(); if (entity != null && !(entity instanceof EntityUndeadHorse) && !(entity instanceof EntityZombieHorse) && !(entity instanceof EntitySkeletonHorse)) { return super.shouldExecute(); } return false; }
public ModelAdapterSkeletonHorse() { super(EntityZombieHorse.class, "zombie_horse", 0.75F); }