fix too lenient should skip check in ofBlocksTiered

This commit is contained in:
Glease committed 2022-08-12 21:13:32 +08:00
1 parent d33cdd79c4
commit c19ac860d4
3 files changed
+12 -6

No files matched your search

@@ -76,11 +76,9 @@ public class ConstructableUtility {
} else if (constructable instanceof ISurvivalConstructable) {
int built = ((ISurvivalConstructable) constructable)
.survivalConstruct(aStack, BUDGET, IItemSource.fromPlayer(playerMP), playerMP);
if (built > 0)
// TODO somehow notify extensions that their inventory might have been modified and need to be
// synced to client or saved
playerMP.inventory.markDirty();
else if (built == -1) {
if (built > 0) {
playerMP.addChatMessage(new ChatComponentTranslation("structurelib.autoplace.built_stat", built));
} else if (built == -1) {
playerMP.addChatMessage(new ChatComponentTranslation("structurelib.autoplace.complete"));
}
setLastUseTickToStackTag(aStack);
@@ -427,9 +427,16 @@ public class StructureUtility {
IItemSource s,
EntityPlayerMP actor,
Consumer<IChatComponent> chatter) {
if (check(t, world, x, y, z)) return PlaceResult.SKIP;
Pair<Block, Integer> hint = getHint(trigger);
if (hint == null) return PlaceResult.REJECT; // TODO or SKIP?
Block block = world.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
TIER tier = tierExtractor.convert(block, meta);
if (!Objects.equals(tier, notSet)) {
return Objects.equals(tier, tierExtractor.convert(hint.getKey(), hint.getValue()))
? PlaceResult.SKIP
: PlaceResult.REJECT;
}
return StructureUtility.survivalPlaceBlock(
hint.getKey(), hint.getValue(), world, x, y, z, s, actor, chatter);
}
@@ -28,6 +28,7 @@ item.structurelib.constructableTrigger.desc.3=(Sneak use on controller to build)
item.structurelib.constructableTrigger.desc.4=Quantity of schematics in item stack affects tier/mode/type
item.structurelib.constructableTrigger.too_fast=Please wait %d ticks before another autoplace...
structurelib.autoplace.built_stat=Built %s blocks
structurelib.autoplace.complete=§aThis multiblock has completed!
structurelib.autoplace.error.not_enabled=§cThis multiblock does not support autoplace in survival!
structurelib.autoplace.error.no_simple_block=§cSuggested to place §r%s§c but none was found