Java 类net.minecraft.entity.passive.EntitySkeletonHorse 实例源码

项目:Overlord    文件:EntityMilkBottle.java   
@Override
protected void onImpact(@Nonnull RayTraceResult mop) {
    if (!this.world.isRemote) {
        AxisAlignedBB axisalignedbb = this.getEntityBoundingBox().grow(4.0D, 2.0D, 4.0D);
        List<EntityLivingBase> list = this.world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);

        if (!list.isEmpty()) {
            for (EntityLivingBase entitylivingbase : list) {
                if (entitylivingbase instanceof EntitySkeletonWarrior || entitylivingbase instanceof EntityBabySkeleton || entitylivingbase instanceof EntitySkeleton || entitylivingbase instanceof EntitySkeletonHorse) {
                    double d0 = this.getDistanceSqToEntity(entitylivingbase);

                    if (d0 < 16.0D)
                        entitylivingbase.heal(1);
                }
            }
        }
        world.playSound(null, posX, posY, posZ, SoundEvents.BLOCK_GLASS_BREAK, SoundCategory.NEUTRAL, 0.5F, 0.8F / (rand.nextFloat() * 0.4F + 0.8F));
        this.setDead();
    }
}
项目:Cyclic    文件:ItemAppleLapis.java   
@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
      }
    }
  }
}
项目:Backmemed    文件:EntityAISkeletonRiders.java   
private AbstractHorse createHorse(DifficultyInstance p_188515_1_)
{
    EntitySkeletonHorse entityskeletonhorse = new EntitySkeletonHorse(this.horse.world);
    entityskeletonhorse.onInitialSpawn(p_188515_1_, (IEntityLivingData)null);
    entityskeletonhorse.setPosition(this.horse.posX, this.horse.posY, this.horse.posZ);
    entityskeletonhorse.hurtResistantTime = 60;
    entityskeletonhorse.enablePersistence();
    entityskeletonhorse.setHorseTamed(true);
    entityskeletonhorse.setGrowingAge(0);
    entityskeletonhorse.world.spawnEntityInWorld(entityskeletonhorse);
    return entityskeletonhorse;
}
项目:Gravestone-mod-Extended    文件:EntityAINearestAttackableHorse.java   
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;
}
项目:Backmemed    文件:ModelAdapterZombieHorse.java   
public ModelAdapterZombieHorse()
{
    super(EntitySkeletonHorse.class, "skeleton_horse", 0.75F);
}
项目:Backmemed    文件:EntityAISkeletonRiders.java   
public EntityAISkeletonRiders(EntitySkeletonHorse horseIn)
{
    this.horse = horseIn;
}
项目:Overlord    文件:CommonEvents.java   
@SubscribeEvent
public static void rightClickEntity(PlayerInteractEvent.EntityInteract event) {
    if (event.getTarget() instanceof EntitySkeleton || ((event.getTarget() instanceof EntitySkeletonWarrior || event.getTarget() instanceof EntityBabySkeleton || event.getTarget() instanceof EntitySkeletonHorse) && event.getEntityPlayer().isSneaking())) {
        if (((EntityLivingBase) event.getTarget()).getHealth() < ((EntityLivingBase) event.getTarget()).getMaxHealth())
            if (!event.getItemStack().isEmpty())
                if (event.getItemStack().getItem() == Items.MILK_BUCKET) {
                    ((EntityLivingBase) event.getTarget()).heal(1);
                    if (!event.getEntityPlayer().isCreative()) {
                        if (event.getItemStack().getCount() > 1)
                            event.getItemStack().shrink(1);
                        else
                            event.getEntityPlayer().setItemStackToSlot(event.getHand() == EnumHand.MAIN_HAND ? EntityEquipmentSlot.MAINHAND : EntityEquipmentSlot.OFFHAND, ItemStack.EMPTY);
                        event.getEntityPlayer().inventory.addItemStackToInventory(new ItemStack(Items.BUCKET));
                    }
                    if (event.getTarget() instanceof EntitySkeletonWarrior)
                        ((EntitySkeletonWarrior) event.getTarget()).increaseMilkLevel(false);
                }
        if (event.getTarget() instanceof EntitySkeleton && ((EntitySkeleton) event.getTarget()).isPotionActive(MobEffects.WEAKNESS) && !(event.getTarget() instanceof EntityCuringSkeleton) && event.getItemStack().getItem() == Items.GOLDEN_APPLE && event.getItemStack().getMetadata() == 0) {
            if (!event.getEntityPlayer().capabilities.isCreativeMode) {
                event.getItemStack().shrink(1);
            }

            if (!event.getWorld().isRemote) {
                EntitySkeleton oldSkelly = (EntitySkeleton) event.getTarget();
                EntityCuringSkeleton newSkelly = new EntityCuringSkeleton(event.getWorld(), event.getEntityPlayer() != null ? event.getEntityPlayer().getUniqueID() : null);
                newSkelly.copyLocationAndAnglesFrom(oldSkelly);
                newSkelly.setHeldItem(EnumHand.MAIN_HAND, oldSkelly.getHeldItemMainhand());
                newSkelly.setHeldItem(EnumHand.OFF_HAND, oldSkelly.getHeldItemOffhand());
                newSkelly.setItemStackToSlot(EntityEquipmentSlot.HEAD, oldSkelly.getItemStackFromSlot(EntityEquipmentSlot.HEAD));
                newSkelly.setItemStackToSlot(EntityEquipmentSlot.CHEST, oldSkelly.getItemStackFromSlot(EntityEquipmentSlot.CHEST));
                newSkelly.setItemStackToSlot(EntityEquipmentSlot.LEGS, oldSkelly.getItemStackFromSlot(EntityEquipmentSlot.LEGS));
                newSkelly.setItemStackToSlot(EntityEquipmentSlot.FEET, oldSkelly.getItemStackFromSlot(EntityEquipmentSlot.FEET));
                event.getWorld().removeEntity(oldSkelly);
                event.getWorld().spawnEntity(newSkelly);
                newSkelly.startConverting(event.getWorld().rand.nextInt(4802) + 3600);
            }
        }
    } else if (event.getTarget() instanceof EntityCow) {
        if (!event.getItemStack().isEmpty())
            if (event.getItemStack().getItem() == Items.GLASS_BOTTLE) {
                if (!event.getWorld().isRemote) {
                    if (!event.getEntityPlayer().isCreative()) {
                        if (event.getItemStack().getCount() > 1)
                            event.getItemStack().shrink(1);
                        else
                            event.getEntityPlayer().setItemStackToSlot(event.getHand() == EnumHand.MAIN_HAND ? EntityEquipmentSlot.MAINHAND : EntityEquipmentSlot.OFFHAND, ItemStack.EMPTY);
                    }
                    event.getEntityPlayer().inventory.addItemStackToInventory(new ItemStack(Overlord.milk_bottle));
                }
                event.getEntityPlayer().playSound(SoundEvents.ENTITY_COW_MILK, 1.0F, 1.0F + event.getWorld().rand.nextFloat());
            }
    }

    if (event.getTarget() instanceof ISkinsuitWearer && event.getItemStack().getItem() == Items.SHEARS) {
        ISkinsuitWearer skin = (ISkinsuitWearer) event.getTarget();
        if (!skin.getSkinType().isNone()) {
            skin.setSkinsuit(ItemStack.EMPTY, SkinType.NONE);
            if (!event.getEntityPlayer().isCreative())
                event.getItemStack().damageItem(1, event.getEntityPlayer());
        }
    }
}