コード例 #1
0
ファイル: BlockPortal.java プロジェクト: CoreyCole/gECON-mod
  public void func_71847_b(
      World p_71847_1_, int p_71847_2_, int p_71847_3_, int p_71847_4_, Random p_71847_5_) {
    super.func_71847_b(p_71847_1_, p_71847_2_, p_71847_3_, p_71847_4_, p_71847_5_);
    if (p_71847_1_.field_73011_w.func_76569_d()
        && p_71847_5_.nextInt(2000) < p_71847_1_.field_73013_u) {
      int var6;
      for (var6 = p_71847_3_;
          !p_71847_1_.func_72797_t(p_71847_2_, var6, p_71847_4_) && var6 > 0;
          --var6) {;
      }

      if (var6 > 0 && !p_71847_1_.func_72809_s(p_71847_2_, var6 + 1, p_71847_4_)) {
        Entity var7 =
            ItemMonsterPlacer.func_77840_a(
                p_71847_1_,
                57,
                (double) p_71847_2_ + 0.5D,
                (double) var6 + 1.1D,
                (double) p_71847_4_ + 0.5D);
        if (var7 != null) {
          var7.field_71088_bW = var7.func_82147_ab();
        }
      }
    }
  }
コード例 #2
0
 /** Ticks the block if it's been scheduled */
 public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
   super.updateTick(par1World, par2, par3, par4, par5Random);
   if (par1World.provider.isSurfaceWorld()
       && par5Random.nextInt(2000) < par1World.difficultySetting) {
     int l;
     for (l = par3; !par1World.doesBlockHaveSolidTopSurface(par2, l, par4) && l > 0; --l) {;
     }
     if (l > 0 && !par1World.isBlockNormalCube(par2, l + 1, par4)) {
       Entity entity =
           ItemMonsterPlacer.spawnCreature(
               par1World, 57, (double) par2 + 0.5D, (double) l + 1.1D, (double) par4 + 0.5D);
       if (entity != null) {
         entity.timeUntilPortal = entity.getPortalCooldown();
       }
     }
   }
 }