Search in sources :

Example 1 with EntitySilverfish

use of net.minecraft.entity.monster.EntitySilverfish in project EnderIO by SleepyTrousers.

the class SilverfishAttractorHandler method tick.

@Override
public void tick(TileAttractor attractor, EntityLiving entity) {
    EntitySilverfish sf = (EntitySilverfish) entity;
    Path pathentity = getPathEntityToEntity(entity, attractor.getTarget(), attractor.getRange() * 2);
    sf.getNavigator().setPath(pathentity, sf.getAIMoveSpeed());
}
Also used : Path(net.minecraft.pathfinding.Path) EntitySilverfish(net.minecraft.entity.monster.EntitySilverfish)

Example 2 with EntitySilverfish

use of net.minecraft.entity.monster.EntitySilverfish in project Bewitchment by Um-Mitternacht.

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

Example 3 with EntitySilverfish

use of net.minecraft.entity.monster.EntitySilverfish in project BetterWithAddons by DaedalusGame.

the class AnimalCrossbreedHandler method initialize.

public static void initialize() {
    inLove = ReflectionHelper.findField(EntityAnimal.class, "field_70881_d", "inLove");
    // Standard
    mutationSet.add(new AnimalMutation((world, pos, mother, father) -> spawnBabyAt(world, pos, new EntityCow(world)), 100));
    mutationSet.add(new AnimalMutation((world, pos, mother, father) -> spawnBabyAt(world, pos, new EntitySheep(world)), 100));
    mutationSet.add(new AnimalMutation((world, pos, mother, father) -> spawnBabyAt(world, pos, new EntityPig(world)), 100));
    // Lower chance for egg hatching animal
    mutationSet.add(new AnimalMutation((world, pos, mother, father) -> spawnBabyAt(world, pos, new EntityChicken(world)), 50));
    mutationSet.add(new AnimalMutation((world, pos, mother, father) -> spawnBabyAt(world, pos, new EntityRabbit(world)), 75));
    // Parent species
    mutationSet.add(new AnimalMutation((world, pos, mother, father) -> spawnBabyAt(world, pos, mother.createChild(mother)), 100));
    mutationSet.add(new AnimalMutation((world, pos, mother, father) -> spawnBabyAt(world, pos, father.createChild(father)), 100));
    // Abominations
    mutationSet.add(new AnimalMutation((world, pos, mother, father) -> spawnEntityAt(world, pos, new EntitySilverfish(world)), 200));
    mutationSet.add(new AnimalMutation((world, pos, mother, father) -> spawnEntityAt(world, pos, new EntityCaveSpider(world)), 100));
    mutationSet.add(new AnimalMutation((world, pos, mother, father) -> spawnEntityAt(world, pos, new EntitySlime(world)), 50));
    // Enviroment dependent
    mutationSet.add(new AnimalMutation((world, pos, mother, father) -> spawnEntityAt(world, pos, new EntitySquid(world)), 0).setCustomWeight(AnimalCrossbreedHandler::getSquidWeight));
    mutationSet.add(new AnimalMutation((world, pos, mother, father) -> spawnBabyAt(world, pos, new EntityWolf(world)), 0).setCustomWeight(AnimalCrossbreedHandler::getWolfWeight));
    mutationSet.add(new AnimalMutation((world, pos, mother, father) -> spawnBabyAt(world, pos, new EntityOcelot(world)), 0).setCustomWeight(AnimalCrossbreedHandler::getOcelotWeight));
}
Also used : net.minecraft.entity.passive(net.minecraft.entity.passive) AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) EntitySlime(net.minecraft.entity.monster.EntitySlime) ReflectionHelper(net.minecraftforge.fml.relauncher.ReflectionHelper) EntityAgeable(net.minecraft.entity.EntityAgeable) ArrayList(java.util.ArrayList) PotionEffect(net.minecraft.potion.PotionEffect) EntitySilverfish(net.minecraft.entity.monster.EntitySilverfish) Vec3d(net.minecraft.util.math.Vec3d) BiomeDictionary(net.minecraftforge.common.BiomeDictionary) Entity(net.minecraft.entity.Entity) World(net.minecraft.world.World) BlockPos(net.minecraft.util.math.BlockPos) Field(java.lang.reflect.Field) Collectors(java.util.stream.Collectors) IBlockState(net.minecraft.block.state.IBlockState) List(java.util.List) LivingEvent(net.minecraftforge.event.entity.living.LivingEvent) Material(net.minecraft.block.material.Material) EntityLivingBase(net.minecraft.entity.EntityLivingBase) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) EntityCaveSpider(net.minecraft.entity.monster.EntityCaveSpider) MobEffects(net.minecraft.init.MobEffects) Biome(net.minecraft.world.biome.Biome) WeightedRandom(net.minecraft.util.WeightedRandom) EntityCaveSpider(net.minecraft.entity.monster.EntityCaveSpider) EntitySlime(net.minecraft.entity.monster.EntitySlime) EntitySilverfish(net.minecraft.entity.monster.EntitySilverfish)

Aggregations

EntitySilverfish (net.minecraft.entity.monster.EntitySilverfish)3 PotionEffect (net.minecraft.potion.PotionEffect)2 BlockPos (net.minecraft.util.math.BlockPos)2 Field (java.lang.reflect.Field)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Material (net.minecraft.block.material.Material)1 IBlockState (net.minecraft.block.state.IBlockState)1 Entity (net.minecraft.entity.Entity)1 EntityAgeable (net.minecraft.entity.EntityAgeable)1 EntityLivingBase (net.minecraft.entity.EntityLivingBase)1 EntityCaveSpider (net.minecraft.entity.monster.EntityCaveSpider)1 EntitySlime (net.minecraft.entity.monster.EntitySlime)1 net.minecraft.entity.passive (net.minecraft.entity.passive)1 MobEffects (net.minecraft.init.MobEffects)1 Path (net.minecraft.pathfinding.Path)1 WeightedRandom (net.minecraft.util.WeightedRandom)1 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)1 Vec3d (net.minecraft.util.math.Vec3d)1