Archiviert
13
0

Beginnings of block_placed

Dieser Commit ist enthalten in:
durron597 2011-01-05 04:54:23 -05:00
Ursprung 4c483edf08
Commit 3df833797b

Datei anzeigen

@ -1,9 +1,9 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.*; import java.util.*;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftPlayer; import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
@ -290,10 +290,38 @@ implements ICommandListener {
d.e.B = false; d.e.B = false;
} }
// Craftbukkit start
CraftBlock lastRightClicked;
// Craftbukkit stop
public void a(Packet15Place packet15place) { public void a(Packet15Place packet15place) {
ItemStack itemstack = e.an.e(); ItemStack itemstack = e.an.e();
boolean flag = d.e.B = d.f.g(e.aw); 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 (packet15place.d == 255) {
if (itemstack == null) { if (itemstack == null) {
return; return;