diff --git a/.github/workflows/make-doc.yml b/.github/workflows/make-doc.yml index 12929cb7d..75b3a667c 100644 --- a/.github/workflows/make-doc.yml +++ b/.github/workflows/make-doc.yml @@ -3,8 +3,7 @@ name: Build documentation on: push: branches: - - mc-1.19.x - - mc-1.20.x + - mc-* jobs: make_doc: diff --git a/buildSrc/src/main/kotlin/cc-tweaked.java-convention.gradle.kts b/buildSrc/src/main/kotlin/cc-tweaked.java-convention.gradle.kts index 9f0fab660..c484b3d3c 100644 --- a/buildSrc/src/main/kotlin/cc-tweaked.java-convention.gradle.kts +++ b/buildSrc/src/main/kotlin/cc-tweaked.java-convention.gradle.kts @@ -94,9 +94,8 @@ sourceSets.all { check("InlineMeSuggester", CheckSeverity.OFF) // Minecraft uses @Deprecated liberally // Too many false positives right now. Maybe we need an indirection for it later on. check("ReferenceEquality", CheckSeverity.OFF) - check("UnusedVariable", CheckSeverity.OFF) // Too many false positives with records. + check("EnumOrdinal", CheckSeverity.OFF) // For now. We could replace most of these with EnumMap. check("OperatorPrecedence", CheckSeverity.OFF) // For now. - check("AlreadyChecked", CheckSeverity.OFF) // Seems to be broken? check("NonOverridingEquals", CheckSeverity.OFF) // Peripheral.equals makes this hard to avoid check("FutureReturnValueIgnored", CheckSeverity.OFF) // Too many false positives with Netty diff --git a/buildSrc/src/main/kotlin/cc/tweaked/gradle/CCTweakedExtension.kt b/buildSrc/src/main/kotlin/cc/tweaked/gradle/CCTweakedExtension.kt index 802ea5c23..3066459e0 100644 --- a/buildSrc/src/main/kotlin/cc/tweaked/gradle/CCTweakedExtension.kt +++ b/buildSrc/src/main/kotlin/cc/tweaked/gradle/CCTweakedExtension.kt @@ -225,12 +225,12 @@ abstract class CCTweakedExtension( * where possible. */ fun downloadFile(label: String, url: String): File { - val url = URI(url) - val path = File(url.path) + val uri = URI(url) + val path = File(uri.path) project.repositories.ivy { name = label - setUrl(URI(url.scheme, url.userInfo, url.host, url.port, path.parent, null, null)) + setUrl(URI(uri.scheme, uri.userInfo, uri.host, uri.port, path.parent, null, null)) patternLayout { artifact("[artifact].[ext]") } diff --git a/buildSrc/src/main/kotlin/cc/tweaked/gradle/MergeTrees.kt b/buildSrc/src/main/kotlin/cc/tweaked/gradle/MergeTrees.kt index 16074cb93..21754f563 100644 --- a/buildSrc/src/main/kotlin/cc/tweaked/gradle/MergeTrees.kt +++ b/buildSrc/src/main/kotlin/cc/tweaked/gradle/MergeTrees.kt @@ -98,7 +98,6 @@ abstract class MergeTrees : DefaultTask() { } val sharedFiles = files.entries.asSequence().filter { (_, v) -> v.found == sources.size }.map { (k, _) -> k }.toList() - println(sharedFiles) // Copy shared files to the common directory fsOperations.sync { diff --git a/gradle.properties b/gradle.properties index 4d7496e21..9d1b2e86a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ kotlin.jvm.target.validation.mode=error # Mod properties isUnstable=true -modVersion=1.110.3 +modVersion=1.111.0 # Minecraft properties: We want to configure this here so we can read it in settings.gradle mcVersion=1.20.6 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index eb9776515..d2fa32ff0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -58,7 +58,7 @@ jmh = "1.37" cctJavadoc = "1.8.2" checkstyle = "10.14.1" curseForgeGradle = "1.1.18" -errorProne-core = "2.23.0" +errorProne-core = "2.27.0" errorProne-plugin = "3.1.0" fabric-loom = "1.6.7" githubRelease = "2.5.2" diff --git a/projects/common/build.gradle.kts b/projects/common/build.gradle.kts index eb5fbbea3..71879ac40 100644 --- a/projects/common/build.gradle.kts +++ b/projects/common/build.gradle.kts @@ -129,3 +129,5 @@ val runData by tasks.registering(MergeTrees::class) { } } } + +tasks.withType(GenerateModuleMetadata::class).configureEach { isEnabled = false } diff --git a/projects/common/src/client/java/dan200/computercraft/client/render/monitor/MonitorBlockEntityRenderer.java b/projects/common/src/client/java/dan200/computercraft/client/render/monitor/MonitorBlockEntityRenderer.java index 0813318c3..7b5b7c158 100644 --- a/projects/common/src/client/java/dan200/computercraft/client/render/monitor/MonitorBlockEntityRenderer.java +++ b/projects/common/src/client/java/dan200/computercraft/client/render/monitor/MonitorBlockEntityRenderer.java @@ -27,7 +27,6 @@ import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.world.phys.AABB; -import org.joml.Matrix3f; import org.joml.Matrix4f; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL20; @@ -48,8 +47,6 @@ public class MonitorBlockEntityRenderer implements BlockEntityRenderer extends HorizontalDirectionalBlock implements IBundledRedstoneBlock, EntityBlock { - private static final ResourceLocation DROP = new ResourceLocation(ComputerCraftAPI.MOD_ID, "computer"); - protected final RegistryEntry> type; private final BlockEntityTicker serverTicker = (level, pos, state, computer) -> computer.serverTick(); @@ -154,12 +149,6 @@ public abstract class AbstractComputerBlock BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType type) { diff --git a/projects/common/src/main/java/dan200/computercraft/shared/media/items/RecordMedia.java b/projects/common/src/main/java/dan200/computercraft/shared/media/items/RecordMedia.java index 86c638528..8442d7d17 100644 --- a/projects/common/src/main/java/dan200/computercraft/shared/media/items/RecordMedia.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/media/items/RecordMedia.java @@ -5,7 +5,6 @@ package dan200.computercraft.shared.media.items; import dan200.computercraft.api.media.IMedia; -import net.minecraft.network.chat.Component; import net.minecraft.sounds.SoundEvent; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.RecordItem; @@ -13,7 +12,7 @@ import net.minecraft.world.item.RecordItem; import javax.annotation.Nullable; /** - * An implementation of IMedia for ItemRecords. + * An implementation of {@link IMedia} for {@link RecordItem}. */ public final class RecordMedia implements IMedia { public static final RecordMedia INSTANCE = new RecordMedia(); @@ -29,16 +28,12 @@ public final class RecordMedia implements IMedia { @Override public @Nullable String getAudioTitle(ItemStack stack) { var item = stack.getItem(); - if (!(item instanceof RecordItem)) return null; - - return Component.translatable(item.getDescriptionId() + ".desc").getString(); + return item instanceof RecordItem record ? record.getDisplayName().getString() : null; } @Override public @Nullable SoundEvent getAudio(ItemStack stack) { var item = stack.getItem(); - if (!(item instanceof RecordItem)) return null; - - return ((RecordItem) item).getSound(); + return item instanceof RecordItem record ? record.getSound() : null; } } diff --git a/projects/common/src/main/java/dan200/computercraft/shared/util/IDAssigner.java b/projects/common/src/main/java/dan200/computercraft/shared/util/IDAssigner.java index fd6ec23ab..30c17f2a0 100644 --- a/projects/common/src/main/java/dan200/computercraft/shared/util/IDAssigner.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/util/IDAssigner.java @@ -33,7 +33,6 @@ public final class IDAssigner { private final Path idFile; private final Path newIdFile; - private boolean atomicMove = true; private @Nullable Map ids; public IDAssigner(Path path) { diff --git a/projects/common/src/main/java/dan200/computercraft/shared/util/TickScheduler.java b/projects/common/src/main/java/dan200/computercraft/shared/util/TickScheduler.java index 89e8e0446..ccabfc291 100644 --- a/projects/common/src/main/java/dan200/computercraft/shared/util/TickScheduler.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/util/TickScheduler.java @@ -4,6 +4,7 @@ package dan200.computercraft.shared.util; +import com.google.errorprone.annotations.Keep; import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ChunkLevel; @@ -132,6 +133,7 @@ public final class TickScheduler { /** * The current state of this token. */ + @Keep private volatile State $state = State.IDLE; public Token(BlockEntity owner) { diff --git a/projects/common/src/main/resources/assets/computercraft/lang/it_it.json b/projects/common/src/main/resources/assets/computercraft/lang/it_it.json index 68f7db998..c9ac0babc 100644 --- a/projects/common/src/main/resources/assets/computercraft/lang/it_it.json +++ b/projects/common/src/main/resources/assets/computercraft/lang/it_it.json @@ -218,5 +218,18 @@ "upgrade.minecraft.diamond_hoe.adjective": "Contadina", "upgrade.minecraft.diamond_pickaxe.adjective": "Minatrice", "upgrade.minecraft.diamond_shovel.adjective": "Scavatrice", - "upgrade.minecraft.diamond_sword.adjective": "Da Combattimento" + "upgrade.minecraft.diamond_sword.adjective": "Da Combattimento", + "tag.item.computercraft.computer": "Computer", + "tag.item.computercraft.wired_modem": "Modem cablati", + "argument.computercraft.computer.distance": "Distanza dall'entità", + "argument.computercraft.computer.family": "Famiglia computer", + "argument.computercraft.computer.id": "ID computer", + "argument.computercraft.computer.instance": "ID istanza unica", + "argument.computercraft.computer.label": "Etichetta computer", + "argument.computercraft.unknown_computer_family": "Famiglia computer '%s' sconosciuta", + "gui.computercraft.config.disabled_generic_methods": "Metodi generici disattivati", + "gui.computercraft.config.disabled_generic_methods.tooltip": "Una lista di metodi generici o sorgenti di metodi da disattivare. I metodi generici sono\nmetodi aggiunti a blocchi/entità blocchi quando non c'è un provider della periferica esplicito.\nQuesto include metodi dell'inventario (ad es. inventory.getItemDetail, inventory.pushItems) e,\nse su Forge, i metodi fluid_storage e energy_storage.\nI metodi in questa lista possono essere sia un gruppo intero di metodi (computer:inventory)\no un singolo metodo (computer:inventory#pushItems).\n", + "tag.item.computercraft.monitor": "Monitor", + "tag.item.computercraft.turtle": "Tartarughe", + "tracking_field.computercraft.java_allocation.name": "Allocazioni Java" } diff --git a/projects/common/src/main/resources/assets/computercraft/models/block/turtle_base.json b/projects/common/src/main/resources/assets/computercraft/models/block/turtle_base.json index 52ae637d4..d526ac215 100644 --- a/projects/common/src/main/resources/assets/computercraft/models/block/turtle_base.json +++ b/projects/common/src/main/resources/assets/computercraft/models/block/turtle_base.json @@ -2,30 +2,30 @@ "parent": "block/block", "render_type": "translucent", "textures": { - "particle": "#texture" + "particle": "#front" }, "elements": [ { "from": [ 2, 2, 2 ], "to": [ 14, 14, 13 ], "faces": { - "down": { "uv": [ 5.75, 2.75, 2.75, 0 ], "texture": "#texture" }, - "up": { "uv": [ 8.75, 0, 5.75, 2.75 ], "texture": "#texture" }, - "north": { "uv": [ 11.5, 5.75, 8.5, 2.75 ], "texture": "#texture" }, - "south": { "uv": [ 5.75, 5.75, 2.75, 2.75 ], "texture": "#texture" }, - "west": { "uv": [ 8.5, 5.75, 5.75, 2.75 ], "texture": "#texture" }, - "east": { "uv": [ 2.75, 5.75, 0, 2.75 ], "texture": "#texture" } + "down": { "uv": [ 0, 0, 12, 11 ], "texture": "#bottom" }, + "up": { "uv": [ 0, 0, 12, 11 ], "texture": "#top" }, + "north": { "uv": [ 0, 0, 12, 12 ], "texture": "#front" }, + "south": { "uv": [ 0, 0, 12, 12 ], "texture": "#back" }, + "west": { "uv": [ 0, 0, 11, 12 ], "texture": "#left" }, + "east": { "uv": [ 0, 0, 11, 12 ], "texture": "#right" } } }, { "from": [ 3, 6, 13 ], "to": [ 13, 13, 15 ], "faces": { - "down": { "uv": [ 11.75, 0.5, 9.25, 0 ], "texture": "#texture" }, - "up": { "uv": [ 14.25, 0, 11.75, 0.5 ], "texture": "#texture" }, - "south": { "uv": [ 11.75, 2.25, 9.25, 0.5 ], "texture": "#texture" }, - "west": { "uv": [ 12.25, 2.25, 11.75, 0.5 ], "texture": "#texture" }, - "east": { "uv": [ 9.25, 2.25, 8.75, 0.5 ], "texture": "#texture" } + "down": { "uv": [ 2, 9, 12, 11 ], "texture": "#backpack" }, + "up": { "uv": [ 2, 0, 12, 2 ], "texture": "#backpack" }, + "south": { "uv": [ 2, 2, 12, 9 ], "texture": "#backpack" }, + "west": { "uv": [ 0, 2, 2, 9 ], "texture": "#backpack" }, + "east": { "uv": [ 12, 2, 14, 9 ], "texture": "#backpack" } } } ] diff --git a/projects/common/src/main/resources/assets/computercraft/models/block/turtle_colour.json b/projects/common/src/main/resources/assets/computercraft/models/block/turtle_colour.json index d40487d67..652791dae 100644 --- a/projects/common/src/main/resources/assets/computercraft/models/block/turtle_colour.json +++ b/projects/common/src/main/resources/assets/computercraft/models/block/turtle_colour.json @@ -1,53 +1,67 @@ { "parent": "computercraft:block/turtle_base", "textures": { - "texture": "computercraft:block/turtle_colour" + "texture": "computercraft:block/turtle_colour", + "body_back": "computercraft:block/turtle_colour_body_back", + "body_backpack": "computercraft:block/turtle_colour_body_backpack", + "body_bottom": "computercraft:block/turtle_colour_body_bottom", + "body_front": "computercraft:block/turtle_colour_body_front", + "body_left": "computercraft:block/turtle_colour_body_left", + "body_right": "computercraft:block/turtle_colour_body_right", + "body_top": "computercraft:block/turtle_colour_body_top", + "frame_back": "computercraft:block/turtle_colour_frame_back", + "frame_backpack": "computercraft:block/turtle_colour_frame_backpack", + "frame_bottom": "computercraft:block/turtle_colour_frame_bottom", + "frame_front": "computercraft:block/turtle_colour_frame_front", + "frame_left": "computercraft:block/turtle_colour_frame_left", + "frame_right": "computercraft:block/turtle_colour_frame_right", + "frame_top": "computercraft:block/turtle_colour_frame_top" }, "elements": [ { "from": [ 2, 2, 2 ], "to": [ 14, 14, 13 ], "faces": { - "down": { "uv": [ 5.75, 8.5, 2.75, 5.75 ], "texture": "#texture", "tintindex": 0 }, - "up": { "uv": [ 8.75, 5.75, 5.75, 8.5 ], "texture": "#texture", "tintindex": 0 }, - "north": { "uv": [ 11.5, 11.5, 8.5, 8.5 ], "texture": "#texture", "tintindex": 0 }, - "south": { "uv": [ 5.75, 11.5, 2.75, 8.5 ], "texture": "#texture", "tintindex": 0 }, - "west": { "uv": [ 8.5, 11.5, 5.75, 8.555 ], "texture": "#texture", "tintindex": 0 }, - "east": { "uv": [ 2.75, 11.5, 0, 8.5 ], "texture": "#texture", "tintindex": 0 } + "down": { "uv": [ 0, 0, 12, 11 ], "texture": "#body_bottom", "tintindex": 0 }, + "up": { "uv": [ 0, 0, 12, 11 ], "texture": "#body_top", "tintindex": 0 }, + "north": { "uv": [ 0, 0, 12, 12 ], "texture": "#body_front", "tintindex": 0 }, + "south": { "uv": [ 0, 0, 12, 12 ], "texture": "#body_back", "tintindex": 0 }, + "west": { "uv": [ 0, 0, 11, 12 ], "texture": "#body_left", "tintindex": 0 }, + "east": { "uv": [ 0, 0, 11, 12 ], "texture": "#body_right", "tintindex": 0 } } }, { "from": [ 3, 6, 13 ], "to": [ 13, 13, 15 ], "faces": { - "down": { "uv": [ 11.75, 6.25, 9.25, 5.75 ], "texture": "#texture", "tintindex": 0 }, - "up": { "uv": [ 14.25, 5.75, 11.75, 6.25 ], "texture": "#texture", "tintindex": 0 }, - "south": { "uv": [ 11.75, 8, 9.25, 6.25 ], "texture": "#texture", "tintindex": 0 }, - "west": { "uv": [ 12.25, 8, 11.75, 6.25 ], "texture": "#texture", "tintindex": 0 }, - "east": { "uv": [ 9.25, 8, 8.75, 6.25 ], "texture": "#texture", "tintindex": 0 } + "down": { "uv": [ 2, 9, 12, 11 ], "texture": "#body_backpack", "tintindex": 0 }, + "up": { "uv": [ 2, 0, 12, 2 ], "texture": "#body_backpack", "tintindex": 0 }, + "south": { "uv": [ 2, 2, 12, 9 ], "texture": "#body_backpack", "tintindex": 0 }, + "west": { "uv": [ 0, 2, 2, 9 ], "texture": "#body_backpack", "tintindex": 0 }, + "east": { "uv": [ 12, 2, 14, 9 ], "texture": "#body_backpack", "tintindex": 0 } } }, { "from": [ 2, 2, 2 ], "to": [ 14, 14, 13 ], "faces": { - "down": { "uv": [ 5.75, 2.75, 2.75, 0 ], "texture": "#texture" }, - "up": { "uv": [ 8.75, 0, 5.75, 2.75 ], "texture": "#texture" }, - "north": { "uv": [ 11.5, 5.75, 8.5, 2.75 ], "texture": "#texture" }, - "south": { "uv": [ 5.75, 5.75, 2.75, 2.75 ], "texture": "#texture" }, - "west": { "uv": [ 8.5, 5.75, 5.75, 2.75 ], "texture": "#texture" }, - "east": { "uv": [ 2.75, 5.75, 0, 2.75 ], "texture": "#texture" } + "down": { "uv": [ 0, 0, 12, 11 ], "texture": "#frame_bottom" }, + "up": { "uv": [ 0, 0, 12, 11 ], "texture": "#frame_top" }, + "north": { "uv": [ 0, 0, 12, 12 ], "texture": "#frame_front" }, + "south": { "uv": [ 0, 0, 12, 12 ], "texture": "#frame_back" }, + "west": { "uv": [ 0, 0, 11, 12 ], "texture": "#frame_left" }, + "east": { "uv": [ 0, 0, 11, 12 ], "texture": "#frame_right" } } }, { "from": [ 3, 6, 13 ], "to": [ 13, 13, 15 ], "faces": { - "down": { "uv": [ 11.75, 0.5, 9.25, 0 ], "texture": "#texture" }, - "up": { "uv": [ 14.25, 0, 11.75, 0.5 ], "texture": "#texture" }, - "south": { "uv": [ 11.75, 2.25, 9.25, 0.5 ], "texture": "#texture" }, - "west": { "uv": [ 12.25, 2.25, 11.75, 0.5 ], "texture": "#texture" }, - "east": { "uv": [ 9.25, 2.25, 8.75, 0.5 ], "texture": "#texture" } + "down": { "uv": [ 2, 9, 12, 11 ], "texture": "#frame_backpack" }, + "up": { "uv": [ 2, 0, 12, 2 ], "texture": "#frame_backpack" }, + "south": { "uv": [ 2, 2, 12, 9 ], "texture": "#frame_backpack" }, + "west": { "uv": [ 0, 2, 2, 9 ], "texture": "#frame_backpack" }, + "east": { "uv": [ 12, 2, 14, 9 ], "texture": "#frame_backpack" } } } ] diff --git a/projects/common/src/main/resources/assets/computercraft/models/block/turtle_elf_overlay.json b/projects/common/src/main/resources/assets/computercraft/models/block/turtle_elf_overlay.json index 047576123..66495626a 100644 --- a/projects/common/src/main/resources/assets/computercraft/models/block/turtle_elf_overlay.json +++ b/projects/common/src/main/resources/assets/computercraft/models/block/turtle_elf_overlay.json @@ -1,6 +1,35 @@ { - "parent": "computercraft:block/turtle_overlay", + "parent": "block/block", "textures": { - "texture": "computercraft:block/turtle_elf_overlay" - } -} + "back": "computercraft:block/turtle_elf_overlay_back", + "backpack": "computercraft:block/turtle_elf_overlay_backpack", + "front": "computercraft:block/turtle_elf_overlay_front", + "left": "computercraft:block/turtle_elf_overlay_left", + "right": "computercraft:block/turtle_elf_overlay_right", + "top": "computercraft:block/turtle_elf_overlay_top" + }, + "elements": [ + { + "from": [ 2, 2, 2 ], + "to": [ 14, 14, 13 ], + "faces": { + "up": { "uv": [ 0, 0, 12, 11 ], "texture": "#top" }, + "north": { "uv": [ 0, 0, 12, 12 ], "texture": "#front" }, + "south": { "uv": [ 0, 0, 12, 12 ], "texture": "#back" }, + "west": { "uv": [ 0, 0, 11, 12 ], "texture": "#left" }, + "east": { "uv": [ 0, 0, 11, 12 ], "texture": "#right" } + } + }, + { + "from": [ 3, 6, 13 ], + "to": [ 13, 13, 15 ], + "faces": { + "down": { "uv": [ 2, 9, 12, 11 ], "texture": "#backpack" }, + "up": { "uv": [ 2, 0, 12, 2 ], "texture": "#backpack" }, + "south": { "uv": [ 2, 2, 12, 9 ], "texture": "#backpack" }, + "west": { "uv": [ 0, 2, 2, 9 ], "texture": "#backpack" }, + "east": { "uv": [ 12, 2, 14, 9 ], "texture": "#backpack" } + } + } + ] + } diff --git a/projects/common/src/main/resources/assets/computercraft/models/block/turtle_overlay.json b/projects/common/src/main/resources/assets/computercraft/models/block/turtle_overlay.json deleted file mode 100644 index 906b68a82..000000000 --- a/projects/common/src/main/resources/assets/computercraft/models/block/turtle_overlay.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "parent": "block/block", - "textures": { - "particle": "#texture" - }, - "elements": [ - { - "from": [ 2, 2, 2 ], - "to": [ 14, 14, 13 ], - "faces": { - "down": { "uv": [ 2.75, 0, 5.75, 2.75 ], "texture": "#texture" }, - "up": { "uv": [ 5.75, 0, 8.75, 2.75 ], "texture": "#texture" }, - "north": { "uv": [ 8.5, 5.75, 11.5, 2.75 ], "texture": "#texture" }, - "south": { "uv": [ 2.75, 5.75, 5.75, 2.75 ], "texture": "#texture" }, - "west": { "uv": [ 0, 5.75, 2.75, 2.75 ], "texture": "#texture" }, - "east": { "uv": [ 5.75, 5.75, 8.5, 2.75 ], "texture": "#texture" } - } - }, - { - "from": [ 3, 6, 13 ], - "to": [ 13, 13, 15 ], - "faces": { - "down": { "uv": [ 9.25, 0, 11.75, 0.5 ], "texture": "#texture" }, - "up": { "uv": [ 11.75, 0, 14.25, 0.5 ], "texture": "#texture" }, - "south": { "uv": [ 9.25, 2.25, 11.75, 0.5 ], "texture": "#texture" }, - "west": { "uv": [ 8.75, 2.25, 9.25, 0.5 ], "texture": "#texture" }, - "east": { "uv": [ 11.75, 2.25, 12.25, 0.5 ], "texture": "#texture" } - } - }, - { - "from": [ 1.5, 1.5, 1.5 ], - "to": [ 14.5, 14.5, 13.5 ], - "faces": { - "down": { "uv": [ 2.75, 8, 5.75, 10.75 ], "texture": "#texture" }, - "up": { "uv": [ 5.75, 8, 8.75, 10.75 ], "texture": "#texture" }, - "north": { "uv": [ 8.5, 13.75, 11.5, 10.75 ], "texture": "#texture" }, - "south": { "uv": [ 2.75, 13.75, 5.75, 10.75 ], "texture": "#texture" }, - "west": { "uv": [ 0, 13.75, 2.75, 10.75 ], "texture": "#texture" }, - "east": { "uv": [ 5.75, 13.75, 8.5, 10.75 ], "texture": "#texture" } - } - } - ] -} diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced.png deleted file mode 100644 index cf617d963..000000000 Binary files a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced.png and /dev/null differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_back.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_back.png new file mode 100644 index 000000000..e642a6154 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_back.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_backpack.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_backpack.png new file mode 100644 index 000000000..0ad22371e Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_backpack.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_bottom.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_bottom.png new file mode 100644 index 000000000..3950c69f3 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_bottom.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_front.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_front.png new file mode 100644 index 000000000..0d508d9c8 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_front.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_left.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_left.png new file mode 100644 index 000000000..d3fcd1d01 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_left.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_right.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_right.png new file mode 100644 index 000000000..a09d72374 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_right.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_top.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_top.png new file mode 100644 index 000000000..a0cf88707 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced_top.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour.png deleted file mode 100644 index 9d3fb89d6..000000000 Binary files a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour.png and /dev/null differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_back.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_back.png new file mode 100644 index 000000000..cb3878282 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_back.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_backpack.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_backpack.png new file mode 100644 index 000000000..5fe7fa806 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_backpack.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_bottom.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_bottom.png new file mode 100644 index 000000000..511a976dc Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_bottom.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_front.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_front.png new file mode 100644 index 000000000..1b3f48ddd Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_front.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_left.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_left.png new file mode 100644 index 000000000..f773e86f8 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_left.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_right.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_right.png new file mode 100644 index 000000000..d086592c0 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_right.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_top.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_top.png new file mode 100644 index 000000000..2886b391a Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_body_top.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_back.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_back.png new file mode 100644 index 000000000..6e0a273d3 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_back.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_backpack.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_backpack.png new file mode 100644 index 000000000..5a52d28ae Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_backpack.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_bottom.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_bottom.png new file mode 100644 index 000000000..e8f976cb5 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_bottom.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_front.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_front.png new file mode 100644 index 000000000..c58d2e6fa Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_front.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_left.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_left.png new file mode 100644 index 000000000..e2b4cc229 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_left.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_right.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_right.png new file mode 100644 index 000000000..3f1edd759 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_right.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_top.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_top.png new file mode 100644 index 000000000..8ccd72641 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour_frame_top.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay.png deleted file mode 100644 index 9b7814a1d..000000000 Binary files a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay.png and /dev/null differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay_back.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay_back.png new file mode 100644 index 000000000..e8e50e9b4 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay_back.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay_backpack.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay_backpack.png new file mode 100644 index 000000000..8a71da941 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay_backpack.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay_front.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay_front.png new file mode 100644 index 000000000..422a17635 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay_front.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay_left.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay_left.png new file mode 100644 index 000000000..9b49d9924 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay_left.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay_right.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay_right.png new file mode 100644 index 000000000..8182236bd Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay_right.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay_top.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay_top.png new file mode 100644 index 000000000..71e96cc18 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay_top.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal.png deleted file mode 100644 index 93f0d75ac..000000000 Binary files a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal.png and /dev/null differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_back.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_back.png new file mode 100644 index 000000000..a99500c58 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_back.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_backpack.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_backpack.png new file mode 100644 index 000000000..d394935eb Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_backpack.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_bottom.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_bottom.png new file mode 100644 index 000000000..3b5064202 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_bottom.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_front.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_front.png new file mode 100644 index 000000000..f5900b538 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_front.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_left.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_left.png new file mode 100644 index 000000000..90e61364c Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_left.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_right.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_right.png new file mode 100644 index 000000000..04f6127b8 Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_right.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_top.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_top.png new file mode 100644 index 000000000..9ca3f030a Binary files /dev/null and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal_top.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_rainbow_overlay.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_rainbow_overlay.png index 0bd213590..a406f8cdb 100644 Binary files a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_rainbow_overlay.png and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_rainbow_overlay.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_trans_overlay.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_trans_overlay.png index e299a4a21..1677be7b8 100644 Binary files a/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_trans_overlay.png and b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_trans_overlay.png differ diff --git a/projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/GameTestSequenceMixin.java b/projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/GameTestSequenceMixin.java index 48d2eaed0..33a970a7c 100644 --- a/projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/GameTestSequenceMixin.java +++ b/projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/GameTestSequenceMixin.java @@ -42,6 +42,7 @@ class GameTestSequenceMixin { } @Shadow + @SuppressWarnings("unused") private void tick(long tick) { } } diff --git a/projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/client/MinecraftMixin.java b/projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/client/MinecraftMixin.java index bab1b7941..743314d51 100644 --- a/projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/client/MinecraftMixin.java +++ b/projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/client/MinecraftMixin.java @@ -38,7 +38,7 @@ class MinecraftMixin implements MinecraftExtensions { private final AtomicBoolean isStable = new AtomicBoolean(false); @Inject(method = "runTick", at = @At("TAIL")) - @SuppressWarnings("UnusedMethod") + @SuppressWarnings("unused") private void updateStable(boolean render, CallbackInfo ci) { isStable.set( level != null && player != null && diff --git a/projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/client/WorldOpenFlowsMixin.java b/projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/client/WorldOpenFlowsMixin.java index ecfef1525..cd917938f 100644 --- a/projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/client/WorldOpenFlowsMixin.java +++ b/projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/client/WorldOpenFlowsMixin.java @@ -22,7 +22,7 @@ public class WorldOpenFlowsMixin { * @reason Makes it easier to run tests. We can switch to an @Inject if this becomes a problem. */ @Overwrite - @SuppressWarnings("UnusedMethod") + @SuppressWarnings("unused") private void askForBackup(LevelStorageSource.LevelStorageAccess access, boolean customised, Runnable load, Runnable cancel) { load.run(); } diff --git a/projects/core/src/main/java/dan200/computercraft/core/apis/FSAPI.java b/projects/core/src/main/java/dan200/computercraft/core/apis/FSAPI.java index a359320dd..794d8b7c4 100644 --- a/projects/core/src/main/java/dan200/computercraft/core/apis/FSAPI.java +++ b/projects/core/src/main/java/dan200/computercraft/core/apis/FSAPI.java @@ -309,10 +309,10 @@ public class FSAPI implements ILuaAPI { *

* The {@code mode} string can be any of the following: *

    - *
  • "r": Read mode
  • - *
  • "w": Write mode
  • - *
  • "a": Append mode
  • - *
  • "r+": Update mode (allows reading and writing), all data is preserved
  • + *
  • "r": Read mode.
  • + *
  • "w": Write mode.
  • + *
  • "a": Append mode.
  • + *
  • "r+": Update mode (allows reading and writing), all data is preserved.
  • *
  • "w+": Update mode, all data is erased.
  • *
*

diff --git a/projects/core/src/main/resources/data/computercraft/lua/rom/apis/io.lua b/projects/core/src/main/resources/data/computercraft/lua/rom/apis/io.lua index 34d6d075a..6291318da 100644 --- a/projects/core/src/main/resources/data/computercraft/lua/rom/apis/io.lua +++ b/projects/core/src/main/resources/data/computercraft/lua/rom/apis/io.lua @@ -365,24 +365,26 @@ end -- or [`nil`], plus an error message. -- -- The `mode` string can be any of the following: --- - **"r"**: Read mode --- - **"w"**: Write mode --- - **"a"**: Append mode +-- - **"r"**: Read mode. +-- - **"w"**: Write mode. +-- - **"a"**: Append mode. +-- - **"r+"**: Update mode (allows reading and writing), all data is preserved. +-- - **"w+"**: Update mode, all data is erased. -- -- The mode may also have a `b` at the end, which opens the file in "binary --- mode". This allows you to read binary files, as well as seek within a file. +-- mode". This has no impact on functionality. -- -- @tparam string filename The name of the file to open. --- @tparam[opt] string mode The mode to open the file with. This defaults to `rb`. +-- @tparam[opt] string mode The mode to open the file with. This defaults to `r`. -- @treturn[1] Handle The opened file. -- @treturn[2] nil In case of an error. -- @treturn[2] string The reason the file could not be opened. +-- @changed 1.111.0 Add support for `r+` and `w+`. function open(filename, mode) expect(1, filename, "string") expect(2, mode, "string", "nil") - local sMode = mode and mode:gsub("%+", "") or "r" - local file, err = fs.open(filename, sMode) + local file, err = fs.open(filename, mode or "r") if not file then return nil, err end return make_file(file) diff --git a/projects/core/src/main/resources/data/computercraft/lua/rom/apis/rednet.lua b/projects/core/src/main/resources/data/computercraft/lua/rom/apis/rednet.lua index b14618bdb..097086a51 100644 --- a/projects/core/src/main/resources/data/computercraft/lua/rom/apis/rednet.lua +++ b/projects/core/src/main/resources/data/computercraft/lua/rom/apis/rednet.lua @@ -149,7 +149,7 @@ function isOpen(modem) end --[[- Allows a computer or turtle with an attached modem to send a message -intended for a sycomputer with a specific ID. At least one such modem must first +intended for a computer with a specific ID. At least one such modem must first be [opened][`rednet.open`] before sending is possible. Assuming the target was in range and also had a correctly opened modem, the diff --git a/projects/core/src/main/resources/data/computercraft/lua/rom/apis/settings.lua b/projects/core/src/main/resources/data/computercraft/lua/rom/apis/settings.lua index 0d6ead5a2..6f1d1a3ab 100644 --- a/projects/core/src/main/resources/data/computercraft/lua/rom/apis/settings.lua +++ b/projects/core/src/main/resources/data/computercraft/lua/rom/apis/settings.lua @@ -19,7 +19,7 @@ When a computer starts, it reads the current value of settings from the settings.define("my.setting", { description = "An example setting", default = 123, - type = number, + type = "number", }) print("my.setting = " .. settings.get("my.setting")) -- 123 diff --git a/projects/core/src/main/resources/data/computercraft/lua/rom/help/changelog.md b/projects/core/src/main/resources/data/computercraft/lua/rom/help/changelog.md index 45a40bbda..863f6448e 100644 --- a/projects/core/src/main/resources/data/computercraft/lua/rom/help/changelog.md +++ b/projects/core/src/main/resources/data/computercraft/lua/rom/help/changelog.md @@ -1,3 +1,15 @@ +# New features in CC: Tweaked 1.111.0 + +* Update several translations (Ale32bit). +* Split up turtle textures into individual textures. +* Add `r+`/`w+` support to the `io` library. +* Warn when capabilities are not registered and Optifine is installed. + +Several bug fixes: +* Allow planks to be used for building in "adventure" (dan200). +* Fix `disk.getAudioTitle()` returning untranslated strings for some modded discs. +* Fix crash when right clicking turtles in spectator. + # New features in CC: Tweaked 1.110.3 * Update several translations (PatriikPlays). diff --git a/projects/core/src/main/resources/data/computercraft/lua/rom/help/whatsnew.md b/projects/core/src/main/resources/data/computercraft/lua/rom/help/whatsnew.md index 0a9ec167e..90f960dd9 100644 --- a/projects/core/src/main/resources/data/computercraft/lua/rom/help/whatsnew.md +++ b/projects/core/src/main/resources/data/computercraft/lua/rom/help/whatsnew.md @@ -1,9 +1,13 @@ -New features in CC: Tweaked 1.110.3 +New features in CC: Tweaked 1.111.0 -* Update several translations (PatriikPlays). +* Update several translations (Ale32bit). +* Split up turtle textures into individual textures. +* Add `r+`/`w+` support to the `io` library. +* Warn when capabilities are not registered and Optifine is installed. Several bug fixes: -* Fix some errors missing source positions. -* Correctly handle multiple threads sending websocket messages at once. +* Allow planks to be used for building in "adventure" (dan200). +* Fix `disk.getAudioTitle()` returning untranslated strings for some modded discs. +* Fix crash when right clicking turtles in spectator. Type "help changelog" to see the full version history. diff --git a/projects/core/src/main/resources/data/computercraft/lua/rom/programs/fun/adventure.lua b/projects/core/src/main/resources/data/computercraft/lua/rom/programs/fun/adventure.lua index b374ff835..ff7134eaa 100644 --- a/projects/core/src/main/resources/data/computercraft/lua/rom/programs/fun/adventure.lua +++ b/projects/core/src/main/resources/data/computercraft/lua/rom/programs/fun/adventure.lua @@ -108,6 +108,7 @@ local items = { }, ["some planks"] = { aliases = { "planks", "wooden planks", "wood planks" }, + material = true, desc = "You could easily craft these planks into sticks.", }, ["some sticks"] = { diff --git a/projects/core/src/test/resources/test-rom/spec/apis/io_spec.lua b/projects/core/src/test/resources/test-rom/spec/apis/io_spec.lua index dd850d530..daa1a54cc 100644 --- a/projects/core/src/test/resources/test-rom/spec/apis/io_spec.lua +++ b/projects/core/src/test/resources/test-rom/spec/apis/io_spec.lua @@ -329,4 +329,19 @@ describe("The io library", function() expect(read_all(file)):eq("alo\n " .. t .. " ;end of file\n") end) end) + + describe("read/write handles", function() + it("can read and write to a file", function() + write_file(file, "an example file") + + local handle = io.open(file, "r+") + expect(handle:read(3)):eq("an ") + + handle:write("exciting file") + expect(handle:seek("cur")):eq(16) + + handle:seek("set", 0) + expect(handle:read("*a")):eq("an exciting file") + end) + end) end) diff --git a/projects/fabric/src/client/java/dan200/computercraft/mixin/client/GameRendererMixin.java b/projects/fabric/src/client/java/dan200/computercraft/mixin/client/GameRendererMixin.java index b0ca49e29..a7d123974 100644 --- a/projects/fabric/src/client/java/dan200/computercraft/mixin/client/GameRendererMixin.java +++ b/projects/fabric/src/client/java/dan200/computercraft/mixin/client/GameRendererMixin.java @@ -27,7 +27,7 @@ class GameRendererMixin { private Map shaders; @Inject(method = "reloadShaders", at = @At(value = "TAIL")) - @SuppressWarnings("UnusedMethod") + @SuppressWarnings("unused") private void onReloadShaders(ResourceProvider resourceManager, CallbackInfo ci) { try { ClientRegistry.registerShaders(resourceManager, (shader, callback) -> { diff --git a/projects/fabric/src/client/java/dan200/computercraft/mixin/client/ItemFrameRendererMixin.java b/projects/fabric/src/client/java/dan200/computercraft/mixin/client/ItemFrameRendererMixin.java index 88b766edc..5be6df1b9 100644 --- a/projects/fabric/src/client/java/dan200/computercraft/mixin/client/ItemFrameRendererMixin.java +++ b/projects/fabric/src/client/java/dan200/computercraft/mixin/client/ItemFrameRendererMixin.java @@ -22,7 +22,7 @@ class ItemFrameRendererMixin { at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;mulPose(Lorg/joml/Quaternionf;)V", ordinal = 2, shift = At.Shift.AFTER), cancellable = true ) - @SuppressWarnings("UnusedMethod") + @SuppressWarnings("unused") private void render(ItemFrame entity, float yaw, float partialTicks, PoseStack pose, MultiBufferSource buffers, int light, CallbackInfo ci) { if (ClientHooks.onRenderItemFrame(pose, buffers, entity, entity.getItem(), light)) { ci.cancel(); diff --git a/projects/fabric/src/client/java/dan200/computercraft/mixin/client/ItemInHandRendererMixin.java b/projects/fabric/src/client/java/dan200/computercraft/mixin/client/ItemInHandRendererMixin.java index 7f934cb4e..3692af1d3 100644 --- a/projects/fabric/src/client/java/dan200/computercraft/mixin/client/ItemInHandRendererMixin.java +++ b/projects/fabric/src/client/java/dan200/computercraft/mixin/client/ItemInHandRendererMixin.java @@ -19,7 +19,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(ItemInHandRenderer.class) class ItemInHandRendererMixin { @Inject(method = "renderArmWithItem", at = @At("HEAD"), cancellable = true) - @SuppressWarnings("UnusedMethod") + @SuppressWarnings("unused") private void onRenderItem( AbstractClientPlayer player, float partialTicks, float pitch, InteractionHand hand, float swingProgress, ItemStack stack, float equippedProgress, PoseStack transform, MultiBufferSource buffer, int combinedLight, CallbackInfo ci diff --git a/projects/fabric/src/client/java/dan200/computercraft/mixin/client/MinecraftMixin.java b/projects/fabric/src/client/java/dan200/computercraft/mixin/client/MinecraftMixin.java index a6697f705..476f21d8c 100644 --- a/projects/fabric/src/client/java/dan200/computercraft/mixin/client/MinecraftMixin.java +++ b/projects/fabric/src/client/java/dan200/computercraft/mixin/client/MinecraftMixin.java @@ -24,7 +24,7 @@ class MinecraftMixin { private ReloadableResourceManager resourceManager; @Inject(method = "updateLevelInEngines", at = @At("HEAD")) - @SuppressWarnings("UnusedMethod") + @SuppressWarnings("unused") private void updateLevelInEngines(ClientLevel screen, CallbackInfo ci) { ClientHooks.onWorldUnload(); } @@ -37,7 +37,7 @@ class MinecraftMixin { ordinal = 0 ) ) - @SuppressWarnings("UnusedMethod") + @SuppressWarnings("unused") private void beforeInitialResourceReload(GameConfig gameConfig, CallbackInfo ci) { ClientRegistry.registerReloadListeners(resourceManager::registerReloadListener, (Minecraft) (Object) this); } diff --git a/projects/fabric/src/client/java/dan200/computercraft/mixin/client/MultiPlayerGameModeMixin.java b/projects/fabric/src/client/java/dan200/computercraft/mixin/client/MultiPlayerGameModeMixin.java index 85377cebc..484389104 100644 --- a/projects/fabric/src/client/java/dan200/computercraft/mixin/client/MultiPlayerGameModeMixin.java +++ b/projects/fabric/src/client/java/dan200/computercraft/mixin/client/MultiPlayerGameModeMixin.java @@ -31,7 +31,7 @@ class MultiPlayerGameModeMixin { cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD ) - @SuppressWarnings("UnusedMethod") + @SuppressWarnings("unused") private void onBlockBreak(BlockPos pos, CallbackInfoReturnable cir, Level level, BlockState state, Block block) { if (!FabricCommonHooks.onBlockDestroy(level, minecraft.player, pos, state, null)) cir.setReturnValue(true); } diff --git a/projects/fabric/src/client/java/dan200/computercraft/mixin/client/SoundEngineMixin.java b/projects/fabric/src/client/java/dan200/computercraft/mixin/client/SoundEngineMixin.java index 95b1c7555..943d3207a 100644 --- a/projects/fabric/src/client/java/dan200/computercraft/mixin/client/SoundEngineMixin.java +++ b/projects/fabric/src/client/java/dan200/computercraft/mixin/client/SoundEngineMixin.java @@ -26,13 +26,13 @@ class SoundEngineMixin { private static SoundEngine self; @Inject(method = "play", at = @At(value = "HEAD")) - @SuppressWarnings("UnusedMethod") + @SuppressWarnings("unused") private void playSound(SoundInstance sound, CallbackInfo ci) { self = (SoundEngine) (Object) this; } @Inject(at = @At("TAIL"), method = "method_19755") - @SuppressWarnings("UnusedMethod") + @SuppressWarnings("unused") private static void onStream(AudioStream stream, Channel channel, CallbackInfo ci) { SpeakerManager.onPlayStreaming(assertNonNull(self), channel, stream); } diff --git a/projects/fabric/src/main/java/dan200/computercraft/mixin/ChunkMapMixin.java b/projects/fabric/src/main/java/dan200/computercraft/mixin/ChunkMapMixin.java index e3d75b645..4ba8045a2 100644 --- a/projects/fabric/src/main/java/dan200/computercraft/mixin/ChunkMapMixin.java +++ b/projects/fabric/src/main/java/dan200/computercraft/mixin/ChunkMapMixin.java @@ -24,7 +24,7 @@ class ChunkMapMixin { ServerLevel level; @Inject(method = "updateChunkScheduling", at = @At("HEAD")) - @SuppressWarnings("UnusedMethod") + @SuppressWarnings("unused") private void onUpdateChunkScheduling(long chunkPos, int newLevel, @Nullable ChunkHolder holder, int oldLevel, CallbackInfoReturnable callback) { CommonHooks.onChunkTicketLevelChanged(level, chunkPos, oldLevel, newLevel); } diff --git a/projects/fabric/src/main/java/dan200/computercraft/mixin/EntityMixin.java b/projects/fabric/src/main/java/dan200/computercraft/mixin/EntityMixin.java index 5e97f4e5c..8014b5dee 100644 --- a/projects/fabric/src/main/java/dan200/computercraft/mixin/EntityMixin.java +++ b/projects/fabric/src/main/java/dan200/computercraft/mixin/EntityMixin.java @@ -20,7 +20,7 @@ class EntityMixin { at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;addFreshEntity(Lnet/minecraft/world/entity/Entity;)Z"), cancellable = true ) - @SuppressWarnings("UnusedMethod") + @SuppressWarnings("unused") private void spawnAtLocation(ItemStack stack, float yOffset, CallbackInfoReturnable cb) { if (CommonHooks.onLivingDrop((Entity) (Object) this, stack)) cb.setReturnValue(null); } diff --git a/projects/fabric/src/main/java/dan200/computercraft/mixin/ItemEntityMixin.java b/projects/fabric/src/main/java/dan200/computercraft/mixin/ItemEntityMixin.java index 71c94154f..8dc004b9e 100644 --- a/projects/fabric/src/main/java/dan200/computercraft/mixin/ItemEntityMixin.java +++ b/projects/fabric/src/main/java/dan200/computercraft/mixin/ItemEntityMixin.java @@ -16,7 +16,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(ItemEntity.class) abstract class ItemEntityMixin { @Inject(method = "tick", at = @At("HEAD")) - @SuppressWarnings("UnusedMethod") + @SuppressWarnings("unused") private void onTick(CallbackInfo ci) { var stack = getItem(); if (stack.getItem() instanceof PocketComputerItem pocket) { diff --git a/projects/fabric/src/main/java/dan200/computercraft/mixin/TagsProviderMixin.java b/projects/fabric/src/main/java/dan200/computercraft/mixin/TagsProviderMixin.java index 2e844e5c8..bcef75dca 100644 --- a/projects/fabric/src/main/java/dan200/computercraft/mixin/TagsProviderMixin.java +++ b/projects/fabric/src/main/java/dan200/computercraft/mixin/TagsProviderMixin.java @@ -21,7 +21,7 @@ import java.util.function.Predicate; @Mixin(TagsProvider.class) class TagsProviderMixin { @Inject(at = @At("HEAD"), method = "method_49658", cancellable = true) - @SuppressWarnings("UnusedMethod") + @SuppressWarnings("unused") private static void onVerifyPresent(Predicate predicate1, Predicate predicate2, TagEntry tag, CallbackInfoReturnable cir) { var element = ((TagEntryAccessor) tag).computercraft$elementOrTag(); if (element.tag() && element.id().getNamespace().equals("minecraft")) cir.setReturnValue(false); diff --git a/tools/update-resources.py b/tools/update-resources.py old mode 100644 new mode 100755 index 7664d1ced..08e0953ac --- a/tools/update-resources.py +++ b/tools/update-resources.py @@ -76,6 +76,45 @@ def unstitch_corners(input_file: pathlib.Path, family: str): sidebar.save(output_dir / f"sidebar_{family}.png") +def unstitch_turtle(input_file: pathlib.Path, family: str, *, dy: int = 0): + input = Image.open(input_file) + output_dir = input_file.parent + + fragments = [ + ("bottom", 22, 0, 24, 22, Image.Transpose.ROTATE_180), + ("top", 46, 0, 24, 22, Image.Transpose.FLIP_LEFT_RIGHT), + ("right", 0, 22, 22, 24, Image.Transpose.ROTATE_180), + ("back", 22, 22, 24, 24, Image.Transpose.ROTATE_180), + ("left", 46, 22, 22, 24, Image.Transpose.ROTATE_180), + ("front", 68, 22, 24, 24, Image.Transpose.ROTATE_180), + ] + + for suffix, x, y, w, h, transform in fragments: + if family == "elf_overlay" and suffix == "bottom": + continue + + slice = input.crop(box(x, dy + y, w, h)).transpose(transform) + + fragment = Image.new("RGBA", (32, 32)) + fragment.paste(slice) + fragment.save(output_dir / f"turtle_{family}_{suffix}.png") + + backpack = Image.new("RGBA", (32, 32)) + backpack.paste( + input.crop(box(70, dy + 4, 28, 14)).transpose(Image.Transpose.ROTATE_180), + (0, 4), + ) + backpack.paste( + input.crop(box(74, dy + 0, 20, 4)).transpose(Image.Transpose.ROTATE_180), + (4, 18), + ) + backpack.paste( + input.crop(box(94, dy + 0, 20, 4)).transpose(Image.Transpose.FLIP_LEFT_RIGHT), + (4, 0), + ) + backpack.save(output_dir / f"turtle_{family}_backpack.png") + + def main() -> None: spec = argparse.ArgumentParser() spec.add_argument("dir", type=pathlib.Path) @@ -97,6 +136,18 @@ def main() -> None: unstitch_corners(path, family) transformed.append(path) + for family in ("normal", "advanced", "elf_overlay"): + path = texture_path / "block" / f"turtle_{family}.png" + if path.exists(): + unstitch_turtle(path, family) + transformed.append(path) + + path = texture_path / "block" / f"turtle_colour.png" + if path.exists(): + unstitch_turtle(path, "colour_frame") + unstitch_turtle(path, "colour_body", dy=46) + transformed.append(path) + if len(transformed) == 0: print("No files were transformed") return