Search in sources :

Example 1 with EntityCow

use of net.minecraft.entity.passive.EntityCow in project Bewitchment by Um-Mitternacht.

the class MycologicalCorruptionBrew method apply.

// Todo: Put Animania compat here, Animania replaces vanilla cows and mooshrooms
@Override
public void apply(World world, BlockPos pos, EntityLivingBase entity, int amplifier, int tick) {
    if (entity instanceof EntityCow & !(entity instanceof EntityMooshroom)) {
        EntityMooshroom mooshroom = new EntityMooshroom(world);
        mooshroom.setPosition(pos.getX(), pos.getY(), pos.getZ());
        entity.setDead();
        world.spawnEntity(mooshroom);
    }
}
Also used : EntityMooshroom(net.minecraft.entity.passive.EntityMooshroom) EntityCow(net.minecraft.entity.passive.EntityCow)

Example 2 with EntityCow

use of net.minecraft.entity.passive.EntityCow in project ForestryMC by ForestryMC.

the class AlleleEffectFungification method doEntityEffect.

private void doEntityEffect(IBeeGenome genome, IBeeHousing housing) {
    AxisAlignedBB aabb = this.getBounding(genome, housing, 1f);
    World world = housing.getWorld();
    List entities = world.getEntitiesWithinAABB(EntityCow.class, aabb);
    for (Object entity : entities) {
        if (entity instanceof EntityCow && !(entity instanceof EntityMooshroom)) {
            convertCowToMooshroom((EntityCow) entity);
            break;
        }
    }
}
Also used : AxisAlignedBB(net.minecraft.util.AxisAlignedBB) EntityMooshroom(net.minecraft.entity.passive.EntityMooshroom) EntityCow(net.minecraft.entity.passive.EntityCow) List(java.util.List) World(net.minecraft.world.World)

Example 3 with EntityCow

use of net.minecraft.entity.passive.EntityCow in project Bewitchment by Um-Mitternacht.

the class GrassGrowBrew method apply.

// Todo: Put Animania compat here, Animania replaces vanilla cows and mooshrooms
@Override
public void apply(World world, BlockPos pos, EntityLivingBase entity, int amplifier, int tick) {
    if (entity instanceof EntityMooshroom) {
        EntityCow cow = new EntityCow(world);
        cow.setPosition(pos.getX(), pos.getY(), pos.getZ());
        entity.setDead();
        world.spawnEntity(cow);
    }
}
Also used : EntityMooshroom(net.minecraft.entity.passive.EntityMooshroom) EntityCow(net.minecraft.entity.passive.EntityCow)

Example 4 with EntityCow

use of net.minecraft.entity.passive.EntityCow in project Almura by AlmuraDev.

the class MixinEntityAnimal method isCustomBreedingItem.

private boolean isCustomBreedingItem(ItemStack stack) {
    final String itemName = stack.getTranslationKey();
    // System.out.println("Breed Item: " + itemName);
    final Entity animal = this;
    if (animal instanceof EntityCow) {
        switch(itemName.toUpperCase()) {
            case "ITEM.ALMURA.FOOD.FOOD.CORN":
            case "ITEM.ALMURA.FOOD.FOOD.SOYBEAN":
            case "ITEM.ALMURA.NORMAL.CROP.ALFALFA_ITEM":
            case "ITEM.WHEAT":
                return true;
            default:
                return false;
        }
    }
    if (animal instanceof EntityPig) {
        switch(itemName.toUpperCase()) {
            case "ITEM.ALMURA.FOOD.FOOD.CORN":
            case "ITEM.ALMURA.FOOD.FOOD.SOYBEAN":
            case "ITEM.CARROTS":
                return true;
            default:
                return false;
        }
    }
    if (animal instanceof EntitySheep) {
        switch(itemName.toUpperCase()) {
            case "ITEM.ALMURA.FOOD.FOOD.CORN":
            case "ITEM.ALMURA.FOOD.FOOD.SOYBEAN":
            case "ITEM.WHEAT":
                return true;
            default:
                return false;
        }
    }
    if (animal instanceof EntityChicken) {
        switch(itemName.toUpperCase()) {
            case "ITEM.ALMURA.FOOD.FOOD.CORN":
            case "ITEM.ALMURA.FOOD.FOOD.SOYBEAN":
            case "ITEM.SEEDS":
            case "ITEM.SEEDS_MELON":
            case "ITEM.BEETROOT_SEEDS":
            case "ITEM.SEEDS_PUMPKIN":
                return true;
            default:
                return false;
        }
    }
    if (animal instanceof EntityOcelot) {
        switch(itemName.toUpperCase()) {
            case "ITEM.FISH":
                return true;
            default:
                return false;
        }
    }
    if (animal instanceof EntityWolf) {
        return stack.getItem() instanceof ItemFood && ((ItemFood) stack.getItem()).isWolfsFavoriteMeat();
    }
    if (animal instanceof EntityRabbit) {
        return this.isRabbitBreedingItem(stack.getItem());
    }
    return false;
}
Also used : Entity(net.minecraft.entity.Entity) ItemFood(net.minecraft.item.ItemFood) EntityChicken(net.minecraft.entity.passive.EntityChicken) EntityCow(net.minecraft.entity.passive.EntityCow) EntityPig(net.minecraft.entity.passive.EntityPig) EntityRabbit(net.minecraft.entity.passive.EntityRabbit) EntitySheep(net.minecraft.entity.passive.EntitySheep) EntityOcelot(net.minecraft.entity.passive.EntityOcelot) EntityWolf(net.minecraft.entity.passive.EntityWolf)

Example 5 with EntityCow

use of net.minecraft.entity.passive.EntityCow in project minecolonies by Minecolonies.

the class EntityAIWorkCowboy method milkCows.

/**
 * Makes the Cowboy "Milk" the cows (Honestly all he does is swap an empty
 * bucket for a milk bucket, there's no actual "Milk" method in {@link EntityCow}
 *
 * @return The next {@link AIState}
 */
private AIState milkCows() {
    worker.setLatestStatus(new TextComponentTranslation(TranslationConstants.COM_MINECOLONIES_COREMOD_STATUS_COWBOY_MILKING));
    if (!worker.hasItemInInventory(getBreedingItem().getItem(), 0) && isInHut(new ItemStack(Items.BUCKET, 1))) {
        if (!walkToBuilding() && getOwnBuilding() != null) {
            isInTileEntity(getOwnBuilding().getTileEntity(), new ItemStack(Items.BUCKET, 1));
        } else {
            return HERDER_DECIDE;
        }
    }
    final EntityCow cow = searchForAnimals().stream().findFirst().orElse(null);
    if (cow == null) {
        return HERDER_DECIDE;
    }
    if (!walkingToAnimal(cow) && equipItem(new ItemStack(Items.BUCKET, 1))) {
        if (!worker.getInventoryCitizen().addItemStackToInventory(new ItemStack(Items.MILK_BUCKET))) {
            worker.removeHeldItem();
            equipItem(new ItemStack(Items.MILK_BUCKET));
            InventoryUtils.removeStackFromItemHandler(new InvWrapper(worker.getInventoryCitizen()), new ItemStack(Items.BUCKET, 1));
        }
        incrementActionsDoneAndDecSaturation();
        worker.addExperience(1.0);
    }
    return HERDER_DECIDE;
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) EntityCow(net.minecraft.entity.passive.EntityCow) InvWrapper(net.minecraftforge.items.wrapper.InvWrapper) ItemStack(net.minecraft.item.ItemStack)

Aggregations

EntityCow (net.minecraft.entity.passive.EntityCow)5 EntityMooshroom (net.minecraft.entity.passive.EntityMooshroom)3 List (java.util.List)1 Entity (net.minecraft.entity.Entity)1 EntityChicken (net.minecraft.entity.passive.EntityChicken)1 EntityOcelot (net.minecraft.entity.passive.EntityOcelot)1 EntityPig (net.minecraft.entity.passive.EntityPig)1 EntityRabbit (net.minecraft.entity.passive.EntityRabbit)1 EntitySheep (net.minecraft.entity.passive.EntitySheep)1 EntityWolf (net.minecraft.entity.passive.EntityWolf)1 ItemFood (net.minecraft.item.ItemFood)1 ItemStack (net.minecraft.item.ItemStack)1 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)1 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)1 World (net.minecraft.world.World)1 InvWrapper (net.minecraftforge.items.wrapper.InvWrapper)1