@Override public boolean apply(EntityPlayer player) { for (int i = 0; i < 10; i++) { BlockPos pos = new BlockPos(player.posX + player.getRNG().nextGaussian() * 4, player.posY, player.posZ + player.getRNG().nextGaussian() * 4); EntityZombie zombie = new EntityZombie(player.world); if (player.world.isAirBlock(pos) && player.world.isAirBlock(pos.up()) && player.world.getBlockState(pos.down()).canEntitySpawn(zombie)) { zombie.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5); zombie.onInitialSpawn(player.world.getDifficultyForLocation(pos), null); player.world.spawnEntity(zombie); if (player.getRNG().nextBoolean() && player.getRNG().nextBoolean()) zombie.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 900, 1)); if (player.getRNG().nextBoolean() && player.getRNG().nextBoolean()) zombie.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 900, 1)); if (player.getRNG().nextBoolean() && player.getRNG().nextBoolean()) zombie.addPotionEffect(new PotionEffect(MobEffects.SPEED, 900, 1)); if (player.getRNG().nextBoolean() && player.getRNG().nextBoolean()) zombie.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 900, 1)); return true; } } return false; }
public EntityVillager(World worldIn, int professionId) { super(worldIn); this.villagerInventory = new InventoryBasic("Items", false, 8); this.setProfession(professionId); this.setSize(0.6F, 1.8F); ((PathNavigateGround)this.getNavigator()).setBreakDoors(true); ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityZombie.class, 8.0F, 0.6D, 0.6D)); this.tasks.addTask(1, new EntityAITradePlayer(this)); this.tasks.addTask(1, new EntityAILookAtTradePlayer(this)); this.tasks.addTask(2, new EntityAIMoveIndoors(this)); this.tasks.addTask(3, new EntityAIRestrictOpenDoor(this)); this.tasks.addTask(4, new EntityAIOpenDoor(this, true)); this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 0.6D)); this.tasks.addTask(6, new EntityAIVillagerMate(this)); this.tasks.addTask(7, new EntityAIFollowGolem(this)); this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F)); this.tasks.addTask(9, new EntityAIVillagerInteract(this)); this.tasks.addTask(9, new EntityAIWander(this, 0.6D)); this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F)); this.setCanPickUpLoot(true); }
private EntityZombie unearthMe() { EntityZombie zombie = (this.getZombieType() == ZombieType.NORMAL ? new EntityZombie(this.world) : new EntityHusk(this.world)); zombie.renderYawOffset = this.renderYawOffset; zombie.prevRotationPitch = zombie.rotationPitch = this.rotationPitch; zombie.prevRotationYaw = zombie.rotationYaw = this.rotationYaw; zombie.setPosition(this.posX, this.posY, this.posZ); zombie.setHealth(this.getHealth()); zombie.setFire((Integer)ReflectionUtils.getFieldValue(entityFire, this)); zombie.setAttackTarget(this.getAttackTarget()); this.springEffect(); this.setDead(); this.world.spawnEntity(zombie); return zombie; }
private EntityZombieHands earthMe(EntityZombie zombie) { EntityZombieHands entity = new EntityZombieHands(this.world); entity.renderYawOffset = zombie.renderYawOffset; entity.prevRotationPitch = entity.rotationPitch = zombie.rotationPitch; entity.prevRotationYaw = entity.rotationYaw = zombie.rotationYaw; entity.setPosition(zombie.posX, zombie.posY, zombie.posZ); entity.setHealth(zombie.getHealth()); entity.setFire((Integer)ReflectionUtils.getFieldValue(entityFire, zombie)); entity.setAttackTarget(zombie.getAttackTarget()); entity.setZombieType(zombie instanceof EntityHusk ? ZombieType.HUSK : ZombieType.NORMAL); zombie.setDead(); entity.springEffect(); this.world.spawnEntity(entity); return entity; }
protected void initEntityAI() { this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityZombie.class, 8.0F, 0.6D, 0.6D)); this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityEvoker.class, 12.0F, 0.8D, 0.8D)); this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityVindicator.class, 8.0F, 0.8D, 0.8D)); this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityVex.class, 8.0F, 0.6D, 0.6D)); this.tasks.addTask(1, new EntityAITradePlayer(this)); this.tasks.addTask(1, new EntityAILookAtTradePlayer(this)); this.tasks.addTask(2, new EntityAIMoveIndoors(this)); this.tasks.addTask(3, new EntityAIRestrictOpenDoor(this)); this.tasks.addTask(4, new EntityAIOpenDoor(this, true)); this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 0.6D)); this.tasks.addTask(6, new EntityAIVillagerMate(this)); this.tasks.addTask(7, new EntityAIFollowGolem(this)); this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F)); this.tasks.addTask(9, new EntityAIVillagerInteract(this)); this.tasks.addTask(9, new EntityAIWanderAvoidWater(this, 0.6D)); this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F)); }
/** * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how * "far" arms and legs can swing at most. */ public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); EntityZombie entityzombie = (EntityZombie)entityIn; float f = MathHelper.sin(this.swingProgress * (float)Math.PI); float f1 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float)Math.PI); this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; this.bipedRightArm.rotateAngleY = -(0.1F - f * 0.6F); this.bipedLeftArm.rotateAngleY = 0.1F - f * 0.6F; float f2 = -(float)Math.PI / (entityzombie.isArmsRaised() ? 1.5F : 2.25F); this.bipedRightArm.rotateAngleX = f2; this.bipedLeftArm.rotateAngleX = f2; this.bipedRightArm.rotateAngleX += f * 1.2F - f1 * 0.4F; this.bipedLeftArm.rotateAngleX += f * 1.2F - f1 * 0.4F; this.bipedRightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F; this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F; this.bipedRightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F; this.bipedLeftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F; }
/** * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how * "far" arms and legs can swing at most. */ public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); boolean flag = entityIn instanceof EntityZombie && ((EntityZombie)entityIn).isArmsRaised(); float f = MathHelper.sin(this.swingProgress * (float)Math.PI); float f1 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float)Math.PI); this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; this.bipedRightArm.rotateAngleY = -(0.1F - f * 0.6F); this.bipedLeftArm.rotateAngleY = 0.1F - f * 0.6F; float f2 = -(float)Math.PI / (flag ? 1.5F : 2.25F); this.bipedRightArm.rotateAngleX = f2; this.bipedLeftArm.rotateAngleX = f2; this.bipedRightArm.rotateAngleX += f * 1.2F - f1 * 0.4F; this.bipedLeftArm.rotateAngleX += f * 1.2F - f1 * 0.4F; this.bipedRightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F; this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F; this.bipedRightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F; this.bipedLeftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F; }
@SuppressWarnings("deprecation") public static void onSetProfession(EntityZombie entity, VillagerProfession prof) { if (prof == null) { if (entity.getZombieType() != ZombieType.NORMAL && entity.getZombieType() != ZombieType.HUSK) entity.setZombieType(ZombieType.NORMAL); return; } int network = INSTANCE.professions.getId(prof); if (network == -1 || prof != INSTANCE.professions.getObjectById(network)) { throw new RuntimeException("Attempted to set villager profession to unregistered profession: " + network + " " + prof); } if (network >= 0 && network < 5) // Vanilla { if (entity.getZombieType() == null || entity.getZombieType().getId() != network + 1) { entity.setZombieType(ZombieType.getVillagerByOrdinal(network)); } } else if (entity.getZombieType() != null) entity.setZombieType(ZombieType.NORMAL); }
public static void onSetProfession(EntityZombie entity, ZombieType type, int network) { if (type == ZombieType.NORMAL || type == ZombieType.HUSK) { if (entity.getVillagerTypeForge() != null) entity.setVillagerType(null); return; } int realID = network - 1; if (type == null) //Forge type? realID = network * -1; // Forge encoded as -ID VillagerProfession prof = INSTANCE.professions.getObjectById(realID); if (prof == null && network != 0 || INSTANCE.professions.getId(prof) != realID) { throw new RuntimeException("Attempted to set villager profession to unregistered profession: " + realID + " " + prof); } if (prof != entity.getVillagerTypeForge()) entity.setVillagerType(prof); }
protected void initEntityAI() { this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityZombie.class, 8.0F, 0.6D, 0.6D)); this.tasks.addTask(1, new EntityAITradePlayer(this)); this.tasks.addTask(1, new EntityAILookAtTradePlayer(this)); this.tasks.addTask(2, new EntityAIMoveIndoors(this)); this.tasks.addTask(3, new EntityAIRestrictOpenDoor(this)); this.tasks.addTask(4, new EntityAIOpenDoor(this, true)); this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 0.6D)); this.tasks.addTask(6, new EntityAIVillagerMate(this)); this.tasks.addTask(7, new EntityAIFollowGolem(this)); this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F)); this.tasks.addTask(9, new EntityAIVillagerInteract(this)); this.tasks.addTask(9, new EntityAIWander(this, 0.6D)); this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F)); }
@SubscribeEvent public void onLivingDeath(LivingDeathEvent event) { if (event.getSource().getSourceOfDamage() != null && event.getSource().getSourceOfDamage() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.getSource().getSourceOfDamage(); if (this.isActive(player) && event.getEntityLiving() instanceof EntityVillager) { EntityVillager villager = (EntityVillager) event.getEntityLiving(); EntityZombie zombieVillager = new EntityZombie(player.worldObj); zombieVillager.copyLocationAndAnglesFrom(villager); player.worldObj.removeEntity(villager); zombieVillager.onInitialSpawn(player.worldObj.getDifficultyForLocation(new BlockPos(zombieVillager)), null); zombieVillager.setVillagerType(villager.getProfessionForge()); zombieVillager.setChild(villager.isChild()); zombieVillager.setNoAI(villager.isAIDisabled()); if (villager.hasCustomName()) { zombieVillager.setCustomNameTag(villager.getCustomNameTag()); zombieVillager.setAlwaysRenderNameTag(villager.getAlwaysRenderNameTag()); } player.worldObj.spawnEntityInWorld(zombieVillager); player.worldObj.playEvent(null, 1026, zombieVillager.getPosition(), 0); } } }
public BiomRoofedForest(int p_i45383_1_) { super(p_i45383_1_); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityCow.class, 8, 4, 6)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityWolf.class, 2, 4, 6)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityCentaure.class, 12, 4, 6)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityLutin.class, 14, 4, 6)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityCaveSpider.class, 8, 2, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 8, 2, 4)); this.topBlock = BlockRegister.GRASS; this.fillerBlock = BlockRegister.DIRT; this.setBiomeName("Mystic Roofed Forest"); this.theBiomeDecorator.grassPerChunk = 16; ((BiomeDecoratorMagic) this.theBiomeDecorator).berry_per_chunk = 6; this.theBiomeDecorator.treesPerChunk = 10; }
public BiomMagicForest(int p_i45383_1_) { super(p_i45383_1_); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityCow.class, 8, 4, 6)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityWolf.class, 2, 4, 6)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityStymph.class, 10, 4, 6)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityLutin.class, 14, 4, 6)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityCentaure.class, 12, 4, 6)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityCaveSpider.class, 8, 2, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 8, 2, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityGobelin.class, 8, 2, 4)); this.topBlock = Blocks.grass; this.fillerBlock = Blocks.dirt; this.setBiomeName("Mystic Forest"); this.theBiomeDecorator.grassPerChunk = 16; ((BiomeDecoratorMagic) this.theBiomeDecorator).berry_per_chunk = 6; this.theBiomeDecorator.treesPerChunk = 6; }
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); }
@Override public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { super.attackEntityFrom(par1DamageSource, par2); if (!this.isDead && !this.worldObj.isRemote) { this.health -= par2; if (this.health <= 0) { this.setDead(); this.worldObj.createExplosion((Entity) null, this.posX, this.posY, this.posZ, 6.0F, true); worldObj.spawnEntityInWorld(new EntityB2Frag(worldObj, this, 0)); worldObj.spawnEntityInWorld(new EntityB2Frag(worldObj, this, 1)); EntityZombie pz = new EntityZombie(worldObj); pz.setPosition(posX, posY, posZ); worldObj.spawnEntityInWorld(pz); RivalRebelsSoundPlayer.playSound(this, 0, 0, 30, 1); } } return true; }
protected void arms(float ageInTicks, Entity entityIn) { boolean armIsRaised = entityIn instanceof EntityZombie && ((EntityZombie) entityIn).isArmsRaised(); float swingAngle = MathHelper.sin(swingProgress * (float) Math.PI); float f1 = MathHelper.sin((1.0F - (1.0F - swingProgress) * (1.0F - swingProgress)) * (float) Math.PI); /* * z rotates arm inward and outward * * y rotates the axis down the arm */ bipedRightArm.rotateAngleZ = 0.0F; bipedLeftArm.rotateAngleZ = 0.0F; staff.rotateAngleX = 0F; if (isStaffAttacking) { bipedRightArm.rotateAngleX += -1.2F; bipedLeftArm.rotateAngleX += -1.4F; staff.rotateAngleX = 1.1F; } else { bipedRightArm.rotateAngleX += -1.1F; } }
@SubscribeEvent(priority = EventPriority.HIGH) public void onEntityLivingDeath(LivingDeathEvent event) { if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { if (ExtendedConfig.spawnSkullCrawlersAtMobsDeath) { if (event.getEntity() instanceof AbstractSkeleton) { EntitySkullCrawler crawler; if (MobSpawn.isWitherSkeleton((AbstractSkeleton) event.getEntity())) { crawler = new EntityWitherSkullCrawler(event.getEntity().getEntityWorld()); } else if (MobSpawn.isStraySkeleton((AbstractSkeleton) event.getEntity())) { crawler = new EntityStraySkullCrawler(event.getEntity().getEntityWorld()); } else { crawler = new EntitySkullCrawler(event.getEntity().getEntityWorld()); } MobSpawn.spawnCrawler(event.getEntity(), crawler); } else if (event.getEntity() instanceof EntityZombie) { MobSpawn.spawnCrawler(event.getEntity(), new EntityZombieSkullCrawler(event.getEntity().getEntityWorld())); } } if (event.getEntity() instanceof EntityCreeper && ((EntityCreeper) event.getEntity()).getPowered()) { // drop creeper statue if entity is a charged creeper GSBlock.MEMORIAL.dropCreeperMemorial(event.getEntity().getEntityWorld(), new BlockPos(event.getEntity())); } } }
@SubscribeEvent public void onEntitySpawn(EntityJoinWorldEvent event) { if(event.getEntity().world.isRemote) { Minecraft mc = Minecraft.getMinecraft(); if(event.getEntity() instanceof EntityFishHook) { fishHooks.add((EntityFishHook)event.getEntity()); } if(event.getEntity() instanceof EntityZombie && !(event.getEntity() instanceof EntityZombieVillager) || event.getEntity() instanceof EntitySkeleton || MobAmputation.config.playerGibs == 1 && event.getEntity() instanceof EntityPlayer && event.getEntity() != mc.player) { EntityLivingBase living = (EntityLivingBase)event.getEntity(); if(!amputationMap.containsKey(living) && !living.isChild()) { attachGibs(event.getEntity().world, living); } } } }
public EntityBaron(World world){ super(world); // TODO: Add a new AI that summons 2 guards if no guards are nearby this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityCreature.class, 0, true, false, new IEntitySelector() { public boolean isEntityApplicable(Entity entity) { if (!isLookingForHome && ((EntityCreature) entity).isWithinHomeDistanceCurrentPosition() && entity instanceof EntityZombie) return true; return false; } })); // Summons 2 guards this.targetTasks.addTask(3, new EntityAISummonGuards(this, EntityPlayer.class, true, true, 2)); setGuardWeaponType(type); }
public EntitySpearGuard(World world){ super(world); if (this.worldObj.difficultySetting == EnumDifficulty.EASY) this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, true)); else this.tasks.addTask(1, new EntityAISpearAttack(this, 1.0D, 20, 60, 15.0F)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityCreature.class, 0, true, false, new IEntitySelector() { public boolean isEntityApplicable(Entity entity) { if (!isLookingForHome && ((EntityCreature) entity).isWithinHomeDistanceCurrentPosition() && entity instanceof EntityZombie) return true; return false; } })); setGuardWeaponType(type); }
public EntityLongbowGuard(World world){ super(world); if (this.worldObj.difficultySetting == EnumDifficulty.EASY) this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, true)); else this.tasks.addTask(1, new EntityAIArrowAttack(this, 1.0D, 20, 60, 15.0F)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityCreature.class, 0, true, false, new IEntitySelector() { public boolean isEntityApplicable(Entity entity) { if (!isLookingForHome && ((EntityCreature) entity).isWithinHomeDistanceCurrentPosition() && entity instanceof EntityZombie) return true; return false; } })); setGuardWeaponType(type); }
public EntityCrossbowGuard(World world){ super(world); if (this.worldObj.difficultySetting == EnumDifficulty.EASY) this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, true)); else this.tasks.addTask(1, new EntityAIArrowAttack(this, 1.0D, 20, 60, 15.0F)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityCreature.class, 0, true, false, new IEntitySelector() { public boolean isEntityApplicable(Entity entity) { if (!isLookingForHome && ((EntityCreature) entity).isWithinHomeDistanceCurrentPosition() && entity instanceof EntityZombie) return true; return false; } })); setGuardWeaponType(type); }
private void spawnTaintLivingEntity(EntityLivingBase entityLiving) { Entity toSpawn = null; //TODO: Investigate why that is not working if ((entityLiving instanceof EntityZombie && ((EntityZombie) entityLiving).isVillager())) { toSpawn = new EntityTaintVillager(entityLiving.worldObj); } //More are coming... if (toSpawn != null) { toSpawn.setLocationAndAngles(entityLiving.posX, entityLiving.posY, entityLiving.posZ, entityLiving.rotationYaw, 0.0F); entityLiving.worldObj.spawnEntityInWorld(toSpawn); entityLiving.setDead(); } }
public void spawnMinions(@Nullable Living target) { int spawnCount = Math.max(3, getPlayers(PARTICIPANT).size()); for (Location<World> spawnPt : spawnPts) { if (Probability.getChance(11)) { for (int i = spawnCount; i > 0; --i) { Zombie zombie = (Zombie) getRegion().getExtent().createEntity(EntityTypes.ZOMBIE, spawnPt.getPosition()); // TODO convert to Sponge Data API ((EntityZombie) zombie).setChild(true); EntityHealthUtil.setMaxHealth(zombie, 1); getRegion().getExtent().spawnEntity(zombie, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build()); if (target != null) { zombie.setTarget(target); } } } } }
@Listener public void onEntityDeath(DestructEntityEvent.Death event, @Getter("getTargetEntity") Zombie zombie) { Optional<PatientXInstance> optInst = manager.getApplicableZone(zombie); if (!optInst.isPresent()) { return; } if (((EntityZombie) zombie).isChild()) { if (Probability.getChance(10)) { Task.builder().execute(() -> { new ItemDropper(zombie.getLocation()).dropStacks( Lists.newArrayList(newItemStack(ItemTypes.GOLD_INGOT, Probability.getRandom(16))), SpawnTypes.DROPPED_ITEM ); }).delayTicks(1).submit(SkreePlugin.inst()); } } }
public EntityCoelophysis(World world) { super(world); this.setSize(1F, 1.2F); minSize = 0.4F; maxSize = 1F; adultAge = 10; maxAge = 16; this.getNavigator().setAvoidsWater(true); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(4, new EntityAITempt(this, 1.2D, Items.rotten_flesh, false)); this.tasks.addTask(6, new EntityAIWander(this, 1.0D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityAnimal.class, 0, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityZombie.class, 0, true)); }
public EntityVillager(World par1World, int par2) { super(par1World); this.setProfession(par2); this.setSize(0.6F, 1.8F); this.getNavigator().setBreakDoors(true); this.getNavigator().setAvoidsWater(true); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityZombie.class, 8.0F, 0.6D, 0.6D)); this.tasks.addTask(1, new EntityAITradePlayer(this)); this.tasks.addTask(1, new EntityAILookAtTradePlayer(this)); this.tasks.addTask(2, new EntityAIMoveIndoors(this)); this.tasks.addTask(3, new EntityAIRestrictOpenDoor(this)); this.tasks.addTask(4, new EntityAIOpenDoor(this, true)); this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 0.6D)); this.tasks.addTask(6, new EntityAIVillagerMate(this)); this.tasks.addTask(7, new EntityAIFollowGolem(this)); this.tasks.addTask(8, new EntityAIPlay(this, 0.32D)); this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F)); this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityVillager.class, 5.0F, 0.02F)); this.tasks.addTask(9, new EntityAIWander(this, 0.6D)); this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F)); }
private void func_82427_a(EntityZombie par1EntityZombie) { if (par1EntityZombie.isVillager()) { if (this.field_82431_q != this.zombieVillagerModel.func_82897_a()) { this.zombieVillagerModel = new ModelZombieVillager(); this.field_82431_q = this.zombieVillagerModel.func_82897_a(); this.field_82436_m = new ModelZombieVillager(1.0F, 0.0F, true); this.field_82433_n = new ModelZombieVillager(0.5F, 0.0F, true); } this.mainModel = this.zombieVillagerModel; this.field_82423_g = this.field_82436_m; this.field_82425_h = this.field_82433_n; } else { this.mainModel = this.field_82434_o; this.field_82423_g = this.field_82437_k; this.field_82425_h = this.field_82435_l; } this.modelBipedMain = (ModelBiped)this.mainModel; }
public EntityGreenVillager(World worldIn, int professionId) { super(worldIn); this.villagerInventory = new InventoryBasic("Items", false, 8); this.setProfession(professionId); this.setSize(0.6F, 1.8F); ((PathNavigateGround)this.getNavigator()).setBreakDoors(true); ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityZombie.class, 8.0F, 0.6D, 0.6D)); this.tasks.addTask(1, new EntityAITradeGreen(this)); this.tasks.addTask(1, new EntityAILookAtTradeGreen(this)); this.tasks.addTask(2, new EntityAIMoveIndoors(this)); this.tasks.addTask(3, new EntityAIRestrictOpenDoor(this)); this.tasks.addTask(4, new EntityAIOpenDoor(this, true)); this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 0.6D)); this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F)); this.tasks.addTask(9, new EntityAIWander(this, 0.6D)); this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F)); this.setCanPickUpLoot(true); }
public EntityRana(World par1World, int par2) { super(par1World); randomTickDivider = 0; isPlayingFlag = false; villageObj = null; setProfession(par2); dead = false; ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true); tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityZombie.class, 8.0F, 0.6D, 0.6D)); this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntitySkeleton.class, 8.0F, 0.6D, 0.6D)); this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntitySpider.class, 8.0F, 0.6D, 0.6D)); this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityTNTPrimed.class, 8.0F, 0.6D, 0.6D)); this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityCreeper.class, 8.0F, 0.6D, 0.6D)); tasks.addTask(5, new EntityAIMoveIndoors(this)); tasks.addTask(6, new EntityAIRestrictOpenDoor(this)); tasks.addTask(7, new EntityAIOpenDoor(this, true)); tasks.addTask(8, new EntityAIMoveTowardsRestriction(this, 0.3F)); tasks.addTask(9, new EntityAIWatchClosest2(this, net.minecraft.entity.player.EntityPlayer.class, 3F, 1.0F)); tasks.addTask(10, new EntityAIWatchClosest2(this, net.minecraft.entity.passive.EntityVillager.class, 5F, 0.02F)); tasks.addTask(11, new EntityAIWatchClosest2(this, com.stormister.rediscovered.EntityRana.class, 5F, 0.02F)); tasks.addTask(12, new EntityAIWatchClosest2(this, com.stormister.rediscovered.EntitySteve.class, 5F, 0.02F)); tasks.addTask(13, new EntityAIWander(this, 0.3F)); tasks.addTask(14, new EntityAIWatchClosest(this, net.minecraft.entity.EntityLiving.class, 8F)); }
public EntityPigman(World worldIn, int professionId) { super(worldIn); this.villagerInventory = new InventoryBasic("Items", false, 8); this.setProfession(professionId); this.setSize(0.6F, 1.8F); ((PathNavigateGround)this.getNavigator()).setBreakDoors(true); ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityZombie.class, 8.0F, 0.6D, 0.6D)); this.tasks.addTask(1, new EntityAITradePigman(this)); this.tasks.addTask(1, new EntityAILookAtTradePigman(this)); this.tasks.addTask(2, new EntityAIMoveIndoors(this)); this.tasks.addTask(3, new EntityAIRestrictOpenDoor(this)); this.tasks.addTask(4, new EntityAIOpenDoor(this, true)); this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 0.6D)); this.tasks.addTask(6, new EntityAIPigmanMate(this)); this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F)); this.tasks.addTask(9, new EntityAIWander(this, 0.6D)); this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F)); this.setCanPickUpLoot(true); }
public EntityMagician(World world) { super(world); this.setSize(0.6F, 1.8F); this.getNavigator().setBreakDoors(true); this.getNavigator().setAvoidsWater(true); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityZombie.class, 8.0F, 0.6D, 0.6D)); this.tasks.addTask(1, new EntityAITradePlayer(this)); this.tasks.addTask(1, new EntityAILookAtTradePlayer(this)); this.tasks.addTask(2, new EntityAIMoveIndoors(this)); this.tasks.addTask(3, new EntityAIRestrictOpenDoor(this)); this.tasks.addTask(4, new EntityAIOpenDoor(this, true)); this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 0.6D)); this.tasks.addTask(6, new EntityAIVillagerMate(this)); this.tasks.addTask(7, new EntityAIFollowGolem(this)); this.tasks.addTask(8, new EntityAIPlay(this, 0.32D)); this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F)); this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityVillager.class, 5.0F, 0.02F)); this.tasks.addTask(9, new EntityAIWander(this, 0.6D)); this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F)); }
@SuppressWarnings({"unchecked","rawtypes"}) @Override public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType,int i,int j,int k){ if (par1EnumCreatureType == EnumCreatureType.monster) { List monsters=new ArrayList(); monsters.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 8, 2, 3)); monsters.add(new BiomeGenBase.SpawnListEntry(EntitySpider.class, 8, 2, 3)); monsters.add(new BiomeGenBase.SpawnListEntry(EntitySkeleton.class, 8, 2, 3)); monsters.add(new BiomeGenBase.SpawnListEntry(EntityCreeper.class, 8, 2, 3)); monsters.add(new BiomeGenBase.SpawnListEntry(EntityEnderman.class, 8, 1, 3)); monsters.add(new BiomeGenBase.SpawnListEntry(EntityPixelOneSwingman.class, 1, 1, 1)); return monsters; } if (par1EnumCreatureType == EnumCreatureType.creature) { List creatures=new ArrayList(); creatures.add(new BiomeGenBase.SpawnListEntry(EntityhumanPixel.class, 8, 2, 3)); creatures.add(new BiomeGenBase.SpawnListEntry(EntitypixelPig.class, 8, 1, 3)); creatures.add(new BiomeGenBase.SpawnListEntry(EntitypixelCow.class, 8, 1, 3)); return creatures; } return null; }
public BiomeGenDestroZone(int par1) { super(par1); this.topBlock = Blocks.sand; this.fillerBlock = Blocks.sand; this.waterColorMultiplier = 0x333333; this.theBiomeDecorator.treesPerChunk = -999; this.theBiomeDecorator.deadBushPerChunk = 2; this.theBiomeDecorator.reedsPerChunk = 50; this.theBiomeDecorator.cactiPerChunk = 10; this.spawnableMonsterList.clear(); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityDestroZertum.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySpider.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySkeleton.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySlime.class, 100, 4, 4)); }
public BiomeGenBioZone(int id) { super(id); this.theBiomeDecorator.generateLakes = true; this.theBiomeDecorator.treesPerChunk = 4; this.spawnableMonsterList.clear(); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySpider.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySkeleton.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityCreeper.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySlime.class, 100, 4, 4)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityZertum.class, 100, 4, 4)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 5, 1, 5)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityChicken.class, 5, 1, 5)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityCow.class, 5, 1, 5)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityPig.class, 5, 1, 5)); }