Search in sources :

Example 1 with EntityRabbit

use of net.minecraft.entity.passive.EntityRabbit in project SilentGems by SilentChaos512.

the class GemsCommonEvents method onLivingUpdate.

@SubscribeEvent
public void onLivingUpdate(LivingUpdateEvent event) {
    if (!event.getEntity().world.isRemote && event.getEntityLiving() instanceof EntityRabbit) {
        EntityRabbit rabbit = (EntityRabbit) event.getEntityLiving();
        ModuleCoffee.tickRabbit(rabbit);
    }
}
Also used : EntityRabbit(net.minecraft.entity.passive.EntityRabbit) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 2 with EntityRabbit

use of net.minecraft.entity.passive.EntityRabbit 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 3 with EntityRabbit

use of net.minecraft.entity.passive.EntityRabbit in project Minestuck by mraof.

the class RabbitSpawner method generate.

@Override
public BlockPos generate(World world, Random random, BlockPos pos, ChunkProviderLands provider) {
    pos = world.getTopSolidOrLiquidBlock(pos);
    if (!world.getBlockState(pos).getMaterial().isLiquid() && !provider.isPositionInSpawn(pos.getX(), pos.getZ())) {
        EntityRabbit entity = new EntityRabbit(world);
        entity.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
        entity.onInitialSpawn(null, null);
        world.spawnEntity(entity);
    }
    return null;
}
Also used : EntityRabbit(net.minecraft.entity.passive.EntityRabbit)

Aggregations

EntityRabbit (net.minecraft.entity.passive.EntityRabbit)3 Entity (net.minecraft.entity.Entity)1 EntityChicken (net.minecraft.entity.passive.EntityChicken)1 EntityCow (net.minecraft.entity.passive.EntityCow)1 EntityOcelot (net.minecraft.entity.passive.EntityOcelot)1 EntityPig (net.minecraft.entity.passive.EntityPig)1 EntitySheep (net.minecraft.entity.passive.EntitySheep)1 EntityWolf (net.minecraft.entity.passive.EntityWolf)1 ItemFood (net.minecraft.item.ItemFood)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1