/** Populates chunk with ores etc etc */
 public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) {
   BlockSand.fallInstantly = true;
   int i = par2 * 16;
   int j = par3 * 16;
   BiomeGenBase biomegenbase = endWorld.getBiomeGenForCoords(i + 16, j + 16);
   biomegenbase.decorate(endWorld, endWorld.rand, i, j);
   BlockSand.fallInstantly = false;
 }
 public List func_73155_a(
     EnumCreatureType p_73155_1_, int p_73155_2_, int p_73155_3_, int p_73155_4_) {
   if (p_73155_1_ == EnumCreatureType.monster
       && this.field_73172_c.func_75048_a(p_73155_2_, p_73155_3_, p_73155_4_)) {
     return this.field_73172_c.func_75059_a();
   } else {
     BiomeGenBase var5 = this.field_73175_o.func_72807_a(p_73155_2_, p_73155_4_);
     return var5 == null ? null : var5.func_76747_a(p_73155_1_);
   }
 }
  /** Returns a list of creatures of the specified type that can spawn at the given location. */
  public List getPossibleCreatures(
      EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) {
    BiomeGenBase biomegenbase = endWorld.getBiomeGenForCoords(par2, par4);

    if (biomegenbase == null) {
      return null;
    } else {
      return biomegenbase.getSpawnableList(par1EnumCreatureType);
    }
  }
  /** Populates chunk with ores etc etc */
  public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) {
    int var4 = par2 * 16;
    int var5 = par3 * 16;
    BiomeGenBase var6 = this.worldObj.getBiomeGenForCoords(var4 + 16, var5 + 16);
    boolean var7 = false;
    this.random.setSeed(this.worldObj.getSeed());
    long var8 = this.random.nextLong() / 2L * 2L + 1L;
    long var10 = this.random.nextLong() / 2L * 2L + 1L;
    this.random.setSeed((long) par2 * var8 + (long) par3 * var10 ^ this.worldObj.getSeed());
    Iterator var12 = this.structureGenerators.iterator();

    while (var12.hasNext()) {
      MapGenStructure var13 = (MapGenStructure) var12.next();
      boolean var14 = var13.generateStructuresInChunk(this.worldObj, this.random, par2, par3);

      if (var13 instanceof MapGenVillage) {
        var7 |= var14;
      }
    }

    int var17;
    int var16;
    int var18;

    if (this.waterLakeGenerator != null && !var7 && this.random.nextInt(4) == 0) {
      var16 = var4 + this.random.nextInt(16) + 8;
      var17 = this.random.nextInt(128);
      var18 = var5 + this.random.nextInt(16) + 8;
      this.waterLakeGenerator.generate(this.worldObj, this.random, var16, var17, var18);
    }

    if (this.lavaLakeGenerator != null && !var7 && this.random.nextInt(8) == 0) {
      var16 = var4 + this.random.nextInt(16) + 8;
      var17 = this.random.nextInt(this.random.nextInt(120) + 8);
      var18 = var5 + this.random.nextInt(16) + 8;

      if (var17 < 63 || this.random.nextInt(10) == 0) {
        this.lavaLakeGenerator.generate(this.worldObj, this.random, var16, var17, var18);
      }
    }

    if (this.field_82702_h) {
      for (var16 = 0; var16 < 8; ++var16) {
        var17 = var4 + this.random.nextInt(16) + 8;
        var18 = this.random.nextInt(128);
        int var15 = var5 + this.random.nextInt(16) + 8;
        (new WorldGenDungeons()).generate(this.worldObj, this.random, var17, var18, var15);
      }
    }

    if (this.field_82697_g) {
      var6.decorate(this.worldObj, this.random, var4, var5);
    }
  }
 public List func_73155_a(
     EnumCreatureType p_73155_1_, int p_73155_2_, int p_73155_3_, int p_73155_4_) {
   if (p_73155_1_ == EnumCreatureType.monster
       && field_73172_c.func_75048_a(p_73155_2_, p_73155_3_, p_73155_4_)) {
     return field_73172_c.func_75059_a();
   }
   BiomeGenBase biomegenbase = field_73175_o.func_72807_a(p_73155_2_, p_73155_4_);
   if (biomegenbase == null) {
     return null;
   } else {
     return biomegenbase.func_76747_a(p_73155_1_);
   }
 }
  @Override
  public void decorate(World par1World, Random par2Random, int par3, int par4) {
    super.decorate(par1World, par2Random, par3, par4);
    int var5 = 3 + par2Random.nextInt(6);

    for (int var6 = 0; var6 < var5; ++var6) {
      int var7 = par3 + par2Random.nextInt(16);
      int var8 = par2Random.nextInt(28) + 4;
      int var9 = par4 + par2Random.nextInt(16);
      int var10 = par1World.getBlockId(var7, var8, var9);

      if (var10 == Block.stone.blockID) {
        int var11 = 0;

        if (var8 <= 48 + par1World.rand.nextInt(2)) {
          byte var12 = 1;

          if (var8 <= 24 + par1World.rand.nextInt(2)) {
            var12 = 2;
          }

          var11 = Block.oreEmerald.GetMetadataConversionForStrataLevel(var12, 0);
        }

        par1World.setBlock(var7, var8, var9, Block.oreEmerald.blockID, var11, 2);
      }
    }
  }
 public void func_76728_a(World p_76728_1_, Random p_76728_2_, int p_76728_3_, int p_76728_4_) {
   super.func_76728_a(p_76728_1_, p_76728_2_, p_76728_3_, p_76728_4_);
   if (p_76728_2_.nextInt(1000) == 0) {
     int var5 = p_76728_3_ + p_76728_2_.nextInt(16) + 8;
     int var6 = p_76728_4_ + p_76728_2_.nextInt(16) + 8;
     WorldGenDesertWells var7 = new WorldGenDesertWells();
     var7.func_76484_a(
         p_76728_1_, p_76728_2_, var5, p_76728_1_.func_72976_f(var5, var6) + 1, var6);
   }
 }
  public void decorate(World par1World, Random par2Random, int par3, int par4) {
    super.decorate(par1World, par2Random, par3, par4);
    WorldGenVines var5 = new WorldGenVines();

    for (int var6 = 0; var6 < 50; ++var6) {
      int var7 = par3 + par2Random.nextInt(16) + 8;
      byte var8 = 64;
      int var9 = par4 + par2Random.nextInt(16) + 8;
      var5.generate(par1World, par2Random, var7, var8, var9);
    }
  }
  @Override
  public void decorate(World par1World, Random par2Random, int par3, int par4) {
    super.decorate(par1World, par2Random, par3, par4);
    int var5 = 12 + par2Random.nextInt(6);

    for (int var6 = 0; var6 < var5; ++var6) {
      int var7 = par3 + par2Random.nextInt(16);
      int var8 = par2Random.nextInt(28) + 4;
      int var9 = par4 + par2Random.nextInt(16);
      int var10 = par1World.getBlockId(var7, var8, var9);
    }
  }
 private static List getSpawnableList(
     World w, BiomeGenBase par1BiomeGenBase, EnumCreatureType par2EnumCreatureType) {
   List list2 = par1BiomeGenBase.getSpawnableList(par2EnumCreatureType);
   List list = new ArrayList();
   for (Object o : list2) {
     SpawnListEntry s = (SpawnListEntry) o;
     String str = (String) (classToStringMapping.get(s.entityClass));
     if (EntityLiving.allow(str, w.provider.dimensionId)) {
       list.add(s);
     }
   }
   return list;
 }
 /** Returns a list of creatures of the specified type that can spawn at the given location. */
 public List getPossibleCreatures(
     EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) {
   BiomeGenBase var5 = this.worldObj.getBiomeGenForCoords(par2, par4);
   return var5 == null ? null : var5.getSpawnableList(par1EnumCreatureType);
 }
  /** Called during chunk generation to spawn initial creatures. */
  public static void performWorldGenSpawning(
      World par0World,
      BiomeGenBase par1BiomeGenBase,
      int par2,
      int par3,
      int par4,
      int par5,
      Random par6Random) {
    List list = getSpawnableList(par0World, par1BiomeGenBase, EnumCreatureType.creature);

    if (list.isEmpty()) {
      return;
    }

    while (par6Random.nextFloat() < par1BiomeGenBase.getSpawningChance()) {
      SpawnListEntry spawnlistentry =
          (SpawnListEntry) WeightedRandom.getRandomItem(par0World.rand, list);
      EntityLivingData entitylivingdata = null;
      int i =
          spawnlistentry.minGroupCount
              + par6Random.nextInt(
                  (1 + spawnlistentry.maxGroupCount) - spawnlistentry.minGroupCount);
      int j = par2 + par6Random.nextInt(par4);
      int k = par3 + par6Random.nextInt(par5);
      int l = j;
      int i1 = k;
      int j1 = 0;

      while (j1 < i) {
        boolean flag = false;

        for (int k1 = 0; !flag && k1 < 4; k1++) {
          int l1 = par0World.getTopSolidOrLiquidBlock(j, k);

          if (canCreatureTypeSpawnAtLocation(EnumCreatureType.creature, par0World, j, l1, k)) {
            float f = (float) j + 0.5F;
            float f1 = l1;
            float f2 = (float) k + 0.5F;
            EntityLiving entityliving;

            try {
              entityliving =
                  (EntityLiving)
                      spawnlistentry
                          .entityClass
                          .getConstructor(new Class[] {net.minecraft.src.World.class})
                          .newInstance(new Object[] {par0World});
            } catch (Exception exception) {
              exception.printStackTrace();
              continue;
            }

            entityliving.setLocationAndAngles(f, f1, f2, par6Random.nextFloat() * 360F, 0.0F);
            par0World.spawnEntityInWorld(entityliving);
            entitylivingdata = entityliving.onSpawnWithEgg(entitylivingdata);
            flag = true;
          }

          j += par6Random.nextInt(5) - par6Random.nextInt(5);

          for (k += par6Random.nextInt(5) - par6Random.nextInt(5);
              j < par2 || j >= par2 + par4 || k < par3 || k >= par3 + par4;
              k = (i1 + par6Random.nextInt(5)) - par6Random.nextInt(5)) {
            j = (l + par6Random.nextInt(5)) - par6Random.nextInt(5);
          }
        }

        j1++;
      }
    }
  }
Exemple #13
0
  /**
   * plays random cave ambient sounds and runs updateTick on random blocks within each chunk in the
   * vacinity of a player
   */
  protected void tickBlocksAndAmbiance() {
    super.tickBlocksAndAmbiance();
    int var1 = 0;
    int var2 = 0;
    Iterator var3 = this.activeChunkSet.iterator();

    while (var3.hasNext()) {
      ChunkCoordIntPair var4 = (ChunkCoordIntPair) var3.next();
      int var5 = var4.chunkXPos * 16;
      int var6 = var4.chunkZPos * 16;
      this.theProfiler.startSection("getChunk");
      Chunk var7 = this.getChunkFromChunkCoords(var4.chunkXPos, var4.chunkZPos);
      this.moodSoundAndLightCheck(var5, var6, var7);
      this.theProfiler.endStartSection("tickChunk");
      var7.updateSkylight();
      this.theProfiler.endStartSection("thunder");
      int var8;
      int var9;
      int var10;
      int var11;

      if (this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) {
        this.updateLCG = this.updateLCG * 3 + 1013904223;
        var8 = this.updateLCG >> 2;
        var9 = var5 + (var8 & 15);
        var10 = var6 + (var8 >> 8 & 15);
        var11 = this.getPrecipitationHeight(var9, var10);

        if (this.canLightningStrikeAt(var9, var11, var10)) {
          this.addWeatherEffect(
              new EntityLightningBolt(this, (double) var9, (double) var11, (double) var10));
        }
      }

      this.theProfiler.endStartSection("iceandsnow");
      int var13;

      if (this.rand.nextInt(16) == 0) {
        this.updateLCG = this.updateLCG * 3 + 1013904223;
        var8 = this.updateLCG >> 2;
        var9 = var8 & 15;
        var10 = var8 >> 8 & 15;
        var11 = this.getPrecipitationHeight(var9 + var5, var10 + var6);

        if (this.isBlockFreezableNaturally(var9 + var5, var11 - 1, var10 + var6)) {
          this.setBlock(var9 + var5, var11 - 1, var10 + var6, Block.ice.blockID);
        }

        if (this.isRaining() && this.canSnowAt(var9 + var5, var11, var10 + var6)) {
          this.setBlock(var9 + var5, var11, var10 + var6, Block.snow.blockID);
        }

        if (this.isRaining()) {
          BiomeGenBase var12 = this.getBiomeGenForCoords(var9 + var5, var10 + var6);

          if (var12.canSpawnLightningBolt()) {
            var13 = this.getBlockId(var9 + var5, var11 - 1, var10 + var6);

            if (var13 != 0) {
              Block.blocksList[var13].fillWithRain(this, var9 + var5, var11 - 1, var10 + var6);
            }
          }
        }
      }

      this.theProfiler.endStartSection("tickTiles");
      ExtendedBlockStorage[] var19 = var7.getBlockStorageArray();
      var9 = var19.length;

      for (var10 = 0; var10 < var9; ++var10) {
        ExtendedBlockStorage var21 = var19[var10];

        if (var21 != null && var21.getNeedsRandomTick()) {
          for (int var20 = 0; var20 < 3; ++var20) {
            this.updateLCG = this.updateLCG * 3 + 1013904223;
            var13 = this.updateLCG >> 2;
            int var14 = var13 & 15;
            int var15 = var13 >> 8 & 15;
            int var16 = var13 >> 16 & 15;
            int var17 = var21.getExtBlockID(var14, var16, var15);
            ++var2;
            Block var18 = Block.blocksList[var17];

            if (var18 != null && var18.getTickRandomly()) {
              ++var1;
              var18.updateTick(
                  this, var14 + var5, var16 + var21.getYLocation(), var15 + var6, this.rand);
            }
          }
        }
      }

      this.theProfiler.endSection();
    }
  }