summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/ItemMinecart.java
diff options
context:
space:
mode:
authorTahg <tahgtahv@gmail.com>2011-01-09 15:01:25 -0500
committerTahg <tahgtahv@gmail.com>2011-01-09 15:01:25 -0500
commitd3b87965c3a90386abb21811e11ad8c5a2d62fce (patch)
tree75315bcdf4510ab5938b63f0d26a6929459d6ff2 /src/main/java/net/minecraft/server/ItemMinecart.java
parent45c70131167d6757956f2dd5e0f77cea6620e0b5 (diff)
parent3d8263f9f89dd94c2abdd3293ab62ca3dd0d8f05 (diff)
downloadcraftbukkit-d3b87965c3a90386abb21811e11ad8c5a2d62fce.tar
craftbukkit-d3b87965c3a90386abb21811e11ad8c5a2d62fce.tar.gz
craftbukkit-d3b87965c3a90386abb21811e11ad8c5a2d62fce.tar.lz
craftbukkit-d3b87965c3a90386abb21811e11ad8c5a2d62fce.tar.xz
craftbukkit-d3b87965c3a90386abb21811e11ad8c5a2d62fce.zip
Merge branch 'master' of https://github.com/Bukkit/CraftBukkit
Diffstat (limited to 'src/main/java/net/minecraft/server/ItemMinecart.java')
-rw-r--r--src/main/java/net/minecraft/server/ItemMinecart.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/ItemMinecart.java b/src/main/java/net/minecraft/server/ItemMinecart.java
new file mode 100644
index 00000000..dfbd443b
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ItemMinecart.java
@@ -0,0 +1,45 @@
+package net.minecraft.server;
+
+import org.bukkit.craftbukkit.CraftBlock;
+import org.bukkit.craftbukkit.CraftItemStack;
+import org.bukkit.craftbukkit.CraftPlayer;
+import org.bukkit.event.Event.Type;
+import org.bukkit.event.player.PlayerItemEvent;
+
+
+public class ItemMinecart extends Item {
+
+ public int a;
+
+ public ItemMinecart(int i, int j) {
+ super(i);
+ aX = 1;
+ a = j;
+ }
+
+ public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) {
+ int i1 = world.a(i, j, k);
+
+ if (i1 == Block.aG.bh) {
+ // Craftbukkit start
+ // Minecarts
+ CraftBlock blockClicked = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
+ CraftItemStack itemInHand = new CraftItemStack(itemstack);
+ CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer);
+ PlayerItemEvent pie = new PlayerItemEvent(Type.PLAYER_ITEM, thePlayer, itemInHand, blockClicked, CraftBlock.notchToBlockFace(l));
+
+ ((WorldServer) world).getServer().getPluginManager().callEvent(pie);
+
+ if (pie.isCancelled()) return false;
+
+ if (!world.z) {
+ world.a(new EntityMinecart(world, (float) i + 0.5F, (float) j + 0.5F, (float) k + 0.5F, a));
+ }
+ itemstack.a--;
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
+