Java 类net.minecraft.entity.monster.SkeletonType 实例源码

项目:RandomToolKit    文件:EntitySkeletonPriest.java   
@Nullable
@Override
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata) {

    if(!worldObj.isRemote){
        for(int i = 0; i < 4; i++){
            EntitySkeleton mob = new EntitySkeleton(worldObj);
            mob.setSkeletonType(SkeletonType.WITHER);
            mob.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.DIAMOND_SWORD));
            mob.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(4.0D);

            BlockPos pos = pickSpawnPoint();
            mob.setLocationAndAngles(0.5 + pos.getX(), pos.getY(), 0.5 + pos.getZ(), CMath.random.nextFloat() * 360,0);

            worldObj.spawnEntityInWorld(mob);
        }
    }

    return super.onInitialSpawn(difficulty, livingdata);
}
项目:CustomWorldGen    文件:RenderSkeleton.java   
/**
 * Allows the render to do state modifications necessary before the model is rendered.
 */
protected void preRenderCallback(EntitySkeleton entitylivingbaseIn, float partialTickTime)
{
    if (entitylivingbaseIn.getSkeletonType() == SkeletonType.WITHER)
    {
        GlStateManager.scale(1.2F, 1.2F, 1.2F);
    }
}
项目:CustomWorldGen    文件:LayerSkeletonType.java   
public void doRenderLayer(EntitySkeleton entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
    if (entitylivingbaseIn.getSkeletonType() == SkeletonType.STRAY)
    {
        this.layerModel.setModelAttributes(this.renderer.getMainModel());
        this.layerModel.setLivingAnimations(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks);
        this.renderer.bindTexture(STRAY_CLOTHES_TEXTURES);
        this.layerModel.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
    }
}
项目:Possessed    文件:SkeletonHandler.java   
@SubscribeEvent
public void onAttackEntity(AttackEntityEvent event) {
    if (event.getTarget() instanceof EntityLivingBase) {
        EntityLivingBase target = (EntityLivingBase) event.getTarget();
        EntityPlayer player = event.getEntityPlayer();
        if (this.isActive(player)) {
            PossessivePlayer possessivePlayer = PossessHandler.get(player);
            EntitySkeleton possessing = (EntitySkeleton) possessivePlayer.getPossessing();
            if (possessing.getSkeletonType() == SkeletonType.WITHER) {
                target.addPotionEffect(new PotionEffect(MobEffects.WITHER, 100, 1));
            }
        }
    }
}
项目:ExpandedRailsMod    文件:RenderSkeleton.java   
/**
 * Allows the render to do state modifications necessary before the model is rendered.
 */
protected void preRenderCallback(EntitySkeleton entitylivingbaseIn, float partialTickTime)
{
    if (entitylivingbaseIn.func_189771_df() == SkeletonType.WITHER)
    {
        GlStateManager.scale(1.2F, 1.2F, 1.2F);
    }
}
项目:ExpandedRailsMod    文件:LayerSkeletonType.java   
public void doRenderLayer(EntitySkeleton entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
    if (entitylivingbaseIn.func_189771_df() == SkeletonType.STRAY)
    {
        this.field_190094_c.setModelAttributes(this.field_190093_b.getMainModel());
        this.field_190094_c.setLivingAnimations(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks);
        this.field_190093_b.bindTexture(field_190092_a);
        this.field_190094_c.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
    }
}
项目:CustomWorldGen    文件:EntityAINearestAttackableTarget.java   
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    if (this.targetChance > 0 && this.taskOwner.getRNG().nextInt(this.targetChance) != 0)
    {
        return false;
    }
    else if (this.targetClass != EntityPlayer.class && this.targetClass != EntityPlayerMP.class)
    {
        List<T> list = this.taskOwner.worldObj.<T>getEntitiesWithinAABB(this.targetClass, this.getTargetableArea(this.getTargetDistance()), this.targetEntitySelector);

        if (list.isEmpty())
        {
            return false;
        }
        else
        {
            Collections.sort(list, this.theNearestAttackableTargetSorter);
            this.targetEntity = list.get(0);
            return true;
        }
    }
    else
    {
        this.targetEntity = (T)this.taskOwner.worldObj.getNearestAttackablePlayer(this.taskOwner.posX, this.taskOwner.posY + (double)this.taskOwner.getEyeHeight(), this.taskOwner.posZ, this.getTargetDistance(), this.getTargetDistance(), new Function<EntityPlayer, Double>()
        {
            @Nullable
            public Double apply(@Nullable EntityPlayer p_apply_1_)
            {
                ItemStack itemstack = p_apply_1_.getItemStackFromSlot(EntityEquipmentSlot.HEAD);

                if (itemstack != null && itemstack.getItem() == Items.SKULL)
                {
                    int i = itemstack.getItemDamage();
                    boolean flag = EntityAINearestAttackableTarget.this.taskOwner instanceof EntitySkeleton && ((EntitySkeleton)EntityAINearestAttackableTarget.this.taskOwner).getSkeletonType() == SkeletonType.NORMAL && i == 0;
                    boolean flag1 = EntityAINearestAttackableTarget.this.taskOwner instanceof EntityZombie && i == 2;
                    boolean flag2 = EntityAINearestAttackableTarget.this.taskOwner instanceof EntityCreeper && i == 4;

                    if (flag || flag1 || flag2)
                    {
                        return Double.valueOf(0.5D);
                    }
                }

                return Double.valueOf(1.0D);
            }
        }, (Predicate<EntityPlayer>)this.targetEntitySelector);
        return this.targetEntity != null;
    }
}
项目:CustomWorldGen    文件:RenderSkeleton.java   
/**
 * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
 */
protected ResourceLocation getEntityTexture(EntitySkeleton entity)
{
    SkeletonType skeletontype = entity.getSkeletonType();
    return skeletontype == SkeletonType.WITHER ? WITHER_SKELETON_TEXTURES : (skeletontype == SkeletonType.STRAY ? STRAY_SKELETON_TEXTURES : SKELETON_TEXTURES);
}
项目:Possessed    文件:SkeletonHandler.java   
@SubscribeEvent
public void onArrowLoose(ArrowLooseEvent event) {
    EntityPlayer player = event.getEntityPlayer();
    if (this.isActive(player)) {
        if (!event.hasAmmo()) {
            ItemStack stack = event.getBow();
            World world = player.getEntityWorld();
            EntitySkeleton skeleton = (EntitySkeleton) PossessHandler.get(player).getPossessing();
            float velocity = ItemBow.getArrowVelocity(event.getCharge());
            if (velocity >= 0.1) {
                if (!world.isRemote) {
                    EntityTippedArrow arrow = new EntityTippedArrow(world, player);
                    if (skeleton.getSkeletonType() != SkeletonType.STRAY) {
                        arrow.setPotionEffect(new ItemStack(Items.ARROW));
                    } else {
                        arrow.setPotionEffect(new ItemStack(Items.TIPPED_ARROW));
                        arrow.addEffect(new PotionEffect(MobEffects.SLOWNESS, 600));
                    }
                    arrow.setAim(player, player.rotationPitch, player.rotationYaw, 0.0F, velocity * 3.0F, 1.0F);
                    arrow.pickupStatus = EntityArrow.PickupStatus.CREATIVE_ONLY;
                    if (velocity == 1.0F) {
                        arrow.setIsCritical(true);
                    }
                    int power = EnchantmentHelper.getEnchantmentLevel(Enchantments.POWER, stack);
                    if (power > 0) {
                        arrow.setDamage(arrow.getDamage() + (double) power * 0.5 + 0.5);
                    }
                    int punch = EnchantmentHelper.getEnchantmentLevel(Enchantments.PUNCH, stack);
                    if (punch > 0) {
                        arrow.setKnockbackStrength(punch);
                    }
                    if (EnchantmentHelper.getEnchantmentLevel(Enchantments.FLAME, stack) > 0) {
                        arrow.setFire(100);
                    }
                    stack.damageItem(1, player);
                    world.spawnEntityInWorld(arrow);
                }
                world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 1.0F, 1.0F / (world.rand.nextFloat() * 0.4F + 1.2F) + velocity * 0.5F);
                player.addStat(StatList.getObjectUseStats(stack.getItem()));
            }
        }
    }
}
项目:ExNihiloAdscensio    文件:BlockFluidWitchwater.java   
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {

    if (world.isRemote)
        return;

    if (entity.isDead)
        return;

    if (entity instanceof EntitySkeleton) {

        EntitySkeleton skeleton = (EntitySkeleton) entity;
        if (skeleton.getSkeletonType() == SkeletonType.NORMAL) {
            skeleton.setSkeletonType(SkeletonType.WITHER);
            skeleton.setHealth(skeleton.getMaxHealth());

            return;
        }
    }

    if (entity instanceof EntityCreeper) {
        EntityCreeper creeper = (EntityCreeper) entity;
        if (!creeper.getPowered()) {
            creeper.onStruckByLightning(null);
            creeper.setHealth(creeper.getMaxHealth());

            return;
        }
    }

    if (entity instanceof EntitySpider && !(entity instanceof EntityCaveSpider)) {
        EntitySpider spider = (EntitySpider) entity;
        spider.setDead();

        EntityCaveSpider caveSpider = new EntityCaveSpider(world);
        caveSpider.setLocationAndAngles(spider.posX, spider.posY, spider.posZ, spider.rotationYaw, spider.rotationPitch);
        caveSpider.renderYawOffset = spider.renderYawOffset;
        caveSpider.setHealth(caveSpider.getMaxHealth());

        world.spawnEntity(caveSpider);

        return;
    }

    if (entity instanceof EntitySquid) {
        EntitySquid squid = (EntitySquid) entity;
        squid.setDead();

        EntityGhast ghast = new EntityGhast(world);
        ghast.setLocationAndAngles(squid.posX, squid.posY, squid.posZ, squid.rotationYaw, squid.rotationPitch);
        ghast.renderYawOffset = squid.renderYawOffset;
        ghast.setHealth(ghast.getMaxHealth());

        world.spawnEntity(ghast);

        return;
    }

    if (entity instanceof EntityAnimal) {
        ((EntityAnimal) entity).onStruckByLightning(null);
        return;
    }

    if (entity instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) entity;
        player.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, 210, 0));
        player.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, 210, 2));
        player.addPotionEffect(new PotionEffect(MobEffects.WITHER, 210, 0));
        player.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 210, 0));
    }
}
项目:Nuclear-Foundation    文件:MethodUtil.java   
public static boolean isNetherMob(EntityLivingBase e){
    if(e instanceof EntityBlaze||(e instanceof EntitySkeleton&&((EntitySkeleton)e).getSkeletonType()==SkeletonType.WITHER)||isBiomeMob(e, "hell")){
        return true;
    }
    return false;
}
项目:Nuclear-Foundation    文件:MethodUtil.java   
public static boolean isColdMob(EntityLivingBase e){
    if(e instanceof EntitySnowman||e instanceof EntityPolarBear||(e instanceof EntitySkeleton&&((EntitySkeleton)e).getSkeletonType()==SkeletonType.STRAY)||isEndMob(e)){
        return true;
    }
    return false;
}
项目:ExpandedRailsMod    文件:EntityAINearestAttackableTarget.java   
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    if (this.targetChance > 0 && this.taskOwner.getRNG().nextInt(this.targetChance) != 0)
    {
        return false;
    }
    else if (this.targetClass != EntityPlayer.class && this.targetClass != EntityPlayerMP.class)
    {
        List<T> list = this.taskOwner.worldObj.<T>getEntitiesWithinAABB(this.targetClass, this.getTargetableArea(this.getTargetDistance()), this.targetEntitySelector);

        if (list.isEmpty())
        {
            return false;
        }
        else
        {
            Collections.sort(list, this.theNearestAttackableTargetSorter);
            this.targetEntity = list.get(0);
            return true;
        }
    }
    else
    {
        this.targetEntity = (T)this.taskOwner.worldObj.getNearestAttackablePlayer(this.taskOwner.posX, this.taskOwner.posY + (double)this.taskOwner.getEyeHeight(), this.taskOwner.posZ, this.getTargetDistance(), this.getTargetDistance(), new Function<EntityPlayer, Double>()
        {
            @Nullable
            public Double apply(@Nullable EntityPlayer p_apply_1_)
            {
                ItemStack itemstack = p_apply_1_.getItemStackFromSlot(EntityEquipmentSlot.HEAD);

                if (itemstack != null && itemstack.getItem() == Items.SKULL)
                {
                    int i = itemstack.getItemDamage();
                    boolean flag = EntityAINearestAttackableTarget.this.taskOwner instanceof EntitySkeleton && ((EntitySkeleton)EntityAINearestAttackableTarget.this.taskOwner).func_189771_df() == SkeletonType.NORMAL && i == 0;
                    boolean flag1 = EntityAINearestAttackableTarget.this.taskOwner instanceof EntityZombie && i == 2;
                    boolean flag2 = EntityAINearestAttackableTarget.this.taskOwner instanceof EntityCreeper && i == 4;

                    if (flag || flag1 || flag2)
                    {
                        return Double.valueOf(0.5D);
                    }
                }

                return Double.valueOf(1.0D);
            }
        }, (Predicate<EntityPlayer>)this.targetEntitySelector);
        return this.targetEntity != null;
    }
}
项目:ExpandedRailsMod    文件:RenderSkeleton.java   
/**
 * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
 */
protected ResourceLocation getEntityTexture(EntitySkeleton entity)
{
    SkeletonType skeletontype = entity.func_189771_df();
    return skeletontype == SkeletonType.WITHER ? WITHER_SKELETON_TEXTURES : (skeletontype == SkeletonType.STRAY ? field_190084_m : SKELETON_TEXTURES);
}