diff options
author | durron597 <martin.jared@gmail.com> | 2011-01-05 04:54:23 -0500 |
---|---|---|
committer | durron597 <martin.jared@gmail.com> | 2011-01-05 04:54:23 -0500 |
commit | 3df833797b6d13b328aad74f3c2f2753f0b461d8 (patch) | |
tree | 252f844b8d0537f5cbfa3776a124b956768233fe /src/main/java/net/minecraft/server/NetServerHandler.java | |
parent | 4c483edf08b2bc893da6d560f6c089f04e3c4bcf (diff) | |
download | craftbukkit-3df833797b6d13b328aad74f3c2f2753f0b461d8.tar craftbukkit-3df833797b6d13b328aad74f3c2f2753f0b461d8.tar.gz craftbukkit-3df833797b6d13b328aad74f3c2f2753f0b461d8.tar.lz craftbukkit-3df833797b6d13b328aad74f3c2f2753f0b461d8.tar.xz craftbukkit-3df833797b6d13b328aad74f3c2f2753f0b461d8.zip |
Beginnings of block_placed
Diffstat (limited to 'src/main/java/net/minecraft/server/NetServerHandler.java')
-rw-r--r-- | src/main/java/net/minecraft/server/NetServerHandler.java | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index 033e36c9..7cfe5ff5 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -1,9 +1,9 @@ package net.minecraft.server; - import java.util.*; import java.util.logging.Logger; import org.bukkit.Location; +import org.bukkit.craftbukkit.CraftBlock; import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.Event.Type; @@ -289,11 +289,39 @@ implements ICommandListener { } d.e.B = false; } + + // Craftbukkit start + CraftBlock lastRightClicked; + // Craftbukkit stop public void a(Packet15Place packet15place) { ItemStack itemstack = e.an.e(); boolean flag = d.e.B = d.f.g(e.aw); + // Craftbukkit start + CraftBlock blockClicked = null; + CraftBlock blockPlaced = null; + + if (packet15place.d == 255) { + // ITEM_USE -- if we have a lastRightClicked then it could be a usable location + blockClicked = lastRightClicked; + lastRightClicked = null; + } else { + // RIGHTCLICK or BLOCK_PLACE .. or nothing + blockClicked = (CraftBlock) d.e.getWorld().getBlockAt(packet15place.a, packet15place.b, packet15place.c); + // TODO: we don't have "faceclicked" concept in bukkit + // blockClicked.setFaceClicked(Block.Face.fromId(paramgt.d)); + lastRightClicked = blockClicked; + } + + // If we clicked on something then we also have a location to place the block + if (blockClicked != null && itemstack != null) { + blockPlaced = (CraftBlock) blockClicked.getFace(CraftBlock.notchToBlockFace(packet15place.d)); + // TODO: in hMod we've set the new type already. We haven't yet here. + // blockPlaced = new Block( localil.c, blockClicked.getX(), blockClicked.getY(), blockClicked.getZ()); + } + // Craftbukkit stop + if (packet15place.d == 255) { if (itemstack == null) { return; |