From 680acfdc8f489af894031739e53f10a90c1f5ae7 Mon Sep 17 00:00:00 2001 From: Fallen_Breath Date: Mon, 22 Jun 2020 20:11:03 +0800 Subject: [PATCH 1/4] zh_cn.json update (#343) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * qc激活->半连接激活 * Update zh_cn.json * ui.rule_%(rule)s_not_set_restart * added quotation marks to rule translation display --- src/main/resources/assets/carpet/lang/zh_cn.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/resources/assets/carpet/lang/zh_cn.json b/src/main/resources/assets/carpet/lang/zh_cn.json index ef0c0124..248faac4 100644 --- a/src/main/resources/assets/carpet/lang/zh_cn.json +++ b/src/main/resources/assets/carpet/lang/zh_cn.json @@ -1,8 +1,8 @@ { - "rule.antiCheatDisabled.name": "移动检测通杀", + "rule.antiCheatDisabled.name": "禁用反作弊移动监测", "rule.antiCheatDisabled.desc": "防止玩家因为“本服务器未启用飞行”,“移动过快”等原因被踢出", - "rule.carpets.name": "放置地毯执行功能", + "rule.carpets.name": "多功能地毯", "rule.carpets.desc": "通过放置地毯方块快捷执行部分功能", "rule.combineXPOrbs.name": "经验球合并", @@ -135,7 +135,7 @@ "rule.pushLimit.desc": "自定义活塞推动上限", "rule.pushLimit.extra.0": "你必须在1-1024中选取一个值", - "rule.quasiConnectivity.name": "qC激活开关", + "rule.quasiConnectivity.name": "半连接激活开关", "rule.quasiConnectivity.desc": "活塞,发射器和投掷器在他们上方方块激活时是否响应", "rule.quasiConnectivity.extra.0": "设置为true为开启 设置为false为禁用", @@ -228,7 +228,8 @@ "ui.tags": "分类", "ui.change_permanently": "永久更改", "ui.click_to_keep_the_settings_in_%(conf)s_to_save_across_restarts": "点击此按钮以使此选项保存于%s,重启后依旧生效", - "ui.rule_%(rule)s_will_now_default_to_%(value)s": "规则%s将会被默认设置为%s", + "ui.rule_%(rule)s_will_now_default_to_%(value)s": "规则“%s”将会被默认设置为%s", + "ui.rule_%(rule)s_not_set_restart": "规则“%s”将在重启后恢复默认值", "ui.current_value": "当前的值" } \ No newline at end of file From eddc638b88a956094e49b0e9bbcfef303cbab2e9 Mon Sep 17 00:00:00 2001 From: TheCatSaber <66741113+TheCatSaber@users.noreply.github.com> Date: Mon, 22 Jun 2020 13:11:26 +0100 Subject: [PATCH 2/4] Corrected grammar and use of parentheses (#344) --- docs/scarpet/language/VariablesAndConstants.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/scarpet/language/VariablesAndConstants.md b/docs/scarpet/language/VariablesAndConstants.md index e3478327..f45f46b8 100644 --- a/docs/scarpet/language/VariablesAndConstants.md +++ b/docs/scarpet/language/VariablesAndConstants.md @@ -17,9 +17,9 @@ block positions. All variables starting with `_` are read-only, and cannot be de `scarpet` accepts numeric and string liters constants. Numbers look like `1, 2.5, -3e-7, 0xff,` and are internally represented as Java's `double` but `scarpet` will try to trim trailing zeros as much as possible so if you need to -use them as intergers, you can. Strings using single quoting, for multiple reasons, but primarily to allow for +use them as intergers, you can. Strings use single quoting, for multiple reasons, but primarily to allow for easier use of strings inside doubly quoted command arguments (when passing a script as a parameter of `/script fill` -for example, or when typing in jsons inside scarpet to feed back into a `/data merge` command for example. +for example), or when typing in jsons inside scarpet (to feed back into a `/data merge` command for example). Strings also use backslashes `\` for quoting special characters, in both plain strings and regular expressions

From 12309e9e2d45e30d46fd3d8b425a65b0824024ef Mon Sep 17 00:00:00 2001
From: gnembon 
Date: Mon, 22 Jun 2020 16:21:55 -0300
Subject: [PATCH 3/4] making sure try, return etc. control flow doesn't leak
 through in_dimension.

---
 src/main/java/carpet/script/CarpetExpression.java | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/main/java/carpet/script/CarpetExpression.java b/src/main/java/carpet/script/CarpetExpression.java
index b69a5267..23e66830 100644
--- a/src/main/java/carpet/script/CarpetExpression.java
+++ b/src/main/java/carpet/script/CarpetExpression.java
@@ -3205,10 +3205,17 @@ public class CarpetExpression
                         throw new InternalExpressionException("Incorrect dimension string: "+dimString);
                 }
             }
-            ((CarpetContext) c).s = innerSource;
-            Value retval = lv.get(1).evalValue(c);
-            ((CarpetContext) c).s = outerSource;
-            return (cc, tt) -> retval;
+            try
+            {
+                ((CarpetContext) c).s = innerSource;
+                Value retval = lv.get(1).evalValue(c);
+                return (cc, tt) -> retval;
+            }
+            finally
+            {
+                ((CarpetContext) c).s = outerSource;
+            }
+
         });
 
         this.expr.addLazyFunction("plop", 4, (c, t, lv) ->{

From 0e88f37b13ffb192db7a0ee4bebe12d94c87fb15 Mon Sep 17 00:00:00 2001
From: gnembon 
Date: Tue, 23 Jun 2020 00:34:53 -0300
Subject: [PATCH 4/4] structure lag, booyah

---
 .../java/carpet/script/CarpetExpression.java    | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/main/java/carpet/script/CarpetExpression.java b/src/main/java/carpet/script/CarpetExpression.java
index b69a5267..663b464a 100644
--- a/src/main/java/carpet/script/CarpetExpression.java
+++ b/src/main/java/carpet/script/CarpetExpression.java
@@ -105,6 +105,7 @@ import net.minecraft.stat.Stat;
 import net.minecraft.stat.StatType;
 import net.minecraft.state.StateManager;
 import net.minecraft.state.property.Property;
+import net.minecraft.structure.StructureFeatures;
 import net.minecraft.structure.StructurePiece;
 import net.minecraft.structure.StructureStart;
 import net.minecraft.text.LiteralText;
@@ -123,6 +124,7 @@ import net.minecraft.util.math.MathHelper;
 import net.minecraft.util.math.Vec3d;
 import net.minecraft.util.math.Vec3i;
 import net.minecraft.util.registry.Registry;
+import net.minecraft.world.gen.chunk.ChunkGenerator;
 import net.minecraft.world.gen.feature.Feature;
 import net.minecraft.world.gen.feature.StructureFeature;
 import net.minecraft.world.poi.PointOfInterest;
@@ -353,6 +355,18 @@ public class CarpetExpression
         return MapValue.wrap(ret);
     }
 
+    private static long lastSeed = -1;
+    private void BooYah(ChunkGenerator generator)
+    {
+        synchronized (generator)
+        {
+            if (generator.getSeed() != lastSeed)
+            {
+                StructureFeatures.STRONGHOLD.shouldStartAt(null, generator, null, 0, 0, null);
+                lastSeed = generator.getSeed();
+            }
+        }
+    }
     private void API_BlockManipulation()
     {
         this.expr.addLazyFunction("block", -1, (c, t, lv) ->
@@ -1135,6 +1149,9 @@ public class CarpetExpression
             BlockArgument locator = BlockArgument.findIn(cc, lv, 0);
 
             ServerWorld world = cc.s.getWorld();
+
+            BooYah(world.getChunkManager().getChunkGenerator());
+
             BlockPos pos = locator.block.getPos();
             StructureFeature structure = null;
             boolean needSize = false;