Archiviert
13
0
Dieser Commit ist enthalten in:
Taylor Kelly 2011-01-10 09:57:47 +08:00 committet von Dinner Bone
Ursprung 21e7f1c440
Commit e5d7a46029
4 geänderte Dateien mit 31 neuen und 15 gelöschten Zeilen

Datei anzeigen

@ -3,15 +3,17 @@ package net.minecraft.server;
public class ItemInWorldManager { public class ItemInWorldManager {
private World b; private World b; //currWorld
public EntityPlayer a; public EntityPlayer a; //currPlayer
private float c; private float c; // not used?
private float d; //Craftbukkit start
private int e; public float d; // blockDamage (0 up to 1) //Craftbukkit - Made public to get damage
private float f; //Craftbukkit stop
private int g; private int e; // funny counter
private int h; private float f; // blockHits
private int i; private int g; //posX
private int h; //posY
private int i; //posZ
public ItemInWorldManager(World world) { public ItemInWorldManager(World world) {
d = 0.0F; d = 0.0F;

Datei anzeigen

@ -233,6 +233,13 @@ public class NetServerHandler extends NetHandler
e.a.b(new Packet13PlayerLookMove(d1, d2 + 1.6200000047683716D, d2, d3, f1, f2, false)); e.a.b(new Packet13PlayerLookMove(d1, d2 + 1.6200000047683716D, d2, d3, f1, f2, false));
} }
// CraftBukkit start
// Get position of last block hit for BlockDamageLevel.STOPPED
private int lastX;
private int lastY;
private int lastZ;
// Craftbukkit stop
public void a(Packet14BlockDig packet14blockdig) { public void a(Packet14BlockDig packet14blockdig) {
if (packet14blockdig.e == 4) { if (packet14blockdig.e == 4) {
e.L(); e.L();
@ -296,6 +303,9 @@ public class NetServerHandler extends NetHandler
} }
} }
} else if (packet14blockdig.e == 2) { } else if (packet14blockdig.e == 2) {
// Get last block that the player hit
// Otherwise the block is a Bedrock @(0,0,0)
block = (CraftBlock) player.getWorld().getBlockAt(lastX, lastY, lastZ);
BlockDamagedEvent event = new BlockDamagedEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.STOPPED, player); BlockDamagedEvent event = new BlockDamagedEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.STOPPED, player);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
@ -326,6 +336,9 @@ public class NetServerHandler extends NetHandler
e.a.b(new Packet53BlockChange(l, i1, j1, d.e)); e.a.b(new Packet53BlockChange(l, i1, j1, d.e));
} }
} }
lastX = l;
lastY = i1;
lastZ = j1;
// Craftbukkit stop // Craftbukkit stop
d.e.B = false; d.e.B = false;

Datei anzeigen

@ -1,5 +1,6 @@
package org.bukkit.craftbukkit; package org.bukkit.craftbukkit;
import java.util.ArrayList;
import net.minecraft.server.InventoryPlayer; import net.minecraft.server.InventoryPlayer;
import org.bukkit.ItemStack; import org.bukkit.ItemStack;
@ -14,15 +15,15 @@ public class CraftInventoryPlayer extends CraftInventory implements PlayerInvent
return (InventoryPlayer) inventory; return (InventoryPlayer) inventory;
} }
public CraftItemStack[] getArmorContents() { public ArrayList<ItemStack> getArmorContents() {
net.minecraft.server.ItemStack[] mcItems = getInventory().getArmorContents(); net.minecraft.server.ItemStack[] mcItems = getInventory().getArmorContents();
CraftItemStack[] items = new CraftItemStack[mcItems.length]; ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
for (int i = 0; i < mcItems.length; i++ ) { for (int i = 0; i < mcItems.length; i++ ) {
items[i] = new CraftItemStack(mcItems[i]); ret.add(new CraftItemStack(mcItems[i]));
} }
return items; return ret;
} }
public int getSize() { public int getSize() {