Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package net.minecraft.server;
2
3public class TileEntityNote extends TileEntity {
4
5 public byte note = 0;
6 public boolean b = false;
7
8 public TileEntityNote() {
9 }
10
11 public void b(NBTTagCompound nbttagcompound) {
12 super.b(nbttagcompound);
13 nbttagcompound.a("note", this.note);
14 }
15
16 public void a(NBTTagCompound nbttagcompound) {
17 super.a(nbttagcompound);
18 this.note = nbttagcompound.c("note");
19 if (this.note < 0) {
20 this.note = 0;
21 }
22
23 if (this.note > 24) {
24 this.note = 24;
25 }
26 }
27
28 public void a() {
29 this.note = (byte) ((this.note + 1) % 25);
30 this.update();
31 }
32
33 public void play(World world, int i, int j, int k) {
34 if (world.getMaterial(i, j + 1, k) == Material.AIR) {
35 Material material = world.getMaterial(i, j - 1, k);
36 byte b0 = 0;
37
38 if (material == Material.STONE) {
39 b0 = 1;
40 }
41
42 if (material == Material.SAND) {
43 b0 = 2;
44 }
45
46 if (material == Material.SHATTERABLE) {
47 b0 = 3;
48 }
49
50 if (material == Material.WOOD) {
51 b0 = 4;
52 }
53
54 world.playNote(i, j, k, b0, this.note);
55 }
56 }
57}