From 7976b3a64d0ac272e87764e0c695969c095909ab Mon Sep 17 00:00:00 2001 From: XiaoMoMi <972454774@qq.com> Date: Mon, 6 Oct 2025 23:39:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=87=AA=E5=8A=A8=E5=88=86?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/configuration/blocks/palm_tree.yml | 5 ++++- .../allocator/VisualBlockStateAllocator.java | 17 ++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/common-files/src/main/resources/resources/default/configuration/blocks/palm_tree.yml b/common-files/src/main/resources/resources/default/configuration/blocks/palm_tree.yml index 6002d41ac..1e2e8afd7 100644 --- a/common-files/src/main/resources/resources/default/configuration/blocks/palm_tree.yml +++ b/common-files/src/main/resources/resources/default/configuration/blocks/palm_tree.yml @@ -154,6 +154,9 @@ items: fuel-time: 100 data: item-name: + lore: + - "Requires the datapack tree configuration to function." + - "If not configured, an oak tree will grow by default." model: template: default:model/generated arguments: @@ -171,7 +174,7 @@ items: - minecraft:farmland - minecraft:sand - type: sapling_block - feature: minecraft:fancy_oak + feature: minecraft:fancy_oak # use custom tree configuration here bone-meal-success-chance: 0.45 loot: template: default:loot_table/self diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/allocator/VisualBlockStateAllocator.java b/core/src/main/java/net/momirealms/craftengine/core/pack/allocator/VisualBlockStateAllocator.java index 7087b55d2..9c729bc97 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/allocator/VisualBlockStateAllocator.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/allocator/VisualBlockStateAllocator.java @@ -91,6 +91,7 @@ public class VisualBlockStateAllocator { // 如果候选满足组,那么直接允许起飞 if (pair.left().test(candidate.blockState())) { pair.right().complete(candidate.blockState()); + candidate.setUsed(); } else { // 不满足候选组要求,那就等着分配新的吧 } @@ -109,13 +110,15 @@ public class VisualBlockStateAllocator { for (AutoStateGroup group : AutoStateGroup.values()) { List>> pendingAllocationFuture = this.pendingAllocationFutures[group.ordinal()]; for (Pair> pair : pendingAllocationFuture) { - BlockStateCandidate nextCandidate = group.findNextCandidate(); - if (nextCandidate != null) { - nextCandidate.setUsed(); - this.cachedBlockStates.put(pair.left(), nextCandidate.blockState()); - pair.right().complete(nextCandidate.blockState()); - } else { - pair.right().completeExceptionally(new StateExhaustedException(group)); + if (!pair.right().isDone()) { + BlockStateCandidate nextCandidate = group.findNextCandidate(); + if (nextCandidate != null) { + nextCandidate.setUsed(); + this.cachedBlockStates.put(pair.left(), nextCandidate.blockState()); + pair.right().complete(nextCandidate.blockState()); + } else { + pair.right().completeExceptionally(new StateExhaustedException(group)); + } } } }