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

项目:MakeClayValuableAgain    文件:ClayProgressionImprovements.java   
@SubscribeEvent
public void dropClay(LivingDropsEvent event) {
    EntityLivingBase deadEntity = event.getEntityLiving();
    World world = deadEntity.getEntityWorld();
    BlockPos position = deadEntity.getPosition();
    double x = position.getX();
    double y = position.getY();
    double z = position.getZ();
    if (deadEntity instanceof EntityWitherSkeleton) {
        if (world.rand.nextInt(10) == 5) {
            event.getDrops().add(new EntityItem(world, x, y, z, new ItemStack(Items.CLAY_BALL)));
        }
    } else if (deadEntity instanceof EntityDragon || deadEntity instanceof EntityWither) {
        event.getDrops().add(new EntityItem(world, x, y, z, new ItemStack(Items.CLAY_BALL)));
    }
}
项目:MineLittlePony    文件:MineLittlePony.java   
private void saveCurrentRenderers(RenderManager rm) {
    // villagers
    saveRenderer(rm, EntityVillager.class);
    saveRenderer(rm, EntityZombieVillager.class);
    // zombies
    saveRenderer(rm, EntityZombie.class);
    saveRenderer(rm, EntityHusk.class);
    // pig zombie
    saveRenderer(rm, EntityPigZombie.class);
    // skeletons
    saveRenderer(rm, EntitySkeleton.class);
    saveRenderer(rm, EntityStray.class);
    saveRenderer(rm, EntityWitherSkeleton.class);
    // illagers
    saveRenderer(rm, EntityVex.class);
    saveRenderer(rm, EntityEvoker.class);
    saveRenderer(rm, EntityVindicator.class);
    saveRenderer(rm, EntityIllusionIllager.class);
}
项目:Dark-Utilities    文件:ItemMaterial.java   
public static void transformEntity (World world, EntityLivingBase entity, ItemStack stack) {

        if (stack.isEmpty()) {

            return;
        }

        final EntityWitherSkeleton witherSkeleton = new EntityWitherSkeleton(world);
        witherSkeleton.copyLocationAndAnglesFrom(entity);
        witherSkeleton.setHealth(entity.getHealth());

        for (final EntityEquipmentSlot slot : EntityEquipmentSlot.values()) {

            if (entity.hasItemInSlot(slot)) {

                witherSkeleton.setItemStackToSlot(slot, entity.getItemStackFromSlot(slot));
                entity.setItemStackToSlot(slot, ItemStack.EMPTY);
                StackUtils.decreaseStackSize(stack, 1);
            }
        }

        world.removeEntity(entity);
        world.spawnEntity(witherSkeleton);
    }
项目:EnderIO    文件:ItemDarkSteelSword.java   
private ItemStack getSkullForEntity(EntityLivingBase entityLiving) {
  // ItemSkull: {"skeleton", "wither", "zombie", "char", "creeper", "dragon"}
  if (entityLiving instanceof EntitySkeleton) {
    return new ItemStack(Items.SKULL, 1, 0);
  } else if (entityLiving instanceof EntityWitherSkeleton) {
    return new ItemStack(Items.SKULL, 1, 1);
  } else if (entityLiving.getClass() == EntityZombie.class) { // sic! not PigZombie, ZombieVillager or Husk
    return new ItemStack(Items.SKULL, 1, 2);
  } else if (entityLiving instanceof EntityCreeper) {
    return new ItemStack(Items.SKULL, 1, 4);
  } else if (entityLiving instanceof EntityEnderman) {
    return new ItemStack(blockEndermanSkull.getBlockNN());
  }

  return null;
}
项目:EndermanEvolution    文件:EntityUtils.java   
public static ItemStack getSkullDrop(EntityLivingBase entity) {
    if (entity instanceof EntitySkeleton) {
        return new ItemStack(Items.SKULL, 1, 0);
    }
    if (entity instanceof EntityWitherSkeleton) {
        return new ItemStack(Items.SKULL, 1, 1);
    }
    if (entity instanceof EntityZombie) {
        return new ItemStack(Items.SKULL, 1, 2);
    }
    if (entity instanceof EntityCreeper) {
        return new ItemStack(Items.SKULL, 1, 4);
    }
    if (entity instanceof EntityPlayer) {
        ItemStack head = new ItemStack(Items.SKULL, 1, 3);
        NBTTagCompound nametag = new NBTTagCompound();
        nametag.setString("SkullOwner", entity.getDisplayName().getFormattedText());
        head.setTagCompound(nametag);
        return head;
    }
    if (entity instanceof EntityDragon) {
        return new ItemStack(Items.SKULL, 1, 5);
    }
    if (entity instanceof EntityEnderman) {
        if (entity instanceof EntityEvolvedEnderman) {
            return new ItemStack(ModItems.SKULL_EVOLVED_ENDERMAN);
        }
        return new ItemStack(ModItems.SKULL_ENDERMAN);
    }
    if (entity instanceof EntityFrienderman) {
        return new ItemStack(ModItems.SKULL_FRIENDERMAN);
    }
    return null;
}
项目:Backmemed    文件:MapGenNetherBridge.java   
public MapGenNetherBridge()
{
    this.spawnList.add(new Biome.SpawnListEntry(EntityBlaze.class, 10, 2, 3));
    this.spawnList.add(new Biome.SpawnListEntry(EntityPigZombie.class, 5, 4, 4));
    this.spawnList.add(new Biome.SpawnListEntry(EntityWitherSkeleton.class, 8, 5, 5));
    this.spawnList.add(new Biome.SpawnListEntry(EntitySkeleton.class, 2, 5, 5));
    this.spawnList.add(new Biome.SpawnListEntry(EntityMagmaCube.class, 3, 4, 4));
}
项目:Battlegear2    文件:MobHookContainerClass.java   
/**
 * Listen to {@link EntityJoinWorldEvent} :
 * Adds random special {@link EntityArrow}s data to {@link AbstractSkeleton}s {@link net.minecraft.network.datasync.EntityDataManager} (for display)
 * Replace the vanilla fired {@link EntityTippedArrow} with the custom {@link AbstractMBArrow} (for actual action)
 * Note: Fails silently
 */
@SubscribeEvent(priority = EventPriority.LOW)
public void onEntityJoinWorld(EntityJoinWorldEvent event){
    if(event.getEntity() instanceof AbstractSkeleton){
        registerArrowType((AbstractSkeleton)event.getEntity());
    }else if(event.getEntity() instanceof EntityTippedArrow && ((EntityTippedArrow) event.getEntity()).getColor() == 0){
        EntityArrow arrow = ((EntityArrow)event.getEntity());
        if (arrow.shootingEntity instanceof AbstractSkeleton) {
            AbstractSkeleton skeleton = (AbstractSkeleton) arrow.shootingEntity;
            if(skeleton.getAttackTarget() != null) {
                ItemStack type = getArrowForMob(skeleton);
                if (type.getItem() instanceof ItemArrow) {
                    EntityArrow mbArrow = ((ItemArrow)type.getItem()).createArrow(skeleton.world, type, skeleton);
                    if (!(mbArrow instanceof EntityTippedArrow)) {
                        EntityLivingBase target = skeleton.getAttackTarget();
                        float pow = MathHelper.sqrt(skeleton.getDistanceSq(target.posX, target.getEntityBoundingBox().minY, target.posZ)) / 15F;
                        pow = MathHelper.clamp(pow, 0.1F, 1.0F);

                        mbArrow.setEnchantmentEffectsFromEntity(skeleton, pow);
                        if (skeleton instanceof EntityWitherSkeleton)
                            mbArrow.setFire(100);
                        double d0 = target.posX - skeleton.posX;
                        double d1 = target.getEntityBoundingBox().minY + (double)(target.height / 3.0F) - mbArrow.posY;
                        double d2 = target.posZ - skeleton.posZ;
                        double d3 = (double)MathHelper.sqrt(d0 * d0 + d2 * d2);
                        mbArrow.setThrowableHeading(d0, d1 + d3 * 0.2D, d2, 1.6F, (float)(14 - skeleton.world.getDifficulty().getDifficultyId() * 4));
                        mbArrow.setDamage(arrow.getDamage());
                        if (skeleton.world.spawnEntity(mbArrow))
                            event.setCanceled(true);
                    }
                }
            }
        }
    }
}
项目:Gravestone-mod-Graves    文件:ModelRendererSkull.java   
public static EnumSkullType getTypeByClass(Entity entity) {
    if (entity instanceof EntityWitherSkeleton) {
        return WITHER_SKULL;
    } else {//if (entity instanceof EntitySkeleton) {
        return SKELETON_SKULL;
    }
}
项目:MakeClayValuableAgain    文件:ClayProgressionImprovements.java   
private void spawnWitherSkeleton(World world, BlockPos toSpawnIn) {
    Entity wither = new EntityWitherSkeleton(world);
    wither.setPosition(toSpawnIn.getX(), toSpawnIn.getY() + 0.5, toSpawnIn.getZ());
    world.spawnEntity(wither);
}
项目:MineLittlePony    文件:RenderPonySkeleton.java   
@Override
protected ResourceLocation getTexture(EntityWitherSkeleton entity) {
    return WITHER;
}
项目:MineLittlePony    文件:RenderPonySkeleton.java   
@Override
protected void preRenderCallback(EntityWitherSkeleton skeleton, float partialTicks) {
    super.preRenderCallback(skeleton, partialTicks);
    GlStateManager.scale(1.2F, 1.2F, 1.2F);
}
项目:MineLittlePony    文件:MineLittlePony.java   
public void initializeMobRenderers(RenderManager rm) {
    if (this.config.villagers) {
        ModUtilities.addRenderer(EntityVillager.class, new RenderPonyVillager(rm));
        ModUtilities.addRenderer(EntityZombieVillager.class, new RenderPonyZombieVillager(rm));
        logger.info("Villagers are now ponies.");
    } else {
        ModUtilities.addRenderer(EntityVillager.class, getRenderer(EntityVillager.class));
        ModUtilities.addRenderer(EntityZombieVillager.class, getRenderer(EntityZombieVillager.class));
    }

    if (this.config.zombies) {
        ModUtilities.addRenderer(EntityZombie.class, new RenderPonyZombie<>(rm));
        ModUtilities.addRenderer(EntityHusk.class, new RenderPonyZombie.Husk(rm));
        logger.info("Zombies are now ponies.");
    } else {
        ModUtilities.addRenderer(EntityZombie.class, getRenderer(EntityZombie.class));
        ModUtilities.addRenderer(EntityHusk.class, getRenderer(EntityHusk.class));
    }

    if (this.config.pigzombies) {
        ModUtilities.addRenderer(EntityPigZombie.class, new RenderPonyPigman(rm));
        logger.info("Zombie pigmen are now ponies.");
    } else {
        ModUtilities.addRenderer(EntityPigZombie.class, getRenderer(EntityPigZombie.class));
    }

    if (this.config.skeletons) {
        ModUtilities.addRenderer(EntitySkeleton.class, new RenderPonySkeleton<>(rm));
        ModUtilities.addRenderer(EntityStray.class, new RenderPonySkeleton.Stray(rm));
        ModUtilities.addRenderer(EntityWitherSkeleton.class, new RenderPonySkeleton.Wither(rm));
        logger.info("Skeletons are now ponies.");
    } else {
        ModUtilities.addRenderer(EntitySkeleton.class, getRenderer(EntitySkeleton.class));
        ModUtilities.addRenderer(EntityStray.class, getRenderer(EntityStray.class));
        ModUtilities.addRenderer(EntityWitherSkeleton.class, getRenderer(EntityWitherSkeleton.class));
    }

    if (this.config.illagers) {
        ModUtilities.addRenderer(EntityVex.class, new RenderPonyVex(rm));
        ModUtilities.addRenderer(EntityEvoker.class, new RenderPonyEvoker(rm));
        ModUtilities.addRenderer(EntityVindicator.class, new RenderPonyVindicator(rm));
        ModUtilities.addRenderer(EntityIllusionIllager.class, new RenderPonyIllusionIllager(rm));
        logger.info("Illagers are now ponies.");
    } else {
        ModUtilities.addRenderer(EntityVex.class, getRenderer(EntityVex.class));
        ModUtilities.addRenderer(EntityEvoker.class, getRenderer(EntityEvoker.class));
        ModUtilities.addRenderer(EntityVindicator.class, getRenderer(EntityVindicator.class));
        ModUtilities.addRenderer(EntityIllusionIllager.class, getRenderer(EntityIllusionIllager.class));
    }
}
项目:Gravestone-mod-Extended    文件:MobSpawn.java   
public static boolean isWitherSkeleton(AbstractSkeleton skeleton) {
    return skeleton instanceof EntityGSSkeleton && ((EntityGSSkeleton) skeleton).getSkeletonType() == SkeletonType.WITHER ||
            skeleton instanceof EntityWitherSkeleton;
}
项目:Cyclic    文件:EnchantBeheading.java   
@SubscribeEvent
public void onEntityKill(LivingDeathEvent event) {
  if (event.getSource().getTrueSource() instanceof EntityPlayer && event.getEntity() instanceof EntityLivingBase) {
    EntityPlayer attacker = (EntityPlayer) event.getSource().getTrueSource();
    World world = attacker.world;
    if (MathHelper.getInt(world.rand, 0, 100) > this.percentDrop) {
      return;
    }
    EntityLivingBase target = (EntityLivingBase) event.getEntity();
    if (target == null) {
      return;
    } //probably wont happen just extra safe
    BlockPos pos = target.getPosition();
    if (target instanceof EntityPlayer) {
      UtilItemStack.dropItemStackInWorld(world, pos, UtilNBT.buildNamedPlayerSkull((EntityPlayer) target));
      return;
    }
    int level = getCurrentLevelTool(attacker);
    if (level < 0) {
      return;
    }
    //else the random number was less than 10, so it passed the 10% chance req
    String key = target.getClass().getName();
    ////we allow all these, which include config, to override the vanilla skulls below
    //first do my wacky class mapping// TODO delete and go to minecraft:blah
    if (mapClassToSkin.containsKey(key)) {
      UtilItemStack.dropItemStackInWorld(world, pos, UtilNBT.buildNamedPlayerSkull(mapClassToSkin.get(key)));
      return;
    }
    else if (mapClassToTag.containsKey(key)) {
      UtilItemStack.dropItemStackInWorld(world, pos, UtilNBT.buildSkullFromTag(mapClassToTag.get(key)));
      return;
    }
    else if (target instanceof EntityCreeper) {//4
      UtilItemStack.dropItemStackInWorld(world, pos, new ItemStack(Items.SKULL, 1, Const.skull_creeper));
      return;
    }
    else if (target instanceof EntityZombie) {//2
      UtilItemStack.dropItemStackInWorld(world, pos, new ItemStack(Items.SKULL, 1, Const.skull_zombie));
      return;
    }
    else if (target instanceof EntitySkeleton) {//0
      UtilItemStack.dropItemStackInWorld(world, pos, new ItemStack(Items.SKULL, 1, Const.skull_skeleton));
      return;
    }
    else if (target instanceof EntityWitherSkeleton) {//1
      UtilItemStack.dropItemStackInWorld(world, pos, new ItemStack(Items.SKULL, 1, Const.skull_wither));
      return;
    }
    else if (target instanceof EntityDragon) {//5
      UtilItemStack.dropItemStackInWorld(world, pos, new ItemStack(Items.SKULL, 1, Const.skull_dragon));
      return;
    }
    else if (target instanceof EntityPlayer) {//player name
      UtilItemStack.dropItemStackInWorld(world, pos, UtilNBT.buildNamedPlayerSkull((EntityPlayer) target));
      return;
    }
    if (EntityList.getKey(target) != null) {
      String resourcelocation = EntityList.getKey(target).toString();
      if (mapResourceToSkin.containsKey(resourcelocation)) {
        UtilItemStack.dropItemStackInWorld(world, pos, UtilNBT.buildNamedPlayerSkull(mapResourceToSkin.get(resourcelocation)));
        return;
      }
    }
    ModCyclic.logger.error("Beheading : mob not found in EntityList " + target.getName());
  }
}
项目:EnderIO    文件:ItemDarkSteelSword.java   
protected boolean isWitherSkeleton(LivingDropsEvent evt) {
  return evt.getEntityLiving() instanceof EntityWitherSkeleton;
}
项目:Dark-Utilities    文件:ItemMaterial.java   
@Override
public boolean itemInteractionForEntity (ItemStack stack, EntityPlayer playerIn, EntityLivingBase target, EnumHand hand) {

    final World world = target.getEntityWorld();

    if (!world.isRemote && stack.getMetadata() == 0 && target instanceof AbstractSkeleton && !(target instanceof EntityWitherSkeleton)) {

        transformEntity(world, target, stack);
        return true;
    }

    return false;
}