Search in sources :

Example 6 with EntityWolf

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

the class FortuneMeetDireWolf method apply.

@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);
        EntityWolf wolf = new EntityWolf(player.world);
        if (player.world.isAirBlock(pos) && player.world.isAirBlock(pos.up()) && player.world.getBlockState(pos.down()).canEntitySpawn(wolf)) {
            wolf.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
            wolf.onInitialSpawn(player.world.getDifficultyForLocation(pos), null);
            wolf.setAttackTarget(player);
            player.world.spawnEntity(wolf);
            if (player.getRNG().nextInt(10) < player.world.getDifficulty().ordinal())
                wolf.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 900, 1));
            if (player.getRNG().nextInt(10) < player.world.getDifficulty().ordinal())
                wolf.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 900, 1));
            if (player.getRNG().nextInt(10) < player.world.getDifficulty().ordinal())
                wolf.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 900, 1));
            return true;
        }
    }
    return false;
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect) BlockPos(net.minecraft.util.math.BlockPos) EntityWolf(net.minecraft.entity.passive.EntityWolf)

Example 7 with EntityWolf

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

the class FortuneMeetDog method apply.

@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);
        EntityWolf dog = new EntityWolf(player.world);
        if (player.world.isAirBlock(pos) && player.world.isAirBlock(pos.up()) && player.world.getBlockState(pos.down()).canEntitySpawn(dog)) {
            dog.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
            dog.onInitialSpawn(player.world.getDifficultyForLocation(pos), null);
            dog.setTamedBy(player);
            player.world.spawnEntity(dog);
            return true;
        }
    }
    return false;
}
Also used : BlockPos(net.minecraft.util.math.BlockPos) EntityWolf(net.minecraft.entity.passive.EntityWolf)

Example 8 with EntityWolf

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

the class WolfsbaneBrew method apply.

// Todo: Make this damage werewolves when their codebase is set up
@Override
public void apply(World world, BlockPos pos, EntityLivingBase entity, int amplifier, int tick) {
    if (amplifier >= 3) {
        if (entity instanceof EntityWolf) {
            entity.addPotionEffect(new PotionEffect(MobEffects.WITHER, 1500, 0));
            entity.attackEntityFrom(DamageSource.MAGIC, 20);
        }
    }
    if (amplifier == 2) {
        if (entity instanceof EntityWolf) {
            entity.attackEntityFrom(DamageSource.MAGIC, 16);
        }
    }
    if (entity instanceof EntityWolf) {
        entity.attackEntityFrom(DamageSource.MAGIC, 10);
    }
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect) EntityWolf(net.minecraft.entity.passive.EntityWolf)

Example 9 with EntityWolf

use of net.minecraft.entity.passive.EntityWolf in project MorePlanets by SteveKunG.

the class RongHouse method addComponentParts.

@Override
public boolean addComponentParts(World world, Random rand, StructureBoundingBox structureBoundingBox) {
    if (!this.offsetToAverageGroundLevel(world, structureBoundingBox, -2)) {
        return false;
    } else {
        StructureBoundingBox structureboundingbox = this.getBoundingBox();
        BlockPos blockpos = new BlockPos(structureboundingbox.minX, structureboundingbox.minY, structureboundingbox.minZ);
        Rotation[] arotation = Rotation.values();
        MinecraftServer minecraftserver = world.getMinecraftServer();
        TemplateManager templatemanager = world.getSaveHandler().getStructureTemplateManager();
        Rotation rotation = arotation[rand.nextInt(arotation.length)];
        PlacementSettings placementsettings = new PlacementSettings().setRotation(rotation).setReplacedBlock(Blocks.STRUCTURE_VOID).setBoundingBox(structureboundingbox);
        Template template = templatemanager.getTemplate(minecraftserver, RONG_HOUSE);
        template.addBlocksToWorldChunk(world, blockpos, placementsettings);
        Map<BlockPos, String> map = template.getDataBlocks(blockpos, placementsettings);
        for (Map.Entry<BlockPos, String> entry : map.entrySet()) {
            String dataName = entry.getValue();
            BlockPos blockpos2 = entry.getKey();
            if ("fronos_foliage".equals(dataName)) {
                world.setBlockState(blockpos2, FOLIAGE.get(rand.nextInt(FOLIAGE.size())).getDefaultState(), 3);
            } else if ("rong_with_white_carpet".equals(dataName)) {
                EntityWolf rong = new EntityWolf(world);
                rong.setTamed(true);
                rong.setHealth(20.0F);
                rong.setCustomNameTag("Rong");
                rong.setSitting(true);
                rong.setCollarColor(EnumDyeColor.LIGHT_BLUE);
                rong.setLocationAndAngles(blockpos2.getX() + 0.5D, blockpos2.getY() + 0.25D, blockpos2.getZ() + 0.5D, 0.0F, 0.0F);
                world.spawnEntity(rong);
                world.setBlockState(blockpos2, Blocks.CARPET.getDefaultState(), 3);
            } else if ("rong_painting".equals(dataName)) {
                EntityPainting painting = new EntityPainting(world, blockpos2, this.getPaintingFacing(rotation, blockpos2));
                painting.art = PaintingMP.RONG;
                world.setBlockState(blockpos2, Blocks.AIR.getDefaultState(), 3);
                world.spawnEntity(painting);
            }
        }
        return true;
    }
}
Also used : StructureBoundingBox(net.minecraft.world.gen.structure.StructureBoundingBox) PlacementSettings(net.minecraft.world.gen.structure.template.PlacementSettings) EntityPainting(net.minecraft.entity.item.EntityPainting) Rotation(net.minecraft.util.Rotation) MinecraftServer(net.minecraft.server.MinecraftServer) Template(net.minecraft.world.gen.structure.template.Template) TemplateManager(net.minecraft.world.gen.structure.template.TemplateManager) BlockPos(net.minecraft.util.math.BlockPos) EntityWolf(net.minecraft.entity.passive.EntityWolf) Map(java.util.Map)

Example 10 with EntityWolf

use of net.minecraft.entity.passive.EntityWolf 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)

Aggregations

EntityWolf (net.minecraft.entity.passive.EntityWolf)12 Entity (net.minecraft.entity.Entity)4 EntityLivingBase (net.minecraft.entity.EntityLivingBase)3 BlockPos (net.minecraft.util.math.BlockPos)3 ITeleportHandler (net.dyeo.teleporter.capabilities.ITeleportHandler)2 EntityMob (net.minecraft.entity.monster.EntityMob)2 EntityAnimal (net.minecraft.entity.passive.EntityAnimal)2 EntitySheep (net.minecraft.entity.passive.EntitySheep)2 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)2 PotionEffect (net.minecraft.potion.PotionEffect)2 Field (java.lang.reflect.Field)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 TeleporterNode (net.dyeo.teleporter.teleport.TeleporterNode)1 TileEntityTeleporter (net.dyeo.teleporter.tileentity.TileEntityTeleporter)1 IBlockState (net.minecraft.block.state.IBlockState)1 EntityPainting (net.minecraft.entity.item.EntityPainting)1 EntityChicken (net.minecraft.entity.passive.EntityChicken)1