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
data:
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:
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

View File

@@ -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<Pair<String, CompletableFuture<BlockStateWrapper>>> pendingAllocationFuture = this.pendingAllocationFutures[group.ordinal()];
for (Pair<String, CompletableFuture<BlockStateWrapper>> 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));
}
}
}
}