Java Code Examples for net.minecraft.entity.monster.EntityZombie

The following are top voted examples for showing how to use net.minecraft.entity.monster.EntityZombie. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Bewitchment   File: FortuneMeetZombie.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 2
Project: DecompiledMinecraft   File: EntityVillager.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 3
Project: DecompiledMinecraft   File: EntityVillager.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 4
Project: BaseClient   File: EntityVillager.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 5
Project: BaseClient   File: EntityVillager.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 6
Project: Halloween   File: EntityZombieHands.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 7
Project: Halloween   File: EntityZombieHands.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 8
Project: Backmemed   File: EntityVillager.java   Source Code and License 6 votes vote down vote up
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));
}
 
Example 9
Project: Backmemed   File: ModelZombieVillager.java   Source Code and License 6 votes vote down vote up
/**
 * 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;
}
 
Example 10
Project: Backmemed   File: ModelZombie.java   Source Code and License 6 votes vote down vote up
/**
 * 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;
}
 
Example 11
Project: CustomWorldGen   File: VillagerRegistry.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 12
Project: CustomWorldGen   File: VillagerRegistry.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 13
Project: CustomWorldGen   File: EntityVillager.java   Source Code and License 6 votes vote down vote up
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));
}
 
Example 14
Project: CustomWorldGen   File: ModelZombieVillager.java   Source Code and License 6 votes vote down vote up
/**
 * 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;
}
 
Example 15
Project: CustomWorldGen   File: ModelZombie.java   Source Code and License 6 votes vote down vote up
/**
 * 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;
}
 
Example 16
Project: Possessed   File: ZombieHandler.java   Source Code and License 6 votes vote down vote up
@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);
        }
    }
}
 
Example 17
Project: MidgarCrusade   File: BiomRoofedForest.java   Source Code and License 6 votes vote down vote up
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;
  }
 
Example 18
Project: MidgarCrusade   File: BiomMagicForest.java   Source Code and License 6 votes vote down vote up
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;
  }
 
Example 19
Project: MineLittlePony   File: MineLittlePony.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 20
Project: Rival-Rebels-Mod   File: EntityB2Spirit.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 21
Project: ToroQuest   File: ModelMage.java   Source Code and License 6 votes vote down vote up
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;
	}

}
 
Example 22
Project: Gravestone-mod-Extended   File: GSEventsHandler.java   Source Code and License 6 votes vote down vote up
@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()));
        }
    }
}
 
Example 23
Project: Mob-Amputation   File: EventHandlerClient.java   Source Code and License 6 votes vote down vote up
@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);
            }
        }
    }
}
 
Example 24
Project: Coding   File: EntityBaron.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 25
Project: Coding   File: EntitySpearGuard.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 26
Project: Coding   File: EntityLongbowGuard.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 27
Project: Coding   File: EntityCrossbowGuard.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 28
Project: ThaumicThings   File: CommonProxy.java   Source Code and License 6 votes vote down vote up
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();
    }
}
 
Example 29
Project: Skree   File: ShnugglesPrimeInstance.java   Source Code and License 6 votes vote down vote up
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);
        }
      }
    }
  }
}
 
Example 30
Project: Skree   File: PatientXListener.java   Source Code and License 6 votes vote down vote up
@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());
    }
  }
}
 
Example 31
Project: It-s-About-Time-Minecraft-Mod   File: EntityCoelophysis.java   Source Code and License 6 votes vote down vote up
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));


  }
 
Example 32
Project: Resilience-Client-Source   File: EntityVillager.java   Source Code and License 6 votes vote down vote up
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));
}
 
Example 33
Project: Resilience-Client-Source   File: RenderZombie.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 34
Project: Rediscovered-Mod-1.8.8   File: EntityGreenVillager.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 35
Project: Rediscovered-Mod-1.8.8   File: EntityRana.java   Source Code and License 6 votes vote down vote up
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));
}
 
Example 36
Project: Rediscovered-Mod-1.8.8   File: EntityPigman.java   Source Code and License 6 votes vote down vote up
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);
   }
 
Example 37
Project: Magicians-Artifice   File: EntityMagician.java   Source Code and License 6 votes vote down vote up
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));
}
 
Example 38
Project: GalacticraftPixelGalaxy   File: ChunkProviderGreenPixel.java   Source Code and License 6 votes vote down vote up
@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;
	}
 
Example 39
Project: ZeroQuest   File: BiomeGenDestroZone.java   Source Code and License 6 votes vote down vote up
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));

}
 
Example 40
Project: ZeroQuest   File: BiomeGenBioZone.java   Source Code and License 6 votes vote down vote up
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)); 
}
 
Example 41
Project: Mini-Bosses   File: EntityFeeder.java   Source Code and License 6 votes vote down vote up
@Override
public void onKillEntity(EntityLivingBase entity) {
	super.onKillEntity(entity);
	
	if(entity instanceof EntityCreeper) {
		this.getDataWatcher().updateObject(12, Integer.valueOf(3));
	}
	if(entity instanceof EntitySkeleton) {
		this.getDataWatcher().updateObject(12, Integer.valueOf(2));
	}
	if(entity instanceof EntityZombie) {
		this.getDataWatcher().updateObject(12, Integer.valueOf(1));
	}
	if(entity instanceof IAnimals) {
		this.heal(10.0F);
	}
	this.heal(5.0F);
}
 
Example 42
Project: ZeroQuest   File: BiomeGenNileSwamp.java   Source Code and License 6 votes vote down vote up
public BiomeGenNileSwamp(int p_i1988_1_)
{
    super(p_i1988_1_);
    this.theBiomeDecorator.treesPerChunk = 2;
    this.theBiomeDecorator.flowersPerChunk = 1;
    this.theBiomeDecorator.deadBushPerChunk = 1;
    this.theBiomeDecorator.mushroomsPerChunk = 8;
    this.theBiomeDecorator.reedsPerChunk = 10;
    this.theBiomeDecorator.clayPerChunk = 1;
    this.theBiomeDecorator.waterlilyPerChunk = 4;
    this.theBiomeDecorator.sandPerChunk2 = 0;
    this.theBiomeDecorator.sandPerChunk = 0;
    this.theBiomeDecorator.grassPerChunk = 5;
    this.waterColorMultiplier = 14745518;
    this.spawnableMonsterList.clear();
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityZertum.class, 100, 3, 4));
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityForisZertum.class, 20, 3, 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));
    this.flowers.clear();
    this.addFlower(Blocks.red_flower, 1, 10);
    this.addFlower(ModBlocks.nilePinkFlower, 1, 20);
}
 
Example 43
Project: RuneCraftery   File: EntityVillager.java   Source Code and License 6 votes vote down vote up
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));
}
 
Example 44
Project: ZeroQuest   File: BiomeGenBlueTaiga.java   Source Code and License 6 votes vote down vote up
public BiomeGenBlueTaiga(int p_i45385_1_, int p_i45385_2_)
{
    super(p_i45385_1_);
    this.field_150644_aH = p_i45385_2_;
    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(EntitySlime.class, 100, 4, 4));
    this.theBiomeDecorator.treesPerChunk = 10;

    if (p_i45385_2_ != 1 && p_i45385_2_ != 2)
    {
        this.theBiomeDecorator.grassPerChunk = 1;
        this.theBiomeDecorator.mushroomsPerChunk = 1;
    }
    else
    {
        this.theBiomeDecorator.grassPerChunk = 7;
        this.theBiomeDecorator.deadBushPerChunk = 1;
        this.theBiomeDecorator.mushroomsPerChunk = 3;
    }
}
 
Example 45
Project: Rediscovered-Mod-1.7.10   File: EntityGreenVillager.java   Source Code and License 6 votes vote down vote up
public EntityGreenVillager(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 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 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));
}
 
Example 46
Project: ZeroQuest   File: BiomeGenBioZone.java   Source Code and License 6 votes vote down vote up
public BiomeGenBioZone(int id) {
    super(id);
    this.theBiomeDecorator.generateLakes = true;
    this.theBiomeDecorator.treesPerChunk = 4;
    this.spawnableMonsterList.clear();
    this.addFlower(ModBlocks.nileBlueFlower.getDefaultState(), 90);
    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(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)); 
}
 
Example 47
Project: ZeroQuest   File: BiomeGenDarkLand.java   Source Code and License 6 votes vote down vote up
public BiomeGenDarkLand(int id) {
    super(id);
   	this.waterColorMultiplier = 0x666600;
   	this.theBiomeDecorator.treesPerChunk = 1;
   	this.theBiomeDecorator.grassPerChunk = 1;
   	this.theBiomeDecorator.flowersPerChunk = -999;
   	this.addFlower(ModBlocks.nileBlackFlower.getDefaultState(), 100);
    this.theBiomeDecorator.generateLakes = true;
    this.spawnableMonsterList.clear();
    this.spawnableCreatureList.clear();
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 60, 1, 5));
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityMagmaCube.class, 1, 4, 4));
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityPigZombie.class, 20, 2, 3));
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityGhast.class, 20, 1, 2));
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySpider.class, 100, 4, 4));
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 100, 4, 4));
}
 
Example 48
Project: Billund   File: BillundProxyCommon.java   Source Code and License 6 votes vote down vote up
@ForgeSubscribe
public void onEntityLivingDeath( LivingDeathEvent event )
{
	if( event.entity.worldObj.isRemote )
	{
		return;
	}
	
	if( event.entity instanceof EntityZombie )
	{
		EntityLivingBase living = (EntityLivingBase)event.entity;
		if( (living.isChild() && r.nextInt(20) == 0) ||
		    (!living.isChild() && r.nextInt(100) == 0) )
		{
			event.entity.entityDropItem( new ItemStack( Billund.Items.orderForm, 1 ), 0.0f );
		}
	}
}
 
Example 49
Project: Cauldron   File: RenderZombie.java   Source Code and License 6 votes vote down vote up
private void func_82427_a(EntityZombie p_82427_1_)
{
    if (p_82427_1_.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;
}
 
Example 50
Project: ExpandedRailsMod   File: ModelZombieVillager.java   Source Code and License 6 votes vote down vote up
/**
 * 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;
}
 
Example 51
Project: ExpandedRailsMod   File: ModelZombie.java   Source Code and License 6 votes vote down vote up
/**
 * 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;
}
 
Example 52
Project: AbyssalCraft   File: EntitySkeletonGoliath.java   Source Code and License 6 votes vote down vote up
public EntitySkeletonGoliath(World par1World) {
	super(par1World);
	setSize(1.0F, 4.5F);
	tasks.addTask(2, new EntityAIAttackMelee(this, 1.0D, true));
	tasks.addTask(3, new EntityAIMoveTowardsRestriction(this, 1.0D));
	tasks.addTask(4, new EntityAIWander(this, 1.0D));
	tasks.addTask(5, new EntityAIFleeSun(this, 1.0D));
	tasks.addTask(7, new EntityAILookIdle(this));
	tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
	tasks.addTask(7, new EntityAIWatchClosest(this, EntityAbyssalZombie.class, 8.0F));
	tasks.addTask(7, new EntityAIWatchClosest(this, EntityZombie.class, 8.0F));
	tasks.addTask(7, new EntityAIWatchClosest(this, EntityDepthsGhoul.class, 8.0F));
	tasks.addTask(7, new EntityAIWatchClosest(this, EntitySkeleton.class, 8.0F));
	tasks.addTask(7, new EntityAIWatchClosest(this, EntitySkeletonGoliath.class, 8.0F));
	targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
	targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
}
 
Example 53
Project: RuneCraftery   File: EntityVillager.java   Source Code and License 6 votes vote down vote up
public EntityVillager(World p_i1748_1_, int p_i1748_2_) {
   super(p_i1748_1_);
   this.func_70938_b(p_i1748_2_);
   this.func_70105_a(0.6F, 1.8F);
   this.func_70661_as().func_75498_b(true);
   this.func_70661_as().func_75491_a(true);
   this.field_70714_bg.func_75776_a(0, new EntityAISwimming(this));
   this.field_70714_bg.func_75776_a(1, new EntityAIAvoidEntity(this, EntityZombie.class, 8.0F, 0.6D, 0.6D));
   this.field_70714_bg.func_75776_a(1, new EntityAITradePlayer(this));
   this.field_70714_bg.func_75776_a(1, new EntityAILookAtTradePlayer(this));
   this.field_70714_bg.func_75776_a(2, new EntityAIMoveIndoors(this));
   this.field_70714_bg.func_75776_a(3, new EntityAIRestrictOpenDoor(this));
   this.field_70714_bg.func_75776_a(4, new EntityAIOpenDoor(this, true));
   this.field_70714_bg.func_75776_a(5, new EntityAIMoveTowardsRestriction(this, 0.6D));
   this.field_70714_bg.func_75776_a(6, new EntityAIVillagerMate(this));
   this.field_70714_bg.func_75776_a(7, new EntityAIFollowGolem(this));
   this.field_70714_bg.func_75776_a(8, new EntityAIPlay(this, 0.32D));
   this.field_70714_bg.func_75776_a(9, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F));
   this.field_70714_bg.func_75776_a(9, new EntityAIWatchClosest2(this, EntityVillager.class, 5.0F, 0.02F));
   this.field_70714_bg.func_75776_a(9, new EntityAIWander(this, 0.6D));
   this.field_70714_bg.func_75776_a(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F));
}
 
Example 54
Project: AbyssalCraft   File: EntityAntiZombie.java   Source Code and License 6 votes vote down vote up
public EntityAntiZombie(World par1World)
{
	super(par1World);
	((PathNavigateGround)getNavigator()).setBreakDoors(true);
	tasks.addTask(0, new EntityAISwimming(this));
	tasks.addTask(2, new EntityAIAttackMelee(this, 1.0D, false));
	tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D));
	tasks.addTask(6, new EntityAIMoveThroughVillage(this, 1.0D, false));
	tasks.addTask(7, new EntityAIWander(this, 1.0D));
	tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
	tasks.addTask(8, new EntityAILookIdle(this));
	targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
	targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityZombie.class, true));
	targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
	targetTasks.addTask(4, new EntityAINearestAttackableTarget(this, EntityVillager.class, false));
	setSize(0.6F, 1.8F);
}
 
Example 55
Project: Corruption   File: BloodLossCorruption.java   Source Code and License 6 votes vote down vote up
@Override
public void onUpdate(EntityPlayer player, Side side) {
    if (side.isClient() && player.worldObj.getTotalWorldTime() % 2 == 0 && (player.posX != player.prevPosX || player.posY != player.prevPosY || player.posZ != player.prevPosZ)) {
        Corruption.proxy.spawnBloodParticle(player);
    }
    else if (side.isServer() && player.worldObj.getTotalWorldTime() % 10 == 0) {
        player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 20, (int) (3 - (player.getHealth()/ 2))));
        World world = player.worldObj;
        List list = world.getEntitiesWithinAABB(EntityZombie.class, player.boundingBox.expand((7 - player.getHealth()) * 5, 5, (7 - player.getHealth()) * 5));
        if (list != null && !list.isEmpty()) {
            for (Object obj : list) {
                EntityZombie entityZombie = (EntityZombie) obj;
                if (!entityZombie.hasPath()) {
                    entityZombie.setAttackTarget(player);
                }
            }
        }
    }
}
 
Example 56
Project: Rediscovered-Mod-1.6.4   File: EntityPigman.java   Source Code and License 6 votes vote down vote up
public EntityPigman(World par1World, int par2)
{
    super(par1World);
    this.randomTickDivider = 0;
    this.isMating = false;
    this.isPlaying = false;
    this.villageObj = null;
    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.3F, 0.35F));
    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.3F));
    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.3F));
    this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F));
}
 
Example 57
Project: Rediscovered-Mod-1.6.4   File: EntityGreenVillager.java   Source Code and License 6 votes vote down vote up
public EntityGreenVillager(World par1World, int par2)
{
    super(par1World);
    this.randomTickDivider = 0;
    this.isMating = false;
    this.isPlaying = false;
    this.villageObj = null;
    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.3F, 0.35F));
    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.3F));
    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.3F));
    this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F));
}
 
Example 58
Project: Rediscovered-Mod-1.7.10   File: EntityPigman.java   Source Code and License 6 votes vote down vote up
public EntityPigman(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 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(9, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F));
    this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityPigman.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));
}
 
Example 59
Project: RuneCraftery   File: RenderZombie.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 60
Project: Loot-Slash-Conquer   File: DungeonHelper.java   Source Code and License 5 votes vote down vote up
private static ResourceLocation getRandomMonster()
{
	ArrayList<ResourceLocation> entities = new ArrayList<ResourceLocation>();
	
	entities.add(EntityList.getKey(EntityZombie.class));
	entities.add(EntityList.getKey(EntitySpider.class));
	entities.add(EntityList.getKey(EntitySkeleton.class));
	entities.add(EntityList.getKey(EntityEnderman.class));
	entities.add(EntityList.getKey(EntityCreeper.class));
	entities.add(EntityList.getKey(EntityCaveSpider.class));
	
	return entities.get((int) (Math.random() * entities.size()));
}