private void setSpawn(byte id) { EntityZombie zombie; if (id == 0) { zombie = new EntityZombie(world); zombie.setLocationAndAngles(posX, posY, posZ, rotationYaw, 0.0F); zombie.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(zombie)), null); zombie.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(GaiaItems.ACCESSORY_HEADGEAR, 1, 0)); zombie.setDropChance(EntityEquipmentSlot.MAINHAND, 0); zombie.setDropChance(EntityEquipmentSlot.OFFHAND, 0); zombie.setDropChance(EntityEquipmentSlot.FEET, 0); zombie.setDropChance(EntityEquipmentSlot.LEGS, 0); zombie.setDropChance(EntityEquipmentSlot.CHEST, 0); zombie.setDropChance(EntityEquipmentSlot.HEAD, 0); world.spawnEntity(zombie); } }
@Override public boolean attackEntityAsMob(Entity entityIn) { removePotionEffect(MobEffects.INVISIBILITY); return super.attackEntityAsMob(entityIn); }
@Override public boolean attackEntityFrom(DamageSource source, float amount) { if(source == DamageSource.FALL) return false; return super.attackEntityFrom(source, amount); }
@Nullable @Override public EntityLiving getExample() { EntityZombie entity = new EntityZombie(WorldDummy.INSTANCE); entity.setPositionAndRotation(12, 0, 0, 30, 73); entity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.STICK)); entity.setItemStackToSlot(EntityEquipmentSlot.CHEST, new ItemStack(Items.DIAMOND_HELMET)); return entity; }
@SubscribeEvent public void entityUpdate(LivingUpdateEvent event) { if(event.getEntity() instanceof EntityZombie && !(event.getEntity() instanceof EntityHusk)) { EntityZombie zombie = (EntityZombie) event.getEntity(); if(zombie.getEntityWorld().isDaytime() && !zombie.getEntityWorld().isRemote && zombie.isChild()) { float f = zombie.getBrightness(); BlockPos blockpos = zombie.getRidingEntity() instanceof EntityBoat ? new BlockPos(zombie.posX, Math.round(zombie.posY), zombie.posZ).up() : new BlockPos(zombie.posX, Math.round(zombie.posY), zombie.posZ); if(f > 0.5F && zombie.getEntityWorld().rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && zombie.getEntityWorld().canSeeSky(blockpos)) { boolean flag = true; ItemStack itemstack = zombie.getItemStackFromSlot(EntityEquipmentSlot.HEAD); if(!itemstack.isEmpty()) { if(itemstack.isItemStackDamageable()) { itemstack.setItemDamage(itemstack.getItemDamage() + zombie.getEntityWorld().rand.nextInt(2)); if(itemstack.getItemDamage() >= itemstack.getMaxDamage()) { zombie.renderBrokenItemStack(itemstack); zombie.setItemStackToSlot(EntityEquipmentSlot.HEAD, ItemStack.EMPTY); } } flag = false; } if(flag) zombie.setFire(8); } } } }
switch (world.rand.nextInt(2)) { case 0: { entity = new EntityZombie(world); if(world.rand.nextInt(hardMode ? 3 : 12) == 0) { entity = new EntityWitch(world);
@Override public boolean onActivate(IImperfectRitualStone imperfectRitualStone, EntityPlayer player) { EntityZombie zombie = new EntityZombie(imperfectRitualStone.getRitualWorld()); zombie.setPosition(imperfectRitualStone.getRitualPos().getX() + 0.5, imperfectRitualStone.getRitualPos().getY() + 2.1, imperfectRitualStone.getRitualPos().getZ() + 0.5); zombie.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 2000)); zombie.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 20000, 7)); zombie.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 20000, 3)); if (!imperfectRitualStone.getRitualWorld().isRemote) imperfectRitualStone.getRitualWorld().spawnEntity(zombie); return true; } }
@Override public boolean getCanSpawnHere() { return super.getCanSpawnHere() && posY < DepthMobs.upperBound; }
@Override protected void applyEntityAttributes() { super.applyEntityAttributes(); getEntityAttribute(SPAWN_REINFORCEMENTS_CHANCE).setBaseValue(0); getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(3); }
@Override public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) { addPotionEffect(new PotionEffect(MobEffects.INVISIBILITY, Integer.MAX_VALUE)); return super.onInitialSpawn(difficulty, livingdata); }
if(world.rand.nextInt(10) == 0) entity = new EntityHusk(world); else entity = new EntityZombie(world); break; case 1:
@Override public boolean getCanSpawnHere() { return super.getCanSpawnHere() && this.world.canSeeSky(new BlockPos(this)); }
@Override protected void applyEntityAttributes() { super.applyEntityAttributes(); getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(ZooConfig.loveChildSpeed.get()); getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(ZooConfig.loveChildArmor.get()); getEntityAttribute(SPAWN_REINFORCEMENTS_CHANCE).setBaseValue(0); applyAttributes(this, ZooConfig.loveChildHealth, ZooConfig.loveChildAttackDamage); }
private void setSpawn(byte id) { EntityZombie zombie; EntitySkeleton skeleton; if (id == 0) { zombie = new EntityZombie(world); zombie.setLocationAndAngles(posX, posY, posZ, rotationYaw, 0.0F); zombie.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(zombie)), null); zombie.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(GaiaItems.ACCESSORY_HEADGEAR, 1, 1)); zombie.setDropChance(EntityEquipmentSlot.MAINHAND, 0); zombie.setDropChance(EntityEquipmentSlot.OFFHAND, 0); zombie.setDropChance(EntityEquipmentSlot.FEET, 0); zombie.setDropChance(EntityEquipmentSlot.LEGS, 0); zombie.setDropChance(EntityEquipmentSlot.CHEST, 0); zombie.setDropChance(EntityEquipmentSlot.HEAD, 0); world.spawnEntity(zombie); } if (id == 1) { skeleton = new EntitySkeleton(world); skeleton.setLocationAndAngles(posX, posY, posZ, rotationYaw, 0.0F); skeleton.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(skeleton)), null); skeleton.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(GaiaItems.ACCESSORY_HEADGEAR, 1, 1)); skeleton.setDropChance(EntityEquipmentSlot.MAINHAND, 0); skeleton.setDropChance(EntityEquipmentSlot.OFFHAND, 0); skeleton.setDropChance(EntityEquipmentSlot.FEET, 0); skeleton.setDropChance(EntityEquipmentSlot.LEGS, 0); skeleton.setDropChance(EntityEquipmentSlot.CHEST, 0); skeleton.setDropChance(EntityEquipmentSlot.HEAD, 0); world.spawnEntity(skeleton); } }
/** * Set the inner entity; * @param innerEntity inner entity */ public void setInnerEntity(EntityLivingBase innerEntity) { if(innerEntity instanceof EntityPlayer) { setPlayerId(((EntityPlayer) innerEntity).getGameProfile().getId().toString()); setPlayerName(((EntityPlayer) innerEntity).getGameProfile().getName()); innerEntity = new EntityZombie(world); } this.data.setInnerEntityName(innerEntity.getClass().getName()); }
@Override public boolean attackEntityFrom(DamageSource source, float amount) { if(amount > 0) removePotionEffect(MobEffects.INVISIBILITY); return super.attackEntityFrom(source, amount); }
@Override public boolean getCanSpawnHere() { BlockPos blockpos = new BlockPos(posX, getEntityBoundingBox().minY - 1, posZ); return super.getCanSpawnHere() && getEntityWorld().getBlockState(blockpos).getBlock() == Blocks.SOUL_SAND; }
@Override public boolean attackEntityAsMob(@Nonnull Entity entityIn) { boolean flag = super.attackEntityAsMob(entityIn); if (flag && entityIn instanceof EntityLivingBase && rand.nextFloat() < ZooConfig.attackTeleportChance.get()) { RandomTeleportUtil.teleportEntity(entityIn.world, entityIn, false, true, ZooConfig.attackTeleportDistance.get()); } return flag; }
@Override protected void applyEntityAttributes() { super.applyEntityAttributes(); getEntityAttribute(SPAWN_REINFORCEMENTS_CHANCE).setBaseValue(0); getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(0); getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.28); getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE).setBaseValue(1); getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(40); }
zombie = new EntityZombie(world); zombie.setLocationAndAngles(posX, posY, posZ, rotationYaw, 0.0F); zombie.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(zombie)), null); zombie.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(GaiaItems.ACCESSORY_HEADGEAR, 1, 0)); zombie.setDropChance(EntityEquipmentSlot.MAINHAND, 0); zombie.setDropChance(EntityEquipmentSlot.OFFHAND, 0); zombie.setDropChance(EntityEquipmentSlot.FEET, 0); zombie.setDropChance(EntityEquipmentSlot.LEGS, 0); zombie.setDropChance(EntityEquipmentSlot.CHEST, 0); zombie.setDropChance(EntityEquipmentSlot.HEAD, 0); world.spawnEntity(zombie);