Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package net.minecraft.server;
2
3// CraftBukkit start
4
5import org.bukkit.craftbukkit.event.CraftEventFactory;
6import org.bukkit.event.block.Action;
7import org.bukkit.event.player.PlayerInteractEvent;
8// CraftBukkit end
9
10public class ItemMinecart extends Item {
11
12 public int a;
13
14 public ItemMinecart(int i, int j) {
15 super(i);
16 this.maxStackSize = 1;
17 this.a = j;
18 }
19
20 public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
21 int i1 = world.getTypeId(i, j, k);
22
23 if (BlockMinecartTrack.c(i1)) {
24 if (!world.isStatic) {
25 // CraftBukkit start - Minecarts
26 PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, i, j, k, l, itemstack);
27
28 if (event.isCancelled()) {
29 return false;
30 }
31 // CraftBukkit end
32
33 world.addEntity(new EntityMinecart(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.a));
34 }
35
36 --itemstack.count;
37 return true;
38 } else {
39 return false;
40 }
41 }
42}