summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft
diff options
context:
space:
mode:
authorAndrew Ardill <andrew.ardill@gmail.com>2011-01-24 00:10:53 +1100
committerAndrew Ardill <andrew.ardill@gmail.com>2011-01-24 00:10:53 +1100
commitab3412e8781e1f3e3f94aa2690cc95120b70a8a2 (patch)
tree8eaae09a66a97b3e6253ad522030b595536e08dc /src/main/java/net/minecraft
parenta809e4e6e32e194c288723ceb2e1534bbddea174 (diff)
downloadcraftbukkit-ab3412e8781e1f3e3f94aa2690cc95120b70a8a2.tar
craftbukkit-ab3412e8781e1f3e3f94aa2690cc95120b70a8a2.tar.gz
craftbukkit-ab3412e8781e1f3e3f94aa2690cc95120b70a8a2.tar.lz
craftbukkit-ab3412e8781e1f3e3f94aa2690cc95120b70a8a2.tar.xz
craftbukkit-ab3412e8781e1f3e3f94aa2690cc95120b70a8a2.zip
removed some potential bugs from some items
Diffstat (limited to 'src/main/java/net/minecraft')
-rw-r--r--src/main/java/net/minecraft/server/ItemFlintAndSteel.java15
-rw-r--r--src/main/java/net/minecraft/server/ItemRedstone.java9
-rw-r--r--src/main/java/net/minecraft/server/ItemSign.java9
3 files changed, 17 insertions, 16 deletions
diff --git a/src/main/java/net/minecraft/server/ItemFlintAndSteel.java b/src/main/java/net/minecraft/server/ItemFlintAndSteel.java
index 0f644ac1..2ea9eb1a 100644
--- a/src/main/java/net/minecraft/server/ItemFlintAndSteel.java
+++ b/src/main/java/net/minecraft/server/ItemFlintAndSteel.java
@@ -3,8 +3,8 @@ package net.minecraft.server;
import java.util.Random;
// CraftBukkit start
-import org.bukkit.Server;
import org.bukkit.block.BlockFace;
+import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
@@ -24,6 +24,11 @@ public class ItemFlintAndSteel extends Item {
}
public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) {
+ // CraftBukkit - store the clicked block
+ CraftWorld craftWorld = ((WorldServer) world).getWorld();
+ CraftServer craftServer = ((WorldServer) world).getServer();
+ org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
+
if (l == 0) {
j--;
}
@@ -46,24 +51,20 @@ public class ItemFlintAndSteel extends Item {
if (i1 == 0) {
// CraftBukkit start - Flint and steel
- Server server = ((WorldServer)world).getServer();
- CraftWorld cworld = ((WorldServer)world).getWorld();
-
Type eventType = Type.PLAYER_ITEM;
Player thePlayer = (Player) entityplayer.getBukkitEntity();
CraftItemStack itemInHand = new CraftItemStack(itemstack);
- org.bukkit.block.Block blockClicked = cworld.getBlockAt(i, j, k);
BlockFace blockFace = CraftBlock.notchToBlockFace(l);
PlayerItemEvent pie = new PlayerItemEvent(eventType, thePlayer, itemInHand, blockClicked, blockFace);
- server.getPluginManager().callEvent(pie);
+ craftServer.getPluginManager().callEvent(pie);
boolean preventLighter = pie.isCancelled();
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL;
BlockIgniteEvent bie = new BlockIgniteEvent(blockClicked, igniteCause, thePlayer);
- server.getPluginManager().callEvent(bie);
+ craftServer.getPluginManager().callEvent(bie);
boolean preventFire = bie.isCancelled();
diff --git a/src/main/java/net/minecraft/server/ItemRedstone.java b/src/main/java/net/minecraft/server/ItemRedstone.java
index 2119012d..e28a1525 100644
--- a/src/main/java/net/minecraft/server/ItemRedstone.java
+++ b/src/main/java/net/minecraft/server/ItemRedstone.java
@@ -19,6 +19,11 @@ public class ItemRedstone extends Item {
}
public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) {
+ // CraftBukkit - store the clicked block
+ CraftWorld craftWorld = ((WorldServer) world).getWorld();
+ CraftServer craftServer = ((WorldServer) world).getServer();
+ org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
+
if (l == 0) {
j--;
}
@@ -42,13 +47,9 @@ public class ItemRedstone extends Item {
}
if (Block.av.a(world, i, j, k)) {
// CraftBukkit start - Redstone
- CraftWorld craftWorld = ((WorldServer) world).getWorld();
- CraftServer craftServer = ((WorldServer) world).getServer();
-
Type eventType = Type.PLAYER_ITEM;
Player who = (entityplayer == null)?null:(Player)entityplayer.getBukkitEntity();
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
- org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
BlockFace blockface = CraftBlock.notchToBlockFace(1);
PlayerItemEvent pie = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockface);
diff --git a/src/main/java/net/minecraft/server/ItemSign.java b/src/main/java/net/minecraft/server/ItemSign.java
index 5950f526..e4241e95 100644
--- a/src/main/java/net/minecraft/server/ItemSign.java
+++ b/src/main/java/net/minecraft/server/ItemSign.java
@@ -28,7 +28,10 @@ public class ItemSign extends Item {
}
// CraftBukkit - store the clicked block
-
+ CraftWorld craftWorld = ((WorldServer) world).getWorld();
+ CraftServer craftServer = ((WorldServer) world).getServer();
+ org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
+
if (l == 1) {
j++;
}
@@ -50,13 +53,9 @@ public class ItemSign extends Item {
// CraftBukkit start
// Signs
- CraftWorld craftWorld = ((WorldServer) world).getWorld();
- CraftServer craftServer = ((WorldServer) world).getServer();
-
Type eventType = Type.PLAYER_ITEM;
Player who = (entityplayer == null)?null:(Player)entityplayer.getBukkitEntity();
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
- org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
BlockFace blockface = CraftBlock.notchToBlockFace(1);
PlayerItemEvent pie = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockface);