Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package net.minecraft.server;
2
3import com.legacyminecraft.poseidon.PoseidonConfig;
4
5public class BlockSponge extends Block {
6 protected BlockSponge(int i) {
7 super(i, Material.SPONGE);
8 this.textureId = 48;
9 }
10
11 public void remove(World world, int i, int j, int k) {
12 byte radius = 2;
13
14 if (PoseidonConfig.getInstance().getConfigBoolean("fix.optimize-sponges.enabled", true)) {
15 this.optimizedRemove(world, i, j, k, radius);
16 return;
17 }
18
19 for (int x = i - radius; x <= i + radius; ++x) {
20 for (int y = j - radius; y <= j + radius; ++y) {
21 for (int z = k - radius; z <= k + radius; ++z) {
22 world.applyPhysics(x, y, z, world.getTypeId(x, y, z));
23 }
24 }
25 }
26 }
27
28 private void optimizedRemove(World world, int i, int j, int k, byte radius) {
29 for (int x = i - radius; x <= i + radius; ++x) {
30 for (int y = j - radius; y <= j + radius; ++y) {
31 if (y > 127 || y < 0) continue;
32
33 for (int z = k - radius; z <= k + radius; ++z) {
34 int type = world.getTypeId(x, y, z);
35 if ((type != Block.WATER.id && type != Block.STATIONARY_WATER.id)) continue;
36
37 world.applyPhysics(x, y, z, type);
38 }
39 }
40 }
41 }
42}