mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 11:44:19 +01:00
Rework skull dropping. Fixes BUKKIT-2930 and BUKKIT-2820
Skulls need their tile entity in order to create an item correctly when broken unlike every other block. Instead of sprinkling special cases all over the code just override dropNaturally for skulls to read from their tile entity and make sure everything that wants to drop them calls this method before removing the block. There is only one case where this wasn't already true so we end up with much less special casing. By: Travis Watkins <amaranth@ubuntu.com>
This commit is contained in:
parent
77e811ab06
commit
6af16dde2e
2 changed files with 1 additions and 9 deletions
|
@ -1084,11 +1084,7 @@ public class CraftWorld implements World {
|
||||||
int blockY = block.getY();
|
int blockY = block.getY();
|
||||||
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
|
||||||
int data = block.getData();
|
net.minecraft.server.Block.byId[blockId].dropNaturally(this.world, blockX, blockY, blockZ, block.getData(), yield, 0);
|
||||||
if (blockId == net.minecraft.server.Block.SKULL.id) {
|
|
||||||
data = net.minecraft.server.Block.SKULL.getDropData(this.world, blockX, blockY, blockZ);
|
|
||||||
}
|
|
||||||
net.minecraft.server.Block.byId[blockId].dropNaturally(this.world, blockX, blockY, blockZ, data, yield, 0);
|
|
||||||
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
|
||||||
|
|
|
@ -348,10 +348,6 @@ public class CraftBlock implements Block {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
|
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
if (block.id == net.minecraft.server.Block.SKULL.id) {
|
|
||||||
data = (byte) block.getDropData(chunk.getHandle().world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
block.dropNaturally(chunk.getHandle().world, x, y, z, data, 1.0F, 0);
|
block.dropNaturally(chunk.getHandle().world, x, y, z, data, 1.0F, 0);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue