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
5public class BlockLadder extends Block {
6
7 protected BlockLadder(int i, int j) {
8 super(i, j, Material.ORIENTABLE);
9 }
10
11 public AxisAlignedBB e(World world, int i, int j, int k) {
12 int l = world.getData(i, j, k);
13 float f = 0.125F;
14
15 if (l == 2) {
16 this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
17 }
18
19 if (l == 3) {
20 this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
21 }
22
23 if (l == 4) {
24 this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
25 }
26
27 if (l == 5) {
28 this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
29 }
30
31 return super.e(world, i, j, k);
32 }
33
34 public boolean a() {
35 return false;
36 }
37
38 public boolean b() {
39 return false;
40 }
41
42 public boolean canPlace(World world, int i, int j, int k) {
43 return world.e(i - 1, j, k) ? true : (world.e(i + 1, j, k) ? true : (world.e(i, j, k - 1) ? true : world.e(i, j, k + 1)));
44 }
45
46 public void postPlace(World world, int i, int j, int k, int l) {
47 int i1 = world.getData(i, j, k);
48
49 if ((i1 == 0 || l == 2) && world.e(i, j, k + 1)) {
50 i1 = 2;
51 }
52
53 if ((i1 == 0 || l == 3) && world.e(i, j, k - 1)) {
54 i1 = 3;
55 }
56
57 if ((i1 == 0 || l == 4) && world.e(i + 1, j, k)) {
58 i1 = 4;
59 }
60
61 if ((i1 == 0 || l == 5) && world.e(i - 1, j, k)) {
62 i1 = 5;
63 }
64
65 world.setData(i, j, k, i1);
66 }
67
68 public void doPhysics(World world, int i, int j, int k, int l) {
69 int i1 = world.getData(i, j, k);
70 boolean flag = false;
71
72 if (i1 == 2 && world.e(i, j, k + 1)) {
73 flag = true;
74 }
75
76 if (i1 == 3 && world.e(i, j, k - 1)) {
77 flag = true;
78 }
79
80 if (i1 == 4 && world.e(i + 1, j, k)) {
81 flag = true;
82 }
83
84 if (i1 == 5 && world.e(i - 1, j, k)) {
85 flag = true;
86 }
87
88 if (!flag) {
89 this.g(world, i, j, k, i1);
90 world.setTypeId(i, j, k, 0);
91 }
92
93 super.doPhysics(world, i, j, k, l);
94 }
95
96 public int a(Random random) {
97 return 1;
98 }
99}