Example #1
0
 /** Called upon the block being destroyed by an explosion */
 public void onBlockDestroyedByExplosion(
     World p_149723_1_, int p_149723_2_, int p_149723_3_, int p_149723_4_, Explosion p_149723_5_) {
   if (!p_149723_1_.isRemote) {
     EntityTNTPrimed entitytntprimed =
         new EntityTNTPrimed(
             p_149723_1_,
             (double) ((float) p_149723_2_ + 0.5F),
             (double) ((float) p_149723_3_ + 0.5F),
             (double) ((float) p_149723_4_ + 0.5F),
             p_149723_5_.getExplosivePlacedBy());
     entitytntprimed.fuse =
         p_149723_1_.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8;
     p_149723_1_.spawnEntityInWorld(entitytntprimed);
   }
 }
 public void spawnTnt(Vector3f pos, int fuse, int size) throws ScriptErrorException {
   final int expSize = size;
   EntityTNTPrimed tnt =
       new EntityTNTPrimed(_world) {
         @Override
         public void onUpdate() {
           super.onUpdate();
           if (isDead) {
             this.worldObj.createExplosion((Entity) null, posX, posY, posZ, expSize, true);
           }
         }
       };
   tnt.fuse = fuse;
   tnt.setPosition(pos.getX(), pos.getY(), pos.getZ());
   _world.spawnEntityInWorld(tnt);
 }
Example #3
0
  public void renderPrimedTNT(
      EntityTNTPrimed par1EntityTNTPrimed,
      double par2,
      double par4,
      double par6,
      float par8,
      float par9) {
    GL11.glPushMatrix();
    GL11.glTranslatef((float) par2, (float) par4, (float) par6);
    float f2;

    if ((float) par1EntityTNTPrimed.fuse - par9 + 1.0F < 10.0F) {
      f2 = 1.0F - ((float) par1EntityTNTPrimed.fuse - par9 + 1.0F) / 10.0F;

      if (f2 < 0.0F) {
        f2 = 0.0F;
      }

      if (f2 > 1.0F) {
        f2 = 1.0F;
      }

      f2 *= f2;
      f2 *= f2;
      float f3 = 1.0F + f2 * 0.3F;
      GL11.glScalef(f3, f3, f3);
    }

    f2 = (1.0F - ((float) par1EntityTNTPrimed.fuse - par9 + 1.0F) / 100.0F) * 0.8F;
    this.loadTexture("/terrain.png");
    this.blockRenderer.renderBlockAsItem(Block.tnt, 0, par1EntityTNTPrimed.getBrightness(par9));

    if (par1EntityTNTPrimed.fuse / 5 % 2 == 0) {
      GL11.glDisable(GL11.GL_TEXTURE_2D);
      GL11.glDisable(GL11.GL_LIGHTING);
      GL11.glEnable(GL11.GL_BLEND);
      GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA);
      GL11.glColor4f(1.0F, 1.0F, 1.0F, f2);
      this.blockRenderer.renderBlockAsItem(Block.tnt, 0, 1.0F);
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      GL11.glDisable(GL11.GL_BLEND);
      GL11.glEnable(GL11.GL_LIGHTING);
      GL11.glEnable(GL11.GL_TEXTURE_2D);
    }

    GL11.glPopMatrix();
  }
  @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(EntityOcelot.class, world), 20));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityWolf.class, world), 20));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityBat.class, world), 35));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityHorse.class, world), 20));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityMinecartHopper.class, world), 15));

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

    EntityWolf invisiwolf = (EntityWolf) MFRUtil.prepareMob(EntityWolf.class, world);
    invisiwolf.addPotionEffect(new PotionEffect(Potion.invisibility.id, 120 * 20));
    invisiwolf.setAngry(true);
    mobs.add(new RandomMob(invisiwolf, 5));

    EntityTNTPrimed tntJockey = (EntityTNTPrimed) MFRUtil.prepareMob(EntityTNTPrimed.class, world);
    EntityBat tntMount = (EntityBat) MFRUtil.prepareMob(EntityBat.class, world);
    tntJockey.fuse = 120;
    tntJockey.mountEntity(tntMount);
    mobs.add(new RandomMob(tntMount, 2));

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

    tntJockey = (EntityTNTPrimed) MFRUtil.prepareMob(EntityTNTPrimed.class, world);
    EntityXPOrb tntMount2 = (EntityXPOrb) MFRUtil.prepareMob(EntityXPOrb.class, world);
    tntJockey.fuse = 120;
    tntMount2.xpValue = 1;
    tntMount2.xpOrbAge = Short.MIN_VALUE;
    tntMount2.field_70532_c = Short.MAX_VALUE;
    tntJockey.mountEntity(tntMount2);
    mobs.add(new RandomMob(tntMount2, 2));

    creeperJockey = (EntityCreeper) MFRUtil.prepareMob(EntityCreeper.class, world);
    EntityXPOrb creeperMount2 = (EntityXPOrb) MFRUtil.prepareMob(EntityXPOrb.class, world);
    creeperMount2.xpValue = 1;
    creeperMount2.xpOrbAge = Short.MIN_VALUE;
    creeperMount2.field_70532_c = Short.MAX_VALUE;
    creeperJockey.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 20));
    creeperJockey.onStruckByLightning(null);
    creeperJockey.mountEntity(creeperMount2);
    mobs.add(new RandomMob(creeperMount2, 1));

    EntityEnderman direBane = (EntityEnderman) MFRUtil.prepareMob(EntityEnderman.class, world);
    direBane.addPotionEffect(new PotionEffect(Potion.regeneration.id, 120 * 20));
    direBane.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 120 * 20));
    direBane.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(120);
    direBane.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.7);
    direBane.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(15);
    direBane.getEntityAttribute(SharedMonsterAttributes.followRange).setAttribute(32);
    direBane.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setAttribute(1);
    direBane.stepHeight = 2;
    EntityPlayer player = world.getPlayerEntityByName("direwolf20");
    if (player != null) {
      direBane.setCustomNameTag("Bane of direwolf");
      direBane.setAlwaysRenderNameTag(true);
      direBane.func_110163_bv();
      ItemStack armor = new ItemStack(Item.plateGold);
      AutoEnchantmentHelper.addRandomEnchantment(direBane.getRNG(), armor, 60);
      int i = EntityLiving.getArmorPosition(armor);
      direBane.setCurrentItemOrArmor(i, armor);
      direBane.setEquipmentDropChance(i, 2.0F);
    }
    mobs.add(new RandomMob(direBane, 1));

    return mobs;
  }