diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 911798206..fc234c84a 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -4,5 +4,5 @@ contact_links: url: https://discord.computercraft.cc about: Get help on the ComputerCraft Discord. - name: GitHub Discussions - url: https://github.com/SquidDev-CC/CC-Tweaked/discussions + url: https://github.com/cc-tweaked/CC-Tweaked/discussions about: Or ask questions on GitHub Discussions. diff --git a/.github/workflows/make-doc.sh b/.github/workflows/make-doc.sh index 802426430..f22851bee 100755 --- a/.github/workflows/make-doc.sh +++ b/.github/workflows/make-doc.sh @@ -13,7 +13,7 @@ chmod 600 "$HOME/.ssh/key" # And upload rsync -avc -e "ssh -i $HOME/.ssh/key -o StrictHostKeyChecking=no -p $SSH_PORT" \ "$GITHUB_WORKSPACE/build/docs/lua/" \ - "$SSH_USER@$SSH_HOST:/var/www/tweaked.cc/$DEST" + "$SSH_USER@$SSH_HOST:/$DEST" rsync -avc -e "ssh -i $HOME/.ssh/key -o StrictHostKeyChecking=no -p $SSH_PORT" \ "$GITHUB_WORKSPACE/build/docs/javadoc/" \ - "$SSH_USER@$SSH_HOST:/var/www/tweaked.cc/$DEST/javadoc" + "$SSH_USER@$SSH_HOST:/$DEST/javadoc" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9e70ba29f..c9afbdb4c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,11 +16,11 @@ automatically with GitHub, so please don't submit PRs adding/changing translatio In order to develop CC: Tweaked, you'll need to download the source code and then run it. This is a pretty simple process. When building on Windows, Use `gradlew.bat` instead of `./gradlew`. - - **Clone the repository:** `git clone https://github.com/SquidDev-CC/CC-Tweaked.git && cd CC-Tweaked` + - **Clone the repository:** `git clone https://github.com/cc-tweaked/CC-Tweaked.git && cd CC-Tweaked` - **Setup Forge:** `./gradlew build` - **Run Minecraft:** `./gradlew runClient` (or run the `GradleStart` class from your IDE). - **Optionally:** For small PRs (especially those only touching Lua code), it may be easier to use GitPod, which - provides a pre-configured environment: [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-2b2b2b?logo=gitpod)](https://gitpod.io/#https://github.com/SquidDev-CC/CC-Tweaked/) + provides a pre-configured environment: [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-2b2b2b?logo=gitpod)](https://gitpod.io/#https://github.com/cc-tweaked/CC-Tweaked/) Do note you will need to download the mod after compiling to test. @@ -103,7 +103,7 @@ tests go inside `describe` blocks, and a single test goes inside `it`. Assertions are generally written using `expect` (inspired by Hamcrest and the like). For instance, `expect(foo):eq("bar")` asserts that your variable `foo` is equal to the expected value `"bar"`. -[new-issue]: https://github.com/SquidDev-CC/CC-Tweaked/issues/new/choose "Create a new issue" +[new-issue]: https://github.com/cc-tweaked/CC-Tweaked/issues/new/choose "Create a new issue" [community]: README.md#Community "Get in touch with the community." [checkstyle]: https://checkstyle.org/ [illuaminate]: https://github.com/SquidDev/illuaminate/ "Illuaminate on GitHub" diff --git a/README.md b/README.md index 37714bd10..3495ea8af 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # ![CC: Tweaked](doc/logo.png) -[![Current build status](https://github.com/SquidDev-CC/CC-Tweaked/workflows/Build/badge.svg)](https://github.com/SquidDev-CC/CC-Tweaked/actions "Current build status") [![Download CC: Tweaked on CurseForge](http://cf.way2muchnoise.eu/title/cc-tweaked.svg)][CurseForge] +[![Current build status](https://github.com/cc-tweaked/CC-Tweaked/workflows/Build/badge.svg)](https://github.com/cc-tweaked/CC-Tweaked/actions "Current build status") [![Download CC: Tweaked on CurseForge](http://cf.way2muchnoise.eu/title/cc-tweaked.svg)][CurseForge] 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 better performance, stability, and a wealth of new features. diff --git a/build.gradle b/build.gradle index 858a1501c..2c7b88792 100644 --- a/build.gradle +++ b/build.gradle @@ -493,7 +493,7 @@ curseforge { project { id = '282001' releaseType = isStable ? 'release' : 'alpha' - changelog = "Release notes can be found on the GitHub repository (https://github.com/SquidDev-CC/CC-Tweaked/releases/tag/v${mc_version}-${mod_version})." + changelog = "Release notes can be found on the GitHub repository (https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v${mc_version}-${mod_version})." addGameVersion "${mc_version}" } @@ -511,7 +511,7 @@ tasks.register('publishModrinth', TaskModrinthUpload.class).configure { uploadFile = jar versionType = isStable ? 'RELEASE' : 'ALPHA' addGameVersion(project.mc_version) - changelog = "Release notes can be found on the [GitHub repository](https://github.com/SquidDev-CC/CC-Tweaked/releases/tag/v${mc_version}-${mod_version})." + changelog = "Release notes can be found on the [GitHub repository](https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v${mc_version}-${mod_version})." addLoader('forge') } @@ -528,21 +528,21 @@ publishing { pom { name = 'CC: Tweaked' description = 'CC: Tweaked is a fork of ComputerCraft, adding programmable computers, turtles and more to Minecraft.' - url = 'https://github.com/SquidDev-CC/CC-Tweaked' + url = 'https://github.com/cc-tweaked/CC-Tweaked' scm { - url = 'https://github.com/SquidDev-CC/CC-Tweaked.git' + url = 'https://github.com/cc-tweaked/CC-Tweaked.git' } issueManagement { system = 'github' - url = 'https://github.com/SquidDev-CC/CC-Tweaked/issues' + url = 'https://github.com/cc-tweaked/CC-Tweaked/issues' } licenses { license { name = 'ComputerCraft Public License, Version 1.0' - url = 'https://github.com/SquidDev-CC/CC-Tweaked/blob/mc-1.15.x/LICENSE' + url = 'https://github.com/cc-tweaked/CC-Tweaked/blob/mc-1.15.x/LICENSE' } } @@ -567,7 +567,7 @@ publishing { githubRelease { token project.hasProperty('githubApiKey') ? project.githubApiKey : '' - owner 'SquidDev-CC' + owner 'cc-tweaked' repo 'CC-Tweaked' targetCommitish.set(project.provider({ def cmd = ["git", "rev-parse", "--abbrev-ref", "HEAD"] diff --git a/doc/index.md b/doc/index.md index ed7aa2848..74d76434b 100644 --- a/doc/index.md +++ b/doc/index.md @@ -43,8 +43,8 @@ If you get stuck, do pop in to the [Minecraft Computer Mod Discord guild][discor ## Get Involved CC: Tweaked lives on [GitHub]. If you've got any ideas, feedback or bugs please do [create an issue][bug]. -[github]: https://github.com/SquidDev-CC/CC-Tweaked/ "CC: Tweaked on GitHub" -[bug]: https://github.com/SquidDev-CC/CC-Tweaked/issues/new/choose +[github]: https://github.com/cc-tweaked/CC-Tweaked/ "CC: Tweaked on GitHub" +[bug]: https://github.com/cc-tweaked/CC-Tweaked/issues/new/choose [computercraft]: https://github.com/dan200/ComputerCraft "ComputerCraft on GitHub" [curseforge]: https://minecraft.curseforge.com/projects/cc-tweaked "Download CC: Tweaked from CurseForge" [modrinth]: https://modrinth.com/mod/gu7yAYhd "Download CC: Tweaked from Modrinth" diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c02..7454180f2 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 69a971507..ffed3a254 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 4f906e0c8..744e882ed 100755 --- a/gradlew +++ b/gradlew @@ -72,7 +72,7 @@ case "`uname`" in Darwin* ) darwin=true ;; - MINGW* ) + MSYS* | MINGW* ) msys=true ;; NONSTOP* ) diff --git a/illuaminate.sexp b/illuaminate.sexp index 63d04be57..ac3ae44e4 100644 --- a/illuaminate.sexp +++ b/illuaminate.sexp @@ -18,7 +18,7 @@ (title "CC: Tweaked") (logo src/main/resources/pack.png) (url https://tweaked.cc/) - (source-link https://github.com/SquidDev-CC/CC-Tweaked/blob/${commit}/${path}#L${line}) + (source-link https://github.com/cc-tweaked/CC-Tweaked/blob/${commit}/${path}#L${line}) (styles src/web/styles.css) (scripts build/rollup/index.js) @@ -71,6 +71,7 @@ :max _CC_DEFAULT_SETTINGS _CC_DISABLE_LUA51_FEATURES + _HOST ;; Ideally we'd pick these up from bios.lua, but illuaminate currently ;; isn't smart enough. sleep write printError read rs))) diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/cable.json b/src/generated/resources/data/computercraft/advancements/recipes/computercraft/cable.json index 69ed2c857..ecec5122c 100644 --- a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/cable.json +++ b/src/generated/resources/data/computercraft/advancements/recipes/computercraft/cable.json @@ -21,7 +21,7 @@ "conditions": { "items": [ { - "tag": "computercraft:computer" + "tag": "computercraft:wired_modem" } ] } diff --git a/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/speaker.json b/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/speaker.json index 350a5019b..567e5aea4 100644 --- a/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/speaker.json +++ b/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/speaker.json @@ -6,14 +6,15 @@ "P" ], "key": { - "#": { + "P": { "item": "computercraft:pocket_computer_advanced" }, - "P": { + "#": { "item": "computercraft:speaker" } }, "result": { - "item": "computercraft:pocket_computer_advanced" + "item": "computercraft:pocket_computer_advanced", + "nbt": "{Upgrade:\"computercraft:speaker\"}" } } \ No newline at end of file diff --git a/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/wireless_modem_advanced.json b/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/wireless_modem_advanced.json index 8896bd062..222c93ae6 100644 --- a/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/wireless_modem_advanced.json +++ b/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/wireless_modem_advanced.json @@ -6,14 +6,15 @@ "P" ], "key": { - "#": { + "P": { "item": "computercraft:pocket_computer_advanced" }, - "P": { + "#": { "item": "computercraft:wireless_modem_advanced" } }, "result": { - "item": "computercraft:pocket_computer_advanced" + "item": "computercraft:pocket_computer_advanced", + "nbt": "{Upgrade:\"computercraft:wireless_modem_advanced\"}" } } \ No newline at end of file diff --git a/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/wireless_modem_normal.json b/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/wireless_modem_normal.json index 9e007b1cd..cd9ff2d17 100644 --- a/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/wireless_modem_normal.json +++ b/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/wireless_modem_normal.json @@ -6,14 +6,15 @@ "P" ], "key": { - "#": { + "P": { "item": "computercraft:pocket_computer_advanced" }, - "P": { + "#": { "item": "computercraft:wireless_modem_normal" } }, "result": { - "item": "computercraft:pocket_computer_advanced" + "item": "computercraft:pocket_computer_advanced", + "nbt": "{Upgrade:\"computercraft:wireless_modem_normal\"}" } } \ No newline at end of file diff --git a/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/speaker.json b/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/speaker.json index b5fb937a4..dc388cbd4 100644 --- a/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/speaker.json +++ b/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/speaker.json @@ -6,14 +6,15 @@ "P" ], "key": { - "#": { + "P": { "item": "computercraft:pocket_computer_normal" }, - "P": { + "#": { "item": "computercraft:speaker" } }, "result": { - "item": "computercraft:pocket_computer_normal" + "item": "computercraft:pocket_computer_normal", + "nbt": "{Upgrade:\"computercraft:speaker\"}" } } \ No newline at end of file diff --git a/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/wireless_modem_advanced.json b/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/wireless_modem_advanced.json index d8e9518e4..c1e7ef083 100644 --- a/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/wireless_modem_advanced.json +++ b/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/wireless_modem_advanced.json @@ -6,14 +6,15 @@ "P" ], "key": { - "#": { + "P": { "item": "computercraft:pocket_computer_normal" }, - "P": { + "#": { "item": "computercraft:wireless_modem_advanced" } }, "result": { - "item": "computercraft:pocket_computer_normal" + "item": "computercraft:pocket_computer_normal", + "nbt": "{Upgrade:\"computercraft:wireless_modem_advanced\"}" } } \ No newline at end of file diff --git a/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/wireless_modem_normal.json b/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/wireless_modem_normal.json index 736753136..bf12b0174 100644 --- a/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/wireless_modem_normal.json +++ b/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/wireless_modem_normal.json @@ -6,14 +6,15 @@ "P" ], "key": { - "#": { + "P": { "item": "computercraft:pocket_computer_normal" }, - "P": { + "#": { "item": "computercraft:wireless_modem_normal" } }, "result": { - "item": "computercraft:pocket_computer_normal" + "item": "computercraft:pocket_computer_normal", + "nbt": "{Upgrade:\"computercraft:wireless_modem_normal\"}" } } \ No newline at end of file diff --git a/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/speaker.json b/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/speaker.json index 6526349af..2cf9964a2 100644 --- a/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/speaker.json +++ b/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/speaker.json @@ -5,10 +5,10 @@ "#T" ], "key": { - "#": { + "T": { "item": "computercraft:turtle_advanced" }, - "T": { + "#": { "item": "computercraft:speaker" } }, diff --git a/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/wireless_modem_advanced.json b/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/wireless_modem_advanced.json index 2aea48cae..c6cc910fe 100644 --- a/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/wireless_modem_advanced.json +++ b/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/wireless_modem_advanced.json @@ -5,10 +5,10 @@ "#T" ], "key": { - "#": { + "T": { "item": "computercraft:turtle_advanced" }, - "T": { + "#": { "item": "computercraft:wireless_modem_advanced" } }, diff --git a/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/wireless_modem_normal.json b/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/wireless_modem_normal.json index 39c434755..7451f115f 100644 --- a/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/wireless_modem_normal.json +++ b/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/wireless_modem_normal.json @@ -5,10 +5,10 @@ "#T" ], "key": { - "#": { + "T": { "item": "computercraft:turtle_advanced" }, - "T": { + "#": { "item": "computercraft:wireless_modem_normal" } }, diff --git a/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/crafting_table.json b/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/crafting_table.json index f7178ff09..15d1993bf 100644 --- a/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/crafting_table.json +++ b/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/crafting_table.json @@ -5,10 +5,10 @@ "#T" ], "key": { - "#": { + "T": { "item": "computercraft:turtle_advanced" }, - "T": { + "#": { "item": "minecraft:crafting_table" } }, diff --git a/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_axe.json b/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_axe.json index ab2831b56..774438beb 100644 --- a/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_axe.json +++ b/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_axe.json @@ -5,10 +5,10 @@ "#T" ], "key": { - "#": { + "T": { "item": "computercraft:turtle_advanced" }, - "T": { + "#": { "item": "minecraft:diamond_axe" } }, diff --git a/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_hoe.json b/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_hoe.json index 13c2f694c..cf00c7587 100644 --- a/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_hoe.json +++ b/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_hoe.json @@ -5,10 +5,10 @@ "#T" ], "key": { - "#": { + "T": { "item": "computercraft:turtle_advanced" }, - "T": { + "#": { "item": "minecraft:diamond_hoe" } }, diff --git a/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_pickaxe.json b/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_pickaxe.json index 3f3763457..58560f66c 100644 --- a/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_pickaxe.json +++ b/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_pickaxe.json @@ -5,10 +5,10 @@ "#T" ], "key": { - "#": { + "T": { "item": "computercraft:turtle_advanced" }, - "T": { + "#": { "item": "minecraft:diamond_pickaxe" } }, diff --git a/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_shovel.json b/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_shovel.json index 248f62209..614e6178f 100644 --- a/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_shovel.json +++ b/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_shovel.json @@ -5,10 +5,10 @@ "#T" ], "key": { - "#": { + "T": { "item": "computercraft:turtle_advanced" }, - "T": { + "#": { "item": "minecraft:diamond_shovel" } }, diff --git a/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_sword.json b/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_sword.json index 8cab2a90b..846b6bc8e 100644 --- a/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_sword.json +++ b/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_sword.json @@ -5,10 +5,10 @@ "#T" ], "key": { - "#": { + "T": { "item": "computercraft:turtle_advanced" }, - "T": { + "#": { "item": "minecraft:diamond_sword" } }, diff --git a/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/speaker.json b/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/speaker.json index 28f425aec..39e3fa7e8 100644 --- a/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/speaker.json +++ b/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/speaker.json @@ -5,10 +5,10 @@ "#T" ], "key": { - "#": { + "T": { "item": "computercraft:turtle_normal" }, - "T": { + "#": { "item": "computercraft:speaker" } }, diff --git a/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/wireless_modem_advanced.json b/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/wireless_modem_advanced.json index 3af190a52..7b6da28e4 100644 --- a/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/wireless_modem_advanced.json +++ b/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/wireless_modem_advanced.json @@ -5,10 +5,10 @@ "#T" ], "key": { - "#": { + "T": { "item": "computercraft:turtle_normal" }, - "T": { + "#": { "item": "computercraft:wireless_modem_advanced" } }, diff --git a/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/wireless_modem_normal.json b/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/wireless_modem_normal.json index f387a143d..66d096584 100644 --- a/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/wireless_modem_normal.json +++ b/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/wireless_modem_normal.json @@ -5,10 +5,10 @@ "#T" ], "key": { - "#": { + "T": { "item": "computercraft:turtle_normal" }, - "T": { + "#": { "item": "computercraft:wireless_modem_normal" } }, diff --git a/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/crafting_table.json b/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/crafting_table.json index 8e8a1dcc9..31647e842 100644 --- a/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/crafting_table.json +++ b/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/crafting_table.json @@ -5,10 +5,10 @@ "#T" ], "key": { - "#": { + "T": { "item": "computercraft:turtle_normal" }, - "T": { + "#": { "item": "minecraft:crafting_table" } }, diff --git a/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_axe.json b/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_axe.json index 85a16309d..a79534db6 100644 --- a/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_axe.json +++ b/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_axe.json @@ -5,10 +5,10 @@ "#T" ], "key": { - "#": { + "T": { "item": "computercraft:turtle_normal" }, - "T": { + "#": { "item": "minecraft:diamond_axe" } }, diff --git a/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_hoe.json b/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_hoe.json index 45491a5e8..0c0fc1c39 100644 --- a/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_hoe.json +++ b/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_hoe.json @@ -5,10 +5,10 @@ "#T" ], "key": { - "#": { + "T": { "item": "computercraft:turtle_normal" }, - "T": { + "#": { "item": "minecraft:diamond_hoe" } }, diff --git a/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_pickaxe.json b/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_pickaxe.json index db9ef1ae6..0490a1267 100644 --- a/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_pickaxe.json +++ b/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_pickaxe.json @@ -5,10 +5,10 @@ "#T" ], "key": { - "#": { + "T": { "item": "computercraft:turtle_normal" }, - "T": { + "#": { "item": "minecraft:diamond_pickaxe" } }, diff --git a/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_shovel.json b/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_shovel.json index 66f98c2c9..7bbe87284 100644 --- a/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_shovel.json +++ b/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_shovel.json @@ -5,10 +5,10 @@ "#T" ], "key": { - "#": { + "T": { "item": "computercraft:turtle_normal" }, - "T": { + "#": { "item": "minecraft:diamond_shovel" } }, diff --git a/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_sword.json b/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_sword.json index c99c73c03..ba893dc67 100644 --- a/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_sword.json +++ b/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_sword.json @@ -5,10 +5,10 @@ "#T" ], "key": { - "#": { + "T": { "item": "computercraft:turtle_normal" }, - "T": { + "#": { "item": "minecraft:diamond_sword" } }, diff --git a/src/generated/resources/data/computercraft/tags/blocks/computer.json b/src/generated/resources/data/computercraft/tags/blocks/computer.json new file mode 100644 index 000000000..bcd0e8037 --- /dev/null +++ b/src/generated/resources/data/computercraft/tags/blocks/computer.json @@ -0,0 +1,8 @@ +{ + "replace": false, + "values": [ + "computercraft:computer_normal", + "computercraft:computer_advanced", + "computercraft:computer_command" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/computercraft/tags/blocks/monitor.json b/src/generated/resources/data/computercraft/tags/blocks/monitor.json new file mode 100644 index 000000000..babaefa8b --- /dev/null +++ b/src/generated/resources/data/computercraft/tags/blocks/monitor.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "computercraft:monitor_normal", + "computercraft:monitor_advanced" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/computercraft/tags/blocks/turtle.json b/src/generated/resources/data/computercraft/tags/blocks/turtle.json new file mode 100644 index 000000000..e4277edfe --- /dev/null +++ b/src/generated/resources/data/computercraft/tags/blocks/turtle.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "computercraft:turtle_normal", + "computercraft:turtle_advanced" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/computercraft/tags/blocks/turtle_always_breakable.json b/src/generated/resources/data/computercraft/tags/blocks/turtle_always_breakable.json new file mode 100644 index 000000000..1d795dcef --- /dev/null +++ b/src/generated/resources/data/computercraft/tags/blocks/turtle_always_breakable.json @@ -0,0 +1,8 @@ +{ + "replace": false, + "values": [ + "#minecraft:leaves", + "minecraft:bamboo", + "minecraft:bamboo_sapling" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/computercraft/tags/blocks/turtle_hoe_harvestable.json b/src/generated/resources/data/computercraft/tags/blocks/turtle_hoe_harvestable.json new file mode 100644 index 000000000..00e81351a --- /dev/null +++ b/src/generated/resources/data/computercraft/tags/blocks/turtle_hoe_harvestable.json @@ -0,0 +1,11 @@ +{ + "replace": false, + "values": [ + "#minecraft:crops", + "minecraft:cactus", + "minecraft:melon", + "minecraft:pumpkin", + "minecraft:carved_pumpkin", + "minecraft:jack_o_lantern" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/computercraft/tags/blocks/turtle_shovel_harvestable.json b/src/generated/resources/data/computercraft/tags/blocks/turtle_shovel_harvestable.json new file mode 100644 index 000000000..dfdc26e22 --- /dev/null +++ b/src/generated/resources/data/computercraft/tags/blocks/turtle_shovel_harvestable.json @@ -0,0 +1,9 @@ +{ + "replace": false, + "values": [ + "minecraft:melon", + "minecraft:pumpkin", + "minecraft:carved_pumpkin", + "minecraft:jack_o_lantern" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/computercraft/tags/blocks/turtle_sword_harvestable.json b/src/generated/resources/data/computercraft/tags/blocks/turtle_sword_harvestable.json new file mode 100644 index 000000000..c38f1efd8 --- /dev/null +++ b/src/generated/resources/data/computercraft/tags/blocks/turtle_sword_harvestable.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "#minecraft:wool", + "minecraft:cobweb" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/computercraft/tags/blocks/wired_modem.json b/src/generated/resources/data/computercraft/tags/blocks/wired_modem.json new file mode 100644 index 000000000..10ade37b3 --- /dev/null +++ b/src/generated/resources/data/computercraft/tags/blocks/wired_modem.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "computercraft:cable", + "computercraft:wired_modem_full" + ] +} \ No newline at end of file diff --git a/src/main/java/dan200/computercraft/client/SoundManager.java b/src/main/java/dan200/computercraft/client/SoundManager.java index c1795d8c9..d4ccf7cac 100644 --- a/src/main/java/dan200/computercraft/client/SoundManager.java +++ b/src/main/java/dan200/computercraft/client/SoundManager.java @@ -9,7 +9,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.resources.sounds.AbstractSoundInstance; import net.minecraft.client.resources.sounds.SoundInstance; import net.minecraft.client.resources.sounds.TickableSoundInstance; -import net.minecraft.sounds.SoundEvent; +import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundSource; import net.minecraft.world.phys.Vec3; @@ -21,7 +21,7 @@ public class SoundManager { private static final Map sounds = new HashMap<>(); - public static void playSound( UUID source, Vec3 position, SoundEvent event, float volume, float pitch ) + public static void playSound( UUID source, Vec3 position, ResourceLocation event, float volume, float pitch ) { var soundManager = Minecraft.getInstance().getSoundManager(); @@ -54,7 +54,7 @@ public class SoundManager private static class MoveableSound extends AbstractSoundInstance implements TickableSoundInstance { - protected MoveableSound( SoundEvent sound, Vec3 position, float volume, float pitch ) + protected MoveableSound( ResourceLocation sound, Vec3 position, float volume, float pitch ) { super( sound, SoundSource.RECORDS ); setPosition( position ); diff --git a/src/main/java/dan200/computercraft/data/BlockTagsGenerator.java b/src/main/java/dan200/computercraft/data/BlockTagsGenerator.java new file mode 100644 index 000000000..6a3ad4ca2 --- /dev/null +++ b/src/main/java/dan200/computercraft/data/BlockTagsGenerator.java @@ -0,0 +1,63 @@ +/* + * This file is part of ComputerCraft - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission. + * Send enquiries to dratcliffe@gmail.com + */ +package dan200.computercraft.data; + +import dan200.computercraft.ComputerCraft; +import dan200.computercraft.shared.Registry; +import net.minecraft.data.DataGenerator; +import net.minecraft.data.tags.BlockTagsProvider; +import net.minecraft.tags.BlockTags; +import net.minecraft.world.level.block.Blocks; +import net.minecraftforge.common.data.ExistingFileHelper; + +import static dan200.computercraft.shared.ComputerCraftTags.Blocks.*; + +public class BlockTagsGenerator extends BlockTagsProvider +{ + public BlockTagsGenerator( DataGenerator generator, ExistingFileHelper helper ) + { + super( generator, ComputerCraft.MOD_ID, helper ); + } + + @Override + @SuppressWarnings( "unchecked" ) + protected void addTags() + { + // Items + tag( COMPUTER ).add( + Registry.ModBlocks.COMPUTER_NORMAL.get(), + Registry.ModBlocks.COMPUTER_ADVANCED.get(), + Registry.ModBlocks.COMPUTER_COMMAND.get() + ); + tag( TURTLE ).add( Registry.ModBlocks.TURTLE_NORMAL.get(), Registry.ModBlocks.TURTLE_ADVANCED.get() ); + tag( WIRED_MODEM ).add( Registry.ModBlocks.CABLE.get(), Registry.ModBlocks.WIRED_MODEM_FULL.get() ); + tag( MONITOR ).add( Registry.ModBlocks.MONITOR_NORMAL.get(), Registry.ModBlocks.MONITOR_ADVANCED.get() ); + + tag( TURTLE_ALWAYS_BREAKABLE ).addTags( BlockTags.LEAVES ).add( + Blocks.BAMBOO, Blocks.BAMBOO_SAPLING // Bamboo isn't instabreak for some odd reason. + ); + + tag( TURTLE_SHOVEL_BREAKABLE ).addTag( BlockTags.MINEABLE_WITH_SHOVEL ).add( + Blocks.MELON, + Blocks.PUMPKIN, + Blocks.CARVED_PUMPKIN, + Blocks.JACK_O_LANTERN + ); + + tag( TURTLE_HOE_BREAKABLE ).addTags( + BlockTags.CROPS, + BlockTags.MINEABLE_WITH_HOE + ).add( + Blocks.CACTUS, + Blocks.MELON, + Blocks.PUMPKIN, + Blocks.CARVED_PUMPKIN, + Blocks.JACK_O_LANTERN + ); + + tag( TURTLE_SWORD_BREAKABLE ).addTags( BlockTags.WOOL ).add( Blocks.COBWEB ); + } +} diff --git a/src/main/java/dan200/computercraft/data/Generators.java b/src/main/java/dan200/computercraft/data/Generators.java index f90376519..e161a89d0 100644 --- a/src/main/java/dan200/computercraft/data/Generators.java +++ b/src/main/java/dan200/computercraft/data/Generators.java @@ -7,6 +7,7 @@ package dan200.computercraft.data; import dan200.computercraft.shared.Registry; import net.minecraft.data.DataGenerator; +import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.forge.event.lifecycle.GatherDataEvent; @@ -20,9 +21,14 @@ public class Generators Registry.registerLoot(); DataGenerator generator = event.getGenerator(); - generator.addProvider( new Recipes( generator ) ); - generator.addProvider( new LootTables( generator ) ); - generator.addProvider( new Tags( generator, event.getExistingFileHelper() ) ); - generator.addProvider( new BlockModelProvider( generator, event.getExistingFileHelper() ) ); + ExistingFileHelper existingFiles = event.getExistingFileHelper(); + + generator.addProvider( new RecipeGenerator( generator ) ); + generator.addProvider( new LootTableGenerator( generator ) ); + generator.addProvider( new BlockModelProvider( generator, existingFiles ) ); + + BlockTagsGenerator blockTags = new BlockTagsGenerator( generator, existingFiles ); + generator.addProvider( blockTags ); + generator.addProvider( new ItemTagsGenerator( generator, blockTags, existingFiles ) ); } } diff --git a/src/main/java/dan200/computercraft/data/ItemTagsGenerator.java b/src/main/java/dan200/computercraft/data/ItemTagsGenerator.java new file mode 100644 index 000000000..ac966916f --- /dev/null +++ b/src/main/java/dan200/computercraft/data/ItemTagsGenerator.java @@ -0,0 +1,39 @@ +/* + * This file is part of ComputerCraft - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission. + * Send enquiries to dratcliffe@gmail.com + */ +package dan200.computercraft.data; + +import dan200.computercraft.ComputerCraft; +import dan200.computercraft.shared.ComputerCraftTags.Blocks; +import dan200.computercraft.shared.Registry; +import net.minecraft.data.DataGenerator; +import net.minecraft.data.tags.ItemTagsProvider; +import net.minecraft.tags.ItemTags; +import net.minecraftforge.common.data.ExistingFileHelper; + +import static dan200.computercraft.shared.ComputerCraftTags.Items.*; + +public class ItemTagsGenerator extends ItemTagsProvider +{ + public ItemTagsGenerator( DataGenerator generator, BlockTagsGenerator blockTags, ExistingFileHelper helper ) + { + super( generator, blockTags, ComputerCraft.MOD_ID, helper ); + } + + @Override + protected void addTags() + { + copy( Blocks.COMPUTER, COMPUTER ); + copy( Blocks.TURTLE, TURTLE ); + tag( WIRED_MODEM ).add( Registry.ModItems.WIRED_MODEM.get(), Registry.ModItems.WIRED_MODEM_FULL.get() ); + copy( Blocks.MONITOR, MONITOR ); + + tag( ItemTags.PIGLIN_LOVED ).add( + Registry.ModItems.COMPUTER_ADVANCED.get(), Registry.ModItems.TURTLE_ADVANCED.get(), + Registry.ModItems.WIRELESS_MODEM_ADVANCED.get(), Registry.ModItems.POCKET_COMPUTER_ADVANCED.get(), + Registry.ModItems.MONITOR_ADVANCED.get() + ); + } +} diff --git a/src/main/java/dan200/computercraft/data/LootTables.java b/src/main/java/dan200/computercraft/data/LootTableGenerator.java similarity index 97% rename from src/main/java/dan200/computercraft/data/LootTables.java rename to src/main/java/dan200/computercraft/data/LootTableGenerator.java index ad5c4e6fe..99c2820ff 100644 --- a/src/main/java/dan200/computercraft/data/LootTables.java +++ b/src/main/java/dan200/computercraft/data/LootTableGenerator.java @@ -30,9 +30,9 @@ import net.minecraftforge.fmllegacy.RegistryObject; import java.util.function.BiConsumer; -public class LootTables extends LootTableProvider +public class LootTableGenerator extends LootTableProvider { - public LootTables( DataGenerator generator ) + public LootTableGenerator( DataGenerator generator ) { super( generator ); } diff --git a/src/main/java/dan200/computercraft/data/Recipes.java b/src/main/java/dan200/computercraft/data/RecipeGenerator.java similarity index 90% rename from src/main/java/dan200/computercraft/data/Recipes.java rename to src/main/java/dan200/computercraft/data/RecipeGenerator.java index 1886150ac..6ed24c094 100644 --- a/src/main/java/dan200/computercraft/data/Recipes.java +++ b/src/main/java/dan200/computercraft/data/RecipeGenerator.java @@ -6,7 +6,6 @@ package dan200.computercraft.data; import dan200.computercraft.ComputerCraft; -import dan200.computercraft.data.Tags.CCTags; import dan200.computercraft.shared.PocketUpgrades; import dan200.computercraft.shared.Registry; import dan200.computercraft.shared.TurtleUpgrades; @@ -40,9 +39,12 @@ import javax.annotation.Nonnull; import java.util.Locale; import java.util.function.Consumer; -public class Recipes extends RecipeProvider +import static dan200.computercraft.shared.ComputerCraftTags.Items.COMPUTER; +import static dan200.computercraft.shared.ComputerCraftTags.Items.WIRED_MODEM; + +public class RecipeGenerator extends RecipeProvider { - public Recipes( DataGenerator generator ) + public RecipeGenerator( DataGenerator generator ) { super( generator ); } @@ -105,8 +107,8 @@ public class Recipes extends RecipeProvider .shaped( result.getItem() ) .group( String.format( "%s:turtle_%s", ComputerCraft.MOD_ID, nameId ) ) .pattern( "#T" ) - .define( '#', base.getItem() ) - .define( 'T', upgrade.getCraftingItem().getItem() ) + .define( 'T', base.getItem() ) + .define( '#', upgrade.getCraftingItem().getItem() ) .unlockedBy( "has_items", inventoryChange( base.getItem(), upgrade.getCraftingItem().getItem() ) ) .save( @@ -134,14 +136,14 @@ public class Recipes extends RecipeProvider String nameId = family.name().toLowerCase( Locale.ROOT ); PocketUpgrades.getVanillaUpgrades().forEach( upgrade -> { - ItemStack result = PocketComputerItemFactory.create( -1, null, -1, family, null ); + ItemStack result = PocketComputerItemFactory.create( -1, null, -1, family, upgrade ); ShapedRecipeBuilder .shaped( result.getItem() ) .group( String.format( "%s:pocket_%s", ComputerCraft.MOD_ID, nameId ) ) .pattern( "#" ) .pattern( "P" ) - .define( '#', base.getItem() ) - .define( 'P', upgrade.getCraftingItem().getItem() ) + .define( 'P', base.getItem() ) + .define( '#', upgrade.getCraftingItem().getItem() ) .unlockedBy( "has_items", inventoryChange( base.getItem(), upgrade.getCraftingItem().getItem() ) ) .save( @@ -163,8 +165,8 @@ public class Recipes extends RecipeProvider .pattern( " # " ) .define( '#', Tags.Items.STONE ) .define( 'R', Tags.Items.DUSTS_REDSTONE ) - .unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) ) - .unlockedBy( "has_modem", inventoryChange( CCTags.COMPUTER ) ) + .unlockedBy( "has_computer", inventoryChange( COMPUTER ) ) + .unlockedBy( "has_modem", inventoryChange( WIRED_MODEM ) ) .save( add ); ShapedRecipeBuilder @@ -207,7 +209,7 @@ public class Recipes extends RecipeProvider .pattern( "#R#" ) .define( '#', Tags.Items.STONE ) .define( 'R', Tags.Items.DUSTS_REDSTONE ) - .unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) ) + .unlockedBy( "has_computer", inventoryChange( COMPUTER ) ) .save( add ); ShapedRecipeBuilder @@ -217,7 +219,7 @@ public class Recipes extends RecipeProvider .pattern( "###" ) .define( '#', Tags.Items.STONE ) .define( 'G', Tags.Items.GLASS_PANES ) - .unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) ) + .unlockedBy( "has_computer", inventoryChange( COMPUTER ) ) .save( add ); ShapedRecipeBuilder @@ -227,7 +229,7 @@ public class Recipes extends RecipeProvider .pattern( "###" ) .define( '#', Tags.Items.INGOTS_GOLD ) .define( 'G', Tags.Items.GLASS_PANES ) - .unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) ) + .unlockedBy( "has_computer", inventoryChange( COMPUTER ) ) .save( add ); ShapedRecipeBuilder @@ -238,7 +240,7 @@ public class Recipes extends RecipeProvider .define( '#', Tags.Items.STONE ) .define( 'A', Items.GOLDEN_APPLE ) .define( 'G', Tags.Items.GLASS_PANES ) - .unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) ) + .unlockedBy( "has_computer", inventoryChange( COMPUTER ) ) .unlockedBy( "has_apple", inventoryChange( Items.GOLDEN_APPLE ) ) .save( add ); @@ -250,7 +252,7 @@ public class Recipes extends RecipeProvider .define( '#', Tags.Items.INGOTS_GOLD ) .define( 'A', Items.GOLDEN_APPLE ) .define( 'G', Tags.Items.GLASS_PANES ) - .unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) ) + .unlockedBy( "has_computer", inventoryChange( COMPUTER ) ) .unlockedBy( "has_apple", inventoryChange( Items.GOLDEN_APPLE ) ) .save( add ); @@ -262,7 +264,7 @@ public class Recipes extends RecipeProvider .define( '#', Tags.Items.STONE ) .define( 'R', Tags.Items.DUSTS_REDSTONE ) .define( 'D', Tags.Items.DYES ) - .unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) ) + .unlockedBy( "has_computer", inventoryChange( COMPUTER ) ) .save( add ); ShapedRecipeBuilder @@ -273,7 +275,7 @@ public class Recipes extends RecipeProvider .define( '#', Tags.Items.STONE ) .define( 'N', Blocks.NOTE_BLOCK ) .define( 'R', Tags.Items.DUSTS_REDSTONE ) - .unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) ) + .unlockedBy( "has_computer", inventoryChange( COMPUTER ) ) .save( add ); ShapedRecipeBuilder @@ -283,19 +285,19 @@ public class Recipes extends RecipeProvider .pattern( "###" ) .define( '#', Tags.Items.STONE ) .define( 'R', Tags.Items.DUSTS_REDSTONE ) - .unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) ) + .unlockedBy( "has_computer", inventoryChange( COMPUTER ) ) .unlockedBy( "has_cable", inventoryChange( Registry.ModItems.CABLE.get() ) ) .save( add ); ShapelessRecipeBuilder .shapeless( Registry.ModBlocks.WIRED_MODEM_FULL.get() ) .requires( Registry.ModItems.WIRED_MODEM.get() ) - .unlockedBy( "has_modem", inventoryChange( CCTags.WIRED_MODEM ) ) + .unlockedBy( "has_modem", inventoryChange( WIRED_MODEM ) ) .save( add, new ResourceLocation( ComputerCraft.MOD_ID, "wired_modem_full_from" ) ); ShapelessRecipeBuilder .shapeless( Registry.ModItems.WIRED_MODEM.get() ) .requires( Registry.ModBlocks.WIRED_MODEM_FULL.get() ) - .unlockedBy( "has_modem", inventoryChange( CCTags.WIRED_MODEM ) ) + .unlockedBy( "has_modem", inventoryChange( WIRED_MODEM ) ) .save( add, new ResourceLocation( ComputerCraft.MOD_ID, "wired_modem_full_to" ) ); ShapedRecipeBuilder @@ -305,7 +307,7 @@ public class Recipes extends RecipeProvider .pattern( "###" ) .define( '#', Tags.Items.STONE ) .define( 'E', Tags.Items.ENDER_PEARLS ) - .unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) ) + .unlockedBy( "has_computer", inventoryChange( COMPUTER ) ) .save( add ); ShapedRecipeBuilder @@ -315,7 +317,7 @@ public class Recipes extends RecipeProvider .pattern( "###" ) .define( '#', Tags.Items.INGOTS_GOLD ) .define( 'E', Items.ENDER_EYE ) - .unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) ) + .unlockedBy( "has_computer", inventoryChange( COMPUTER ) ) .unlockedBy( "has_wireless", inventoryChange( Registry.ModBlocks.WIRELESS_MODEM_NORMAL.get() ) ) .save( add ); diff --git a/src/main/java/dan200/computercraft/data/Tags.java b/src/main/java/dan200/computercraft/data/Tags.java deleted file mode 100644 index f8e28cef6..000000000 --- a/src/main/java/dan200/computercraft/data/Tags.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is part of ComputerCraft - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission. - * Send enquiries to dratcliffe@gmail.com - */ -package dan200.computercraft.data; - -import dan200.computercraft.ComputerCraft; -import dan200.computercraft.shared.Registry; -import net.minecraft.data.DataGenerator; -import net.minecraft.data.tags.BlockTagsProvider; -import net.minecraft.data.tags.ItemTagsProvider; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.ItemTags; -import net.minecraft.tags.Tag; -import net.minecraft.world.item.Item; -import net.minecraftforge.common.data.ExistingFileHelper; - -import static dan200.computercraft.data.Tags.CCTags.*; - -public class Tags extends ItemTagsProvider -{ - private static final Tag.Named PIGLIN_LOVED = ItemTags.PIGLIN_LOVED; - - public static class CCTags - { - public static final Tag.Named COMPUTER = item( "computer" ); - public static final Tag.Named TURTLE = item( "turtle" ); - public static final Tag.Named WIRED_MODEM = item( "wired_modem" ); - public static final Tag.Named MONITOR = item( "monitor" ); - } - - public Tags( DataGenerator generator, ExistingFileHelper helper ) - { - super( generator, new BlockTagsProvider( generator, ComputerCraft.MOD_ID, helper ), ComputerCraft.MOD_ID, helper ); - } - - @Override - protected void addTags() - { - tag( COMPUTER ).add( - Registry.ModItems.COMPUTER_NORMAL.get(), - Registry.ModItems.COMPUTER_ADVANCED.get(), - Registry.ModItems.COMPUTER_COMMAND.get() - ); - tag( TURTLE ).add( Registry.ModItems.TURTLE_NORMAL.get(), Registry.ModItems.TURTLE_ADVANCED.get() ); - tag( WIRED_MODEM ).add( Registry.ModItems.WIRED_MODEM.get(), Registry.ModItems.WIRED_MODEM_FULL.get() ); - tag( MONITOR ).add( Registry.ModItems.MONITOR_NORMAL.get(), Registry.ModItems.MONITOR_ADVANCED.get() ); - - tag( PIGLIN_LOVED ).add( - Registry.ModItems.COMPUTER_ADVANCED.get(), Registry.ModItems.TURTLE_ADVANCED.get(), - Registry.ModItems.WIRELESS_MODEM_ADVANCED.get(), Registry.ModItems.POCKET_COMPUTER_ADVANCED.get(), - Registry.ModItems.MONITOR_ADVANCED.get() - ); - } - - private static Tag.Named item( String name ) - { - return ItemTags.bind( new ResourceLocation( ComputerCraft.MOD_ID, name ).toString() ); - } -} diff --git a/src/main/java/dan200/computercraft/shared/ComputerCraftTags.java b/src/main/java/dan200/computercraft/shared/ComputerCraftTags.java new file mode 100644 index 000000000..691ef0ed8 --- /dev/null +++ b/src/main/java/dan200/computercraft/shared/ComputerCraftTags.java @@ -0,0 +1,48 @@ +/* + * This file is part of ComputerCraft - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission. + * Send enquiries to dratcliffe@gmail.com + */ +package dan200.computercraft.shared; + +import dan200.computercraft.ComputerCraft; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; +import net.minecraft.tags.Tag; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; + +public class ComputerCraftTags +{ + public static class Items + { + public static final Tag.Named COMPUTER = make( "computer" ); + public static final Tag.Named TURTLE = make( "turtle" ); + public static final Tag.Named WIRED_MODEM = make( "wired_modem" ); + public static final Tag.Named MONITOR = make( "monitor" ); + + private static Tag.Named make( String name ) + { + return ItemTags.bind( new ResourceLocation( ComputerCraft.MOD_ID, name ).toString() ); + } + } + + public static class Blocks + { + public static final Tag.Named COMPUTER = make( "computer" ); + public static final Tag.Named TURTLE = make( "turtle" ); + public static final Tag.Named WIRED_MODEM = make( "wired_modem" ); + public static final Tag.Named MONITOR = make( "monitor" ); + + public static final Tag.Named TURTLE_ALWAYS_BREAKABLE = make( "turtle_always_breakable" ); + public static final Tag.Named TURTLE_SHOVEL_BREAKABLE = make( "turtle_shovel_harvestable" ); + public static final Tag.Named TURTLE_SWORD_BREAKABLE = make( "turtle_sword_harvestable" ); + public static final Tag.Named TURTLE_HOE_BREAKABLE = make( "turtle_hoe_harvestable" ); + + private static Tag.Named make( String name ) + { + return BlockTags.bind( new ResourceLocation( ComputerCraft.MOD_ID, name ).toString() ); + } + } +} diff --git a/src/main/java/dan200/computercraft/shared/Config.java b/src/main/java/dan200/computercraft/shared/Config.java index f0331f9f1..5ab0cc330 100644 --- a/src/main/java/dan200/computercraft/shared/Config.java +++ b/src/main/java/dan200/computercraft/shared/Config.java @@ -341,6 +341,7 @@ public final class Config ComputerCraft.httpMaxRequests = httpMaxRequests.get(); ComputerCraft.httpMaxWebsockets = httpMaxWebsockets.get(); ComputerCraft.httpDownloadBandwidth = httpDownloadBandwidth.get(); + ComputerCraft.httpUploadBandwidth = httpUploadBandwidth.get(); NetworkUtils.reloadConfig(); // Peripheral diff --git a/src/main/java/dan200/computercraft/shared/network/client/SpeakerPlayClientMessage.java b/src/main/java/dan200/computercraft/shared/network/client/SpeakerPlayClientMessage.java index 0a4a43d0d..863af7a9d 100644 --- a/src/main/java/dan200/computercraft/shared/network/client/SpeakerPlayClientMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/client/SpeakerPlayClientMessage.java @@ -9,12 +9,10 @@ import dan200.computercraft.client.SoundManager; import dan200.computercraft.shared.network.NetworkMessage; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; -import net.minecraft.sounds.SoundEvent; import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fmllegacy.network.NetworkEvent; -import net.minecraftforge.registries.ForgeRegistries; import javax.annotation.Nonnull; import java.util.UUID; @@ -68,7 +66,6 @@ public class SpeakerPlayClientMessage implements NetworkMessage @OnlyIn( Dist.CLIENT ) public void handle( NetworkEvent.Context context ) { - SoundEvent sound = ForgeRegistries.SOUND_EVENTS.getValue( this.sound ); - if( sound != null ) SoundManager.playSound( source, pos, sound, volume, pitch ); + SoundManager.playSound( source, pos, sound, volume, pitch ); } } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockCable.java b/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockCable.java index d731e855a..6305220c7 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockCable.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockCable.java @@ -35,7 +35,8 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.EnumMap; -import static dan200.computercraft.shared.util.WaterloggableHelpers.*; +import static dan200.computercraft.shared.util.WaterloggableHelpers.WATERLOGGED; +import static dan200.computercraft.shared.util.WaterloggableHelpers.getFluidStateForPlacement; public class BlockCable extends BlockGeneric implements SimpleWaterloggedBlock { diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/BlockWirelessModem.java b/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/BlockWirelessModem.java index efffefb8e..4fa6c29c1 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/BlockWirelessModem.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/BlockWirelessModem.java @@ -30,7 +30,8 @@ import net.minecraftforge.fmllegacy.RegistryObject; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import static dan200.computercraft.shared.util.WaterloggableHelpers.*; +import static dan200.computercraft.shared.util.WaterloggableHelpers.WATERLOGGED; +import static dan200.computercraft.shared.util.WaterloggableHelpers.getFluidStateForPlacement; public class BlockWirelessModem extends BlockGeneric implements SimpleWaterloggedBlock { diff --git a/src/main/java/dan200/computercraft/shared/turtle/blocks/BlockTurtle.java b/src/main/java/dan200/computercraft/shared/turtle/blocks/BlockTurtle.java index a3b12f7ce..11bf1a3b6 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/blocks/BlockTurtle.java +++ b/src/main/java/dan200/computercraft/shared/turtle/blocks/BlockTurtle.java @@ -47,7 +47,8 @@ import net.minecraftforge.fmllegacy.RegistryObject; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import static dan200.computercraft.shared.util.WaterloggableHelpers.*; +import static dan200.computercraft.shared.util.WaterloggableHelpers.WATERLOGGED; +import static dan200.computercraft.shared.util.WaterloggableHelpers.getFluidStateForPlacement; public class BlockTurtle extends BlockComputerBase implements SimpleWaterloggedBlock { diff --git a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleHoe.java b/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleHoe.java index 11a157d59..a643ae303 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleHoe.java +++ b/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleHoe.java @@ -9,6 +9,7 @@ import dan200.computercraft.api.turtle.ITurtleAccess; import dan200.computercraft.api.turtle.TurtleCommandResult; import dan200.computercraft.api.turtle.TurtleSide; import dan200.computercraft.api.turtle.TurtleVerb; +import dan200.computercraft.shared.ComputerCraftTags; import dan200.computercraft.shared.turtle.core.TurtlePlaceCommand; import dan200.computercraft.shared.turtle.core.TurtlePlayer; import net.minecraft.core.BlockPos; @@ -18,7 +19,6 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; import javax.annotation.Nonnull; @@ -40,17 +40,14 @@ public class TurtleHoe extends TurtleTool } @Override - protected boolean canBreakBlock( BlockState state, Level world, BlockPos pos, TurtlePlayer player ) + protected TurtleCommandResult checkBlockBreakable( BlockState state, Level world, BlockPos pos, TurtlePlayer player ) { - if( !super.canBreakBlock( state, world, pos, player ) ) return false; + TurtleCommandResult result = super.checkBlockBreakable( state, world, pos, player ); + if( !result.isSuccess() ) return result; - Material material = state.getMaterial(); - return material == Material.PLANT || - material == Material.CACTUS || - material == Material.VEGETABLE || - material == Material.LEAVES || - material == Material.WATER_PLANT || - material == Material.REPLACEABLE_PLANT; + return state.is( ComputerCraftTags.Blocks.TURTLE_HOE_BREAKABLE ) + || isTriviallyBreakable( world, pos, state ) + ? result : INEFFECTIVE; } @Nonnull diff --git a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleShovel.java b/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleShovel.java index f5c60e571..63b2e4d63 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleShovel.java +++ b/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleShovel.java @@ -9,6 +9,7 @@ import dan200.computercraft.api.turtle.ITurtleAccess; import dan200.computercraft.api.turtle.TurtleCommandResult; import dan200.computercraft.api.turtle.TurtleSide; import dan200.computercraft.api.turtle.TurtleVerb; +import dan200.computercraft.shared.ComputerCraftTags; import dan200.computercraft.shared.turtle.core.TurtlePlaceCommand; import dan200.computercraft.shared.turtle.core.TurtlePlayer; import net.minecraft.core.BlockPos; @@ -18,7 +19,6 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; import javax.annotation.Nonnull; @@ -40,21 +40,14 @@ public class TurtleShovel extends TurtleTool } @Override - protected boolean canBreakBlock( BlockState state, Level world, BlockPos pos, TurtlePlayer player ) + protected TurtleCommandResult checkBlockBreakable( BlockState state, Level world, BlockPos pos, TurtlePlayer player ) { - if( !super.canBreakBlock( state, world, pos, player ) ) return false; + TurtleCommandResult result = super.checkBlockBreakable( state, world, pos, player ); + if( !result.isSuccess() ) return result; - Material material = state.getMaterial(); - return material == Material.DIRT || - material == Material.SAND || - material == Material.TOP_SNOW || - material == Material.CLAY || - material == Material.SNOW || - material == Material.PLANT || - material == Material.CACTUS || - material == Material.VEGETABLE || - material == Material.LEAVES || - material == Material.REPLACEABLE_PLANT; + return state.is( ComputerCraftTags.Blocks.TURTLE_SHOVEL_BREAKABLE ) + || isTriviallyBreakable( world, pos, state ) + ? result : INEFFECTIVE; } @Nonnull diff --git a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleSword.java b/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleSword.java index 9ff81ded6..5b8c356a7 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleSword.java +++ b/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleSword.java @@ -5,6 +5,8 @@ */ package dan200.computercraft.shared.turtle.upgrades; +import dan200.computercraft.api.turtle.TurtleCommandResult; +import dan200.computercraft.shared.ComputerCraftTags; import dan200.computercraft.shared.turtle.core.TurtlePlayer; import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; @@ -12,7 +14,6 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; public class TurtleSword extends TurtleTool { @@ -32,16 +33,14 @@ public class TurtleSword extends TurtleTool } @Override - protected boolean canBreakBlock( BlockState state, Level world, BlockPos pos, TurtlePlayer player ) + protected TurtleCommandResult checkBlockBreakable( BlockState state, Level world, BlockPos pos, TurtlePlayer player ) { - if( !super.canBreakBlock( state, world, pos, player ) ) return false; + TurtleCommandResult result = super.checkBlockBreakable( state, world, pos, player ); + if( !result.isSuccess() ) return result; - Material material = state.getMaterial(); - return material == Material.PLANT || - material == Material.LEAVES || - material == Material.REPLACEABLE_PLANT || - material == Material.WOOL || - material == Material.WEB; + return state.is( ComputerCraftTags.Blocks.TURTLE_SWORD_BREAKABLE ) + || isTriviallyBreakable( world, pos, state ) + ? result : INEFFECTIVE; } @Override diff --git a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleTool.java b/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleTool.java index 3cd7f53e1..5fa0b51a5 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleTool.java +++ b/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleTool.java @@ -10,6 +10,7 @@ import com.mojang.math.Transformation; import dan200.computercraft.ComputerCraft; import dan200.computercraft.api.client.TransformedModel; import dan200.computercraft.api.turtle.*; +import dan200.computercraft.shared.ComputerCraftTags; import dan200.computercraft.shared.TurtlePermissions; import dan200.computercraft.shared.turtle.core.TurtleBrain; import dan200.computercraft.shared.turtle.core.TurtlePlayer; @@ -27,6 +28,7 @@ import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.decoration.ArmorStand; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; @@ -46,6 +48,9 @@ import java.util.function.Function; public class TurtleTool extends AbstractTurtleUpgrade { + protected static final TurtleCommandResult UNBREAKABLE = TurtleCommandResult.failure( "Unbreakable block detected" ); + protected static final TurtleCommandResult INEFFECTIVE = TurtleCommandResult.failure( "Cannot break block with this tool" ); + protected final ItemStack item; public TurtleTool( ResourceLocation id, String adjective, Item item ) @@ -107,13 +112,14 @@ public class TurtleTool extends AbstractTurtleUpgrade } } - protected boolean canBreakBlock( BlockState state, Level world, BlockPos pos, TurtlePlayer player ) + protected TurtleCommandResult checkBlockBreakable( BlockState state, Level world, BlockPos pos, TurtlePlayer player ) { Block block = state.getBlock(); return !state.isAir() && block != Blocks.BEDROCK && state.getDestroyProgress( player, world, pos ) > 0 - && block.canEntityDestroy( state, world, pos, player ); + && block.canEntityDestroy( state, world, pos, player ) + ? TurtleCommandResult.success() : UNBREAKABLE; } protected float getDamageMultiplier() @@ -158,6 +164,7 @@ public class TurtleTool extends AbstractTurtleUpgrade { float damage = (float) turtlePlayer.getAttributeValue( Attributes.ATTACK_DAMAGE ); damage *= getDamageMultiplier(); + ComputerCraft.log.info( "Dealing {} damage", damage ); if( damage > 0.0f ) { DamageSource source = DamageSource.playerAttack( turtlePlayer ); @@ -224,10 +231,8 @@ public class TurtleTool extends AbstractTurtleUpgrade } // Check if we can break the block - if( !canBreakBlock( state, world, blockPosition, turtlePlayer ) ) - { - return TurtleCommandResult.failure( "Unbreakable block detected" ); - } + TurtleCommandResult breakable = checkBlockBreakable( state, world, blockPosition, turtlePlayer ); + if( !breakable.isSuccess() ) return breakable; // Consume the items the block drops DropConsumer.set( world, blockPosition, turtleDropConsumer( turtleTile, turtle ) ); @@ -281,4 +286,11 @@ public class TurtleTool extends AbstractTurtleUpgrade } ) ); } } + + protected boolean isTriviallyBreakable( BlockGetter reader, BlockPos pos, BlockState state ) + { + return state.is( ComputerCraftTags.Blocks.TURTLE_ALWAYS_BREAKABLE ) + // Allow breaking any "instabreak" block. + || state.getDestroySpeed( reader, pos ) == 0; + } } diff --git a/src/main/java/dan200/computercraft/shared/util/DropConsumer.java b/src/main/java/dan200/computercraft/shared/util/DropConsumer.java index 78489e1ca..1563207e8 100644 --- a/src/main/java/dan200/computercraft/shared/util/DropConsumer.java +++ b/src/main/java/dan200/computercraft/shared/util/DropConsumer.java @@ -97,6 +97,7 @@ public final class DropConsumer if( dropEntity == null || drops.getEntity() != dropEntity ) return; for( ItemEntity drop : drops.getDrops() ) handleDrops( drop.getItem() ); + drops.getDrops().clear(); drops.setCanceled( true ); } } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 582f8581b..26efe1f4e 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -1,8 +1,8 @@ modLoader="javafml" loaderVersion="[37,38)" -issueTrackerURL="https://github.com/SquidDev-CC/CC-Tweaked/issues" -displayURL="https://github.com/SquidDev-CC/CC-Tweaked" +issueTrackerURL="https://github.com/cc-tweaked/CC-Tweaked/issues" +displayURL="https://github.com/cc-tweaked/CC-Tweaked" logoFile="pack.png" credits="Created by Daniel Ratcliffe (@DanTwoHundred)" diff --git a/src/main/resources/assets/computercraft/lang/en_us.json b/src/main/resources/assets/computercraft/lang/en_us.json index e19fd33e6..60c468634 100644 --- a/src/main/resources/assets/computercraft/lang/en_us.json +++ b/src/main/resources/assets/computercraft/lang/en_us.json @@ -40,7 +40,7 @@ "chat.computercraft.wired_modem.peripheral_connected": "Peripheral \"%s\" connected to network", "chat.computercraft.wired_modem.peripheral_disconnected": "Peripheral \"%s\" disconnected from network", "commands.computercraft.synopsis": "Various commands for controlling computers.", - "commands.computercraft.desc": "The /computercraft command provides various debugging and administrator tools for controlling and interacting with computers.", + "commands.computercraft.desc": "The /computercraft command provides various debugging and administrator tools for controlling and interacting with computers.", "commands.computercraft.help.synopsis": "Provide help for a specific command", "commands.computercraft.help.desc": "Displays this help message", "commands.computercraft.help.no_children": "%s has no sub-commands", diff --git a/src/main/resources/assets/computercraft/lang/fr_fr.json b/src/main/resources/assets/computercraft/lang/fr_fr.json index 3fc29d36e..fd21b0cd3 100644 --- a/src/main/resources/assets/computercraft/lang/fr_fr.json +++ b/src/main/resources/assets/computercraft/lang/fr_fr.json @@ -116,7 +116,7 @@ "gui.computercraft.tooltip.terminate": "Arrêter le programme en cours d'éxecution", "gui.computercraft.tooltip.terminate.key": "Tenir Ctrl+T", "gui.computercraft.upload.overwrite": "Les fichiers seraient écrasés", - "gui.computercraft.upload.overwrite.detail": "Les fichiers suivants seront écrasés lors de l'envoie. Continuer ?%s", + "gui.computercraft.upload.overwrite.detail": "Les fichiers suivants seront écrasés lors de l'envoie. Continuer?%s", "gui.computercraft.upload.overwrite_button": "Écraser", "gui.computercraft.upload.success": "Envoie avec succès", "gui.computercraft.upload.success.msg": "Le fichier %d est envoyé.", @@ -125,7 +125,7 @@ "gui.computercraft.upload.failed.computer_off": "Vous devez allumer cet ordinateur avant d'envoyer ce fichier.", "gui.computercraft.upload.failed.too_much": "Votre fichier est trop lourd pour être envoyé.", "gui.computercraft.upload.failed.overwrite_dir": "%s ne peut pas être envoyé, il y a déjà un dossier avec le même nom.", - "gui.computercraft.upload.failed.generic": "Echec de l'envoie des fichiers(%s)", + "gui.computercraft.upload.failed.generic": "Echec de l'envoie des fichiers (%s)", "commands.computercraft.dump.open_path": "Voir les fichiers de cet ordinateur", "gui.computercraft.tooltip.turn_on": "Allumer cet ordinateur" } diff --git a/src/main/resources/assets/computercraft/lang/ru_ru.json b/src/main/resources/assets/computercraft/lang/ru_ru.json index 1c6a51bec..b3987d970 100644 --- a/src/main/resources/assets/computercraft/lang/ru_ru.json +++ b/src/main/resources/assets/computercraft/lang/ru_ru.json @@ -127,5 +127,8 @@ "gui.computercraft.upload.failed.generic": "Загрузка файлов не удалась (%s)", "gui.computercraft.upload.overwrite": "Файлы будут перезаписаны", "gui.computercraft.upload.overwrite.detail": "При загрузке следующие файлы будут перезаписаны. Продолжить?%s", - "gui.computercraft.upload.overwrite_button": "Перезаписать" + "gui.computercraft.upload.overwrite_button": "Перезаписать", + "gui.computercraft.upload.failed.name_too_long": "Названия файлов слишком длинны для загрузки.", + "gui.computercraft.upload.failed.too_many_files": "Нельзя загрузить столько файлов.", + "gui.computercraft.upload.failed.corrupted": "Файлы повреждены при загрузки. Попробуй снова." } diff --git a/src/main/resources/data/computercraft/lua/rom/motd.txt b/src/main/resources/data/computercraft/lua/rom/motd.txt index ea4ea341d..972589050 100644 --- a/src/main/resources/data/computercraft/lua/rom/motd.txt +++ b/src/main/resources/data/computercraft/lua/rom/motd.txt @@ -1,4 +1,4 @@ -Please report bugs at https://github.com/SquidDev-CC/CC-Tweaked. Thanks! +Please report bugs at https://github.com/cc-tweaked/CC-Tweaked. Thanks! View the documentation at https://tweaked.cc Show off your programs or ask for help at our forum: https://forums.computercraft.cc You can disable these messages by running "set motd.enable false". diff --git a/src/main/resources/data/computercraft/lua/rom/programs/about.lua b/src/main/resources/data/computercraft/lua/rom/programs/about.lua new file mode 100644 index 000000000..37a0e2901 --- /dev/null +++ b/src/main/resources/data/computercraft/lua/rom/programs/about.lua @@ -0,0 +1,4 @@ +-- Prints information about CraftOS +term.setTextColor(colors.yellow) +print(os.version() .. " on " .. _HOST) +term.setTextColor(colors.white) diff --git a/src/main/resources/data/computercraft/lua/rom/programs/motd.lua b/src/main/resources/data/computercraft/lua/rom/programs/motd.lua index 57ab7b916..5a2e78b83 100644 --- a/src/main/resources/data/computercraft/lua/rom/programs/motd.lua +++ b/src/main/resources/data/computercraft/lua/rom/programs/motd.lua @@ -5,6 +5,8 @@ elseif date.month == 12 and date.day == 24 then print("Merry X-mas!") elseif date.month == 10 and date.day == 31 then print("OOoooOOOoooo! Spooky!") +elseif date.month == 4 and date.day == 28 then + print("Ed Balls") else local tMotd = {} diff --git a/src/test/resources/test-rom/spec/programs/motd_spec.lua b/src/test/resources/test-rom/spec/programs/motd_spec.lua index d426fb6e7..47fcfccd3 100644 --- a/src/test/resources/test-rom/spec/programs/motd_spec.lua +++ b/src/test/resources/test-rom/spec/programs/motd_spec.lua @@ -1,8 +1,8 @@ local capture = require "test_helpers".capture_program describe("The motd program", function() - local function setup_date(month, day) - stub(os, "date", function() return { month = month, day = day } end) + local function setup_date(day, month) + stub(os, "date", function() return { day = day, month = month } end) end it("displays MOTD", function() @@ -16,20 +16,26 @@ describe("The motd program", function() :matches { ok = true, output = "Hello World!\n", error = "" } end) - it("displays date-specific MOTD (1/1)", function() + it("displays date-specific MOTD (1 Jan)", function() setup_date(1, 1) expect(capture(stub, "motd")) :matches { ok = true, output = "Happy new year!\n", error = "" } end) - it("displays date-specific MOTD (10/31)", function() - setup_date(10, 31) + it("displays date-specific MOTD (28 Apr)", function() + setup_date(28, 4) + expect(capture(stub, "motd")) + :matches { ok = true, output = "Ed Balls\n", error = "" } + end) + + it("displays date-specific MOTD (31 Oct)", function() + setup_date(31, 10) expect(capture(stub, "motd")) :matches { ok = true, output = "OOoooOOOoooo! Spooky!\n", error = "" } end) - it("displays date-specific MOTD (12/24)", function() - setup_date(12, 24) + it("displays date-specific MOTD (24 Dec)", function() + setup_date(24, 12) expect(capture(stub, "motd")) :matches { ok = true, output = "Merry X-mas!\n", error = "" } end) diff --git a/src/testMod/java/dan200/computercraft/ingame/ComputerTest.kt b/src/testMod/java/dan200/computercraft/ingame/ComputerTest.kt index 242e431b6..3bfdf1061 100644 --- a/src/testMod/java/dan200/computercraft/ingame/ComputerTest.kt +++ b/src/testMod/java/dan200/computercraft/ingame/ComputerTest.kt @@ -11,7 +11,7 @@ class Computer_Test { /** * Ensures redstone signals do not travel through computers. * - * @see [#548](https://github.com/SquidDev-CC/CC-Tweaked/issues/548) + * @see [#548](https://github.com/cc-tweaked/CC-Tweaked/issues/548) */ @GameTest fun No_through_signal(context: GameTestHelper) = context.sequence { diff --git a/src/testMod/java/dan200/computercraft/ingame/DiskDriveTest.kt b/src/testMod/java/dan200/computercraft/ingame/DiskDriveTest.kt index 2eaf4d9a6..080ed8f60 100644 --- a/src/testMod/java/dan200/computercraft/ingame/DiskDriveTest.kt +++ b/src/testMod/java/dan200/computercraft/ingame/DiskDriveTest.kt @@ -11,7 +11,7 @@ class Disk_Drive_Test { /** * Ensure audio disks exist and we can play them. * - * @see [#688](https://github.com/SquidDev-CC/CC-Tweaked/issues/688) + * @see [#688](https://github.com/cc-tweaked/CC-Tweaked/issues/688) */ @GameTest fun Audio_disk(helper: GameTestHelper) = helper.sequence { thenComputerOk() } diff --git a/src/testMod/java/dan200/computercraft/ingame/TurtleTest.kt b/src/testMod/java/dan200/computercraft/ingame/TurtleTest.kt index a50ddfc3c..0f8938e24 100644 --- a/src/testMod/java/dan200/computercraft/ingame/TurtleTest.kt +++ b/src/testMod/java/dan200/computercraft/ingame/TurtleTest.kt @@ -13,7 +13,7 @@ class Turtle_Test { /** * Checks turtles can sheer sheep (and drop items) * - * @see [#537](https://github.com/SquidDev-CC/CC-Tweaked/issues/537) + * @see [#537](https://github.com/cc-tweaked/CC-Tweaked/issues/537) */ @GameTest(timeoutTicks = COMPUTER_TIMEOUT) fun Shears_sheep(helper: GameTestHelper) = helper.sequence { thenComputerOk() } @@ -21,7 +21,7 @@ class Turtle_Test { /** * Checks turtles can place lava. * - * @see [#518](https://github.com/SquidDev-CC/CC-Tweaked/issues/518) + * @see [#518](https://github.com/cc-tweaked/CC-Tweaked/issues/518) */ @GameTest(timeoutTicks = COMPUTER_TIMEOUT) fun Place_lava(helper: GameTestHelper) = helper.sequence { thenComputerOk() } @@ -29,7 +29,7 @@ class Turtle_Test { /** * Checks turtles can place when waterlogged. * - * @see [#385](https://github.com/SquidDev-CC/CC-Tweaked/issues/385) + * @see [#385](https://github.com/cc-tweaked/CC-Tweaked/issues/385) */ @GameTest(timeoutTicks = COMPUTER_TIMEOUT) fun Place_waterlogged(helper: GameTestHelper) = helper.sequence { thenComputerOk() } @@ -37,7 +37,7 @@ class Turtle_Test { /** * Checks turtles can pick up lava * - * @see [#297](https://github.com/SquidDev-CC/CC-Tweaked/issues/297) + * @see [#297](https://github.com/cc-tweaked/CC-Tweaked/issues/297) */ @GameTest(timeoutTicks = COMPUTER_TIMEOUT) fun Gather_lava(helper: GameTestHelper) = helper.sequence { thenComputerOk() } @@ -45,7 +45,7 @@ class Turtle_Test { /** * Checks turtles can hoe dirt. * - * @see [#258](https://github.com/SquidDev-CC/CC-Tweaked/issues/258) + * @see [#258](https://github.com/cc-tweaked/CC-Tweaked/issues/258) */ @GameTest(timeoutTicks = COMPUTER_TIMEOUT) fun Hoe_dirt(helper: GameTestHelper) = helper.sequence { thenComputerOk() } @@ -53,7 +53,7 @@ class Turtle_Test { /** * Checks turtles can place monitors * - * @see [#691](https://github.com/SquidDev-CC/CC-Tweaked/issues/691) + * @see [#691](https://github.com/cc-tweaked/CC-Tweaked/issues/691) */ @GameTest(timeoutTicks = COMPUTER_TIMEOUT) fun Place_monitor(helper: GameTestHelper) = helper.sequence { thenComputerOk() } diff --git a/src/testMod/resources/META-INF/mods.toml b/src/testMod/resources/META-INF/mods.toml index 8c0e29159..30ddf13c4 100644 --- a/src/testMod/resources/META-INF/mods.toml +++ b/src/testMod/resources/META-INF/mods.toml @@ -1,8 +1,8 @@ modLoader="javafml" loaderVersion="[30,)" -issueTrackerURL="https://github.com/SquidDev-CC/CC-Tweaked/issues" -displayURL="https://github.com/SquidDev-CC/CC-Tweaked" +issueTrackerURL="https://github.com/cc-tweaked/CC-Tweaked/issues" +displayURL="https://github.com/cc-tweaked/CC-Tweaked" logoFile="pack.png" credits="Created by Daniel Ratcliffe (@DanTwoHundred)"