mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-29 11:59:17 +00:00
fix: fix block place desync due to update suppression(#506)
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MC_XiaoHei <xor7xiaohei@gmail.com>
|
||||
Date: Sat, 5 Jul 2025 09:48:47 +0800
|
||||
Subject: [PATCH] Fix block place desync due to update suppression
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java
|
||||
index 1356af3e5dfeb9f3a3bb1bcff9109d49c795729d..c5ced8acc1c1f1a6b1082f3deee990d1a8a8c677 100644
|
||||
--- a/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/net/minecraft/world/item/ItemStack.java
|
||||
@@ -389,8 +389,12 @@ public final class ItemStack implements DataComponentHolder {
|
||||
}
|
||||
}
|
||||
InteractionResult interactionResult;
|
||||
+ org.leavesmc.leaves.util.UpdateSuppressionException ue = null;
|
||||
try {
|
||||
interactionResult = item.useOn(context);
|
||||
+ } catch (org.leavesmc.leaves.util.UpdateSuppressionException te) {
|
||||
+ interactionResult = net.minecraft.world.InteractionResult.SUCCESS.configurePaper(e -> e.placedBlockAt(clickedPos.immutable()));
|
||||
+ ue = te;
|
||||
} finally {
|
||||
serverLevel.captureBlockStates = false;
|
||||
}
|
||||
@@ -537,6 +541,7 @@ public final class ItemStack implements DataComponentHolder {
|
||||
serverLevel.capturedBlockStates.clear();
|
||||
// CraftBukkit end
|
||||
|
||||
+ if (ue != null) throw ue;
|
||||
return interactionResult;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user