Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package net.minecraft.server;
2
3public class BlockJukeBox extends BlockContainer {
4
5 protected BlockJukeBox(int i, int j) {
6 super(i, j, Material.WOOD);
7 }
8
9 public int a(int i) {
10 return this.textureId + (i == 1 ? 1 : 0);
11 }
12
13 public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
14 if (world.getData(i, j, k) == 0) {
15 return false;
16 } else {
17 this.b_(world, i, j, k);
18 return true;
19 }
20 }
21
22 public void f(World world, int i, int j, int k, int l) {
23 if (!world.isStatic) {
24 TileEntityRecordPlayer tileentityrecordplayer = (TileEntityRecordPlayer) world.getTileEntity(i, j, k);
25
26 tileentityrecordplayer.a = l;
27 tileentityrecordplayer.update();
28 world.setData(i, j, k, 1);
29 }
30 }
31
32 public void b_(World world, int i, int j, int k) {
33 if (!world.isStatic) {
34 TileEntityRecordPlayer tileentityrecordplayer = (TileEntityRecordPlayer) world.getTileEntity(i, j, k);
35 if (tileentityrecordplayer == null) return; // CraftBukkit
36 int l = tileentityrecordplayer.a;
37
38 if (l != 0) {
39 world.e(1005, i, j, k, 0);
40 world.a((String) null, i, j, k);
41 tileentityrecordplayer.a = 0;
42 tileentityrecordplayer.update();
43 world.setData(i, j, k, 0);
44 float f = 0.7F;
45 double d0 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
46 double d1 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.2D + 0.6D;
47 double d2 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
48 EntityItem entityitem = new EntityItem(world, (double) i + d0, (double) j + d1, (double) k + d2, new ItemStack(l, 1, 0));
49
50 entityitem.pickupDelay = 10;
51 world.addEntity(entityitem);
52 }
53 }
54 }
55
56 public void remove(World world, int i, int j, int k) {
57 this.b_(world, i, j, k);
58 super.remove(world, i, j, k);
59 }
60
61 public void dropNaturally(World world, int i, int j, int k, int l, float f) {
62 if (!world.isStatic) {
63 super.dropNaturally(world, i, j, k, l, f);
64 }
65 }
66
67 protected TileEntity a_() {
68 return new TileEntityRecordPlayer();
69 }
70}