From d9b0cc7075dc91ed8981d294a5b2d0ce5a8cc77f Mon Sep 17 00:00:00 2001 From: Ella <168729127+Bluerella@users.noreply.github.com> Date: Thu, 9 May 2024 01:59:31 +0530 Subject: [PATCH 01/12] Changed Heart Character (-3 pixels) --- .../computercraft/textures/gui/term_font.png | Bin 1164 -> 5637 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/projects/core/src/main/resources/assets/computercraft/textures/gui/term_font.png b/projects/core/src/main/resources/assets/computercraft/textures/gui/term_font.png index 975fcc05bb26a3e7d8583bddb65d28bb3428716f..8b686235e1967708d0361c1feac0cad1a58324da 100644 GIT binary patch literal 5637 zcmd^D`9D-`*gta&Gp2`TNFl@6%34FozVAF`Ux!Sk>`P=FX^5zpL8z21SqG!6Wg8Wu zn5aS45fQRQp~QQhpWn~>7rf_}bI#{F_qp%uy07d0e!tgk>vN_&C}9);06gYqMz#O| zgC1c3k_)=Ig_K?S?=95U)BvdN7g+!RfmU-Pef!As%ekMkvE{r*w7vbJrRqzn!-6*r z{xMhn9=q;)%3NF)9e;0c?~5)Pi1Wj2w>gF$Lcq}5@jx($ZW4qc*%xPuG?040Hh^?X z0pP*U)@`tG91sJ*PnZB;)5vxiFNg+o0Pu(;0CV$?u}8p=fEW;W7efY4oYASc3Bbt* z$&60u7e|hYvGf6ufzV@LgyYC}Q>lwM0LJFP1uKDQMrW647@7>M!T$eDtCkJKLRWlL zdwcu-fL%Q`IF%{ko+uxPp`K4oa@#f|XetawC zQAWY5+C-po=I*N|C*7`n6Sg;46CU~X!(uXVncW-Z@MjEO5bhPk<;nR_V=oQ%zObx_ zyCCyPzuCHBnzLrnapa^L7>Q&QdGsW*(l5_pyv{wSYVJ*kvp*NMc&&|oIur3;@cM!D zceoIvftm10T!724W(4Ex&((pAU(dSv7(KUg^#Rdcd#;&>H+5De09eaiUD{0s4N58c zE9Mv6+6gFqnzw5;kS%u@EI2Xuf`hb{b`tHrzhb9RSl3Fx4c3Np3^%+%3i!G$`@A^m zR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6#z@O>2^W0zgB2~y>_*2(E*f~4%OvVr9QTn z60;p!OZ}Ru_6V{E_5uVT)t(>B%=X3I-G8id@0KKKETxpf+6#cYyZc__IF40d%CNV^ z3={B2vslBWuP*>Fu8ysx1Ut4&t&Q_uBs1+z0upMsMM*MK+DVYshxrNQBuU~RNoiHd zFi4WpNs_p(06RSeD>aNVGqY*fX@{43T`nQ@04} From 5af3e15dd58cf3053ff23936efb0dfc790c02ded Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Tue, 28 May 2024 20:16:32 +0100 Subject: [PATCH 02/12] Nicer lexer error for "!" --- .../modules/main/cc/internal/syntax/errors.lua | 17 +++++++++++++++++ .../modules/main/cc/internal/syntax/lexer.lua | 3 +++ .../modules/cc/internal/syntax/lexer_spec.md | 11 +++++++++++ 3 files changed, 31 insertions(+) diff --git a/projects/core/src/main/resources/data/computercraft/lua/rom/modules/main/cc/internal/syntax/errors.lua b/projects/core/src/main/resources/data/computercraft/lua/rom/modules/main/cc/internal/syntax/errors.lua index c425a26dc2..ea5cf5d1d1 100644 --- a/projects/core/src/main/resources/data/computercraft/lua/rom/modules/main/cc/internal/syntax/errors.lua +++ b/projects/core/src/main/resources/data/computercraft/lua/rom/modules/main/cc/internal/syntax/errors.lua @@ -284,6 +284,23 @@ function errors.wrong_ne(start_pos, end_pos) } end +--[[- `!` was used instead of `not`. + +@tparam number start_pos The start position of the token. +@tparam number end_pos The end position of the token. +@return The resulting parse error. +]] +function errors.wrong_not(start_pos, end_pos) + expect(1, start_pos, "number") + expect(2, end_pos, "number") + + return { + "Unexpected character.", + annotate(start_pos, end_pos), + "Tip: Replace this with " .. code("not") .. " to negate a boolean.", + } +end + --[[- An unexpected character was used. @tparam number pos The position of this character. diff --git a/projects/core/src/main/resources/data/computercraft/lua/rom/modules/main/cc/internal/syntax/lexer.lua b/projects/core/src/main/resources/data/computercraft/lua/rom/modules/main/cc/internal/syntax/lexer.lua index 0b9d45a7eb..9faf3b5a9f 100644 --- a/projects/core/src/main/resources/data/computercraft/lua/rom/modules/main/cc/internal/syntax/lexer.lua +++ b/projects/core/src/main/resources/data/computercraft/lua/rom/modules/main/cc/internal/syntax/lexer.lua @@ -327,6 +327,9 @@ local function lex_token(context, str, pos) elseif contents == "!=" or contents == "<>" then context.report(errors.wrong_ne, pos, end_pos) return tokens.NE, end_pos + elseif contents == "!" then + context.report(errors.wrong_not, pos, end_pos) + return tokens.NOT, end_pos end end diff --git a/projects/core/src/test/resources/test-rom/spec/modules/cc/internal/syntax/lexer_spec.md b/projects/core/src/test/resources/test-rom/spec/modules/cc/internal/syntax/lexer_spec.md index a0049c3671..c6e9835660 100644 --- a/projects/core/src/test/resources/test-rom/spec/modules/cc/internal/syntax/lexer_spec.md +++ b/projects/core/src/test/resources/test-rom/spec/modules/cc/internal/syntax/lexer_spec.md @@ -265,6 +265,7 @@ if a != b then end if a ~= b then end if a && b then end if a || b then end +if ! a then end ``` ```txt @@ -307,6 +308,16 @@ Tip: Replace this with or to check if either value is true. 4:9-4:9 IDENT b 4:11-4:14 THEN then 4:16-4:18 END end +5:1-5:2 IF if +Unexpected character. + | + 5 | if ! a then end + | ^ +Tip: Replace this with not to negate a boolean. +5:4-5:4 NOT ! +5:6-5:6 IDENT a +5:8-5:11 THEN then +5:13-5:15 END end ``` For entirely unknown glyphs we should just give up and return an `ERROR` token. From 334761788ac1b50d343bdae33a8ef17107761456 Mon Sep 17 00:00:00 2001 From: Weblate Date: Wed, 5 Jun 2024 18:24:44 +0000 Subject: [PATCH 03/12] Translations for Chinese (Simplified) Co-authored-by: Kevin Z --- .../assets/computercraft/lang/zh_cn.json | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/projects/common/src/main/resources/assets/computercraft/lang/zh_cn.json b/projects/common/src/main/resources/assets/computercraft/lang/zh_cn.json index 2deddd3312..0d3ad1317b 100644 --- a/projects/common/src/main/resources/assets/computercraft/lang/zh_cn.json +++ b/projects/common/src/main/resources/assets/computercraft/lang/zh_cn.json @@ -102,7 +102,7 @@ "item.computercraft.pocket_computer_normal.upgraded": "%s手提计算机", "item.computercraft.printed_book": "打印书", "item.computercraft.printed_page": "打印纸", - "item.computercraft.printed_pages": "打印纸", + "item.computercraft.printed_pages": "打印纸簇", "item.computercraft.treasure_disk": "软盘", "itemGroup.computercraft": "ComputerCraft", "tracking_field.computercraft.fs.name": "文件系统操作", @@ -120,5 +120,41 @@ "upgrade.minecraft.diamond_hoe.adjective": "耕种", "upgrade.minecraft.diamond_pickaxe.adjective": "采掘", "upgrade.minecraft.diamond_shovel.adjective": "挖掘", - "upgrade.minecraft.diamond_sword.adjective": "战斗" + "upgrade.minecraft.diamond_sword.adjective": "战斗", + "argument.computercraft.computer.instance": "唯一实例ID", + "commands.computercraft.dump.open_path": "查看该电脑的文件", + "gui.computercraft.config.command_require_creative": "命令电脑需要创造模式", + "gui.computercraft.config.command_require_creative.tooltip": "玩家需要处于创造模式并为管理员才能与命令计算机交互。\n这是原版命令方块的默认行为。", + "gui.computercraft.config.http.bandwidth": "带宽", + "gui.computercraft.config.http.bandwidth.global_download.tooltip": "每秒钟可以下载的字节数. 所有电脑共享该设置 (bytes/s).\n范围: > 1", + "gui.computercraft.config.http.proxy.type.tooltip": "代理使用的协议.\n允许: HTTP, HTTPS, SOCKS4, SOCKS5", + "argument.computercraft.computer.id": "电脑ID", + "argument.computercraft.computer.distance": "实体距离", + "argument.computercraft.computer.family": "电脑类别", + "argument.computercraft.computer.label": "电脑标签", + "argument.computercraft.unknown_computer_family": "未知电脑类别 '%s'", + "commands.computercraft.help.desc": "显示该帮助信息", + "gui.computercraft.config.computer_space_limit.tooltip": "计算机和海龟的磁盘空间限制,以字节为单位。", + "gui.computercraft.config.disabled_generic_methods": "禁用的通用方法", + "gui.computercraft.config.http.bandwidth.global_upload": "全局上传限速", + "gui.computercraft.config.http.bandwidth.global_download": "全局下载限速", + "gui.computercraft.config.http.bandwidth.global_upload.tooltip": "每秒钟可以上传的字节数. 所有电脑共享该设置 (bytes/s).\n范围: > 1", + "gui.computercraft.config.http.bandwidth.tooltip": "限制电脑可以使用的带宽.", + "gui.computercraft.config.http.proxy": "代理", + "gui.computercraft.config.http.proxy.host": "主机名", + "gui.computercraft.config.http.proxy.host.tooltip": "代理服务器的主机名或IP地址.", + "gui.computercraft.config.http.proxy.port": "端口", + "gui.computercraft.config.http.proxy.port.tooltip": "代理服务器的端口.\n范围: 1 ~ 65536", + "gui.computercraft.config.http.proxy.type": "代理类型", + "gui.computercraft.config.http.rules": "允许/阻止规则", + "gui.computercraft.config.http.tooltip": "控制HTTP API", + "tracking_field.computercraft.java_allocation.name": "Java分配", + "tracking_field.computercraft.max": "%s (最大)", + "tracking_field.computercraft.server_tasks.name": "服务器任务", + "tag.item.computercraft.turtle": "海龟", + "tag.item.computercraft.wired_modem": "有线调制解调器", + "tracking_field.computercraft.avg": "%s (平均)", + "tracking_field.computercraft.computer_tasks.name": "任务", + "tracking_field.computercraft.count": "%s (计数)", + "tracking_field.computercraft.http_requests.name": "HTTP请求" } From ac851a795b5ba5652a0b3f18076a53c7a597e793 Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Thu, 6 Jun 2024 20:04:32 +0100 Subject: [PATCH 04/12] Fix command.getBlockInfos indexing expression And add an example, to make it all a little clearer --- .../shared/computer/apis/CommandAPI.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/projects/common/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java index 3fcb162c24..fa841cf1d7 100644 --- a/projects/common/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java @@ -172,7 +172,7 @@ public final Object[] getBlockPosition() { * blocks at once. *

* Blocks are traversed by ascending y level, followed by z and x - the returned - * table may be indexed using `x + z*width + y*depth*depth`. + * table may be indexed using `x + z*width + y*width*depth + 1`. * * @param minX The start x coordinate of the range to query. * @param minY The start y coordinate of the range to query. @@ -186,6 +186,25 @@ public final Object[] getBlockPosition() { * @throws LuaException If trying to get information about more than 4096 blocks. * @cc.since 1.76 * @cc.changed 1.99 Added {@code dimension} argument. + * + * @cc.usage Print out all blocks in a cube around the computer. + * + *

{@code
+     * -- Get a 3x3x3 cube around the computer
+     * local x, y, z = commands.getBlockPosition()
+     * local min_x, min_y, min_z, max_x, max_y, max_z = x - 1, y - 1, z - 1, x + 1, y + 1, z + 1
+     * local blocks = commands.getBlockInfos(min_x, min_y, min_z, max_x, max_y, max_z)
+     *
+     * -- Then loop over all blocks and print them out.
+     * local width, height, depth = max_x - min_x + 1, max_y - min_y + 1, max_z - min_z + 1
+     * for x = min_x, max_x do
+     *   for y = min_y, max_y do
+     *     for z = min_z, max_z do
+     *       print(("%d, %d %d => %s"):format(x, y, z, blocks[(x - min_x) + (z - min_z) * width + (y - min_y) * width * depth + 1].name))
+     *     end
+     *   end
+     * end
+     * }
*/ @LuaFunction(mainThread = true) public final List> getBlockInfos(int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Optional dimension) throws LuaException { From 1944995c3388a46099a28c4e68e2e62285294354 Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Tue, 11 Jun 2024 20:27:06 +0100 Subject: [PATCH 05/12] Update CCF links to my mirror --- doc/index.md | 2 +- doc/mod-page.md | 2 +- .../src/main/resources/data/computercraft/lua/rom/apis/gps.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/index.md b/doc/index.md index efa1a28d42..ed70ab0702 100644 --- a/doc/index.md +++ b/doc/index.md @@ -38,7 +38,7 @@ little daunting getting started. Thankfully, there's several fantastic tutorials - [Direwolf20's ComputerCraft tutorials](https://www.youtube.com/watch?v=wrUHUhfCY5A "ComputerCraft Tutorial Episode 1 - HELP! and Hello World") - [Sethbling's ComputerCraft series](https://www.youtube.com/watch?v=DSsx4VSe-Uk "Programming Tutorial with Minecraft Turtles -- Ep. 1: Intro to Turtles and If-Then-Else_End") - - [Lyqyd's Computer Basics 1](http://www.computercraft.info/forums2/index.php?/topic/15033-computer-basics-i/ "Computer Basics I") + - [Lyqyd's Computer Basics 1](https://ccf.squiddev.cc/forums2/index.php?/topic/15033-computer-basics-i/ "Computer Basics I") Once you're a little more familiar with the mod, the sidebar and links below provide more detailed documentation on the various APIs and peripherals provided by the mod. diff --git a/doc/mod-page.md b/doc/mod-page.md index 2397779788..4002ba2464 100644 --- a/doc/mod-page.md +++ b/doc/mod-page.md @@ -45,7 +45,7 @@ little daunting getting started. Thankfully, there's several fantastic tutorials - [Direwolf20's ComputerCraft tutorials](https://www.youtube.com/watch?v=wrUHUhfCY5A "ComputerCraft Tutorial Episode 1 - HELP! and Hello World") - [Sethbling's ComputerCraft series](https://www.youtube.com/watch?v=DSsx4VSe-Uk "Programming Tutorial with Minecraft Turtles -- Ep. 1: Intro to Turtles and If-Then-Else_End") - - [Lyqyd's Computer Basics 1](http://www.computercraft.info/forums2/index.php?/topic/15033-computer-basics-i/ "Computer Basics I") + - [Lyqyd's Computer Basics 1](https://ccf.squiddev.cc/forums2/index.php?/topic/15033-computer-basics-i/ "Computer Basics I") Once you're a little more familiar with the mod, the [wiki](https://tweaked.cc/) provides more detailed documentation on the various APIs and peripherals provided by the mod. diff --git a/projects/core/src/main/resources/data/computercraft/lua/rom/apis/gps.lua b/projects/core/src/main/resources/data/computercraft/lua/rom/apis/gps.lua index d1eafec2c7..a884af2536 100644 --- a/projects/core/src/main/resources/data/computercraft/lua/rom/apis/gps.lua +++ b/projects/core/src/main/resources/data/computercraft/lua/rom/apis/gps.lua @@ -23,7 +23,7 @@ just the same. For example, you might build a GPS cluster according to [this tutorial][1], using z to account for height, or you might use y to account for height in the way that Minecraft's debug screen displays. -[1]: http://www.computercraft.info/forums2/index.php?/topic/3088-how-to-guide-gps-global-position-system/ +[1]: https://ccf.squiddev.cc/forums2/index.php?/topic/3088-how-to-guide-gps-global-position-system/ @module gps @since 1.31 From 9fbb1070ef0ffc4af9ed53f51e781d5e950aacfb Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Fri, 14 Jun 2024 22:12:16 +0100 Subject: [PATCH 06/12] Remove redundant helper method from datagen Vanilla has had an equivalent method for a few years now! --- .../java/dan200/computercraft/data/ItemModelProvider.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/projects/common/src/main/java/dan200/computercraft/data/ItemModelProvider.java b/projects/common/src/main/java/dan200/computercraft/data/ItemModelProvider.java index ac80bc9a5b..4d0e990c89 100644 --- a/projects/common/src/main/java/dan200/computercraft/data/ItemModelProvider.java +++ b/projects/common/src/main/java/dan200/computercraft/data/ItemModelProvider.java @@ -36,13 +36,13 @@ public static void addItemModels(ItemModelGenerators generators) { } private static void registerPocketComputer(ItemModelGenerators generators, ResourceLocation id, boolean off) { - createFlatItem(generators, addSuffix(id, "_blinking"), + createFlatItem(generators, id.withSuffix("_blinking"), new ResourceLocation(ComputerCraftAPI.MOD_ID, "item/pocket_computer_blink"), id, new ResourceLocation(ComputerCraftAPI.MOD_ID, "item/pocket_computer_light") ); - createFlatItem(generators, addSuffix(id, "_on"), + createFlatItem(generators, id.withSuffix("_on"), new ResourceLocation(ComputerCraftAPI.MOD_ID, "item/pocket_computer_on"), id, new ResourceLocation(ComputerCraftAPI.MOD_ID, "item/pocket_computer_light") @@ -94,8 +94,4 @@ private static void createFlatItem(ItemModelGenerators generators, ResourceLocat new ModelTemplate(Optional.of(new ResourceLocation("item/generated")), Optional.empty(), slots) .create(model, mapping, generators.output); } - - private static ResourceLocation addSuffix(ResourceLocation location, String suffix) { - return new ResourceLocation(location.getNamespace(), location.getPath() + suffix); - } } From af2179284425331d29abf84aebdad6a7d72b42be Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Wed, 19 Jun 2024 09:57:56 +0100 Subject: [PATCH 07/12] Publish docs via an artifact instead We'll deploy this via a webhook instead. --- .github/workflows/make-doc.sh | 19 ------------------- .github/workflows/make-doc.yml | 25 ++++++++++--------------- projects/web/build.gradle.kts | 2 ++ 3 files changed, 12 insertions(+), 34 deletions(-) delete mode 100755 .github/workflows/make-doc.sh diff --git a/.github/workflows/make-doc.sh b/.github/workflows/make-doc.sh deleted file mode 100755 index 640f466b1d..0000000000 --- a/.github/workflows/make-doc.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -set -eu - -DEST="${GITHUB_REF#refs/*/}" -echo "Uploading docs to https://tweaked.cc/$DEST" - -# Setup ssh key -mkdir -p "$HOME/.ssh/" -echo "$SSH_KEY" > "$HOME/.ssh/key" -chmod 600 "$HOME/.ssh/key" - -# And upload -rsync -avc -e "ssh -i $HOME/.ssh/key -o StrictHostKeyChecking=no -p $SSH_PORT" \ - "$GITHUB_WORKSPACE/projects/web/build/site/" \ - "$SSH_USER@$SSH_HOST:/$DEST" -rsync -avc -e "ssh -i $HOME/.ssh/key -o StrictHostKeyChecking=no -p $SSH_PORT" \ - "$GITHUB_WORKSPACE/projects/common-api/build/docs/javadoc/" \ - "$SSH_USER@$SSH_HOST:/$DEST/javadoc" diff --git a/.github/workflows/make-doc.yml b/.github/workflows/make-doc.yml index 26eeb3c4e3..424cbceb7c 100644 --- a/.github/workflows/make-doc.yml +++ b/.github/workflows/make-doc.yml @@ -11,30 +11,25 @@ jobs: runs-on: ubuntu-latest steps: - - name: Clone repository + - name: 📥 Clone repository uses: actions/checkout@v4 - - name: Set up Java + - name: 📥 Set up Java uses: actions/setup-java@v4 with: java-version: 17 distribution: 'temurin' - - name: Setup Gradle + - name: 📥 Setup Gradle uses: gradle/actions/setup-gradle@v3 with: cache-read-only: ${{ !startsWith(github.ref, 'refs/heads/mc-') }} - - name: Build with Gradle - run: ./gradlew compileJava --no-daemon || ./gradlew compileJava --no-daemon + - name: ⚒️ Generate documentation + run: ./gradlew docWebsite --no-daemon - - name: Generate documentation - run: ./gradlew docWebsite :common-api:javadoc --no-daemon - - - name: Upload documentation - run: .github/workflows/make-doc.sh 2> /dev/null - env: - SSH_KEY: ${{ secrets.SSH_KEY }} - SSH_USER: ${{ secrets.SSH_USER }} - SSH_HOST: ${{ secrets.SSH_HOST }} - SSH_PORT: ${{ secrets.SSH_PORT }} + - name: 📤 Upload Jar + uses: actions/upload-artifact@v4 + with: + name: Documentation + path: ./projects/web/build/site/ diff --git a/projects/web/build.gradle.kts b/projects/web/build.gradle.kts index 19d83ceb4c..887cd4f048 100644 --- a/projects/web/build.gradle.kts +++ b/projects/web/build.gradle.kts @@ -145,6 +145,8 @@ val docWebsite by tasks.registering(Copy::class) { from(illuaminateDocs) { exclude("**/*.html") } // And item/block images from the data export from(file("src/htmlTransform/export/items")) { into("images/items") } + // Add the common-api (and core-api) javadoc + from(project(":common-api").tasks.named("javadoc")) { into("javadoc") } into(layout.buildDirectory.dir("site")) } From c582fb521cb2d7f9aef76f9fb77b9f4d2a2f7948 Mon Sep 17 00:00:00 2001 From: Weblate Date: Wed, 19 Jun 2024 14:52:37 +0000 Subject: [PATCH 08/12] Translations for German Co-authored-by: Lord Duck --- .../assets/computercraft/lang/de_de.json | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/projects/common/src/main/resources/assets/computercraft/lang/de_de.json b/projects/common/src/main/resources/assets/computercraft/lang/de_de.json index ba4405f210..e41421b74a 100644 --- a/projects/common/src/main/resources/assets/computercraft/lang/de_de.json +++ b/projects/common/src/main/resources/assets/computercraft/lang/de_de.json @@ -130,5 +130,18 @@ "upgrade.minecraft.diamond_hoe.adjective": "Ackerbau", "upgrade.minecraft.diamond_pickaxe.adjective": "Bergbau", "upgrade.minecraft.diamond_shovel.adjective": "Graben", - "upgrade.minecraft.diamond_sword.adjective": "Nahkampf" + "upgrade.minecraft.diamond_sword.adjective": "Nahkampf", + "argument.computercraft.computer.id": "Computer ID", + "argument.computercraft.computer.instance": "einzigartige Instanz ID", + "argument.computercraft.computer.label": "Computer name", + "argument.computercraft.unknown_computer_family": "Unbekannte computer familie '%s'", + "gui.computercraft.config.floppy_space_limit.tooltip": "Die maximale Dateisystem Größe von Disketten (in bytes).", + "gui.computercraft.config.http.bandwidth": "Bandbreite", + "gui.computercraft.config.http.bandwidth.global_upload": "Globales upload limit", + "gui.computercraft.config.http.bandwidth.global_download.tooltip": "Die maximale Geschwindigkeit aller Computer in bytes/s mit der Heruntergeladen werden kann.\nBereich: > 1", + "gui.computercraft.config.http.bandwidth.global_download": "Globales download limit", + "gui.computercraft.config.http.bandwidth.tooltip": "Limitiert die Bandbreite der Computer.", + "argument.computercraft.computer.family": "Computer familie", + "gui.computercraft.config.execution.max_main_global_time.tooltip": "Die maximale Zeit in millisekunden, in der Aufgaben ausgeführt werden.\nAnmerkung: Diese Zeit wird höchstwarscheinlich überschritten und dient nur als ungefähre Grenze.\nLimit: > 1", + "gui.computercraft.config.http.bandwidth.global_upload.tooltip": "Die maximale Hochladungs Geschwindigkeit aller Computer in bytes/s.\nBereich: > 1" } From ce133a5e66592e30dcd08d6dde88ff8e1ed21411 Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Wed, 19 Jun 2024 21:46:07 +0100 Subject: [PATCH 09/12] Update Minecraft wiki link We didn't update this at the same time as the other links, as it pointed to an even older wiki URL! --- doc/reference/breaking_changes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/reference/breaking_changes.md b/doc/reference/breaking_changes.md index 4c3b39fb8e..4d3ef6cbcd 100644 --- a/doc/reference/breaking_changes.md +++ b/doc/reference/breaking_changes.md @@ -77,5 +77,5 @@ as documentation for breaking changes and "gotchas" one should look out for betw you can no longer type `turtle/excavate` to run `/rom/programs/turtle/excavate.lua`. [flattening]: https://minecraft.wiki/w/Java_Edition_1.13/Flattening -[legal_data_pack]: https://minecraft.gamepedia.com/Tutorials/Creating_a_data_pack#Legal_characters +[legal_data_pack]: https://minecraft.wiki/w/Tutorials/Creating_a_data_pack#Legal_characters [datapack-example]: https://github.com/cc-tweaked/datapack-example "An example datapack for CC: Tweaked" From cfd11ffa9287ba87c9d92b0a4552d0cd113378b2 Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Thu, 20 Jun 2024 18:31:28 +0100 Subject: [PATCH 10/12] Support dark and light mode logos on the website Requires an illuaminate bump to support tags. Fixes #1861. --- doc/index.md | 9 ++++++++- gradle/libs.versions.toml | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/index.md b/doc/index.md index ed70ab0702..cfc5708109 100644 --- a/doc/index.md +++ b/doc/index.md @@ -4,7 +4,14 @@ SPDX-FileCopyrightText: 2020 The CC: Tweaked Developers SPDX-License-Identifier: MPL-2.0 --> -# ![CC: Tweaked](logo.png) +

+ + + + CC: Tweaked + +

+ CC: Tweaked is a mod for Minecraft which adds programmable computers, turtles and more to the game. A fork of the much-beloved [ComputerCraft], it continues its legacy with improved performance and stability, along with a wealth of new features. diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 42534f269b..91546e46f0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -64,7 +64,7 @@ forgeGradle = "6.0.21" githubRelease = "2.5.2" gradleVersions = "0.50.0" ideaExt = "1.1.7" -illuaminate = "0.1.0-71-g378d86e" +illuaminate = "0.1.0-73-g43ee16c" librarian = "1.+" lwjgl = "3.3.3" minotaur = "2.+" From e4236824d7c375b79772fe23abfe66e5a6e71bc0 Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Thu, 20 Jun 2024 19:03:17 +0100 Subject: [PATCH 11/12] Revert "Changed Heart Character (-3 pixels)" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit d9b0cc7075dc91ed8981d294a5b2d0ce5a8cc77f. I'm not sure what happened here, but the font is just entirely offset. This is on me for not noticing during review. 🤦 --- .../computercraft/textures/gui/term_font.png | Bin 5637 -> 1164 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/projects/core/src/main/resources/assets/computercraft/textures/gui/term_font.png b/projects/core/src/main/resources/assets/computercraft/textures/gui/term_font.png index 8b686235e1967708d0361c1feac0cad1a58324da..975fcc05bb26a3e7d8583bddb65d28bb3428716f 100644 GIT binary patch delta 1155 zcmV-}1bq92EQ|?|7=Hl+0001HygDTS000J1OjJbx00960|E1ZV-2eap0d!JMQvg8b z*k%9#1T;xRK~!ko?U+A{BS#R$U(mq>1N$%v6kO1l2|8HJU=&o)nC5taI24FuFyb&q zfjBPMV8g)_>#wX&;B_!(FWmI(9tV56Km|g<{HU&e{rWHPVt<$c1Relb6_6(y@c_IL z@^5qCZg8WmKLV}L{anl7?w;QQn|g*pZWFLI#9D?sBf0(vY>DH?S}zDQJOI5_fzR;( zfVfn!%NgWS0VP;B9AQQhpwEE&H{J~gxO3g3<9xi_*=+=p?szb(WMH@2!0GG0bjC^z zj#ZnDMizLjRDbJMVCHR%RNzE!cnrW3>rtgSH0>`si+i*VOzAD1AjgND$*P% zQwPh+K{ z;iR3Y6GP%q@g%Z}oDxG{2PCO5i%L{A!)Q4(i0YbWTs|>(>KU?zWE2|o5%lumjD2q&*$^a&CSi@P3Rkg$tPz#S>ILL@gjQ?ZYjxY*milI)6#z@O>2^W0zgB2~y>_*2(E*f~4%OvVr9QTn z60;p!OZ}Ru_6V{E_5uVT)t(>B%=X3I-G8id@0KKKETxpf+6#cYyZc__IF40d%CNV^ z3={B2vslBWuP*>Fu8ysx1Ut4&t&Q_uBs1+z0upMsMM*MK+DVYshxrNQBuU~RNoiHd zFi4WpNs_p(06RSeD>aNVGqY*fX@{43T`nQ@04} literal 5637 zcmd^D`9D-`*gta&Gp2`TNFl@6%34FozVAF`Ux!Sk>`P=FX^5zpL8z21SqG!6Wg8Wu zn5aS45fQRQp~QQhpWn~>7rf_}bI#{F_qp%uy07d0e!tgk>vN_&C}9);06gYqMz#O| zgC1c3k_)=Ig_K?S?=95U)BvdN7g+!RfmU-Pef!As%ekMkvE{r*w7vbJrRqzn!-6*r z{xMhn9=q;)%3NF)9e;0c?~5)Pi1Wj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_qlX9KXZ};kZ=I7-U=gH}O(c6`a5Wex ziY8qK_Gm$<%YYZQnd68{g>=Xn<- Date: Fri, 21 Jun 2024 07:54:18 +0100 Subject: [PATCH 12/12] Fix drive.getAudioTitle returning null for no disk Historically (and according to the docs) getAudioTitle returned "false" when the drive was empty (or had invalid media), and "null" when the disk had no item. This was accidentally changed in a later refactor -- this change fixes that behaviour. --- .../diskdrive/DiskDrivePeripheral.java | 3 +- .../computercraft/gametest/Disk_Drive_Test.kt | 12 ++++++ ...isk_drive_test.audio_title_when_empty.snbt | 40 +++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 projects/common/src/testMod/resources/data/cctest/structures/disk_drive_test.audio_title_when_empty.snbt diff --git a/projects/common/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDrivePeripheral.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDrivePeripheral.java index 31cb03b20a..d103baf961 100644 --- a/projects/common/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDrivePeripheral.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDrivePeripheral.java @@ -129,7 +129,8 @@ public final boolean hasAudio() { @LuaFunction @Nullable public final Object getAudioTitle() { - return diskDrive.getMedia().getAudioTitle(); + var stack = diskDrive.getMedia(); + return stack.media() != null ? stack.getAudioTitle() : false; } /** diff --git a/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Disk_Drive_Test.kt b/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Disk_Drive_Test.kt index 11fd18344f..245d561306 100644 --- a/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Disk_Drive_Test.kt +++ b/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Disk_Drive_Test.kt @@ -10,6 +10,7 @@ import dan200.computercraft.gametest.api.* import dan200.computercraft.shared.ModRegistry import dan200.computercraft.shared.media.items.DiskItem import dan200.computercraft.shared.peripheral.diskdrive.DiskDriveBlock +import dan200.computercraft.shared.peripheral.diskdrive.DiskDrivePeripheral import dan200.computercraft.shared.peripheral.diskdrive.DiskDriveState import dan200.computercraft.test.core.assertArrayEquals import dan200.computercraft.test.core.computer.getApi @@ -42,6 +43,17 @@ class Disk_Drive_Test { } } + /** + * [DiskDrivePeripheral] returns `false` when the item is not a disk (or is absent). + */ + @GameTest + fun Audio_title_when_empty(helper: GameTestHelper) = helper.sequence { + thenOnComputer { + callPeripheral("right", "getAudioTitle") + .assertArrayEquals(false, message = "Correct audio title") + } + } + @GameTest fun Ejects_disk(helper: GameTestHelper) = helper.sequence { val stackAt = BlockPos(2, 2, 2) diff --git a/projects/common/src/testMod/resources/data/cctest/structures/disk_drive_test.audio_title_when_empty.snbt b/projects/common/src/testMod/resources/data/cctest/structures/disk_drive_test.audio_title_when_empty.snbt new file mode 100644 index 0000000000..9583c510bb --- /dev/null +++ b/projects/common/src/testMod/resources/data/cctest/structures/disk_drive_test.audio_title_when_empty.snbt @@ -0,0 +1,40 @@ +{ + DataVersion: 2730, + size: [3, 3, 3], + data: [ + {pos: [0, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [0, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [0, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [0, 1, 0], state: "minecraft:air"}, + {pos: [0, 1, 1], state: "computercraft:disk_drive{facing:north,state:full}", nbt: {id: "computercraft:disk_drive"}}, + {pos: [0, 1, 2], state: "minecraft:air"}, + {pos: [1, 1, 0], state: "minecraft:air"}, + {pos: [1, 1, 1], state: "computercraft:computer_advanced{facing:north,state:blinking}", nbt: {ComputerId: 1, Label: "disk_drive_test.audio_title_when_empty", On: 1b, id: "computercraft:computer_advanced"}}, + {pos: [1, 1, 2], state: "minecraft:air"}, + {pos: [2, 1, 0], state: "minecraft:air"}, + {pos: [2, 1, 1], state: "minecraft:air"}, + {pos: [2, 1, 2], state: "minecraft:air"}, + {pos: [0, 2, 0], state: "minecraft:air"}, + {pos: [0, 2, 1], state: "minecraft:air"}, + {pos: [0, 2, 2], state: "minecraft:air"}, + {pos: [1, 2, 0], state: "minecraft:air"}, + {pos: [1, 2, 1], state: "minecraft:air"}, + {pos: [1, 2, 2], state: "minecraft:air"}, + {pos: [2, 2, 0], state: "minecraft:air"}, + {pos: [2, 2, 1], state: "minecraft:air"}, + {pos: [2, 2, 2], state: "minecraft:air"} + ], + entities: [], + palette: [ + "minecraft:polished_andesite", + "minecraft:air", + "computercraft:disk_drive{facing:north,state:full}", + "computercraft:computer_advanced{facing:north,state:blinking}" + ] +}