From 12ea55e6eb57c86611dc03473afaf8e3d152694c Mon Sep 17 00:00:00 2001 From: Rad <99306685+Rad586@users.noreply.github.com> Date: Sat, 27 Apr 2024 22:46:23 +0800 Subject: [PATCH 1/2] Update Expressions.md (#12) --- docs/zh-cn/Expressions.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/zh-cn/Expressions.md b/docs/zh-cn/Expressions.md index e375e2c..b87a950 100644 --- a/docs/zh-cn/Expressions.md +++ b/docs/zh-cn/Expressions.md @@ -8,9 +8,13 @@ 本模组在 EvalEx 的基础上,添加了一些额外功能。 -- `random` 能在指定范围内生成随机数。接受 2 个值(最小,最大)。 -- `clamp` 将其他两个值约束在范围内。接受 3 个值(值,最小,最大)。 -- `lerp` 平滑地将初值过渡到末值。`初值 + 平滑系数 * (末值 - 初值)`。接受 3 个值(平滑系数,初值,末值)。 +| 函数 | 描述 | 参数 | 示例 | +|---|---|---|---| +| `random` | 在指定范围内生成随机数。 | `min`, `max` | `random(0, 23)` | +| `clamp` | 将其他两个值约束在范围内。 | `value`, `min`, `max` | `clamp(12, 14, 16)` | +| `lerp` | 平滑地将初值过渡到末值。 | `delta`, `start`, `end` | `lerp(0.5, 10, 16)` | +| `structContainsKey` | 检查结构是否包含指定键值。 | `struct`, `key` | `structContainsKey(this_entity, "getHealth")` | +| `hasContext` | 检查是否有指定语境。 | `key` | `hasContext("killer_entity")` | ## 读取情境数据 -- 2.51.2 From 7eb4b673b765b3b79d9548010554c76d5cc322f5 Mon Sep 17 00:00:00 2001 From: melontini <104443436+melontini@users.noreply.github.com> Date: Tue, 30 Apr 2024 23:39:53 +0700 Subject: [PATCH 2/2] Update Events.md --- docs/develop/Events.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/develop/Events.md b/docs/develop/Events.md index aa89d0c..d0921e1 100644 --- a/docs/develop/Events.md +++ b/docs/develop/Events.md @@ -20,7 +20,7 @@ EventType.builder() .build(new Identifier("modid", "custom_event")); ``` -Events can aceepts additional parameters using `extension()`. After specifying an extension you can return a custom type. +Events can accept additional parameters using `extension()`. After specifying an extension you can return a custom type. ```java EventType.builder() @@ -53,7 +53,7 @@ private static LootContext makeContext(ServerWorld world, Entity entity, Vec3d o If you did specify an extension, or are using an unsupported return type, you'll have to write custom resolution logic. -To do that you'll simple have to create an `EventContext`. `EventContext` is used to pass execution parameters to commands. +To do that you'll simply have to create an `EventContext`. `EventContext` is used to pass execution parameters to commands. ```java EventContext context = EventContext.builder(type) @@ -66,4 +66,4 @@ To get the return value, you can call `getReturnValue(def)`, the default value c ```java boolean val = context.getReturnValue(def); if (val != def) return val; -``` \ No newline at end of file +``` -- 2.51.2