geforkt von Mirrors/Paper
03a4e7ac75
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 37262de8 PR-812: Add Registry#match(String) d6b40162 SPIGOT-4569: Add more BlockData API f9691891 PR-809: Throw a more clear error for BlockIterators with zero direction, add Vector#isZero() 91e79e19 PR-804: Added methods to get translation keys for materials, itemstacks and more 426b00d3 PR-795: Add new BiomeParameterPoint passed to BiomeProvider#getBiome 0e91ea52 SPIGOT-7224: Add events for brewing stands and campfires starting their actions CraftBukkit Changes: a50301aa5 Fix issues with fluid tag conversion and fluid #isTagged 6aeb5e4c3 SPIGOT-4569: Implement more BlockData API 7dbf862c2 PR-1131: Added methods to get translation keys for materials, itemstacks and more 7167588b1 PR-1117: Add new BiomeParameterPoint passed to BiomeProvider#getBiome 7c44152eb SPIGOT-7224: Add events for brewing stands and campfires starting their actions
55 Zeilen
3.3 KiB
Diff
55 Zeilen
3.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Wed, 2 Feb 2022 13:50:06 -0800
|
|
Subject: [PATCH] Trigger bee_nest_destroyed trigger in the correct place
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
index 17c313b9cb45c8158cab751ffc4e0dc3b7e1fa3c..796d17f51496974cfdfed2593753b8c09b5c81c1 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
@@ -419,12 +419,16 @@ public class ServerPlayerGameMode {
|
|
block.destroy(this.level, pos, iblockdata);
|
|
}
|
|
|
|
+ ItemStack mainHandStack = null; // Paper
|
|
+ boolean isCorrectTool = false; // Paper
|
|
if (this.isCreative()) {
|
|
// return true; // CraftBukkit
|
|
} else {
|
|
ItemStack itemstack = this.player.getMainHandItem();
|
|
ItemStack itemstack1 = itemstack.copy();
|
|
boolean flag1 = this.player.hasCorrectToolForDrops(iblockdata);
|
|
+ mainHandStack = itemstack1; // Paper
|
|
+ isCorrectTool = flag1; // Paper
|
|
|
|
itemstack.mineBlock(this.level, iblockdata, pos, this.player);
|
|
if (flag && flag1 && event.isDropItems()) { // CraftBukkit - Check if block should drop items
|
|
@@ -445,6 +449,13 @@ public class ServerPlayerGameMode {
|
|
if (flag && event != null) {
|
|
iblockdata.getBlock().popExperience(this.level, pos, event.getExpToDrop(), this.player); // Paper
|
|
}
|
|
+ // Paper start - trigger after items are dropped (check impls of block#playerDestroy)
|
|
+ if (mainHandStack != null) {
|
|
+ if (flag && isCorrectTool && event.isDropItems() && block instanceof net.minecraft.world.level.block.BeehiveBlock && tileentity instanceof net.minecraft.world.level.block.entity.BeehiveBlockEntity beehiveBlockEntity) { // simulates the guard on block#playerDestroy above
|
|
+ CriteriaTriggers.BEE_NEST_DESTROYED.trigger(player, iblockdata, mainHandStack, beehiveBlockEntity.getOccupantCount());
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
|
|
return true;
|
|
// CraftBukkit end
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
|
|
index 81048c54c45b77894ee1e2045870446dff7c71d4..fe7daa57119af137eeb76ca2c0e54bf7903ebbca 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
|
|
@@ -88,7 +88,7 @@ public class BeehiveBlock extends BaseEntityBlock {
|
|
this.angerNearbyBees(world, pos);
|
|
}
|
|
|
|
- CriteriaTriggers.BEE_NEST_DESTROYED.trigger((ServerPlayer) player, state, stack, tileentitybeehive.getOccupantCount());
|
|
+ // CriteriaTriggers.BEE_NEST_DESTROYED.trigger((ServerPlayer) player, state, stack, tileentitybeehive.getOccupantCount()); // Paper - moved until after items are dropped
|
|
}
|
|
|
|
}
|