Skip to content

Commit

Permalink
Merge branch 'mc-1.20.x' into mc-1.20.y
Browse files Browse the repository at this point in the history
  • Loading branch information
SquidDev committed Jun 21, 2024
2 parents de078e3 + 25b8a65 commit bb933d0
Show file tree
Hide file tree
Showing 18 changed files with 184 additions and 51 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/make-doc.sh

This file was deleted.

25 changes: 10 additions & 15 deletions .github/workflows/make-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 21
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/
11 changes: 9 additions & 2 deletions doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ SPDX-FileCopyrightText: 2020 The CC: Tweaked Developers
SPDX-License-Identifier: MPL-2.0
-->

# ![CC: Tweaked](logo.png)
<h1>
<picture>
<source media="(prefers-color-scheme: dark)" srcset="logo-darkmode.png">
<source media="(prefers-color-scheme: light)" srcset="logo.png">
<img alt="CC: Tweaked" src="logo.png">
</picture>
</h1>

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.
Expand Down Expand Up @@ -38,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 sidebar and links below provide more detailed documentation on the
various APIs and peripherals provided by the mod.
Expand Down
2 changes: 1 addition & 1 deletion doc/mod-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion doc/reference/breaking_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fabric-loom = "1.6.7"
githubRelease = "2.5.2"
gradleVersions = "0.50.0"
ideaExt = "1.1.7"
illuaminate = "0.1.0-71-g378d86e"
illuaminate = "0.1.0-73-g43ee16c"
lwjgl = "3.3.3"
minotaur = "2.8.7"
neoGradle = "7.0.116"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public final Object[] getBlockPosition() {
* blocks at once.
* <p>
* 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.
Expand All @@ -194,6 +194,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.
*
* <pre>{@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
* }</pre>
*/
@LuaFunction(mainThread = true)
public final List<Map<?, ?>> getBlockInfos(int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Optional<String> dimension) throws LuaException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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": "文件系统操作",
Expand All @@ -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请求"
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import dan200.computercraft.core.apis.FSAPI
import dan200.computercraft.gametest.api.*
import dan200.computercraft.shared.ModRegistry
import dan200.computercraft.shared.peripheral.diskdrive.DiskDriveBlock
import dan200.computercraft.shared.peripheral.diskdrive.DiskDrivePeripheral
import dan200.computercraft.shared.peripheral.diskdrive.DiskDriveState
import dan200.computercraft.shared.util.DataComponentUtil
import dan200.computercraft.test.core.assertArrayEquals
Expand Down Expand Up @@ -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)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions projects/web/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
Expand Down

0 comments on commit bb933d0

Please sign in to comment.