Search in sources :

Example 1 with RandomMob

use of powercrystals.minefactoryreloaded.api.RandomMob in project MineFactoryReloaded by powercrystals.

the class TwilightForestMobProvider method getRandomMobs.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public List<RandomMob> getRandomMobs(World world) {
    List<RandomMob> mobs = new ArrayList<RandomMob>();
    try {
        Class tfBoar = Class.forName("twilightforest.entity.passive.EntityTFBoar");
        Class tfDeathTome = Class.forName("twilightforest.entity.EntityTFDeathTome");
        Class tfDeer = Class.forName("twilightforest.entity.passive.EntityTFDeer");
        Class tfMazeSlime = Class.forName("twilightforest.entity.EntityTFMazeSlime");
        Class tfPenguin = Class.forName("twilightforest.entity.passive.EntityTFPenguin");
        Class tfPinchBeetle = Class.forName("twilightforest.entity.EntityTFPinchBeetle");
        Class tfRaven = Class.forName("twilightforest.entity.passive.EntityTFRaven");
        Class tfSquirrel = Class.forName("twilightforest.entity.passive.EntityTFSquirrel");
        Class tfTinyBird = Class.forName("twilightforest.entity.passive.EntityTFTinyBird");
        Class tfWraith = Class.forName("twilightforest.entity.EntityTFWraith");
        mobs.add(new RandomMob(MFRUtil.prepareMob(tfBoar, world), 80));
        mobs.add(new RandomMob(MFRUtil.prepareMob(tfDeer, world), 80));
        mobs.add(new RandomMob(MFRUtil.prepareMob(tfRaven, world), 50));
        mobs.add(new RandomMob(MFRUtil.prepareMob(tfPenguin, world), 25));
        mobs.add(new RandomMob(MFRUtil.prepareMob(tfSquirrel, world), 25));
        mobs.add(new RandomMob(MFRUtil.prepareMob(tfTinyBird, world), 15));
        mobs.add(new RandomMob(MFRUtil.prepareMob(tfMazeSlime, world), 15));
        mobs.add(new RandomMob(MFRUtil.prepareMob(tfPinchBeetle, world), 15));
        mobs.add(new RandomMob(MFRUtil.prepareMob(tfWraith, world), 5));
        mobs.add(new RandomMob(MFRUtil.prepareMob(tfDeathTome, world), 10));
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
    return mobs;
}
Also used : RandomMob(powercrystals.minefactoryreloaded.api.RandomMob) ArrayList(java.util.ArrayList)

Example 2 with RandomMob

use of powercrystals.minefactoryreloaded.api.RandomMob in project MineFactoryReloaded by powercrystals.

the class VanillaMobProvider method getRandomMobs.

@Override
public List<RandomMob> getRandomMobs(World world) {
    List<RandomMob> mobs = new ArrayList<RandomMob>();
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityMooshroom.class, world), 20));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntitySlime.class, world), 20));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityCow.class, world), 100));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityChicken.class, world), 100));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntitySheep.class, world), 100));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityWitch.class, world), 10));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityGhast.class, world), 15));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityPig.class, world), 100));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityCreeper.class, world), 25));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntitySquid.class, world), 30));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityMinecartHopper.class, world), 15));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityOcelot.class, world), 20));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityWolf.class, world), 20));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityBat.class, world), 35));
    EntityCreeper chargedCreeper = (EntityCreeper) MFRUtil.prepareMob(EntityCreeper.class, world);
    NBTTagCompound creeperNBT = new NBTTagCompound();
    chargedCreeper.writeToNBT(creeperNBT);
    creeperNBT.setBoolean("powered", true);
    creeperNBT.setShort("Fuse", (short) 120);
    chargedCreeper.readFromNBT(creeperNBT);
    mobs.add(new RandomMob(chargedCreeper, 5));
    EntityTNTPrimed armedTNT = (EntityTNTPrimed) MFRUtil.prepareMob(EntityTNTPrimed.class, world);
    armedTNT.fuse = 120;
    mobs.add(new RandomMob(armedTNT, 5));
    EntitySlime invisislime = (EntitySlime) MFRUtil.prepareMob(EntitySlime.class, world);
    invisislime.addPotionEffect(new PotionEffect(Potion.invisibility.id, 120 * 20));
    mobs.add(new RandomMob(invisislime, 5));
    EntityMooshroom invisishroom = (EntityMooshroom) MFRUtil.prepareMob(EntityMooshroom.class, world);
    invisishroom.addPotionEffect(new PotionEffect(Potion.invisibility.id, 120 * 20));
    mobs.add(new RandomMob(invisishroom, 5));
    EntitySkeleton skeleton1 = (EntitySkeleton) MFRUtil.prepareMob(EntitySkeleton.class, world);
    EntitySkeleton skeleton2 = (EntitySkeleton) MFRUtil.prepareMob(EntitySkeleton.class, world);
    EntitySkeleton skeleton3 = (EntitySkeleton) MFRUtil.prepareMob(EntitySkeleton.class, world);
    EntitySkeleton skeleton4 = (EntitySkeleton) MFRUtil.prepareMob(EntitySkeleton.class, world);
    skeleton4.mountEntity(skeleton3);
    skeleton3.mountEntity(skeleton2);
    skeleton2.mountEntity(skeleton1);
    mobs.add(new RandomMob(skeleton1, 2));
    EntityBlaze blazeJockey = (EntityBlaze) MFRUtil.prepareMob(EntityBlaze.class, world);
    EntityGhast blazeMount = (EntityGhast) MFRUtil.prepareMob(EntityGhast.class, world);
    blazeJockey.mountEntity(blazeMount);
    mobs.add(new RandomMob(blazeMount, 2));
    EntityCreeper creeperJockey = (EntityCreeper) MFRUtil.prepareMob(EntityCreeper.class, world);
    EntityCaveSpider creeperMount = (EntityCaveSpider) MFRUtil.prepareMob(EntityCaveSpider.class, world);
    creeperJockey.mountEntity(creeperMount);
    mobs.add(new RandomMob(creeperMount, 2));
    return mobs;
}
Also used : EntityMooshroom(net.minecraft.entity.passive.EntityMooshroom) RandomMob(powercrystals.minefactoryreloaded.api.RandomMob) EntityCaveSpider(net.minecraft.entity.monster.EntityCaveSpider) PotionEffect(net.minecraft.potion.PotionEffect) EntityTNTPrimed(net.minecraft.entity.item.EntityTNTPrimed) EntitySlime(net.minecraft.entity.monster.EntitySlime) EntitySkeleton(net.minecraft.entity.monster.EntitySkeleton) ArrayList(java.util.ArrayList) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) EntityGhast(net.minecraft.entity.monster.EntityGhast) EntityBlaze(net.minecraft.entity.monster.EntityBlaze) EntityCreeper(net.minecraft.entity.monster.EntityCreeper)

Example 3 with RandomMob

use of powercrystals.minefactoryreloaded.api.RandomMob in project MineFactoryReloaded by powercrystals.

the class ItemSafariNet method spawnCreature.

private static Entity spawnCreature(World world, NBTTagCompound mobTag, double x, double y, double z, int side) {
    Entity e;
    if (mobTag.getBoolean("hide")) {
        List<RandomMob> mobs = new ArrayList<RandomMob>();
        for (IRandomMobProvider p : MFRRegistry.getRandomMobProviders()) {
            System.out.println("Adding mobs from " + p.getClass().getName());
            mobs.addAll(p.getRandomMobs(world));
        }
        e = ((RandomMob) WeightedRandom.getRandomItem(world.rand, mobs)).getMob();
    } else {
        NBTTagList pos = mobTag.getTagList("Pos");
        ((NBTTagDouble) pos.tagAt(0)).data = x;
        ((NBTTagDouble) pos.tagAt(1)).data = y;
        ((NBTTagDouble) pos.tagAt(2)).data = z;
        e = EntityList.createEntityFromNBT(mobTag, world);
        if (e != null) {
            if (e instanceof EntityLiving) {
                ((EntityLiving) e).initCreature();
            }
            e.readFromNBT(mobTag);
        }
    }
    if (e != null) {
        int offsetX = Facing.offsetsXForSide[side];
        int offsetY = side == 0 ? -1 : 0;
        int offsetZ = Facing.offsetsZForSide[side];
        AxisAlignedBB bb = e.boundingBox;
        e.setLocationAndAngles(x + (bb.maxX - bb.minX) * 0.5 * offsetX, y + (bb.maxY - bb.minY) * 0.5 * offsetY, z + (bb.maxZ - bb.minZ) * 0.5 * offsetZ, world.rand.nextFloat() * 360.0F, 0.0F);
        world.spawnEntityInWorld(e);
        if (e instanceof EntityLiving) {
            ((EntityLiving) e).playLivingSound();
        }
        Entity riddenByEntity = e.riddenByEntity;
        while (riddenByEntity != null) {
            riddenByEntity.setLocationAndAngles(x, y, z, world.rand.nextFloat() * 360.0F, 0.0F);
            world.spawnEntityInWorld(riddenByEntity);
            if (riddenByEntity instanceof EntityLiving) {
                ((EntityLiving) riddenByEntity).playLivingSound();
            }
            riddenByEntity = riddenByEntity.riddenByEntity;
        }
    }
    return e;
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) AxisAlignedBB(net.minecraft.util.AxisAlignedBB) Entity(net.minecraft.entity.Entity) RandomMob(powercrystals.minefactoryreloaded.api.RandomMob) EntityLiving(net.minecraft.entity.EntityLiving) ArrayList(java.util.ArrayList) IRandomMobProvider(powercrystals.minefactoryreloaded.api.IRandomMobProvider)

Aggregations

ArrayList (java.util.ArrayList)3 RandomMob (powercrystals.minefactoryreloaded.api.RandomMob)3 Entity (net.minecraft.entity.Entity)1 EntityLiving (net.minecraft.entity.EntityLiving)1 EntityTNTPrimed (net.minecraft.entity.item.EntityTNTPrimed)1 EntityBlaze (net.minecraft.entity.monster.EntityBlaze)1 EntityCaveSpider (net.minecraft.entity.monster.EntityCaveSpider)1 EntityCreeper (net.minecraft.entity.monster.EntityCreeper)1 EntityGhast (net.minecraft.entity.monster.EntityGhast)1 EntitySkeleton (net.minecraft.entity.monster.EntitySkeleton)1 EntitySlime (net.minecraft.entity.monster.EntitySlime)1 EntityMooshroom (net.minecraft.entity.passive.EntityMooshroom)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 NBTTagList (net.minecraft.nbt.NBTTagList)1 PotionEffect (net.minecraft.potion.PotionEffect)1 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)1 IRandomMobProvider (powercrystals.minefactoryreloaded.api.IRandomMobProvider)1