Search in sources :

Example 1 with EntitySlime

use of net.minecraft.entity.monster.EntitySlime in project PneumaticCraft by MineMaarten.

the class BlockSlimePlant method executeFullGrownEffect.

@Override
public void executeFullGrownEffect(World world, int x, int y, int z, Random rand) {
    if (world.getBlockMetadata(x, y, z) == 14) {
        int nearbyEntityCount = world.getEntitiesWithinAABB(EntitySlime.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(SPAWN_RANGE * 2, 4.0D, SPAWN_RANGE * 2)).size();
        if (nearbyEntityCount < MAX_NEARBY_ENTITIES) {
            EntitySlime SS = new EntitySlime(world);
            double randXmotion = rand.nextDouble() - 0.5D;
            // rand.nextDouble();
            double randYmotion = 1D;
            double randZmotion = rand.nextDouble() - 0.5D;
            SS.setLocationAndAngles(x + 0.5D, y + 0.5D, z + 0.5D, rand.nextFloat() * 360.0F, 0.0F);
            SS.motionX = randXmotion;
            SS.motionY = randYmotion;
            SS.motionZ = randZmotion;
            world.spawnEntityInWorld(SS);
            SS.spawnExplosionParticle();
            SS.playSound("mob.newsound.chickenplop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
            world.setBlockMetadataWithNotify(x, y, z, 13 - SS.getSlimeSize(), 3);
        }
    } else {
        world.setBlockMetadataWithNotify(x, y, z, 14, 2);
        world.scheduleBlockUpdate(x, y, z, this, 60);
    }
}
Also used : EntitySlime(net.minecraft.entity.monster.EntitySlime)

Example 2 with EntitySlime

use of net.minecraft.entity.monster.EntitySlime in project MineFactoryReloaded by powercrystals.

the class ItemSyringeSlime method inject.

@Override
public boolean inject(World world, EntityLiving entity, ItemStack syringe) {
    EntitySlime slime = (EntitySlime) entity;
    slime.setSlimeSize(slime.getSlimeSize() << 1);
    return true;
}
Also used : EntitySlime(net.minecraft.entity.monster.EntitySlime)

Example 3 with EntitySlime

use of net.minecraft.entity.monster.EntitySlime in project PneumaticCraft by MineMaarten.

the class RenderTarget method render.

public void render(float partialTicks, boolean justRenderWhenHovering) {
    for (IEntityTrackEntry tracker : trackEntries) {
        tracker.render(entity, partialTicks);
    }
    double x = entity.prevPosX + (entity.posX - entity.prevPosX) * partialTicks;
    double y = entity.prevPosY + (entity.posY - entity.prevPosY) * partialTicks + entity.height / 2D;
    double z = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * partialTicks;
    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glPushMatrix();
    GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
    float red;
    float green;
    float blue;
    float alpha = 0.5F;
    if (entity instanceof EntityDrone) {
        red = 1;
        green = 1;
        blue = 0;
    } else if (entity instanceof EntityMob || entity instanceof EntitySlime) {
        red = 1;
        green = 0;
        blue = 0;
    } else {
        red = 0;
        green = 1;
        blue = 0;
    }
    float size = entity.height * 0.5F;
    if (ticksExisted < 60) {
        size += 5 - Math.abs(ticksExisted) * 0.083F;
        alpha = Math.abs(ticksExisted) * 0.005F;
    }
    GL11.glTranslated(x, y, z);
    GL11.glRotatef(180.0F - RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(180.0F - RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);
    GL11.glColor4d(red, green, blue, alpha);
    float renderSize = oldSize + (size - oldSize) * partialTicks;
    circle1.render(renderSize, partialTicks);
    circle2.render(renderSize + 0.2D, partialTicks);
    int targetAcquireProgress = (int) ((ticksExisted - 50) / 0.7F);
    if (ticksExisted <= 120 && ticksExisted > 50) {
        GL11.glColor4d(0, 1, 0, 0.8D);
        RenderProgressBar.render(0D, 0.4D, 1.8D, 0.9D, 0, targetAcquireProgress);
    }
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    FontRenderer fontRenderer = RenderManager.instance.getFontRenderer();
    GL11.glScaled(0.02D, 0.02D, 0.02D);
    GL11.glColor4d(red, green, blue, alpha);
    if (ticksExisted > 120) {
        if (justRenderWhenHovering && !isLookingAtTarget) {
            stat.closeWindow();
        } else {
            stat.openWindow();
        }
        textList = new ArrayList<String>();
        for (IEntityTrackEntry tracker : trackEntries) {
            tracker.addInfo(entity, textList);
        }
        stat.setText(textList);
        stat.render(-1, -1, partialTicks);
    } else if (ticksExisted > 50) {
        fontRenderer.drawString("Acquiring Target...", 0, 0, 0x7F7F7F);
        fontRenderer.drawString(targetAcquireProgress + "%", 37, 28, 0x002F00);
    } else if (ticksExisted < -30) {
        stat.closeWindow();
        //if(stat.getWidth() > stat.getMinWidth() || stat.getHeight() > stat.getMinHeight()) {
        //    stat.setText(new ArrayList<String>());
        stat.render(-1, -1, partialTicks);
        //            }
        fontRenderer.drawString("Lost Target!", 0, 0, 0xFF0000);
    }
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
    oldSize = size;
}
Also used : EntityMob(net.minecraft.entity.monster.EntityMob) IEntityTrackEntry(pneumaticCraft.api.client.pneumaticHelmet.IEntityTrackEntry) EntityDrone(pneumaticCraft.common.entity.living.EntityDrone) EntitySlime(net.minecraft.entity.monster.EntitySlime) FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 4 with EntitySlime

use of net.minecraft.entity.monster.EntitySlime 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 5 with EntitySlime

use of net.minecraft.entity.monster.EntitySlime in project Railcraft by Railcraft.

the class TrackKitEmbarking method onMinecartPass.

@Override
public void onMinecartPass(EntityMinecart cart) {
    if (isPowered() && cart.canBeRidden() && !cart.isBeingRidden() && cart.getEntityData().getInteger("MountPrevention") <= 0) {
        int a = area;
        AxisAlignedBB box = AABBFactory.start().createBoxForTileAt(getPos()).build();
        box = box.expand(a, a, a);
        List<EntityLivingBase> entities = theWorldAsserted().getEntitiesWithinAABB(EntityLivingBase.class, box);
        if (entities.size() > 0) {
            EntityLivingBase entity = entities.get(MiscTools.RANDOM.nextInt(entities.size()));
            if (entity instanceof EntityPlayer) {
                EntityPlayer player = (EntityPlayer) entity;
                if (player.isSneaking()) {
                    return;
                }
                ItemStack current = player.getActiveItemStack();
                if (!InvTools.isEmpty(current) && current.getItem() instanceof IToolCrowbar) {
                    return;
                }
            } else if (excludedEntities.contains(entity.getClass())) {
                return;
            } else if (entity instanceof EntitySlime) {
                EntitySlime slime = (EntitySlime) entity;
                if (slime.getSlimeSize() >= 100)
                    return;
            }
            if (!entity.isRiding()) {
                EffectManager.instance.teleportEffect(entity, cart.getPositionVector());
                CartTools.addPassenger(cart, entity);
            }
        }
    }
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) EntitySlime(net.minecraft.entity.monster.EntitySlime) EntityLivingBase(net.minecraft.entity.EntityLivingBase) IToolCrowbar(mods.railcraft.api.core.items.IToolCrowbar) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack)

Aggregations

EntitySlime (net.minecraft.entity.monster.EntitySlime)5 ArrayList (java.util.ArrayList)1 IToolCrowbar (mods.railcraft.api.core.items.IToolCrowbar)1 FontRenderer (net.minecraft.client.gui.FontRenderer)1 EntityLivingBase (net.minecraft.entity.EntityLivingBase)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 EntityMob (net.minecraft.entity.monster.EntityMob)1 EntitySkeleton (net.minecraft.entity.monster.EntitySkeleton)1 EntityMooshroom (net.minecraft.entity.passive.EntityMooshroom)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 ItemStack (net.minecraft.item.ItemStack)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 PotionEffect (net.minecraft.potion.PotionEffect)1 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)1 IEntityTrackEntry (pneumaticCraft.api.client.pneumaticHelmet.IEntityTrackEntry)1 EntityDrone (pneumaticCraft.common.entity.living.EntityDrone)1