9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-19 15:09:15 +00:00

修复自动分配

This commit is contained in:
XiaoMoMi
2025-10-06 23:39:37 +08:00
parent 67f8e0d5e7
commit 7976b3a64d
2 changed files with 14 additions and 8 deletions

View File

@@ -154,6 +154,9 @@ items:
fuel-time: 100 fuel-time: 100
data: data:
item-name: <!i><i18n:item.palm_sapling> item-name: <!i><i18n:item.palm_sapling>
lore:
- "<!i><gray>Requires the datapack tree configuration to function."
- "<!i><gray>If not configured, an oak tree will grow by default."
model: model:
template: default:model/generated template: default:model/generated
arguments: arguments:
@@ -171,7 +174,7 @@ items:
- minecraft:farmland - minecraft:farmland
- minecraft:sand - minecraft:sand
- type: sapling_block - type: sapling_block
feature: minecraft:fancy_oak feature: minecraft:fancy_oak # use custom tree configuration here
bone-meal-success-chance: 0.45 bone-meal-success-chance: 0.45
loot: loot:
template: default:loot_table/self template: default:loot_table/self

View File

@@ -91,6 +91,7 @@ public class VisualBlockStateAllocator {
// 如果候选满足组,那么直接允许起飞 // 如果候选满足组,那么直接允许起飞
if (pair.left().test(candidate.blockState())) { if (pair.left().test(candidate.blockState())) {
pair.right().complete(candidate.blockState()); pair.right().complete(candidate.blockState());
candidate.setUsed();
} else { } else {
// 不满足候选组要求,那就等着分配新的吧 // 不满足候选组要求,那就等着分配新的吧
} }
@@ -109,13 +110,15 @@ public class VisualBlockStateAllocator {
for (AutoStateGroup group : AutoStateGroup.values()) { for (AutoStateGroup group : AutoStateGroup.values()) {
List<Pair<String, CompletableFuture<BlockStateWrapper>>> pendingAllocationFuture = this.pendingAllocationFutures[group.ordinal()]; List<Pair<String, CompletableFuture<BlockStateWrapper>>> pendingAllocationFuture = this.pendingAllocationFutures[group.ordinal()];
for (Pair<String, CompletableFuture<BlockStateWrapper>> pair : pendingAllocationFuture) { for (Pair<String, CompletableFuture<BlockStateWrapper>> pair : pendingAllocationFuture) {
BlockStateCandidate nextCandidate = group.findNextCandidate(); if (!pair.right().isDone()) {
if (nextCandidate != null) { BlockStateCandidate nextCandidate = group.findNextCandidate();
nextCandidate.setUsed(); if (nextCandidate != null) {
this.cachedBlockStates.put(pair.left(), nextCandidate.blockState()); nextCandidate.setUsed();
pair.right().complete(nextCandidate.blockState()); this.cachedBlockStates.put(pair.left(), nextCandidate.blockState());
} else { pair.right().complete(nextCandidate.blockState());
pair.right().completeExceptionally(new StateExhaustedException(group)); } else {
pair.right().completeExceptionally(new StateExhaustedException(group));
}
} }
} }
} }