Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package net.minecraft.server;
2
3import java.util.Random;
4
5import uk.betacraft.uberbukkit.UberbukkitConfig;
6
7public class BlockLockedChest extends Block {
8
9 protected BlockLockedChest(int i) {
10 super(i, Material.WOOD);
11 this.textureId = 26;
12 }
13
14 public int a(int i) {
15 return i == 1 ? this.textureId - 1 : (i == 0 ? this.textureId - 1 : (i == 3 ? this.textureId + 1 : this.textureId));
16 }
17
18 public boolean canPlace(World world, int i, int j, int k) {
19 // uberbukkit
20 if (!UberbukkitConfig.getInstance().getBoolean("worldgen.generate_steveco_chests", true)) {
21 return true;
22 }
23
24 int l = 0;
25
26 if (world.getTypeId(i - 1, j, k) == this.id) {
27 ++l;
28 }
29
30 if (world.getTypeId(i + 1, j, k) == this.id) {
31 ++l;
32 }
33
34 if (world.getTypeId(i, j, k - 1) == this.id) {
35 ++l;
36 }
37
38 if (world.getTypeId(i, j, k + 1) == this.id) {
39 ++l;
40 }
41
42 return l > 1 ? false : (this.g(world, i - 1, j, k) ? false : (this.g(world, i + 1, j, k) ? false : (this.g(world, i, j, k - 1) ? false : !this.g(world, i, j, k + 1))));
43 }
44
45 private boolean g(World world, int i, int j, int k) {
46 return world.getTypeId(i, j, k) != this.id ? false : (world.getTypeId(i - 1, j, k) == this.id ? true : (world.getTypeId(i + 1, j, k) == this.id ? true : (world.getTypeId(i, j, k - 1) == this.id ? true : world.getTypeId(i, j, k + 1) == this.id)));
47 }
48
49 public void a(World world, int i, int j, int k, Random random) {
50 // uberbukkit
51 if (!UberbukkitConfig.getInstance().getBoolean("worldgen.generate_steveco_chests", true))
52 world.setTypeId(i, j, k, 0);
53 }
54}