Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package net.minecraft.server;
2
3public class BlockNote extends BlockContainer {
4
5 public BlockNote(int i) {
6 super(i, 74, Material.WOOD);
7 }
8
9 public int a(int i) {
10 return this.textureId;
11 }
12
13 public void doPhysics(World world, int i, int j, int k, int l) {
14 if (l > 0 && Block.byId[l].isPowerSource()) {
15 boolean flag = world.isBlockPowered(i, j, k);
16 TileEntityNote tileentitynote = (TileEntityNote) world.getTileEntity(i, j, k);
17
18 if (tileentitynote.b != flag) {
19 if (flag) {
20 tileentitynote.play(world, i, j, k);
21 }
22
23 tileentitynote.b = flag;
24 }
25 }
26 }
27
28 public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
29 if (world.isStatic) {
30 return true;
31 } else {
32 TileEntityNote tileentitynote = (TileEntityNote) world.getTileEntity(i, j, k);
33
34 tileentitynote.a();
35 tileentitynote.play(world, i, j, k);
36 return true;
37 }
38 }
39
40 public void b(World world, int i, int j, int k, EntityHuman entityhuman) {
41 if (!world.isStatic) {
42 TileEntityNote tileentitynote = (TileEntityNote) world.getTileEntity(i, j, k);
43
44 tileentitynote.play(world, i, j, k);
45 }
46 }
47
48 protected TileEntity a_() {
49 return new TileEntityNote();
50 }
51
52 public void a(World world, int i, int j, int k, int l, int i1) {
53 float f = (float) Math.pow(2.0D, (double) (i1 - 12) / 12.0D);
54 String s = "harp";
55
56 if (l == 1) {
57 s = "bd";
58 }
59
60 if (l == 2) {
61 s = "snare";
62 }
63
64 if (l == 3) {
65 s = "hat";
66 }
67
68 if (l == 4) {
69 s = "bassattack";
70 }
71
72 world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "note." + s, 3.0F, f);
73 world.a("note", (double) i + 0.5D, (double) j + 1.2D, (double) k + 0.5D, (double) i1 / 24.0D, 0.0D, 0.0D);
74 }
75}