summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorErik Broes <erikbroes@ripe.net>2011-02-25 21:59:35 +0100
committerErik Broes <erikbroes@ripe.net>2011-02-25 22:44:25 +0100
commit61339bcb2a1a0e5ed7b8ed58bbf0019db826243d (patch)
tree7d915dce061b4aac9d73c21b3d843bfd3e50929d /src/main/java
parent666c968dab175e45f8112ecd9c9dcd1e290b3675 (diff)
downloadcraftbukkit-61339bcb2a1a0e5ed7b8ed58bbf0019db826243d.tar
craftbukkit-61339bcb2a1a0e5ed7b8ed58bbf0019db826243d.tar.gz
craftbukkit-61339bcb2a1a0e5ed7b8ed58bbf0019db826243d.tar.lz
craftbukkit-61339bcb2a1a0e5ed7b8ed58bbf0019db826243d.tar.xz
craftbukkit-61339bcb2a1a0e5ed7b8ed58bbf0019db826243d.zip
Properly handle PLAYER_ITEM and its clickedFace.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/net/minecraft/server/NetServerHandler.java28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java
index 7b62d346..4394cc38 100644
--- a/src/main/java/net/minecraft/server/NetServerHandler.java
+++ b/src/main/java/net/minecraft/server/NetServerHandler.java
@@ -58,6 +58,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// Store the last block right clicked and what type it was
private CraftBlock lastRightClicked;
+ private BlockFace lastRightClickedFace;
private int lastMaterial;
public CraftPlayer getPlayer() {
@@ -415,28 +416,25 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
boolean flag = ((WorldServer) this.e.world).v = this.d.f.h(this.e.name);
CraftBlock blockClicked = null;
- BlockFace blockFace = null;
+ BlockFace blockFace = BlockFace.SELF;
if (packet15place.d == 255) {
// CraftBukkit ITEM_USE -- if we have a lastRightClicked then it could be a usable location
- if (packet15place.e != null && packet15place.e.id == lastMaterial) {
- blockClicked = lastRightClicked;
- } else if (lastMaterial == 0) {
- blockClicked = lastRightClicked;
+ if ((packet15place.e != null && packet15place.e.id == lastMaterial) || lastMaterial == 0) {
+ blockClicked = this.lastRightClicked;
+ blockFace = this.lastRightClickedFace;
}
- lastRightClicked = null;
- lastMaterial = 0;
+ this.lastRightClicked = null;
+ this.lastRightClickedFace = null;
+ this.lastMaterial = 0;
} else {
// CraftBukkit RIGHTCLICK or BLOCK_PLACE .. or nothing
blockClicked = (CraftBlock) ((WorldServer) e.world).getWorld().getBlockAt(packet15place.a, packet15place.b, packet15place.c);
- lastRightClicked = blockClicked;
- lastMaterial = (packet15place.e == null) ? 0 : packet15place.e.id;
- }
-
- if (blockClicked != null && itemstack != null) {
blockFace = CraftBlock.notchToBlockFace(packet15place.d);
- } else {
- blockFace = BlockFace.SELF;
+
+ this.lastRightClicked = blockClicked;
+ this.lastMaterial = (packet15place.e == null) ? 0 : packet15place.e.id;
+ this.lastRightClickedFace = blockFace;
}
// CraftBukkit if rightclick decremented the item, always send the update packet.
@@ -484,6 +482,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
int j = packet15place.b;
int k = packet15place.c;
int l = packet15place.d;
+
// CraftBukkit
ChunkCoordinates chunkcoordinates = this.e.world.l();
int i1 = (int) MathHelper.e((float) (i - chunkcoordinates.a));
@@ -502,6 +501,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.e.c.a(this.e, this.e.world, itemstack, i, j, k, l);
this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world)));
// CraftBukkit end
+
if (l == 0) {
--j;
}