geforkt von Mirrors/Paper
89d51d5f29
Because this exploit has been widely known for years and has not been fixed by Mojang, we decided that it was worth allowing people to toggle it on/off due to how easy it is to make it configurable. It should be noted that this decision does not promise all future exploits will be configurable.
55 Zeilen
3.6 KiB
Diff
55 Zeilen
3.6 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 4fe571915b247ec612b2376dce57991e441f63c2..8f4c9b99b638cfce8cc7c55f6369f62e757f4e48 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
@@ -421,12 +421,16 @@ public class ServerPlayerGameMode {
|
|
block.destroy(this.level, pos, iblockdata1);
|
|
}
|
|
|
|
+ ItemStack mainHandStack = null; // Paper - Trigger bee_nest_destroyed trigger in the correct place
|
|
+ boolean isCorrectTool = false; // Paper - Trigger bee_nest_destroyed trigger in the correct place
|
|
if (this.isCreative()) {
|
|
// return true; // CraftBukkit
|
|
} else {
|
|
ItemStack itemstack = this.player.getMainHandItem();
|
|
ItemStack itemstack1 = itemstack.copy();
|
|
boolean flag1 = this.player.hasCorrectToolForDrops(iblockdata1);
|
|
+ mainHandStack = itemstack1; // Paper - Trigger bee_nest_destroyed trigger in the correct place
|
|
+ isCorrectTool = flag1; // Paper - Trigger bee_nest_destroyed trigger in the correct place
|
|
|
|
itemstack.mineBlock(this.level, iblockdata1, pos, this.player);
|
|
if (flag && flag1 && event.isDropItems()) { // CraftBukkit - Check if block should drop items
|
|
@@ -447,6 +451,13 @@ public class ServerPlayerGameMode {
|
|
if (flag && event != null) {
|
|
iblockdata.getBlock().popExperience(this.level, pos, event.getExpToDrop(), this.player); // Paper
|
|
}
|
|
+ // Paper start - Trigger bee_nest_destroyed trigger in the correct place (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 - Trigger bee_nest_destroyed trigger in the correct place
|
|
|
|
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 27f1c1ac12251f1438ee8bf14f4afb5fe601138f..799e44ae5a7c3d6994653d43d455c39f3e30b012 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
|
|
@@ -95,7 +95,7 @@ public class BeehiveBlock extends BaseEntityBlock {
|
|
this.angerNearbyBees(world, pos);
|
|
}
|
|
|
|
- CriteriaTriggers.BEE_NEST_DESTROYED.trigger((ServerPlayer) player, state, tool, tileentitybeehive.getOccupantCount());
|
|
+ // CriteriaTriggers.BEE_NEST_DESTROYED.trigger((ServerPlayer) player, state, tool, tileentitybeehive.getOccupantCount()); // Paper - Trigger bee_nest_destroyed trigger in the correct place; moved until after items are dropped
|
|
}
|
|
|
|
}
|