0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2024-11-25 13:56:14 +00:00
craftbukkit/nms-patches/net/minecraft/world/level/block/Block.patch
2024-10-23 02:15:00 +11:00

53 lines
2.2 KiB
Diff

--- a/net/minecraft/world/level/block/Block.java
+++ b/net/minecraft/world/level/block/Block.java
@@ -340,7 +340,13 @@
EntityItem entityitem = (EntityItem) supplier.get();
entityitem.setDefaultPickUpDelay();
- world.addFreshEntity(entityitem);
+ // CraftBukkit start
+ if (world.captureDrops != null) {
+ world.captureDrops.add(entityitem);
+ } else {
+ world.addFreshEntity(entityitem);
+ }
+ // CraftBukkit end
return;
}
}
@@ -369,7 +375,7 @@
public void playerDestroy(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, @Nullable TileEntity tileentity, ItemStack itemstack) {
entityhuman.awardStat(StatisticList.BLOCK_MINED.get(this));
- entityhuman.causeFoodExhaustion(0.005F);
+ entityhuman.causeFoodExhaustion(0.005F, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.BLOCK_MINED); // CraftBukkit - EntityExhaustionEvent
dropResources(iblockdata, world, blockposition, tileentity, entityhuman, itemstack);
}
@@ -494,15 +500,23 @@
return this.builtInRegistryHolder;
}
- protected void tryDropExperience(WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, IntProvider intprovider) {
+ // CraftBukkit start
+ protected int tryDropExperience(WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, IntProvider intprovider) {
int i = EnchantmentManager.processBlockExperience(worldserver, itemstack, intprovider.sample(worldserver.getRandom()));
if (i > 0) {
- this.popExperience(worldserver, blockposition, i);
+ // this.popExperience(worldserver, blockposition, i);
+ return i;
}
+ return 0;
}
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
+ return 0;
+ }
+ // CraftBukkit end
+
private static record a(VoxelShape first, VoxelShape second) {
public boolean equals(Object object) {