geforkt von Mirrors/Paper
Reverting the Drop API for now, we need to re-evalute this as it is causing too many issues and blocking releases.
This reverts commits: - d2d03afc8854394aeefb40ea5ebf224c8032b19f - 6245746e91123dd8ef70e5f15b7cdfc7e36d8e8c - 41fae5c613e9e69a8f6bdf33b23bb09d7f407433 - c34bdecab42cf4098054a5ea43e1c2958d44ae92 - d7445084ac9a90fa0b66d8b050b8d0d2a062eaf3 - 6a6ed2e6ae2328a8a791bcc6857c44dc6c6a7030 - a783bc4dc95da8e26c673abe48fad96b550aba28 - cb50fd68766df8e07631ba5be85759f8257e8068 - 34dfff2ad5c407c712b2783f02960aac5e8649f2 - f33b513820de987b49a4338e85df80968217a601 - 5fd9fdfde055e6eb6a83db246d009b69377b7c94 - 2795b116f40d06551fbb7b96d1963c0ddbeac384 By: Warren Loo <evilseph@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
0ebe730fce
Commit
33284b8b86
@ -1056,7 +1056,6 @@ public class CraftWorld implements World {
|
|||||||
int blockZ = block.getZ();
|
int blockZ = block.getZ();
|
||||||
// following code is lifted from Explosion.a(boolean), and modified
|
// following code is lifted from Explosion.a(boolean), and modified
|
||||||
net.minecraft.server.Block.byId[blockId].dropNaturally(this.world, blockX, blockY, blockZ, block.getData(), yield, 0);
|
net.minecraft.server.Block.byId[blockId].dropNaturally(this.world, blockX, blockY, blockZ, block.getData(), yield, 0);
|
||||||
net.minecraft.server.Block.byId[blockId].doActualDrop(this.world, blockX, blockY, blockZ);
|
|
||||||
block.setType(org.bukkit.Material.AIR);
|
block.setType(org.bukkit.Material.AIR);
|
||||||
// not sure what this does, seems to have something to do with the 'base' material of a block.
|
// not sure what this does, seems to have something to do with the 'base' material of a block.
|
||||||
// For example, WOODEN_STAIRS does something with WOOD in this method
|
// For example, WOODEN_STAIRS does something with WOOD in this method
|
||||||
|
@ -18,7 +18,6 @@ import org.bukkit.block.BlockFace;
|
|||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.PistonMoveReaction;
|
import org.bukkit.block.PistonMoveReaction;
|
||||||
import org.bukkit.craftbukkit.CraftChunk;
|
import org.bukkit.craftbukkit.CraftChunk;
|
||||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.metadata.MetadataValue;
|
import org.bukkit.metadata.MetadataValue;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@ -348,7 +347,7 @@ public class CraftBlock implements Block {
|
|||||||
|
|
||||||
setTypeId(Material.AIR.getId());
|
setTypeId(Material.AIR.getId());
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
block.b(chunk.getHandle().world, x, y, z, data, 0);
|
block.dropNaturally(chunk.getHandle().world, x, y, z, data, 1.0F, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -20,7 +20,6 @@ import net.minecraft.server.InventoryCrafting;
|
|||||||
import net.minecraft.server.Item;
|
import net.minecraft.server.Item;
|
||||||
import net.minecraft.server.ItemStack;
|
import net.minecraft.server.ItemStack;
|
||||||
import net.minecraft.server.Packet101CloseWindow;
|
import net.minecraft.server.Packet101CloseWindow;
|
||||||
import net.minecraft.server.Packet53BlockChange;
|
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
import net.minecraft.server.WorldServer;
|
import net.minecraft.server.WorldServer;
|
||||||
|
|
||||||
@ -511,49 +510,4 @@ public class CraftEventFactory {
|
|||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final List<org.bukkit.inventory.ItemStack> drops = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
|
|
||||||
|
|
||||||
public static boolean callBlockBreakEvent(World world, int x, int y, int z, int id, int data, boolean creative, EntityHuman player) {
|
|
||||||
net.minecraft.server.Block blockType = net.minecraft.server.Block.byId[id];
|
|
||||||
if (blockType == null) { // Illegal block ID
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tell client the block is gone immediately then process events
|
|
||||||
if (world.getTileEntity(x, y, z) == null) {
|
|
||||||
Packet53BlockChange packet = new Packet53BlockChange(x, y, z, world);
|
|
||||||
|
|
||||||
packet.material = 0;
|
|
||||||
packet.data = 0;
|
|
||||||
((EntityPlayer) player).netServerHandler.sendPacket(packet);
|
|
||||||
}
|
|
||||||
|
|
||||||
Block block = world.getWorld().getBlockAt(x, y, z);
|
|
||||||
List<ItemStack> toDrop = blockType.calculateDrops(world, player, x, y, z, data);
|
|
||||||
drops.clear();
|
|
||||||
|
|
||||||
if (!creative && player.b(blockType)) {
|
|
||||||
for (ItemStack stack : toDrop) {
|
|
||||||
drops.add(new CraftItemStack(stack));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BlockBreakEvent event = new BlockBreakEvent(block, (org.bukkit.entity.Player) player.getBukkitEntity(), drops);
|
|
||||||
world.getServer().getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
toDrop.clear();
|
|
||||||
// Let the client know the block still exists
|
|
||||||
((EntityPlayer) player).netServerHandler.sendPacket(new Packet53BlockChange(x, y, z, world));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
toDrop.clear();
|
|
||||||
for (org.bukkit.inventory.ItemStack stack : drops) {
|
|
||||||
toDrop.add(CraftItemStack.createNMSItemStack(stack));
|
|
||||||
}
|
|
||||||
|
|
||||||
return false; // Event not cancelled
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren