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;
}
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;
}
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);
}
}
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;
}
}
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;
}
Aggregations