public void getChunkAt(IChunkProvider ichunkprovider, int i, int j) {
    BlockSand.instaFall = true;
    int k = i * 16;
    int l = j * 16;
    BiomeBase biomebase = this.m.getBiome(k + 16, l + 16);

    biomebase.a(this.m, this.m.random, k, l);
    BlockSand.instaFall = false;
  }
Beispiel #2
0
 private List<EntityType> getSpawnableEntities(EnumCreatureType creatureType) {
   List<EntityType> entityTypes = new ArrayList<EntityType>();
   for (BiomeBase.BiomeMeta meta : (List<BiomeBase.BiomeMeta>) biomeBase.getMobs(creatureType)) {
     entityTypes.add(EntityType.fromId(ENTITY_CLASS_ID_MAP.get(meta.b)));
   }
   return entityTypes;
 }
Beispiel #3
0
  public void changeBlockBiome(Location location) {
    int x = location.getBlockX();
    int z = location.getBlockZ();
    World world = ((CraftWorld) location.getWorld()).getHandle();
    if (world.isLoaded(new BlockPosition(x, 0, z))) {
      Chunk chunk = world.getChunkAtWorldCoords(new BlockPosition(x, 0, z));

      if (chunk != null) {
        byte[] biomevals = chunk.getBiomeIndex();
        biomevals[((z & 0xF) << 4) | (x & 0xF)] = (byte) BiomeBase.a(biomeBase);
      }
    }
  }
  private boolean b(int i, int j) {
    if (a(i, j)) {
      return true;
    } else {
      BiomeBase biomebase = BiomeBase.getBiome(i);
      BiomeBase biomebase1 = BiomeBase.getBiome(j);

      if (biomebase != null && biomebase1 != null) {
        BiomeBase.EnumTemperature biomebase_enumtemperature = biomebase.m();
        BiomeBase.EnumTemperature biomebase_enumtemperature1 = biomebase1.m();

        return biomebase_enumtemperature == biomebase_enumtemperature1
            || biomebase_enumtemperature == BiomeBase.EnumTemperature.MEDIUM
            || biomebase_enumtemperature1 == BiomeBase.EnumTemperature.MEDIUM;
      } else {
        return false;
      }
    }
  }
Beispiel #5
0
 public float getTemperature() {
   return biomeBase.getTemperature();
 }
Beispiel #6
0
 public float getHumidity() {
   return biomeBase.getHumidity();
 }
  public List getMobsFor(EnumCreatureType enumcreaturetype, int i, int j, int k) {
    BiomeBase biomebase = this.m.getBiome(i, k);

    return biomebase == null ? null : biomebase.getMobs(enumcreaturetype);
  }
  protected void g() {
    super.g();
    int i = 0;
    int j = 0;
    // CraftBukkit start
    // Iterator iterator = this.chunkTickList.iterator();

    for (long chunkCoord : this.chunkTickList.popAll()) {
      int chunkX = LongHash.msw(chunkCoord);
      int chunkZ = LongHash.lsw(chunkCoord);
      // ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
      int k = chunkX * 16;
      int l = chunkZ * 16;

      this.methodProfiler.a("getChunk");
      Chunk chunk = this.getChunkAt(chunkX, chunkZ);
      // CraftBukkit end

      this.a(k, l, chunk);
      this.methodProfiler.c("tickChunk");
      chunk.k();
      this.methodProfiler.c("thunder");
      int i1;
      int j1;
      int k1;
      int l1;

      if (this.random.nextInt(100000) == 0 && this.Q() && this.P()) {
        this.k = this.k * 3 + 1013904223;
        i1 = this.k >> 2;
        j1 = k + (i1 & 15);
        k1 = l + (i1 >> 8 & 15);
        l1 = this.h(j1, k1);
        if (this.isRainingAt(j1, l1, k1)) {
          this.strikeLightning(new EntityLightning(this, (double) j1, (double) l1, (double) k1));
        }
      }

      this.methodProfiler.c("iceandsnow");
      int i2;

      if (this.random.nextInt(16) == 0) {
        this.k = this.k * 3 + 1013904223;
        i1 = this.k >> 2;
        j1 = i1 & 15;
        k1 = i1 >> 8 & 15;
        l1 = this.h(j1 + k, k1 + l);
        if (this.y(j1 + k, l1 - 1, k1 + l)) {
          // CraftBukkit start
          BlockState blockState = this.getWorld().getBlockAt(j1 + k, l1 - 1, k1 + l).getState();
          blockState.setTypeId(Block.ICE.id);

          BlockFormEvent iceBlockForm = new BlockFormEvent(blockState.getBlock(), blockState);
          this.getServer().getPluginManager().callEvent(iceBlockForm);
          if (!iceBlockForm.isCancelled()) {
            blockState.update(true);
          }
          // CraftBukkit end
        }

        if (this.Q() && this.z(j1 + k, l1, k1 + l)) {
          // CraftBukkit start
          BlockState blockState = this.getWorld().getBlockAt(j1 + k, l1, k1 + l).getState();
          blockState.setTypeId(Block.SNOW.id);

          BlockFormEvent snow = new BlockFormEvent(blockState.getBlock(), blockState);
          this.getServer().getPluginManager().callEvent(snow);
          if (!snow.isCancelled()) {
            blockState.update(true);
          }
          // CraftBukkit end
        }

        if (this.Q()) {
          BiomeBase biomebase = this.getBiome(j1 + k, k1 + l);

          if (biomebase.d()) {
            i2 = this.getTypeId(j1 + k, l1 - 1, k1 + l);
            if (i2 != 0) {
              Block.byId[i2].g(this, j1 + k, l1 - 1, k1 + l);
            }
          }
        }
      }

      this.methodProfiler.c("tickTiles");
      ChunkSection[] achunksection = chunk.i();

      j1 = achunksection.length;

      for (k1 = 0; k1 < j1; ++k1) {
        ChunkSection chunksection = achunksection[k1];

        if (chunksection != null && chunksection.shouldTick()) {
          for (int j2 = 0; j2 < 3; ++j2) {
            this.k = this.k * 3 + 1013904223;
            i2 = this.k >> 2;
            int k2 = i2 & 15;
            int l2 = i2 >> 8 & 15;
            int i3 = i2 >> 16 & 15;
            int j3 = chunksection.getTypeId(k2, i3, l2);

            ++j;
            Block block = Block.byId[j3];

            if (block != null && block.isTicking()) {
              ++i;
              block.a(this, k2 + k, i3 + chunksection.getYPosition(), l2 + l, this.random);
            }
          }
        }
      }

      this.methodProfiler.b();
    }
  }
Beispiel #9
0
  public BiomeBase[] a(BiomeBase[] abiomebase, int i, int j, int k, int l) {
    if (abiomebase == null || abiomebase.length < k * l) {
      abiomebase = new BiomeBase[k * l];
    }

    this.temperature =
        this.e.a(
            this.temperature,
            (double) i,
            (double) j,
            k,
            k,
            0.02500000037252903D,
            0.02500000037252903D,
            0.25D);
    this.rain =
        this.f.a(
            this.rain,
            (double) i,
            (double) j,
            k,
            k,
            0.05000000074505806D,
            0.05000000074505806D,
            0.3333333333333333D);
    this.c = this.g.a(this.c, (double) i, (double) j, k, k, 0.25D, 0.25D, 0.5882352941176471D);
    int i1 = 0;

    for (int j1 = 0; j1 < k; ++j1) {
      for (int k1 = 0; k1 < l; ++k1) {
        double d0 = this.c[i1] * 1.1D + 0.5D;
        double d1 = 0.01D;
        double d2 = 1.0D - d1;
        double d3 = (this.temperature[i1] * 0.15D + 0.7D) * d2 + d0 * d1;

        d1 = 0.0020D;
        d2 = 1.0D - d1;
        double d4 = (this.rain[i1] * 0.15D + 0.5D) * d2 + d0 * d1;

        d3 = 1.0D - (1.0D - d3) * (1.0D - d3);
        if (d3 < 0.0D) {
          d3 = 0.0D;
        }

        if (d4 < 0.0D) {
          d4 = 0.0D;
        }

        if (d3 > 1.0D) {
          d3 = 1.0D;
        }

        if (d4 > 1.0D) {
          d4 = 1.0D;
        }

        this.temperature[i1] = d3;
        this.rain[i1] = d4;
        abiomebase[i1++] = BiomeBase.a(d3, d4);
      }
    }

    return abiomebase;
  }