net.minecraft.entity.passive.EntityChicken Java Examples

The following examples show how to use net.minecraft.entity.passive.EntityChicken. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CustomSpawner.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
public final int despawnVanillaAnimals(WorldServer worldObj)
{
    int count = 0;
    for (int j = 0; j < worldObj.loadedEntityList.size(); j++)
    {
        Entity entity = (Entity) worldObj.loadedEntityList.get(j);
        if (!(entity instanceof EntityLiving))
        {
            continue;
        }
        if ((entity instanceof EntityCow || entity instanceof EntitySheep || entity instanceof EntityPig || entity instanceof EntityOcelot || entity instanceof EntityChicken || entity instanceof EntitySquid || entity instanceof EntityWolf))
        {
            count += entityDespawnCheck(worldObj, (EntityLiving) entity);

        }
    }
    return count;
}
 
Example #2
Source File: MoCreatures.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
public static void ClearVanillaSpawnLists()
{
    for (int i = 0; i < BiomeGenBase.biomeList.length; i++)
    {
        if (BiomeGenBase.biomeList[i] != null)
        {
            EntityRegistry.removeSpawn(EntityCow.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityPig.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntitySheep.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityChicken.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityWolf.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntitySquid.class, EnumCreatureType.waterCreature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityOcelot.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityBat.class, EnumCreatureType.ambient, BiomeGenBase.biomeList[i]);
        }
    }
}
 
Example #3
Source File: ServerEventHandler.java    From Et-Futurum with The Unlicense 6 votes vote down vote up
@SubscribeEvent
public void interactEntityEvent(EntityInteractEvent event) {
	ItemStack stack = event.entityPlayer.getCurrentEquippedItem();
	if (stack == null)
		return;
	if (!(event.target instanceof EntityAnimal))
		return;

	EntityAnimal animal = (EntityAnimal) event.target;
	if (!animal.isChild()) {
		if (animal instanceof EntityPig) {
			if (stack.getItem() == ModItems.beetroot && EtFuturum.enableBeetroot)
				setAnimalInLove(animal, event.entityPlayer, stack);
		} else if (animal instanceof EntityChicken)
			if (stack.getItem() == ModItems.beetroot_seeds && EtFuturum.enableBeetroot)
				setAnimalInLove(animal, event.entityPlayer, stack);
	} else if (EtFuturum.enableBabyGrowthBoost && isFoodItem(animal, stack))
		feedBaby(animal, event.entityPlayer, stack);
}
 
Example #4
Source File: ServerEventHandler.java    From Et-Futurum with The Unlicense 6 votes vote down vote up
@SubscribeEvent
public void spawnEvent(EntityJoinWorldEvent event) {
	if (event.entity instanceof EntityPig) {
		EntityPig pig = (EntityPig) event.entity;
		if (EtFuturum.enableBeetroot)
			pig.tasks.addTask(4, new EntityAITempt(pig, 1.2, ModItems.beetroot, false));
	} else if (event.entity instanceof EntityChicken) {
		EntityChicken chicken = (EntityChicken) event.entity;
		if (EtFuturum.enableBeetroot)
			chicken.tasks.addTask(3, new EntityAITempt(chicken, 1.0D, ModItems.beetroot_seeds, false));
	} else if (event.entity instanceof EntityWolf) {
		EntityWolf wolf = (EntityWolf) event.entity;
		if (EtFuturum.enableRabbit)
			wolf.targetTasks.addTask(4, new EntityAITargetNonTamed(wolf, EntityRabbit.class, 200, false));
	} else if (event.entity instanceof EntityVillager) {
		EntityVillager villager = (EntityVillager) event.entity;
		for (Object obj : villager.tasks.taskEntries) {
			EntityAITaskEntry entry = (EntityAITaskEntry) obj;
			if (entry.action instanceof EntityAIOpenDoor) {
				villager.tasks.removeTask(entry.action);
				villager.tasks.addTask(entry.priority, new EntityAIOpenCustomDoor(villager, true));
				break;
			}
		}
	}
}
 
Example #5
Source File: CivilizationHandlers.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
private boolean isAnimal(EntityLivingBase victim) {
	return victim instanceof EntityCow ||
			victim instanceof EntityHorse ||
			victim instanceof EntityPig ||
			victim instanceof EntityDonkey ||
			victim instanceof EntityChicken ||
			victim instanceof EntitySheep;
}
 
Example #6
Source File: CustomSpawner.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
public CustomSpawner()
{
    biomeList = new ArrayList<BiomeGenBase>();
    log.setParent(FMLLog.getLogger());
    try
    {
        for (BiomeGenBase biomegenbase : BiomeGenBase.biomeList)
        {
            if (biomegenbase == null)
            {
                continue;
            }
            biomeList.add(biomegenbase);
        }

        customCreatureSpawnList = new List[biomeList.size()];
        customMobSpawnList = new List[biomeList.size()];
        customAmbientSpawnList = new List[biomeList.size()];
        customAquaticSpawnList = new List[biomeList.size()];
        entityClasses = new List[4];
        vanillaClassList = new ArrayList<Class>();
        vanillaClassList.add(EntityChicken.class);
        vanillaClassList.add(EntityCow.class);
        vanillaClassList.add(EntityPig.class);
        vanillaClassList.add(EntitySheep.class);
        vanillaClassList.add(EntityWolf.class);
        vanillaClassList.add(EntitySquid.class);
        vanillaClassList.add(EntityOcelot.class);
        vanillaClassList.add(EntityBat.class);
        clearLists();
    }
    catch (Exception ex)
    {
        throw new RuntimeException(ex);
    }
}
 
Example #7
Source File: MoCTools.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
public static int despawnVanillaAnimals(World worldObj, List[] classList)
{
    int count = 0;
    for (int j = 0; j < worldObj.loadedEntityList.size(); j++)
    {
        Entity entity = (Entity) worldObj.loadedEntityList.get(j);
        if ((entity instanceof EntityLiving) && (entity instanceof EntityCow || entity instanceof EntitySheep || entity instanceof EntityPig || entity instanceof EntityChicken || entity instanceof EntitySquid || entity instanceof EntityWolf))
        {
            count += entityDespawnCheck(worldObj, (EntityLiving) entity);

        }
    }
    return count;
}
 
Example #8
Source File: ServerEventHandler.java    From Et-Futurum with The Unlicense 5 votes vote down vote up
private boolean isFoodItem(EntityAnimal animal, ItemStack food) {
	if (animal.isBreedingItem(food))
		return true;
	else if (animal instanceof EntityPig && food.getItem() == ModItems.beetroot && EtFuturum.enableBeetroot)
		return true;
	else if (animal instanceof EntityChicken && food.getItem() == ModItems.beetroot_seeds && EtFuturum.enableBeetroot)
		return true;
	else
		return false;
}
 
Example #9
Source File: BiomeCragCliffs.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
public BiomeCragCliffs() {
	super(properties);
	blueRock = getBlock("blue_rock").getDefaultState();
	topBlock = blueRock;
	fillerBlock = Blocks.STONE.getDefaultState();
	decorator.treesPerChunk = -999;
	decorator.extraTreeChance = -999;
	decorator.flowersPerChunk = -999;
	decorator.grassPerChunk = 2;
	decorator.generateFalls = false;

	spawnableCreatureList.clear();
	spawnableCreatureList.add(new SpawnListEntry(EntityChicken.class, 2, 1, 2));
}
 
Example #10
Source File: BiomeMiniJungle.java    From Traverse-Legacy-1-12-2 with MIT License 5 votes vote down vote up
public BiomeMiniJungle() {
    super(properties);
    decorator.treesPerChunk = 30;
    decorator.flowersPerChunk = 5;
    decorator.grassPerChunk = 25;
    decorator.reedsPerChunk = 2;
    decorator.clayPerChunk = 3;
    decorator.waterlilyPerChunk = 12;

    this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityOcelot.class, 1, 1, 1));
    this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityChicken.class, 4, 4, 4));
    this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityParrot.class, 40, 1, 2));

}
 
Example #11
Source File: BiomeCragCliffs.java    From Traverse-Legacy-1-12-2 with MIT License 5 votes vote down vote up
public BiomeCragCliffs() {
	super(properties);
	blueRock = getBlock("blue_rock").getDefaultState();
	topBlock = blueRock;
	fillerBlock = Blocks.STONE.getDefaultState();
	decorator.treesPerChunk = -999;
	decorator.extraTreeChance = -999;
	decorator.flowersPerChunk = -999;
	decorator.grassPerChunk = 2;
	decorator.generateFalls = false;

	spawnableCreatureList.clear();
	spawnableCreatureList.add(new SpawnListEntry(EntityChicken.class, 2, 1, 2));
}
 
Example #12
Source File: WillsAssortedThingsEventHandler.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
@SubscribeEvent
public static void onPlayerRightClick(PlayerInteractEvent.EntityInteract event) {
    EntityPlayer player = event.getEntityPlayer();
    if (event.getEntityPlayer().getHeldItemMainhand().getItem() == Items.ARROW) {
        if (event.getTarget() instanceof EntityChicken) {
            event.getWorld().playSound(player.posX, player.posY, player.posZ, SoundEvents.ENTITY_CHICKEN_HURT, SoundCategory.VOICE, 2.0f, 1.3f, false);
            player.getHeldItemMainhand().setCount(player.getHeldItemMainhand().getCount()-1);
            player.inventory.addItemStackToInventory(new ItemStack(ModItems.CHICKEN_ARROW));
        }
    }
}
 
Example #13
Source File: EntityChickenArrow.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void onHit(RayTraceResult raytraceResultIn) {
    if (this.world.isRemote)
        return;
    this.setDead();
    EntityChicken chicken = new EntityChicken(world);
    Vec3d hit = raytraceResultIn.hitVec;
    chicken.setPosition(hit.x, hit.y, hit.z);
    world.spawnEntity(chicken);
    world.spawnEntity(new EntityItem(world, hit.x, hit.y, hit.z, new ItemStack(Items.EGG)));
}
 
Example #14
Source File: BiomeMiniJungle.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
public BiomeMiniJungle() {
    super(properties);
    decorator.treesPerChunk = 30;
    decorator.flowersPerChunk = 5;
    decorator.grassPerChunk = 25;
    decorator.reedsPerChunk = 2;
    decorator.clayPerChunk = 3;
    decorator.waterlilyPerChunk = 12;

    this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityOcelot.class, 1, 1, 1));
    this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityChicken.class, 4, 4, 4));
    this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityParrot.class, 40, 1, 2));

}
 
Example #15
Source File: CraftChicken.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
public CraftChicken(CraftServer server, EntityChicken entity) {
    super(server, entity);
}
 
Example #16
Source File: CraftChicken.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityChicken getHandle() {
    return (EntityChicken) entity;
}
 
Example #17
Source File: CraftChicken.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityChicken getHandle() {
    return (EntityChicken) entity;
}
 
Example #18
Source File: CraftChicken.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public CraftChicken(CraftServer server, EntityChicken entity) {
    super(server, entity);
}
 
Example #19
Source File: EntityExplodingChicken.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static void registerFixesChicken(DataFixer fixer)
{
    EntityLiving.registerFixesMob(fixer, EntityChicken.class);
}
 
Example #20
Source File: EntityExplodingChicken.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
public EntityChicken createChild(EntityAgeable ageable)
{
    return new EntityChicken(this.world);
}