use of net.minecraft.entity.monster.EntityWitherSkeleton in project EnderIO by SleepyTrousers.
the class CapturedMob method getEntity.
@SuppressWarnings("null")
@Nullable
public Entity getEntity(@Nullable World world, @Nullable BlockPos pos, @Nullable DifficultyInstance difficulty, boolean clone) {
if (world == null) {
return null;
}
if (entityNbt != null && (clone || isUnspawnable(entityId))) {
final Entity entity = EntityList.createEntityFromNBT(entityNbt, world);
if (!clone && entity != null) {
// The caller doesn't expect a clone, but we return one. Give it a unique/new ID to avoid problems with duplicate entities.
entity.setUniqueId(MathHelper.getRandomUUID(world.rand));
}
return entity;
}
Entity entity = EntityList.createEntityByIDFromName(entityId, world);
if (entity == null) {
return null;
}
if (pos != null) {
entity.setPosition(pos.getX(), pos.getY(), pos.getZ());
}
if (entity instanceof EntityLiving) {
if (pos != null && difficulty == null) {
difficulty = world.getDifficultyForLocation(pos);
}
if (difficulty != null) {
((EntityLiving) entity).onInitialSpawn(difficulty, null);
}
}
if (entity instanceof EntityWitherSkeleton) {
if (Celeb.H31.isOn() && Math.random() < 0.25) {
entity.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(Math.random() < 0.1 ? Blocks.LIT_PUMPKIN : Blocks.PUMPKIN));
((EntityWitherSkeleton) entity).setDropChance(EntityEquipmentSlot.HEAD, 0.0F);
} else if (Celeb.C06.isOn() && Math.random() < 0.25) {
entity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Math.random() < 0.25 ? Items.LEATHER_BOOTS : Items.STICK));
} else if (Math.random() < 0.1) {
entity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(ModObject.itemDarkSteelSword.getItemNN()));
((EntityWitherSkeleton) entity).setDropChance(EntityEquipmentSlot.MAINHAND, 0.00001F);
}
}
return entity;
}
use of net.minecraft.entity.monster.EntityWitherSkeleton in project NetherEx by LogicTechCorp.
the class EventHandler method onLivingDrops.
@SubscribeEvent
public static void onLivingDrops(LivingDropsEvent event) {
Random rand = new Random();
BlockPos deathPoint = event.getEntity().getPosition();
if (event.getEntity() instanceof EntityGhast) {
event.getDrops().add(new EntityItem(event.getEntity().getEntityWorld(), deathPoint.getX(), deathPoint.getY(), deathPoint.getZ(), new ItemStack(NetherExItems.FOOD_MEAT_GHAST_RAW, rand.nextInt(3) + 1, 0)));
} else if (event.getEntity() instanceof EntityWitherSkeleton) {
ListIterator<EntityItem> iter = event.getDrops().listIterator();
while (iter.hasNext()) {
EntityItem entityItem = iter.next();
ItemStack stack = entityItem.getEntityItem();
if (stack.getItem() == Items.BONE || stack.getItem() == Items.COAL) {
iter.remove();
}
}
event.getDrops().add(new EntityItem(event.getEntity().world, deathPoint.getX(), deathPoint.getY(), deathPoint.getZ(), new ItemStack(NetherExItems.ITEM_BONE_WITHER, rand.nextInt(3), 0)));
}
}
Aggregations