Skip to content

Commit

Permalink
better layer range check hint for `tweakmSchematicBlockPlacementRestr…
Browse files Browse the repository at this point in the history
…iction`

in_margin -> outside_the_layer
  • Loading branch information
Fallen-Breath committed Jun 18, 2022
1 parent 5f2978a commit ead6285
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,6 @@ public static boolean canDoBlockPlacement(MinecraftClient mc, ItemPlacementConte
return true;
}

// If the target pos is outside the layer range (within margin range), cancel
if (!layerRange.isPositionWithinRange(pos))
{
if (hintType.showNotPossible)
{
info("in_margin");
}
return false;
}

World schematicWorld = SchematicWorldHandler.getSchematicWorld();
World clientWorld = mc.world;

Expand Down Expand Up @@ -90,6 +80,16 @@ public static boolean canDoBlockPlacement(MinecraftClient mc, ItemPlacementConte
return false;
}

// If the target pos is outside the layer range, cancel
if (!layerRange.isPositionWithinRange(pos))
{
if (hintType.showNotPossible)
{
info("outside_the_layer");
}
return false;
}

// check if the player is using the right item stack for block placement
if (EntityUtils.getUsedHandForItem(mc.player, schematicStack) == null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/tweakermore/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"tweakermore.config.tweakmSchematicBlockPlacementRestriction": "tweakmSchematicBlockPlacementRestriction",
"tweakermore.config.tweakmSchematicBlockPlacementRestriction.comment": "Similar to litematica's placementRestriction option, it cancels block placement when the placement doesn't match current schematic\nUnlike litematica's implementation, it uses a simple and accurate constraint strategy,\nit works nicely with tweakeroo's placement tweaks\nDoes not work with litematica's or easy place mode",
"tweakermore.config.tweakmSchematicBlockPlacementRestriction.pretty_name": "Schematic Block Placement Restriction",
"tweakermore.config.tweakmSchematicBlockPlacementRestriction.in_margin": "Block placement not allowed (in margin)",
"tweakermore.config.tweakmSchematicBlockPlacementRestriction.outside_the_layer": "Block placement not allowed (outside the layer)",
"tweakermore.config.tweakmSchematicBlockPlacementRestriction.is_air": "Block placement not allowed (is air)",
"tweakermore.config.tweakmSchematicBlockPlacementRestriction.no_block": "No item for %1$s",
"tweakermore.config.tweakmSchematicBlockPlacementRestriction.wrong_item": "Require %1$s",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/tweakermore/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"tweakermore.config.tweakmSchematicBlockPlacementRestriction": "原理图方块放置限制",
"tweakermore.config.tweakmSchematicBlockPlacementRestriction.comment": "与litematica的放置限制(placementRestriction)选项类似,它将取消与原理图不匹配的方块的放置\n但与litematica的实现不同的是,它使用了一个简单又准确的约束策略,\n可以完美地与tweakeroo的方块放置功能兼容\n在litematica的放置限制或轻松放置开启时无效",
"tweakermore.config.tweakmSchematicBlockPlacementRestriction.pretty_name": "原理图方块放置限制",
"tweakermore.config.tweakmSchematicBlockPlacementRestriction.in_margin": "此处不允许方块放置 (边缘保护)",
"tweakermore.config.tweakmSchematicBlockPlacementRestriction.outside_the_layer": "此处不允许方块放置 (位于渲染层外)",
"tweakermore.config.tweakmSchematicBlockPlacementRestriction.is_air": "此处不允许方块放置 (不存在方块)",
"tweakermore.config.tweakmSchematicBlockPlacementRestriction.no_block": "%1$s不存在对应的物品",
"tweakermore.config.tweakmSchematicBlockPlacementRestriction.wrong_item": "需要%1$s",
Expand Down

0 comments on commit ead6285

Please sign in to comment.