diff --git a/.gitignore b/.gitignore index dfcf71d52..43eefce7e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /classes /logs /build +/projects/*/logs /projects/*/build /buildSrc/build /out @@ -11,6 +12,7 @@ # Runtime directories /run +/projects/*/run *.ipr *.iws @@ -25,4 +27,4 @@ /.vscode *.launch -/src/generated/resources/.cache +/projects/*/src/generated/resources/.cache diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4f6497bda..ab9c34909 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -48,8 +48,7 @@ repos: exclude: | (?x)^( - src/generated| + projects/[a-z]+/src/generated| projects/core/src/test/resources/test-rom/data/json-parsing/| - src/testMod/server-files/| .*\.dfpwm ) diff --git a/build.gradle.kts b/build.gradle.kts index db2fdd128..b4a123fd6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,345 +1,9 @@ -import cc.tweaked.gradle.* -import groovy.util.Node -import groovy.util.NodeList -import net.darkhax.curseforgegradle.TaskPublishCurseForge -import net.minecraftforge.gradle.common.util.RunConfig import org.jetbrains.gradle.ext.compiler import org.jetbrains.gradle.ext.settings plugins { - // Build - id("cc-tweaked.forge") - id("cc-tweaked.gametest") - alias(libs.plugins.mixinGradle) - alias(libs.plugins.shadow) - // Publishing - alias(libs.plugins.curseForgeGradle) - alias(libs.plugins.githubRelease) - alias(libs.plugins.minotaur) - // Utility alias(libs.plugins.taskTree) id("org.jetbrains.gradle.plugin.idea-ext") - - id("cc-tweaked.illuaminate") - id("cc-tweaked.publishing") - id("cc-tweaked") -} - -val isStable = true -val modVersion: String by extra -val mcVersion: String by extra - -val allProjects = listOf(":core-api", ":core", ":forge-api").map { evaluationDependsOn(it) } -cct { - allProjects.forEach { externalSources(it) } -} - -sourceSets { - main { - resources.srcDir("src/generated/resources") - } -} - -minecraft { - runs { - // configureEach would be better, but we need to eagerly configure configs or otherwise the run task doesn't - // get set up properly. - all { - lazyToken("minecraft_classpath") { - configurations["shade"].copyRecursive().resolve().joinToString(File.pathSeparator) { it.absolutePath } - } - - property("forge.logging.markers", "REGISTRIES") - property("forge.logging.console.level", "debug") - - forceExit = false - - mods.register("computercraft") { - cct.sourceDirectories.get().forEach { - if (it.classes) sources(it.sourceSet) - } - } - } - - val client by registering { - workingDirectory(file("run")) - } - - val server by registering { - workingDirectory(file("run/server")) - arg("--nogui") - } - - val data by registering { - workingDirectory(file("run")) - args( - "--mod", - "computercraft", - "--all", - "--output", - file("src/generated/resources/"), - "--existing", - file("src/main/resources/"), - ) - property("cct.pretty-json", "true") - } - - fun RunConfig.configureForGameTest() { - val old = lazyTokens.get("minecraft_classpath") - lazyToken("minecraft_classpath") { - // We do some terrible hacks here to basically find all things not already on the runtime classpath - // and add them. /Except/ for our source sets, as those need to load inside the Minecraft classpath. - val testMod = configurations["testModRuntimeClasspath"].resolve() - val implementation = configurations.runtimeClasspath.get().resolve() - val new = (testMod - implementation) - .asSequence() - .filter { it.isFile && !it.name.endsWith("-test-fixtures.jar") } - .map { it.absolutePath } - .joinToString(File.pathSeparator) - if (old == null) new else old.get() + File.pathSeparator + new - } - - property("cctest.sources", file("src/testMod/resources/data/cctest").absolutePath) - - arg("--mixin.config=computercraft-gametest.mixins.json") - - mods.register("cctest") { - source(sourceSets["testMod"]) - source(sourceSets["testFixtures"]) - // FIXME: We need this for running in-dev but not from Gradle: - // source(project(":core").sourceSets.testFixtures.get()) - } - } - - val testClient by registering { - workingDirectory(file("run/testClient")) - parent(client.get()) - configureForGameTest() - } - - val gameTestServer by registering { - workingDirectory(file("run/testServer")) - configureForGameTest() - - property("forge.logging.console.level", "info") - } - } -} - -mixin { - add(sourceSets.main.get(), "computercraft.mixins.refmap.json") - config("computercraft.mixins.json") -} - -reobf { - register("shadowJar") -} - -configurations { - val shade by registering { isTransitive = false } - implementation { extendsFrom(shade.get()) } - register("cctJavadoc") -} - -dependencies { - annotationProcessor("org.spongepowered:mixin:0.8.5-SQUID:processor") - - errorprone(project(":lints")) - - compileOnly(libs.jetbrainsAnnotations) - annotationProcessorEverywhere(libs.autoService) - - libs.bundles.externalMods.forge.compile.get().map { compileOnly(fg.deobf(it)) } - libs.bundles.externalMods.forge.runtime.get().map { runtimeOnly(fg.deobf(it)) } - - implementation(project(":core")) - implementation(commonClasses(project(":forge-api"))) - implementation(clientClasses(project(":forge-api"))) - "shade"(libs.cobalt) - "shade"(libs.netty.http) - - testFixturesApi(libs.bundles.test) - testFixturesApi(libs.bundles.kotlin) - - testImplementation(testFixtures(project(":core"))) - testImplementation(libs.bundles.test) - testImplementation(libs.bundles.kotlin) - testRuntimeOnly(libs.bundles.testRuntime) - - testModImplementation(testFixtures(project(":core"))) - - "cctJavadoc"(libs.cctJavadoc) -} - -illuaminate { - version.set(libs.versions.illuaminate) -} - -// Compile tasks - -val luaJavadoc by tasks.registering(Javadoc::class) { - description = "Generates documentation for Java-side Lua functions." - group = JavaBasePlugin.DOCUMENTATION_GROUP - - source(sourceSets.main.get().java) - source(project(":core").sourceSets.main.get().java) - - setDestinationDir(buildDir.resolve("docs/luaJavadoc")) - classpath = sourceSets.main.get().compileClasspath - - options.docletpath = configurations["cctJavadoc"].files.toList() - options.doclet = "cc.tweaked.javadoc.LuaDoclet" - (options as StandardJavadocDocletOptions).noTimestamp(false) - - javadocTool.set( - javaToolchains.javadocToolFor { - languageVersion.set(cc.tweaked.gradle.CCTweakedPlugin.JAVA_VERSION) - }, - ) -} - -tasks.processResources { - inputs.property("modVersion", modVersion) - inputs.property("forgeVersion", libs.versions.forge.get()) - - filesMatching("META-INF/mods.toml") { - expand(mapOf("forgeVersion" to libs.versions.forge.get(), "file" to mapOf("jarVersion" to modVersion))) - } -} - -tasks.jar { - finalizedBy("reobfJar") - archiveClassifier.set("slim") - - from(allProjects.map { zipTree(it.tasks.jar.get().archiveFile) }) -} - -tasks.shadowJar { - finalizedBy("reobfShadowJar") - archiveClassifier.set("") - - from(allProjects.map { zipTree(it.tasks.jar.get().archiveFile) }) - - configurations = listOf(project.configurations["shade"]) - relocate("org.squiddev.cobalt", "cc.tweaked.internal.cobalt") - relocate("io.netty.handler", "cc.tweaked.internal.netty") - // TODO: minimize(): Would be good to support once our build scripts are stabilised. -} - -tasks.assemble { dependsOn("shadowJar") } - -// Check tasks - -tasks.test { - systemProperty("cct.test-files", buildDir.resolve("tmp/testFiles").absolutePath) -} - -val lintLua by tasks.registering(IlluaminateExec::class) { - group = JavaBasePlugin.VERIFICATION_GROUP - description = "Lint Lua (and Lua docs) with illuaminate" - - // Config files - inputs.file("illuaminate.sexp").withPropertyName("illuaminate.sexp") - // Sources - inputs.files(fileTree("doc")).withPropertyName("docs") - inputs.files(fileTree("src/main/resources/data/computercraft/lua")).withPropertyName("lua rom") - inputs.files(luaJavadoc) - - args = listOf("lint") - - doFirst { if (System.getenv("GITHUB_ACTIONS") != null) println("::add-matcher::.github/matchers/illuaminate.json") } - doLast { if (System.getenv("GITHUB_ACTIONS") != null) println("::remove-matcher owner=illuaminate::") } -} - -val runGametest by tasks.registering(JavaExec::class) { - group = LifecycleBasePlugin.VERIFICATION_GROUP - description = "Runs tests on a temporary Minecraft instance." - dependsOn("cleanRunGametest") - - // Copy from runGameTestServer. We do it in this slightly odd way as runGameTestServer - // isn't created until the task is configured (which is no good for us). - val exec = tasks.getByName("runGameTestServer") - dependsOn(exec.dependsOn) - exec.copyToFull(this) -} - -cct.jacoco(runGametest) - -tasks.check { dependsOn(runGametest) } - -// Upload tasks - -val publishCurseForge by tasks.registering(TaskPublishCurseForge::class) { - group = PublishingPlugin.PUBLISH_TASK_GROUP - description = "Upload artifacts to CurseForge" - - apiToken = findProperty("curseForgeApiKey") ?: "" - enabled = apiToken != "" - - val mainFile = upload("282001", tasks.shadowJar.get().archiveFile) - dependsOn(tasks.shadowJar) // Ughr. - mainFile.changelog = - "Release notes can be found on the [GitHub repository](https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v$mcVersion-$modVersion)." - mainFile.changelogType = "markdown" - mainFile.releaseType = if (isStable) "release" else "alpha" - mainFile.gameVersions.add(mcVersion) -} - -tasks.publish { dependsOn(publishCurseForge) } - -modrinth { - token.set(findProperty("modrinthApiKey") as String? ?: "") - projectId.set("gu7yAYhd") - versionNumber.set("$mcVersion-$modVersion") - versionName.set(modVersion) - versionType.set(if (isStable) "release" else "alpha") - uploadFile.set(tasks.shadowJar as Any) - gameVersions.add(mcVersion) - changelog.set("Release notes can be found on the [GitHub repository](https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v$mcVersion-$modVersion).") - - syncBodyFrom.set(provider { file("doc/mod-page.md").readText() }) -} - -tasks.publish { dependsOn(tasks.modrinth) } - -githubRelease { - token(findProperty("githubApiKey") as String? ?: "") - owner.set("cc-tweaked") - repo.set("CC-Tweaked") - targetCommitish.set(cct.gitBranch) - - tagName.set("v$mcVersion-$modVersion") - releaseName.set("[$mcVersion] $modVersion") - body.set( - provider { - "## " + file("src/main/resources/data/computercraft/lua/rom/help/whatsnew.md") - .readLines() - .takeWhile { it != "Type \"help changelog\" to see the full version history." } - .joinToString("\n").trim() - }, - ) - prerelease.set(!isStable) -} - -tasks.publish { dependsOn(tasks.githubRelease) } - -// Don't publish the slim jar -for (cfg in listOf(configurations.apiElements, configurations.runtimeElements)) { - cfg.configure { artifacts.removeIf { it.classifier == "slim" } } -} - -publishing { - publications { - named("maven", MavenPublication::class) { - fg.component(this) - // Remove all dependencies: they're shaded anyway! This is very ugly, but not found a better way :(. - pom.withXml { - for (node in asNode().get("dependencies") as NodeList) { - asNode().remove(node as Node) - } - } - } - } } idea.project.settings.compiler.javac { diff --git a/buildSrc/src/main/kotlin/cc-tweaked.forge.gradle.kts b/buildSrc/src/main/kotlin/cc-tweaked.forge.gradle.kts index f2903ae32..a2b8b7030 100644 --- a/buildSrc/src/main/kotlin/cc-tweaked.forge.gradle.kts +++ b/buildSrc/src/main/kotlin/cc-tweaked.forge.gradle.kts @@ -19,7 +19,7 @@ minecraft { val libs = project.extensions.getByType().named("libs") mappings("parchment", "${libs.findVersion("parchmentMc").get()}-${libs.findVersion("parchment").get()}-$mcVersion") - accessTransformer(rootProject.file("src/main/resources/META-INF/accesstransformer.cfg")) + accessTransformer(project(":forge").file("src/main/resources/META-INF/accesstransformer.cfg")) } MinecraftConfigurations.setup(project) diff --git a/buildSrc/src/main/kotlin/cc-tweaked.gametest.gradle.kts b/buildSrc/src/main/kotlin/cc-tweaked.gametest.gradle.kts index 782e33de2..74a56352a 100644 --- a/buildSrc/src/main/kotlin/cc-tweaked.gametest.gradle.kts +++ b/buildSrc/src/main/kotlin/cc-tweaked.gametest.gradle.kts @@ -1,3 +1,6 @@ +import cc.tweaked.gradle.clientClasses +import cc.tweaked.gradle.commonClasses + /** * Sets up the configurations for writing game tests. * @@ -9,12 +12,13 @@ plugins { id("cc-tweaked.java-convention") } -val main = sourceSets.main.get() +val main = sourceSets["main"] +val client = sourceSets["client"] -// Both testMod and testFixtures inherit from the main classpath, just so we have access to Minecraft classes. +// Both testMod and testFixtures inherit from the main and client classpath, just so we have access to Minecraft classes. val testMod by sourceSets.creating { - compileClasspath += main.compileClasspath - runtimeClasspath += main.runtimeClasspath + compileClasspath += main.compileClasspath + client.compileClasspath + runtimeClasspath += main.runtimeClasspath + client.runtimeClasspath } configurations { @@ -30,12 +34,13 @@ configurations { // Like the main test configurations, we're safe to depend on source set outputs. dependencies { add(testMod.implementationConfigurationName, main.output) + add(testMod.implementationConfigurationName, client.output) } // Similar to java-test-fixtures, but tries to avoid putting the obfuscated jar on the classpath. val testFixtures by sourceSets.creating { - compileClasspath += main.compileClasspath + compileClasspath += main.compileClasspath + client.compileClasspath } java.registerFeature("testFixtures") { @@ -44,6 +49,12 @@ java.registerFeature("testFixtures") { } dependencies { - add(testFixtures.implementationConfigurationName, main.output) + val libs = project.extensions.getByType().named("libs") + add(testFixtures.apiConfigurationName, libs.findBundle("test").get()) + // Consumers of this project already have the common and client classes on the classpath, so it's fine for these + // to be compile-only. + add(testFixtures.compileOnlyApiConfigurationName, commonClasses(project)) + add(testFixtures.compileOnlyApiConfigurationName, clientClasses(project)) + testImplementation(testFixtures(project)) } diff --git a/buildSrc/src/main/kotlin/cc/tweaked/gradle/Extensions.kt b/buildSrc/src/main/kotlin/cc/tweaked/gradle/Extensions.kt index 664527e5e..fc0a4b5f2 100644 --- a/buildSrc/src/main/kotlin/cc/tweaked/gradle/Extensions.kt +++ b/buildSrc/src/main/kotlin/cc/tweaked/gradle/Extensions.kt @@ -7,6 +7,9 @@ fun DependencyHandler.annotationProcessorEverywhere(dep: Any) { add("compileOnly", dep) add("annotationProcessor", dep) + add("clientCompileOnly", dep) + add("clientAnnotationProcessor", dep) + add("testCompileOnly", dep) add("testAnnotationProcessor", dep) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 018fda99e..26b6be08f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,6 +5,7 @@ forge = "43.1.1" parchment = "2022.10.16" parchmentMc = "1.19.2" +mixin = "0.8.5" # Normal dependencies asm = "9.3" @@ -23,8 +24,11 @@ nightConfig = "3.6.5" slf4j = "1.7.36" # Minecraft mods +forgeConfig = "4.2.6" +iris = "1.19.x-v1.2.6" jei = "11.3.0.262" oculus = "1.2.5" +rei = "9.1.550" # Testing hamcrest = "2.2" @@ -63,12 +67,16 @@ jsr305 = { module = "com.google.code.findbugs:jsr305", version.ref = "jsr305" } kotlin-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlin-coroutines" } kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" } netty-http = { module = "io.netty:netty-codec-http", version.ref = "netty" } +nightConfig-core = { module = "com.electronwill.night-config:core", version.ref = "nightConfig" } +nightConfig-toml = { module = "com.electronwill.night-config:toml", version.ref = "nightConfig" } slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } # Minecraft mods +forgeConfig = { module = "net.minecraftforge:forgeconfigapiport-fabric", version.ref = "forgeConfig" } jei-api = { module = "mezz.jei:jei-1.19.2-common-api", version.ref = "jei" } jei-fabric = { module = "mezz.jei:jei-1.19.2-fabric", version.ref = "jei" } jei-forge = { module = "mezz.jei:jei-1.19.2-forge", version.ref = "jei" } +mixin = { module = "org.spongepowered:mixin", version.ref = "mixin" } oculus = { module = "maven.modrinth:oculus", version.ref = "oculus" } # Testing @@ -110,7 +118,7 @@ taskTree = { id = "com.dorongold.task-tree", version.ref = "taskTree" } kotlin = ["kotlin-stdlib", "kotlin-coroutines"] # Minecraft -externalMods-common = ["jei-api"] +externalMods-common = ["jei-api", "forgeConfig", "nightConfig-core", "nightConfig-toml"] externalMods-forge-compile = ["oculus", "jei-api"] externalMods-forge-runtime = ["jei-forge"] diff --git a/illuaminate.sexp b/illuaminate.sexp index 081151132..c1e984e81 100644 --- a/illuaminate.sexp +++ b/illuaminate.sexp @@ -2,7 +2,7 @@ (sources /doc/ - /build/docs/luaJavadoc/ + /projects/forge/build/docs/luaJavadoc/ /projects/core/src/main/resources/data/computercraft/lua/bios.lua /projects/core/src/main/resources/data/computercraft/lua/rom/ /projects/core/src/test/resources/test-rom @@ -16,7 +16,7 @@ (site (title "CC: Tweaked") - (logo src/main/resources/pack.png) + (logo projects/common/src/main/resources/pack.png) (url https://tweaked.cc/) (source-link https://github.com/cc-tweaked/CC-Tweaked/blob/${commit}/${path}#L${line}) @@ -33,7 +33,7 @@ (library-path /doc/stub/ - /build/docs/luaJavadoc/ + /projects/forge/build/docs/luaJavadoc/ /projects/core/src/main/resources/data/computercraft/lua/rom/apis/ /projects/core/src/main/resources/data/computercraft/lua/rom/apis/command/ @@ -87,7 +87,7 @@ (lint (allow-toplevel-global true))) ;; Silence some variable warnings in documentation stubs. -(at (/doc/stub/ /build/docs/luaJavadoc/) +(at (/doc/stub/ /projects/forge/build/docs/luaJavadoc/) (linters -var:unused-global) (lint (allow-toplevel-global true))) diff --git a/projects/common/build.gradle.kts b/projects/common/build.gradle.kts new file mode 100644 index 000000000..e06446f4a --- /dev/null +++ b/projects/common/build.gradle.kts @@ -0,0 +1,38 @@ +import cc.tweaked.gradle.annotationProcessorEverywhere +import cc.tweaked.gradle.clientClasses +import cc.tweaked.gradle.commonClasses + +plugins { + id("cc-tweaked.vanilla") + id("cc-tweaked.gametest") +} + +minecraft { + accessWideners( + "src/main/resources/computercraft.accesswidener", + "src/main/resources/computercraft-common.accesswidener", + ) +} + +dependencies { + // Pull in our other projects. See comments in MinecraftConfigurations on this nastiness. + implementation(project(":core")) + implementation(commonClasses(project(":common-api"))) + clientImplementation(clientClasses(project(":common-api"))) + + compileOnly(libs.bundles.externalMods.common) + compileOnly(project(":forge-stubs")) + + compileOnly(libs.mixin) + annotationProcessorEverywhere(libs.autoService) + + testImplementation(testFixtures(project(":core"))) + testImplementation(libs.bundles.test) + testImplementation(project(":forge-stubs")) + testRuntimeOnly(libs.bundles.testRuntime) + + errorprone(project(":lints")) + + testModImplementation(testFixtures(project(":core"))) + testModImplementation(libs.bundles.kotlin) +} diff --git a/src/main/java/dan200/computercraft/client/ClientHooks.java b/projects/common/src/client/java/dan200/computercraft/client/ClientHooks.java similarity index 85% rename from src/main/java/dan200/computercraft/client/ClientHooks.java rename to projects/common/src/client/java/dan200/computercraft/client/ClientHooks.java index 120dc0df6..de569edcc 100644 --- a/src/main/java/dan200/computercraft/client/ClientHooks.java +++ b/projects/common/src/client/java/dan200/computercraft/client/ClientHooks.java @@ -10,18 +10,18 @@ import com.mojang.blaze3d.vertex.PoseStack; import dan200.computercraft.api.turtle.TurtleSide; import dan200.computercraft.client.pocket.ClientPocketComputers; import dan200.computercraft.client.render.CableHighlightRenderer; -import dan200.computercraft.client.render.ItemPocketRenderer; -import dan200.computercraft.client.render.ItemPrintoutRenderer; -import dan200.computercraft.client.render.MonitorHighlightRenderer; +import dan200.computercraft.client.render.PocketItemRenderer; +import dan200.computercraft.client.render.PrintoutItemRenderer; +import dan200.computercraft.client.render.monitor.MonitorHighlightRenderer; import dan200.computercraft.client.render.monitor.MonitorRenderState; import dan200.computercraft.client.sound.SpeakerManager; import dan200.computercraft.shared.CommonHooks; import dan200.computercraft.shared.command.CommandComputerCraft; import dan200.computercraft.shared.computer.core.ServerContext; -import dan200.computercraft.shared.media.items.ItemPrintout; -import dan200.computercraft.shared.peripheral.monitor.TileMonitor; -import dan200.computercraft.shared.pocket.items.ItemPocketComputer; -import dan200.computercraft.shared.turtle.blocks.TileTurtle; +import dan200.computercraft.shared.media.items.PrintoutItem; +import dan200.computercraft.shared.peripheral.monitor.MonitorBlockEntity; +import dan200.computercraft.shared.pocket.items.PocketComputerItem; +import dan200.computercraft.shared.turtle.blocks.TurtleBlockEntity; import dan200.computercraft.shared.util.PauseAwareTimer; import net.minecraft.Util; import net.minecraft.client.Camera; @@ -76,12 +76,12 @@ public final class ClientHooks { PoseStack transform, MultiBufferSource render, int lightTexture, InteractionHand hand, float pitch, float equipProgress, float swingProgress, ItemStack stack ) { - if (stack.getItem() instanceof ItemPocketComputer) { - ItemPocketRenderer.INSTANCE.renderItemFirstPerson(transform, render, lightTexture, hand, pitch, equipProgress, swingProgress, stack); + if (stack.getItem() instanceof PocketComputerItem) { + PocketItemRenderer.INSTANCE.renderItemFirstPerson(transform, render, lightTexture, hand, pitch, equipProgress, swingProgress, stack); return true; } - if (stack.getItem() instanceof ItemPrintout) { - ItemPrintoutRenderer.INSTANCE.renderItemFirstPerson(transform, render, lightTexture, hand, pitch, equipProgress, swingProgress, stack); + if (stack.getItem() instanceof PrintoutItem) { + PrintoutItemRenderer.INSTANCE.renderItemFirstPerson(transform, render, lightTexture, hand, pitch, equipProgress, swingProgress, stack); return true; } @@ -89,8 +89,8 @@ public final class ClientHooks { } public static boolean onRenderItemFrame(PoseStack transform, MultiBufferSource render, ItemFrame frame, ItemStack stack, int light) { - if (stack.getItem() instanceof ItemPrintout) { - ItemPrintoutRenderer.onRenderInFrame(transform, render, frame, stack, light); + if (stack.getItem() instanceof PrintoutItem) { + PrintoutItemRenderer.onRenderInFrame(transform, render, frame, stack, light); return true; } @@ -141,12 +141,12 @@ public final class ClientHooks { var tile = minecraft.level.getBlockEntity(((BlockHitResult) minecraft.hitResult).getBlockPos()); - if (tile instanceof TileMonitor monitor) { + if (tile instanceof MonitorBlockEntity monitor) { addText.accept(""); addText.accept( String.format("Targeted monitor: (%d, %d), %d x %d", monitor.getXIndex(), monitor.getYIndex(), monitor.getWidth(), monitor.getHeight()) ); - } else if (tile instanceof TileTurtle turtle) { + } else if (tile instanceof TurtleBlockEntity turtle) { addText.accept(""); addText.accept("Targeted turtle:"); addText.accept(String.format("Id: %d", turtle.getComputerID())); @@ -155,7 +155,7 @@ public final class ClientHooks { } } - private static void addTurtleUpgrade(Consumer out, TileTurtle turtle, TurtleSide side) { + private static void addTurtleUpgrade(Consumer out, TurtleBlockEntity turtle, TurtleSide side) { var upgrade = turtle.getUpgrade(side); if (upgrade != null) out.accept(String.format("Upgrade[%s]: %s", side, upgrade.getUpgradeID())); } diff --git a/src/main/java/dan200/computercraft/client/ClientRegistry.java b/projects/common/src/client/java/dan200/computercraft/client/ClientRegistry.java similarity index 73% rename from src/main/java/dan200/computercraft/client/ClientRegistry.java rename to projects/common/src/client/java/dan200/computercraft/client/ClientRegistry.java index 46ae186fc..b6fd0353d 100644 --- a/src/main/java/dan200/computercraft/client/ClientRegistry.java +++ b/projects/common/src/client/java/dan200/computercraft/client/ClientRegistry.java @@ -11,30 +11,33 @@ import dan200.computercraft.api.client.turtle.TurtleUpgradeModeller; import dan200.computercraft.client.gui.*; import dan200.computercraft.client.pocket.ClientPocketComputers; import dan200.computercraft.client.render.RenderTypes; -import dan200.computercraft.client.render.TileEntityMonitorRenderer; -import dan200.computercraft.client.render.TileEntityTurtleRenderer; +import dan200.computercraft.client.render.TurtleBlockEntityRenderer; +import dan200.computercraft.client.render.monitor.MonitorBlockEntityRenderer; import dan200.computercraft.client.turtle.TurtleModemModeller; import dan200.computercraft.core.util.Colour; import dan200.computercraft.shared.ModRegistry; import dan200.computercraft.shared.common.IColouredItem; -import dan200.computercraft.shared.computer.inventory.ContainerComputerBase; -import dan200.computercraft.shared.computer.inventory.ContainerViewComputer; -import dan200.computercraft.shared.media.items.ItemDisk; +import dan200.computercraft.shared.computer.inventory.AbstractComputerMenu; +import dan200.computercraft.shared.computer.inventory.ViewComputerMenu; +import dan200.computercraft.shared.media.items.DiskItem; import dan200.computercraft.shared.media.items.ItemTreasureDisk; import net.minecraft.client.color.item.ItemColor; import net.minecraft.client.gui.screens.MenuScreens; +import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.ShaderInstance; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.client.renderer.item.ClampedItemPropertyFunction; import net.minecraft.client.renderer.item.ItemProperties; -import net.minecraft.client.renderer.item.ItemPropertyFunction; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; +import javax.annotation.Nullable; import java.io.IOException; import java.util.function.BiConsumer; import java.util.function.Consumer; @@ -73,19 +76,19 @@ public final class ClientRegistry { * Register any client-side objects which must be done on the main thread. */ public static void registerMainThread() { - MenuScreens.>register(ModRegistry.Menus.COMPUTER.get(), GuiComputer::new); - MenuScreens.>register(ModRegistry.Menus.POCKET_COMPUTER.get(), GuiComputer::new); - MenuScreens.>register(ModRegistry.Menus.POCKET_COMPUTER_NO_TERM.get(), NoTermComputerScreen::new); - MenuScreens.register(ModRegistry.Menus.TURTLE.get(), GuiTurtle::new); + MenuScreens.>register(ModRegistry.Menus.COMPUTER.get(), ComputerScreen::new); + MenuScreens.>register(ModRegistry.Menus.POCKET_COMPUTER.get(), ComputerScreen::new); + MenuScreens.>register(ModRegistry.Menus.POCKET_COMPUTER_NO_TERM.get(), NoTermComputerScreen::new); + MenuScreens.register(ModRegistry.Menus.TURTLE.get(), TurtleScreen::new); - MenuScreens.register(ModRegistry.Menus.PRINTER.get(), GuiPrinter::new); - MenuScreens.register(ModRegistry.Menus.DISK_DRIVE.get(), GuiDiskDrive::new); - MenuScreens.register(ModRegistry.Menus.PRINTOUT.get(), GuiPrintout::new); + MenuScreens.register(ModRegistry.Menus.PRINTER.get(), PrinterScreen::new); + MenuScreens.register(ModRegistry.Menus.DISK_DRIVE.get(), DiskDriveScreen::new); + MenuScreens.register(ModRegistry.Menus.PRINTOUT.get(), PrintoutScreen::new); - MenuScreens.>register(ModRegistry.Menus.VIEW_COMPUTER.get(), GuiComputer::new); + MenuScreens.>register(ModRegistry.Menus.VIEW_COMPUTER.get(), ComputerScreen::new); registerItemProperty("state", - (stack, world, player, random) -> ClientPocketComputers.get(stack).getState().ordinal(), + new UnclampedPropertyFunction((stack, world, player, random) -> ClientPocketComputers.get(stack).getState().ordinal()), ModRegistry.Items.POCKET_COMPUTER_NORMAL, ModRegistry.Items.POCKET_COMPUTER_ADVANCED ); registerItemProperty("coloured", @@ -95,8 +98,7 @@ public final class ClientRegistry { } @SafeVarargs - @SuppressWarnings("deprecation") - private static void registerItemProperty(String name, ItemPropertyFunction getter, Supplier... items) { + private static void registerItemProperty(String name, ClampedItemPropertyFunction getter, Supplier... items) { var id = new ResourceLocation(ComputerCraftAPI.MOD_ID, name); for (var item : items) ItemProperties.register(item.get(), id, getter); } @@ -130,7 +132,7 @@ public final class ClientRegistry { public static void registerItemColours(BiConsumer register) { register.accept( - (stack, layer) -> layer == 1 ? ((ItemDisk) stack.getItem()).getColour(stack) : 0xFFFFFF, + (stack, layer) -> layer == 1 ? ((DiskItem) stack.getItem()).getColour(stack) : 0xFFFFFF, ModRegistry.Items.DISK.get() ); @@ -165,10 +167,10 @@ public final class ClientRegistry { } public static void registerBlockEntityRenderers(BlockEntityRenderRegistry register) { - register.register(ModRegistry.BlockEntities.MONITOR_NORMAL.get(), TileEntityMonitorRenderer::new); - register.register(ModRegistry.BlockEntities.MONITOR_ADVANCED.get(), TileEntityMonitorRenderer::new); - register.register(ModRegistry.BlockEntities.TURTLE_NORMAL.get(), TileEntityTurtleRenderer::new); - register.register(ModRegistry.BlockEntities.TURTLE_ADVANCED.get(), TileEntityTurtleRenderer::new); + register.register(ModRegistry.BlockEntities.MONITOR_NORMAL.get(), MonitorBlockEntityRenderer::new); + register.register(ModRegistry.BlockEntities.MONITOR_ADVANCED.get(), MonitorBlockEntityRenderer::new); + register.register(ModRegistry.BlockEntities.TURTLE_NORMAL.get(), TurtleBlockEntityRenderer::new); + register.register(ModRegistry.BlockEntities.TURTLE_ADVANCED.get(), TurtleBlockEntityRenderer::new); } public interface BlockEntityRenderRegistry { @@ -178,4 +180,19 @@ public final class ClientRegistry { public static void registerShaders(ResourceManager resources, BiConsumer> load) throws IOException { RenderTypes.registerShaders(resources, load); } + + private record UnclampedPropertyFunction( + ClampedItemPropertyFunction function + ) implements ClampedItemPropertyFunction { + @Override + public float unclampedCall(ItemStack stack, @Nullable ClientLevel level, @Nullable LivingEntity entity, int layer) { + return function.unclampedCall(stack, level, entity, layer); + } + + @Deprecated + @Override + public float call(ItemStack stack, @Nullable ClientLevel level, @Nullable LivingEntity entity, int layer) { + return function.unclampedCall(stack, level, entity, layer); + } + } } diff --git a/src/main/java/dan200/computercraft/client/ClientTableFormatter.java b/projects/common/src/client/java/dan200/computercraft/client/ClientTableFormatter.java similarity index 100% rename from src/main/java/dan200/computercraft/client/ClientTableFormatter.java rename to projects/common/src/client/java/dan200/computercraft/client/ClientTableFormatter.java diff --git a/src/main/java/dan200/computercraft/client/ComputerCraftAPIClientImpl.java b/projects/common/src/client/java/dan200/computercraft/client/ComputerCraftAPIClientImpl.java similarity index 99% rename from src/main/java/dan200/computercraft/client/ComputerCraftAPIClientImpl.java rename to projects/common/src/client/java/dan200/computercraft/client/ComputerCraftAPIClientImpl.java index 25b337f2f..8ebaca381 100644 --- a/src/main/java/dan200/computercraft/client/ComputerCraftAPIClientImpl.java +++ b/projects/common/src/client/java/dan200/computercraft/client/ComputerCraftAPIClientImpl.java @@ -12,7 +12,6 @@ import dan200.computercraft.api.turtle.TurtleUpgradeSerialiser; import dan200.computercraft.client.turtle.TurtleUpgradeModellers; import dan200.computercraft.impl.client.ComputerCraftAPIClientService; - @AutoService(ComputerCraftAPIClientService.class) public final class ComputerCraftAPIClientImpl implements ComputerCraftAPIClientService { @Override diff --git a/src/main/java/dan200/computercraft/client/FrameInfo.java b/projects/common/src/client/java/dan200/computercraft/client/FrameInfo.java similarity index 100% rename from src/main/java/dan200/computercraft/client/FrameInfo.java rename to projects/common/src/client/java/dan200/computercraft/client/FrameInfo.java diff --git a/src/main/java/dan200/computercraft/client/gui/ComputerScreenBase.java b/projects/common/src/client/java/dan200/computercraft/client/gui/AbstractComputerScreen.java similarity index 93% rename from src/main/java/dan200/computercraft/client/gui/ComputerScreenBase.java rename to projects/common/src/client/java/dan200/computercraft/client/gui/AbstractComputerScreen.java index eb7f56e26..423f5adaa 100644 --- a/src/main/java/dan200/computercraft/client/gui/ComputerScreenBase.java +++ b/projects/common/src/client/java/dan200/computercraft/client/gui/AbstractComputerScreen.java @@ -8,12 +8,12 @@ package dan200.computercraft.client.gui; import com.mojang.blaze3d.vertex.PoseStack; import dan200.computercraft.client.gui.widgets.ComputerSidebar; import dan200.computercraft.client.gui.widgets.DynamicImageButton; -import dan200.computercraft.client.gui.widgets.WidgetTerminal; +import dan200.computercraft.client.gui.widgets.TerminalWidget; import dan200.computercraft.client.platform.ClientPlatformHelper; import dan200.computercraft.core.terminal.Terminal; import dan200.computercraft.shared.computer.core.ComputerFamily; import dan200.computercraft.shared.computer.core.InputHandler; -import dan200.computercraft.shared.computer.inventory.ContainerComputerBase; +import dan200.computercraft.shared.computer.inventory.AbstractComputerMenu; import dan200.computercraft.shared.computer.upload.FileUpload; import dan200.computercraft.shared.computer.upload.UploadResult; import dan200.computercraft.shared.config.Config; @@ -40,15 +40,15 @@ import java.util.concurrent.TimeUnit; import static dan200.computercraft.core.util.Nullability.assertNonNull; -public abstract class ComputerScreenBase extends AbstractContainerScreen { - private static final Logger LOG = LoggerFactory.getLogger(ComputerScreenBase.class); +public abstract class AbstractComputerScreen extends AbstractContainerScreen { + private static final Logger LOG = LoggerFactory.getLogger(AbstractComputerScreen.class); private static final Component OK = Component.translatable("gui.ok"); private static final Component NO_RESPONSE_TITLE = Component.translatable("gui.computercraft.upload.no_response"); private static final Component NO_RESPONSE_MSG = Component.translatable("gui.computercraft.upload.no_response.msg", Component.literal("import").withStyle(ChatFormatting.DARK_GRAY)); - protected @Nullable WidgetTerminal terminal; + protected @Nullable TerminalWidget terminal; protected Terminal terminalData; protected final ComputerFamily family; protected final InputHandler input; @@ -58,7 +58,7 @@ public abstract class ComputerScreenBase extend private long uploadNagDeadline = Long.MAX_VALUE; private final ItemStack displayStack; - public ComputerScreenBase(T container, Inventory player, Component title, int sidebarYOffset) { + public AbstractComputerScreen(T container, Inventory player, Component title, int sidebarYOffset) { super(container, player, title); terminalData = container.getTerminal(); family = container.getFamily(); @@ -67,9 +67,9 @@ public abstract class ComputerScreenBase extend this.sidebarYOffset = sidebarYOffset; } - protected abstract WidgetTerminal createTerminal(); + protected abstract TerminalWidget createTerminal(); - protected final WidgetTerminal getTerminal() { + protected final TerminalWidget getTerminal() { if (terminal == null) throw new IllegalStateException("Screen has not been initialised yet"); return terminal; } diff --git a/src/main/java/dan200/computercraft/client/gui/ClientInputHandler.java b/projects/common/src/client/java/dan200/computercraft/client/gui/ClientInputHandler.java similarity index 100% rename from src/main/java/dan200/computercraft/client/gui/ClientInputHandler.java rename to projects/common/src/client/java/dan200/computercraft/client/gui/ClientInputHandler.java diff --git a/src/main/java/dan200/computercraft/client/gui/GuiComputer.java b/projects/common/src/client/java/dan200/computercraft/client/gui/ComputerScreen.java similarity index 65% rename from src/main/java/dan200/computercraft/client/gui/GuiComputer.java rename to projects/common/src/client/java/dan200/computercraft/client/gui/ComputerScreen.java index f213b3202..323b3075a 100644 --- a/src/main/java/dan200/computercraft/client/gui/GuiComputer.java +++ b/projects/common/src/client/java/dan200/computercraft/client/gui/ComputerScreen.java @@ -7,26 +7,26 @@ package dan200.computercraft.client.gui; import com.mojang.blaze3d.vertex.PoseStack; import dan200.computercraft.client.gui.widgets.ComputerSidebar; -import dan200.computercraft.client.gui.widgets.WidgetTerminal; +import dan200.computercraft.client.gui.widgets.TerminalWidget; import dan200.computercraft.client.render.ComputerBorderRenderer; -import dan200.computercraft.shared.computer.inventory.ContainerComputerBase; +import dan200.computercraft.shared.computer.inventory.AbstractComputerMenu; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; import static dan200.computercraft.client.render.ComputerBorderRenderer.BORDER; import static dan200.computercraft.client.render.RenderTypes.FULL_BRIGHT_LIGHTMAP; -public final class GuiComputer extends ComputerScreenBase { - public GuiComputer(T container, Inventory player, Component title) { +public final class ComputerScreen extends AbstractComputerScreen { + public ComputerScreen(T container, Inventory player, Component title) { super(container, player, title, BORDER); - imageWidth = WidgetTerminal.getWidth(terminalData.getWidth()) + BORDER * 2 + ComputerSidebar.WIDTH; - imageHeight = WidgetTerminal.getHeight(terminalData.getHeight()) + BORDER * 2; + imageWidth = TerminalWidget.getWidth(terminalData.getWidth()) + BORDER * 2 + AbstractComputerMenu.SIDEBAR_WIDTH; + imageHeight = TerminalWidget.getHeight(terminalData.getHeight()) + BORDER * 2; } @Override - protected WidgetTerminal createTerminal() { - return new WidgetTerminal(terminalData, input, leftPos + ComputerSidebar.WIDTH + BORDER, topPos + BORDER); + protected TerminalWidget createTerminal() { + return new TerminalWidget(terminalData, input, leftPos + AbstractComputerMenu.SIDEBAR_WIDTH + BORDER, topPos + BORDER); } @Override diff --git a/src/main/java/dan200/computercraft/client/gui/GuiDiskDrive.java b/projects/common/src/client/java/dan200/computercraft/client/gui/DiskDriveScreen.java similarity index 83% rename from src/main/java/dan200/computercraft/client/gui/GuiDiskDrive.java rename to projects/common/src/client/java/dan200/computercraft/client/gui/DiskDriveScreen.java index 079c12fdf..25aa1beff 100644 --- a/src/main/java/dan200/computercraft/client/gui/GuiDiskDrive.java +++ b/projects/common/src/client/java/dan200/computercraft/client/gui/DiskDriveScreen.java @@ -7,17 +7,17 @@ package dan200.computercraft.client.gui; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; -import dan200.computercraft.shared.peripheral.diskdrive.ContainerDiskDrive; +import dan200.computercraft.shared.peripheral.diskdrive.DiskDriveMenu; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; -public class GuiDiskDrive extends AbstractContainerScreen { +public class DiskDriveScreen extends AbstractContainerScreen { private static final ResourceLocation BACKGROUND = new ResourceLocation("computercraft", "textures/gui/disk_drive.png"); - public GuiDiskDrive(ContainerDiskDrive container, Inventory player, Component title) { + public DiskDriveScreen(DiskDriveMenu container, Inventory player, Component title) { super(container, player, title); } diff --git a/src/main/java/dan200/computercraft/client/gui/ItemToast.java b/projects/common/src/client/java/dan200/computercraft/client/gui/ItemToast.java similarity index 100% rename from src/main/java/dan200/computercraft/client/gui/ItemToast.java rename to projects/common/src/client/java/dan200/computercraft/client/gui/ItemToast.java diff --git a/src/main/java/dan200/computercraft/client/gui/NoTermComputerScreen.java b/projects/common/src/client/java/dan200/computercraft/client/gui/NoTermComputerScreen.java similarity index 90% rename from src/main/java/dan200/computercraft/client/gui/NoTermComputerScreen.java rename to projects/common/src/client/java/dan200/computercraft/client/gui/NoTermComputerScreen.java index e92fe337d..473b6bea2 100644 --- a/src/main/java/dan200/computercraft/client/gui/NoTermComputerScreen.java +++ b/projects/common/src/client/java/dan200/computercraft/client/gui/NoTermComputerScreen.java @@ -6,9 +6,9 @@ package dan200.computercraft.client.gui; import com.mojang.blaze3d.vertex.PoseStack; -import dan200.computercraft.client.gui.widgets.WidgetTerminal; +import dan200.computercraft.client.gui.widgets.TerminalWidget; import dan200.computercraft.core.terminal.Terminal; -import dan200.computercraft.shared.computer.inventory.ContainerComputerBase; +import dan200.computercraft.shared.computer.inventory.AbstractComputerMenu; import net.minecraft.client.KeyMapping; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.MenuAccess; @@ -20,10 +20,10 @@ import javax.annotation.Nullable; import static dan200.computercraft.core.util.Nullability.assertNonNull; -public class NoTermComputerScreen extends Screen implements MenuAccess { +public class NoTermComputerScreen extends Screen implements MenuAccess { private final T menu; private final Terminal terminalData; - private @Nullable WidgetTerminal terminal; + private @Nullable TerminalWidget terminal; public NoTermComputerScreen(T menu, Inventory player, Component title) { super(title); @@ -48,7 +48,7 @@ public class NoTermComputerScreen extends Scree super.init(); minecraft.keyboardHandler.setSendRepeatsToGui(true); - terminal = addWidget(new WidgetTerminal(terminalData, new ClientInputHandler(menu), 0, 0)); + terminal = addWidget(new TerminalWidget(terminalData, new ClientInputHandler(menu), 0, 0)); terminal.visible = false; terminal.active = false; setFocused(terminal); diff --git a/src/main/java/dan200/computercraft/client/gui/OptionScreen.java b/projects/common/src/client/java/dan200/computercraft/client/gui/OptionScreen.java similarity index 100% rename from src/main/java/dan200/computercraft/client/gui/OptionScreen.java rename to projects/common/src/client/java/dan200/computercraft/client/gui/OptionScreen.java diff --git a/src/main/java/dan200/computercraft/client/gui/GuiPrinter.java b/projects/common/src/client/java/dan200/computercraft/client/gui/PrinterScreen.java similarity index 85% rename from src/main/java/dan200/computercraft/client/gui/GuiPrinter.java rename to projects/common/src/client/java/dan200/computercraft/client/gui/PrinterScreen.java index 0762e317f..efd061a91 100644 --- a/src/main/java/dan200/computercraft/client/gui/GuiPrinter.java +++ b/projects/common/src/client/java/dan200/computercraft/client/gui/PrinterScreen.java @@ -7,17 +7,17 @@ package dan200.computercraft.client.gui; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; -import dan200.computercraft.shared.peripheral.printer.ContainerPrinter; +import dan200.computercraft.shared.peripheral.printer.PrinterMenu; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; -public class GuiPrinter extends AbstractContainerScreen { +public class PrinterScreen extends AbstractContainerScreen { private static final ResourceLocation BACKGROUND = new ResourceLocation("computercraft", "textures/gui/printer.png"); - public GuiPrinter(ContainerPrinter container, Inventory player, Component title) { + public PrinterScreen(PrinterMenu container, Inventory player, Component title) { super(container, player, title); } diff --git a/src/main/java/dan200/computercraft/client/gui/GuiPrintout.java b/projects/common/src/client/java/dan200/computercraft/client/gui/PrintoutScreen.java similarity index 84% rename from src/main/java/dan200/computercraft/client/gui/GuiPrintout.java rename to projects/common/src/client/java/dan200/computercraft/client/gui/PrintoutScreen.java index 6391bc3e6..57c0555b4 100644 --- a/src/main/java/dan200/computercraft/client/gui/GuiPrintout.java +++ b/projects/common/src/client/java/dan200/computercraft/client/gui/PrintoutScreen.java @@ -9,8 +9,8 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.Tesselator; import dan200.computercraft.core.terminal.TextBuffer; -import dan200.computercraft.shared.common.ContainerHeldItem; -import dan200.computercraft.shared.media.items.ItemPrintout; +import dan200.computercraft.shared.common.HeldItemMenu; +import dan200.computercraft.shared.media.items.PrintoutItem; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.network.chat.Component; @@ -20,29 +20,29 @@ import org.lwjgl.glfw.GLFW; import static dan200.computercraft.client.render.PrintoutRenderer.*; import static dan200.computercraft.client.render.RenderTypes.FULL_BRIGHT_LIGHTMAP; -public class GuiPrintout extends AbstractContainerScreen { +public class PrintoutScreen extends AbstractContainerScreen { private final boolean book; private final int pages; private final TextBuffer[] text; private final TextBuffer[] colours; private int page; - public GuiPrintout(ContainerHeldItem container, Inventory player, Component title) { + public PrintoutScreen(HeldItemMenu container, Inventory player, Component title) { super(container, player, title); imageHeight = Y_SIZE; - var text = ItemPrintout.getText(container.getStack()); + var text = PrintoutItem.getText(container.getStack()); this.text = new TextBuffer[text.length]; for (var i = 0; i < this.text.length; i++) this.text[i] = new TextBuffer(text[i]); - var colours = ItemPrintout.getColours(container.getStack()); + var colours = PrintoutItem.getColours(container.getStack()); this.colours = new TextBuffer[colours.length]; for (var i = 0; i < this.colours.length; i++) this.colours[i] = new TextBuffer(colours[i]); page = 0; - pages = Math.max(this.text.length / ItemPrintout.LINES_PER_PAGE, 1); - book = ((ItemPrintout) container.getStack().getItem()).getType() == ItemPrintout.Type.BOOK; + pages = Math.max(this.text.length / PrintoutItem.LINES_PER_PAGE, 1); + book = ((PrintoutItem) container.getStack().getItem()).getType() == PrintoutItem.Type.BOOK; } @Override @@ -88,7 +88,7 @@ public class GuiPrintout extends AbstractContainerScreen { var renderer = MultiBufferSource.immediate(Tesselator.getInstance().getBuilder()); drawBorder(transform, renderer, leftPos, topPos, getBlitOffset(), page, pages, book, FULL_BRIGHT_LIGHTMAP); - drawText(transform, renderer, leftPos + X_TEXT_MARGIN, topPos + Y_TEXT_MARGIN, ItemPrintout.LINES_PER_PAGE * page, FULL_BRIGHT_LIGHTMAP, text, colours); + drawText(transform, renderer, leftPos + X_TEXT_MARGIN, topPos + Y_TEXT_MARGIN, PrintoutItem.LINES_PER_PAGE * page, FULL_BRIGHT_LIGHTMAP, text, colours); renderer.endBatch(); } diff --git a/src/main/java/dan200/computercraft/client/gui/GuiTurtle.java b/projects/common/src/client/java/dan200/computercraft/client/gui/TurtleScreen.java similarity index 73% rename from src/main/java/dan200/computercraft/client/gui/GuiTurtle.java rename to projects/common/src/client/java/dan200/computercraft/client/gui/TurtleScreen.java index f64286775..020ced781 100644 --- a/src/main/java/dan200/computercraft/client/gui/GuiTurtle.java +++ b/projects/common/src/client/java/dan200/computercraft/client/gui/TurtleScreen.java @@ -9,17 +9,18 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.client.gui.widgets.ComputerSidebar; -import dan200.computercraft.client.gui.widgets.WidgetTerminal; +import dan200.computercraft.client.gui.widgets.TerminalWidget; import dan200.computercraft.client.render.ComputerBorderRenderer; import dan200.computercraft.shared.computer.core.ComputerFamily; -import dan200.computercraft.shared.turtle.inventory.ContainerTurtle; +import dan200.computercraft.shared.computer.inventory.AbstractComputerMenu; +import dan200.computercraft.shared.turtle.inventory.TurtleMenu; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; -import static dan200.computercraft.shared.turtle.inventory.ContainerTurtle.*; +import static dan200.computercraft.shared.turtle.inventory.TurtleMenu.*; -public class GuiTurtle extends ComputerScreenBase { +public class TurtleScreen extends AbstractComputerScreen { private static final ResourceLocation BACKGROUND_NORMAL = new ResourceLocation(ComputerCraftAPI.MOD_ID, "textures/gui/turtle_normal.png"); private static final ResourceLocation BACKGROUND_ADVANCED = new ResourceLocation(ComputerCraftAPI.MOD_ID, "textures/gui/turtle_advanced.png"); @@ -28,24 +29,24 @@ public class GuiTurtle extends ComputerScreenBase { private final ComputerFamily family; - public GuiTurtle(ContainerTurtle container, Inventory player, Component title) { + public TurtleScreen(TurtleMenu container, Inventory player, Component title) { super(container, player, title, BORDER); family = container.getFamily(); - imageWidth = TEX_WIDTH + ComputerSidebar.WIDTH; + imageWidth = TEX_WIDTH + AbstractComputerMenu.SIDEBAR_WIDTH; imageHeight = TEX_HEIGHT; } @Override - protected WidgetTerminal createTerminal() { - return new WidgetTerminal(terminalData, input, leftPos + BORDER + ComputerSidebar.WIDTH, topPos + BORDER); + protected TerminalWidget createTerminal() { + return new TerminalWidget(terminalData, input, leftPos + BORDER + AbstractComputerMenu.SIDEBAR_WIDTH, topPos + BORDER); } @Override protected void renderBg(PoseStack transform, float partialTicks, int mouseX, int mouseY) { var advanced = family == ComputerFamily.ADVANCED; RenderSystem.setShaderTexture(0, advanced ? BACKGROUND_ADVANCED : BACKGROUND_NORMAL); - blit(transform, leftPos + ComputerSidebar.WIDTH, topPos, 0, 0, TEX_WIDTH, TEX_HEIGHT); + blit(transform, leftPos + AbstractComputerMenu.SIDEBAR_WIDTH, topPos, 0, 0, TEX_WIDTH, TEX_HEIGHT); var slot = getMenu().getSelectedSlot(); if (slot >= 0) { diff --git a/src/main/java/dan200/computercraft/client/gui/widgets/ComputerSidebar.java b/projects/common/src/client/java/dan200/computercraft/client/gui/widgets/ComputerSidebar.java similarity index 89% rename from src/main/java/dan200/computercraft/client/gui/widgets/ComputerSidebar.java rename to projects/common/src/client/java/dan200/computercraft/client/gui/widgets/ComputerSidebar.java index 195e5d6d2..ec80d7f35 100644 --- a/src/main/java/dan200/computercraft/client/gui/widgets/ComputerSidebar.java +++ b/projects/common/src/client/java/dan200/computercraft/client/gui/widgets/ComputerSidebar.java @@ -9,6 +9,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.client.render.ComputerBorderRenderer; import dan200.computercraft.shared.computer.core.InputHandler; +import dan200.computercraft.shared.computer.inventory.AbstractComputerMenu; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.screens.Screen; @@ -39,7 +40,6 @@ public final class ComputerSidebar { private static final int BUTTONS = 2; private static final int HEIGHT = (ICON_HEIGHT + ICON_MARGIN * 2) * BUTTONS + CORNERS_BORDER * 2; - public static final int WIDTH = 17; private ComputerSidebar() { } @@ -73,18 +73,18 @@ public final class ComputerSidebar { public static void renderBackground(PoseStack transform, int x, int y) { Screen.blit(transform, - x, y, 0, 102, WIDTH, FULL_BORDER, + x, y, 0, 102, AbstractComputerMenu.SIDEBAR_WIDTH, FULL_BORDER, ComputerBorderRenderer.TEX_SIZE, ComputerBorderRenderer.TEX_SIZE ); Screen.blit(transform, - x, y + FULL_BORDER, WIDTH, HEIGHT - FULL_BORDER * 2, - 0, 107, WIDTH, 4, + x, y + FULL_BORDER, AbstractComputerMenu.SIDEBAR_WIDTH, HEIGHT - FULL_BORDER * 2, + 0, 107, AbstractComputerMenu.SIDEBAR_WIDTH, 4, ComputerBorderRenderer.TEX_SIZE, ComputerBorderRenderer.TEX_SIZE ); Screen.blit(transform, - x, y + HEIGHT - FULL_BORDER, 0, 111, WIDTH, FULL_BORDER, + x, y + HEIGHT - FULL_BORDER, 0, 111, AbstractComputerMenu.SIDEBAR_WIDTH, FULL_BORDER, ComputerBorderRenderer.TEX_SIZE, ComputerBorderRenderer.TEX_SIZE ); } diff --git a/src/main/java/dan200/computercraft/client/gui/widgets/DynamicImageButton.java b/projects/common/src/client/java/dan200/computercraft/client/gui/widgets/DynamicImageButton.java similarity index 100% rename from src/main/java/dan200/computercraft/client/gui/widgets/DynamicImageButton.java rename to projects/common/src/client/java/dan200/computercraft/client/gui/widgets/DynamicImageButton.java diff --git a/src/main/java/dan200/computercraft/client/gui/widgets/WidgetTerminal.java b/projects/common/src/client/java/dan200/computercraft/client/gui/widgets/TerminalWidget.java similarity index 98% rename from src/main/java/dan200/computercraft/client/gui/widgets/WidgetTerminal.java rename to projects/common/src/client/java/dan200/computercraft/client/gui/widgets/TerminalWidget.java index 243ac1cc9..c5abcc2eb 100644 --- a/src/main/java/dan200/computercraft/client/gui/widgets/WidgetTerminal.java +++ b/projects/common/src/client/java/dan200/computercraft/client/gui/widgets/TerminalWidget.java @@ -25,7 +25,7 @@ import static dan200.computercraft.client.render.ComputerBorderRenderer.MARGIN; import static dan200.computercraft.client.render.text.FixedWidthFontRenderer.FONT_HEIGHT; import static dan200.computercraft.client.render.text.FixedWidthFontRenderer.FONT_WIDTH; -public class WidgetTerminal extends AbstractWidget { +public class TerminalWidget extends AbstractWidget { private static final float TERMINATE_TIME = 0.5f; private final Terminal terminal; @@ -47,7 +47,7 @@ public class WidgetTerminal extends AbstractWidget { private final BitSet keysDown = new BitSet(256); - public WidgetTerminal(Terminal terminal, InputHandler computer, int x, int y) { + public TerminalWidget(Terminal terminal, InputHandler computer, int x, int y) { super(x, y, terminal.getWidth() * FONT_WIDTH + MARGIN * 2, terminal.getHeight() * FONT_HEIGHT + MARGIN * 2, Component.empty()); this.terminal = terminal; diff --git a/src/main/java/dan200/computercraft/client/integration/Optifine.java b/projects/common/src/client/java/dan200/computercraft/client/integration/Optifine.java similarity index 100% rename from src/main/java/dan200/computercraft/client/integration/Optifine.java rename to projects/common/src/client/java/dan200/computercraft/client/integration/Optifine.java diff --git a/src/main/java/dan200/computercraft/client/integration/ShaderMod.java b/projects/common/src/client/java/dan200/computercraft/client/integration/ShaderMod.java similarity index 96% rename from src/main/java/dan200/computercraft/client/integration/ShaderMod.java rename to projects/common/src/client/java/dan200/computercraft/client/integration/ShaderMod.java index 433b29ace..75e0a135f 100644 --- a/src/main/java/dan200/computercraft/client/integration/ShaderMod.java +++ b/projects/common/src/client/java/dan200/computercraft/client/integration/ShaderMod.java @@ -7,7 +7,7 @@ package dan200.computercraft.client.integration; import dan200.computercraft.client.render.RenderTypes; import dan200.computercraft.client.render.text.DirectFixedWidthFontRenderer; -import dan200.computercraft.client.util.DirectVertexBuffer; +import dan200.computercraft.client.render.vbo.DirectVertexBuffer; import java.nio.ByteBuffer; import java.util.Optional; diff --git a/src/main/java/dan200/computercraft/client/model/turtle/TurtleModelParts.java b/projects/common/src/client/java/dan200/computercraft/client/model/turtle/TurtleModelParts.java similarity index 90% rename from src/main/java/dan200/computercraft/client/model/turtle/TurtleModelParts.java rename to projects/common/src/client/java/dan200/computercraft/client/model/turtle/TurtleModelParts.java index 4bf236c28..59a995710 100644 --- a/src/main/java/dan200/computercraft/client/model/turtle/TurtleModelParts.java +++ b/projects/common/src/client/java/dan200/computercraft/client/model/turtle/TurtleModelParts.java @@ -10,9 +10,10 @@ import com.mojang.math.Transformation; import dan200.computercraft.api.client.TransformedModel; import dan200.computercraft.api.turtle.ITurtleUpgrade; import dan200.computercraft.api.turtle.TurtleSide; -import dan200.computercraft.client.render.TileEntityTurtleRenderer; +import dan200.computercraft.client.platform.ClientPlatformHelper; +import dan200.computercraft.client.render.TurtleBlockEntityRenderer; import dan200.computercraft.client.turtle.TurtleUpgradeModellers; -import dan200.computercraft.shared.turtle.items.ItemTurtle; +import dan200.computercraft.shared.turtle.items.TurtleItem; import dan200.computercraft.shared.util.Holiday; import dan200.computercraft.shared.util.HolidayUtil; import net.minecraft.client.Minecraft; @@ -70,7 +71,7 @@ public final class TurtleModelParts { } public Combination getCombination(ItemStack stack) { - var turtle = (ItemTurtle) stack.getItem(); + var turtle = (TurtleItem) stack.getItem(); var colour = turtle.getColour(stack); var leftUpgrade = turtle.getUpgrade(stack, TurtleSide.LEFT); @@ -91,9 +92,9 @@ public final class TurtleModelParts { var parts = new ArrayList(4); parts.add(transform(combo.colour() ? colourModel : familyModel, transformation)); - var overlayModelLocation = TileEntityTurtleRenderer.getTurtleOverlayModel(combo.overlay(), combo.christmas()); + var overlayModelLocation = TurtleBlockEntityRenderer.getTurtleOverlayModel(combo.overlay(), combo.christmas()); if (overlayModelLocation != null) { - parts.add(transform(modelManager.getModel(overlayModelLocation), transformation)); + parts.add(transform(ClientPlatformHelper.get().getModel(modelManager, overlayModelLocation), transformation)); } if (combo.leftUpgrade() != null) { var model = TurtleUpgradeModellers.getModel(combo.leftUpgrade(), null, TurtleSide.LEFT); diff --git a/src/main/java/dan200/computercraft/client/platform/AbstractClientNetworkContext.java b/projects/common/src/client/java/dan200/computercraft/client/platform/AbstractClientNetworkContext.java similarity index 91% rename from src/main/java/dan200/computercraft/client/platform/AbstractClientNetworkContext.java rename to projects/common/src/client/java/dan200/computercraft/client/platform/AbstractClientNetworkContext.java index f580d1049..8255501d6 100644 --- a/src/main/java/dan200/computercraft/client/platform/AbstractClientNetworkContext.java +++ b/projects/common/src/client/java/dan200/computercraft/client/platform/AbstractClientNetworkContext.java @@ -6,7 +6,7 @@ package dan200.computercraft.client.platform; import dan200.computercraft.client.ClientTableFormatter; -import dan200.computercraft.client.gui.ComputerScreenBase; +import dan200.computercraft.client.gui.AbstractComputerScreen; import dan200.computercraft.client.gui.OptionScreen; import dan200.computercraft.client.pocket.ClientPocketComputers; import dan200.computercraft.client.sound.SpeakerManager; @@ -16,7 +16,7 @@ import dan200.computercraft.shared.computer.menu.ComputerMenu; import dan200.computercraft.shared.computer.terminal.TerminalState; import dan200.computercraft.shared.computer.upload.UploadResult; import dan200.computercraft.shared.network.client.ClientNetworkContext; -import dan200.computercraft.shared.peripheral.monitor.TileMonitor; +import dan200.computercraft.shared.peripheral.monitor.MonitorBlockEntity; import dan200.computercraft.shared.peripheral.speaker.SpeakerPosition; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; @@ -54,7 +54,7 @@ public abstract class AbstractClientNetworkContext implements ClientNetworkConte if (player == null) return; var te = player.level.getBlockEntity(pos); - if (!(te instanceof TileMonitor monitor)) return; + if (!(te instanceof MonitorBlockEntity monitor)) return; monitor.read(terminal); } @@ -101,8 +101,8 @@ public abstract class AbstractClientNetworkContext implements ClientNetworkConte var minecraft = Minecraft.getInstance(); var screen = OptionScreen.unwrap(minecraft.screen); - if (screen instanceof ComputerScreenBase && ((ComputerScreenBase) screen).getMenu().containerId == containerId) { - ((ComputerScreenBase) screen).uploadResult(result, errorMessage); + if (screen instanceof AbstractComputerScreen && ((AbstractComputerScreen) screen).getMenu().containerId == containerId) { + ((AbstractComputerScreen) screen).uploadResult(result, errorMessage); } } diff --git a/src/main/java/dan200/computercraft/client/platform/ClientPlatformHelper.java b/projects/common/src/client/java/dan200/computercraft/client/platform/ClientPlatformHelper.java similarity index 100% rename from src/main/java/dan200/computercraft/client/platform/ClientPlatformHelper.java rename to projects/common/src/client/java/dan200/computercraft/client/platform/ClientPlatformHelper.java diff --git a/src/main/java/dan200/computercraft/client/pocket/ClientPocketComputers.java b/projects/common/src/client/java/dan200/computercraft/client/pocket/ClientPocketComputers.java similarity index 87% rename from src/main/java/dan200/computercraft/client/pocket/ClientPocketComputers.java rename to projects/common/src/client/java/dan200/computercraft/client/pocket/ClientPocketComputers.java index 229843cf5..f7a7d4e6c 100644 --- a/src/main/java/dan200/computercraft/client/pocket/ClientPocketComputers.java +++ b/projects/common/src/client/java/dan200/computercraft/client/pocket/ClientPocketComputers.java @@ -7,9 +7,9 @@ package dan200.computercraft.client.pocket; import dan200.computercraft.shared.computer.core.ComputerFamily; import dan200.computercraft.shared.computer.core.ServerComputer; -import dan200.computercraft.shared.computer.items.ItemComputer; +import dan200.computercraft.shared.computer.items.ComputerItem; import dan200.computercraft.shared.network.client.PocketComputerDataMessage; -import dan200.computercraft.shared.pocket.items.ItemPocketComputer; +import dan200.computercraft.shared.pocket.items.PocketComputerItem; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import net.minecraft.world.item.ItemStack; @@ -47,7 +47,7 @@ public final class ClientPocketComputers { } public static PocketComputerData get(ItemStack stack) { - var family = stack.getItem() instanceof ItemComputer computer ? computer.getFamily() : ComputerFamily.NORMAL; - return get(ItemPocketComputer.getInstanceID(stack), family != ComputerFamily.NORMAL); + var family = stack.getItem() instanceof ComputerItem computer ? computer.getFamily() : ComputerFamily.NORMAL; + return get(PocketComputerItem.getInstanceID(stack), family != ComputerFamily.NORMAL); } } diff --git a/src/main/java/dan200/computercraft/client/pocket/PocketComputerData.java b/projects/common/src/client/java/dan200/computercraft/client/pocket/PocketComputerData.java similarity index 100% rename from src/main/java/dan200/computercraft/client/pocket/PocketComputerData.java rename to projects/common/src/client/java/dan200/computercraft/client/pocket/PocketComputerData.java diff --git a/src/main/java/dan200/computercraft/client/render/CableHighlightRenderer.java b/projects/common/src/client/java/dan200/computercraft/client/render/CableHighlightRenderer.java similarity index 95% rename from src/main/java/dan200/computercraft/client/render/CableHighlightRenderer.java rename to projects/common/src/client/java/dan200/computercraft/client/render/CableHighlightRenderer.java index 9e284dee9..912e51403 100644 --- a/src/main/java/dan200/computercraft/client/render/CableHighlightRenderer.java +++ b/projects/common/src/client/java/dan200/computercraft/client/render/CableHighlightRenderer.java @@ -7,7 +7,7 @@ package dan200.computercraft.client.render; import com.mojang.blaze3d.vertex.PoseStack; import dan200.computercraft.shared.ModRegistry; -import dan200.computercraft.shared.peripheral.modem.wired.BlockCable; +import dan200.computercraft.shared.peripheral.modem.wired.CableBlock; import dan200.computercraft.shared.peripheral.modem.wired.CableShapes; import dan200.computercraft.shared.util.WorldUtil; import net.minecraft.client.Camera; @@ -37,7 +37,7 @@ public final class CableHighlightRenderer { var state = world.getBlockState(pos); // We only care about instances with both cable and modem. - if (state.getBlock() != ModRegistry.Blocks.CABLE.get() || state.getValue(BlockCable.MODEM).getFacing() == null || !state.getValue(BlockCable.CABLE)) { + if (state.getBlock() != ModRegistry.Blocks.CABLE.get() || state.getValue(CableBlock.MODEM).getFacing() == null || !state.getValue(CableBlock.CABLE)) { return false; } diff --git a/src/main/java/dan200/computercraft/client/render/ComputerBorderRenderer.java b/projects/common/src/client/java/dan200/computercraft/client/render/ComputerBorderRenderer.java similarity index 100% rename from src/main/java/dan200/computercraft/client/render/ComputerBorderRenderer.java rename to projects/common/src/client/java/dan200/computercraft/client/render/ComputerBorderRenderer.java diff --git a/src/main/java/dan200/computercraft/client/render/ItemMapLikeRenderer.java b/projects/common/src/client/java/dan200/computercraft/client/render/ItemMapLikeRenderer.java similarity index 100% rename from src/main/java/dan200/computercraft/client/render/ItemMapLikeRenderer.java rename to projects/common/src/client/java/dan200/computercraft/client/render/ItemMapLikeRenderer.java diff --git a/src/main/java/dan200/computercraft/client/render/ItemPocketRenderer.java b/projects/common/src/client/java/dan200/computercraft/client/render/PocketItemRenderer.java similarity index 92% rename from src/main/java/dan200/computercraft/client/render/ItemPocketRenderer.java rename to projects/common/src/client/java/dan200/computercraft/client/render/PocketItemRenderer.java index 2ef0d8944..2992cf830 100644 --- a/src/main/java/dan200/computercraft/client/render/ItemPocketRenderer.java +++ b/projects/common/src/client/java/dan200/computercraft/client/render/PocketItemRenderer.java @@ -12,7 +12,7 @@ import dan200.computercraft.client.pocket.ClientPocketComputers; import dan200.computercraft.client.render.text.FixedWidthFontRenderer; import dan200.computercraft.core.util.Colour; import dan200.computercraft.shared.computer.core.ComputerFamily; -import dan200.computercraft.shared.pocket.items.ItemPocketComputer; +import dan200.computercraft.shared.pocket.items.PocketComputerItem; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.world.item.ItemStack; @@ -23,10 +23,10 @@ import static dan200.computercraft.client.render.text.FixedWidthFontRenderer.FON /** * Emulates map rendering for pocket computers. */ -public final class ItemPocketRenderer extends ItemMapLikeRenderer { - public static final ItemPocketRenderer INSTANCE = new ItemPocketRenderer(); +public final class PocketItemRenderer extends ItemMapLikeRenderer { + public static final PocketItemRenderer INSTANCE = new PocketItemRenderer(); - private ItemPocketRenderer() { + private PocketItemRenderer() { } @Override @@ -52,7 +52,7 @@ public final class ItemPocketRenderer extends ItemMapLikeRenderer { transform.translate(-0.5 * width, -0.5 * height, 0); // Render the main frame - var item = (ItemPocketComputer) stack.getItem(); + var item = (PocketComputerItem) stack.getItem(); var family = item.getFamily(); var frameColour = item.getColour(stack); diff --git a/src/main/java/dan200/computercraft/client/render/ItemPrintoutRenderer.java b/projects/common/src/client/java/dan200/computercraft/client/render/PrintoutItemRenderer.java similarity index 80% rename from src/main/java/dan200/computercraft/client/render/ItemPrintoutRenderer.java rename to projects/common/src/client/java/dan200/computercraft/client/render/PrintoutItemRenderer.java index 23c6c9a80..ce5561722 100644 --- a/src/main/java/dan200/computercraft/client/render/ItemPrintoutRenderer.java +++ b/projects/common/src/client/java/dan200/computercraft/client/render/PrintoutItemRenderer.java @@ -7,7 +7,7 @@ package dan200.computercraft.client.render; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Vector3f; -import dan200.computercraft.shared.media.items.ItemPrintout; +import dan200.computercraft.shared.media.items.PrintoutItem; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.decoration.ItemFrame; @@ -16,16 +16,16 @@ import net.minecraft.world.item.ItemStack; import static dan200.computercraft.client.render.PrintoutRenderer.*; import static dan200.computercraft.client.render.text.FixedWidthFontRenderer.FONT_HEIGHT; import static dan200.computercraft.client.render.text.FixedWidthFontRenderer.FONT_WIDTH; -import static dan200.computercraft.shared.media.items.ItemPrintout.LINES_PER_PAGE; -import static dan200.computercraft.shared.media.items.ItemPrintout.LINE_MAX_LENGTH; +import static dan200.computercraft.shared.media.items.PrintoutItem.LINES_PER_PAGE; +import static dan200.computercraft.shared.media.items.PrintoutItem.LINE_MAX_LENGTH; /** * Emulates map and item-frame rendering for printouts. */ -public final class ItemPrintoutRenderer extends ItemMapLikeRenderer { - public static final ItemPrintoutRenderer INSTANCE = new ItemPrintoutRenderer(); +public final class PrintoutItemRenderer extends ItemMapLikeRenderer { + public static final PrintoutItemRenderer INSTANCE = new PrintoutItemRenderer(); - private ItemPrintoutRenderer() { + private PrintoutItemRenderer() { } @Override @@ -38,7 +38,7 @@ public final class ItemPrintoutRenderer extends ItemMapLikeRenderer { } public static void onRenderInFrame(PoseStack transform, MultiBufferSource render, ItemFrame frame, ItemStack stack, int packedLight) { - if (!(stack.getItem() instanceof ItemPrintout)) return; + if (!(stack.getItem() instanceof PrintoutItem)) return; // Move a little bit forward to ensure we're not clipping with the frame transform.translate(0.0f, 0.0f, -0.001f); @@ -51,8 +51,8 @@ public final class ItemPrintoutRenderer extends ItemMapLikeRenderer { } private static void drawPrintout(PoseStack transform, MultiBufferSource render, ItemStack stack, int light) { - var pages = ItemPrintout.getPageCount(stack); - var book = ((ItemPrintout) stack.getItem()).getType() == ItemPrintout.Type.BOOK; + var pages = PrintoutItem.getPageCount(stack); + var book = ((PrintoutItem) stack.getItem()).getType() == PrintoutItem.Type.BOOK; double width = LINE_MAX_LENGTH * FONT_WIDTH + X_TEXT_MARGIN * 2; double height = LINES_PER_PAGE * FONT_HEIGHT + Y_TEXT_MARGIN * 2; @@ -78,7 +78,7 @@ public final class ItemPrintoutRenderer extends ItemMapLikeRenderer { drawBorder(transform, render, 0, 0, -0.01f, 0, pages, book, light); drawText( transform, render, X_TEXT_MARGIN, Y_TEXT_MARGIN, 0, light, - ItemPrintout.getText(stack), ItemPrintout.getColours(stack) + PrintoutItem.getText(stack), PrintoutItem.getColours(stack) ); } } diff --git a/src/main/java/dan200/computercraft/client/render/PrintoutRenderer.java b/projects/common/src/client/java/dan200/computercraft/client/render/PrintoutRenderer.java similarity index 98% rename from src/main/java/dan200/computercraft/client/render/PrintoutRenderer.java rename to projects/common/src/client/java/dan200/computercraft/client/render/PrintoutRenderer.java index 433758976..db15bd55c 100644 --- a/src/main/java/dan200/computercraft/client/render/PrintoutRenderer.java +++ b/projects/common/src/client/java/dan200/computercraft/client/render/PrintoutRenderer.java @@ -14,7 +14,7 @@ import dan200.computercraft.core.terminal.TextBuffer; import net.minecraft.client.renderer.MultiBufferSource; import static dan200.computercraft.client.render.text.FixedWidthFontRenderer.FONT_HEIGHT; -import static dan200.computercraft.shared.media.items.ItemPrintout.LINES_PER_PAGE; +import static dan200.computercraft.shared.media.items.PrintoutItem.LINES_PER_PAGE; public final class PrintoutRenderer { private static final float BG_SIZE = 256.0f; diff --git a/src/main/java/dan200/computercraft/client/render/RenderTypes.java b/projects/common/src/client/java/dan200/computercraft/client/render/RenderTypes.java similarity index 84% rename from src/main/java/dan200/computercraft/client/render/RenderTypes.java rename to projects/common/src/client/java/dan200/computercraft/client/render/RenderTypes.java index 78cdadef1..e10d74575 100644 --- a/src/main/java/dan200/computercraft/client/render/RenderTypes.java +++ b/projects/common/src/client/java/dan200/computercraft/client/render/RenderTypes.java @@ -8,6 +8,7 @@ package dan200.computercraft.client.render; import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.VertexFormat; import dan200.computercraft.api.ComputerCraftAPI; +import dan200.computercraft.client.render.monitor.MonitorTextureBufferShader; import dan200.computercraft.client.render.text.FixedWidthFontRenderer; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.RenderStateShard; @@ -50,12 +51,12 @@ public class RenderTypes { */ public static final RenderType PRINTOUT_BACKGROUND = RenderType.text(new ResourceLocation("computercraft", "textures/gui/printout.png")); - static MonitorTextureBufferShader getMonitorTextureBufferShader() { + public static MonitorTextureBufferShader getMonitorTextureBufferShader() { if (monitorTboShader == null) throw new NullPointerException("MonitorTboShader has not been registered"); return monitorTboShader; } - static ShaderInstance getTerminalShader() { + public static ShaderInstance getTerminalShader() { return Objects.requireNonNull(GameRenderer.getRendertypeTextShader(), "Text shader has not been registered"); } @@ -63,14 +64,14 @@ public class RenderTypes { load.accept( new MonitorTextureBufferShader( resources, - new ResourceLocation(ComputerCraftAPI.MOD_ID, "monitor_tbo"), + ComputerCraftAPI.MOD_ID + "/monitor_tbo", MONITOR_TBO.format() ), x -> monitorTboShader = (MonitorTextureBufferShader) x ); } - private static final class Types extends RenderStateShard { + private static final class Types extends RenderType { private static final RenderStateShard.TextureStateShard TERM_FONT_TEXTURE = new TextureStateShard( FixedWidthFontRenderer.FONT, false, false // blur, minimap @@ -85,8 +86,9 @@ public class RenderTypes { .createCompositeState(false) ); - private Types(String name, Runnable setup, Runnable destroy) { - super(name, setup, destroy); + @SuppressWarnings("UnusedMethod") + private Types(String name, VertexFormat format, VertexFormat.Mode mode, int buffer, boolean crumbling, boolean sort, Runnable setup, Runnable teardown) { + super(name, format, mode, buffer, crumbling, sort, setup, teardown); } } } diff --git a/src/main/java/dan200/computercraft/client/render/TileEntityTurtleRenderer.java b/projects/common/src/client/java/dan200/computercraft/client/render/TurtleBlockEntityRenderer.java similarity index 84% rename from src/main/java/dan200/computercraft/client/render/TileEntityTurtleRenderer.java rename to projects/common/src/client/java/dan200/computercraft/client/render/TurtleBlockEntityRenderer.java index 431f1fd6f..7b53058e1 100644 --- a/src/main/java/dan200/computercraft/client/render/TileEntityTurtleRenderer.java +++ b/projects/common/src/client/java/dan200/computercraft/client/render/TurtleBlockEntityRenderer.java @@ -7,16 +7,19 @@ package dan200.computercraft.client.render; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Transformation; import com.mojang.math.Vector3f; import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.api.turtle.TurtleSide; +import dan200.computercraft.client.platform.ClientPlatformHelper; import dan200.computercraft.client.turtle.TurtleUpgradeModellers; import dan200.computercraft.shared.computer.core.ComputerFamily; -import dan200.computercraft.shared.turtle.blocks.TileTurtle; +import dan200.computercraft.shared.turtle.blocks.TurtleBlockEntity; import dan200.computercraft.shared.util.DirectionUtil; import dan200.computercraft.shared.util.Holiday; import dan200.computercraft.shared.util.HolidayUtil; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.block.model.BakedQuad; @@ -33,7 +36,7 @@ import net.minecraft.world.phys.HitResult; import javax.annotation.Nullable; import java.util.List; -public class TileEntityTurtleRenderer implements BlockEntityRenderer { +public class TurtleBlockEntityRenderer implements BlockEntityRenderer { private static final ModelResourceLocation NORMAL_TURTLE_MODEL = new ModelResourceLocation("computercraft:turtle_normal", "inventory"); private static final ModelResourceLocation ADVANCED_TURTLE_MODEL = new ModelResourceLocation("computercraft:turtle_advanced", "inventory"); private static final ResourceLocation COLOUR_TURTLE_MODEL = new ResourceLocation(ComputerCraftAPI.MOD_ID, "block/turtle_colour"); @@ -42,9 +45,11 @@ public class TileEntityTurtleRenderer implements BlockEntityRenderer private final RandomSource random = RandomSource.create(0); private final BlockEntityRenderDispatcher renderer; + private final Font font; - public TileEntityTurtleRenderer(BlockEntityRendererProvider.Context context) { + public TurtleBlockEntityRenderer(BlockEntityRendererProvider.Context context) { renderer = context.getBlockEntityRenderDispatcher(); + font = context.getFont(); } public static ResourceLocation getTurtleModel(ComputerFamily family, boolean coloured) { @@ -61,13 +66,13 @@ public class TileEntityTurtleRenderer implements BlockEntityRenderer } @Override - public void render(TileTurtle turtle, float partialTicks, PoseStack transform, MultiBufferSource buffers, int lightmapCoord, int overlayLight) { + public void render(TurtleBlockEntity turtle, float partialTicks, PoseStack transform, MultiBufferSource buffers, int lightmapCoord, int overlayLight) { // Render the label var label = turtle.getLabel(); var hit = renderer.cameraHitResult; if (label != null && hit.getType() == HitResult.Type.BLOCK && turtle.getBlockPos().equals(((BlockHitResult) hit).getBlockPos())) { var mc = Minecraft.getInstance(); - var font = renderer.font; + var font = this.font; transform.pushPose(); transform.translate(0.5, 1.2, 0.5); @@ -119,7 +124,7 @@ public class TileEntityTurtleRenderer implements BlockEntityRenderer transform.popPose(); } - private void renderUpgrade(PoseStack transform, VertexConsumer renderer, int lightmapCoord, int overlayLight, TileTurtle turtle, TurtleSide side, float f) { + private void renderUpgrade(PoseStack transform, VertexConsumer renderer, int lightmapCoord, int overlayLight, TurtleBlockEntity turtle, TurtleSide side, float f) { var upgrade = turtle.getUpgrade(side); if (upgrade == null) return; transform.pushPose(); @@ -130,7 +135,7 @@ public class TileEntityTurtleRenderer implements BlockEntityRenderer transform.translate(0.0f, -0.5f, -0.5f); var model = TurtleUpgradeModellers.getModel(upgrade, turtle.getAccess(), side); - model.getMatrix().push(transform); + pushPoseFromTransformation(transform, model.getMatrix()); renderModel(transform, renderer, lightmapCoord, overlayLight, model.getModel(), null); transform.popPose(); @@ -139,7 +144,7 @@ public class TileEntityTurtleRenderer implements BlockEntityRenderer private void renderModel(PoseStack transform, VertexConsumer renderer, int lightmapCoord, int overlayLight, ResourceLocation modelLocation, @Nullable int[] tints) { var modelManager = Minecraft.getInstance().getItemRenderer().getItemModelShaper().getModelManager(); - renderModel(transform, renderer, lightmapCoord, overlayLight, modelManager.getModel(modelLocation), tints); + renderModel(transform, renderer, lightmapCoord, overlayLight, ClientPlatformHelper.get().getModel(modelManager, modelLocation), tints); } private void renderModel(PoseStack transform, VertexConsumer renderer, int lightmapCoord, int overlayLight, BakedModel model, @Nullable int[] tints) { @@ -166,4 +171,18 @@ public class TileEntityTurtleRenderer implements BlockEntityRenderer buffer.putBulkData(matrix, bakedquad, r, g, b, lightmapCoord, overlayLight); } } + + private static void pushPoseFromTransformation(PoseStack stack, Transformation transformation) { + stack.pushPose(); + + var trans = transformation.getTranslation(); + stack.translate(trans.x(), trans.y(), trans.z()); + + stack.mulPose(transformation.getLeftRotation()); + + var scale = transformation.getScale(); + stack.scale(scale.x(), scale.y(), scale.z()); + + stack.mulPose(transformation.getRightRotation()); + } } diff --git a/src/main/java/dan200/computercraft/client/render/TileEntityMonitorRenderer.java b/projects/common/src/client/java/dan200/computercraft/client/render/monitor/MonitorBlockEntityRenderer.java similarity index 88% rename from src/main/java/dan200/computercraft/client/render/TileEntityMonitorRenderer.java rename to projects/common/src/client/java/dan200/computercraft/client/render/monitor/MonitorBlockEntityRenderer.java index 10643f609..f5f93aa77 100644 --- a/src/main/java/dan200/computercraft/client/render/TileEntityMonitorRenderer.java +++ b/projects/common/src/client/java/dan200/computercraft/client/render/monitor/MonitorBlockEntityRenderer.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.client.render; +package dan200.computercraft.client.render.monitor; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.MemoryTracker; @@ -17,16 +17,16 @@ import com.mojang.math.Matrix4f; import com.mojang.math.Vector3f; import dan200.computercraft.client.FrameInfo; import dan200.computercraft.client.integration.ShaderMod; -import dan200.computercraft.client.render.monitor.MonitorRenderState; +import dan200.computercraft.client.render.RenderTypes; import dan200.computercraft.client.render.text.DirectFixedWidthFontRenderer; import dan200.computercraft.client.render.text.FixedWidthFontRenderer; -import dan200.computercraft.client.util.DirectBuffers; -import dan200.computercraft.client.util.DirectVertexBuffer; +import dan200.computercraft.client.render.vbo.DirectBuffers; +import dan200.computercraft.client.render.vbo.DirectVertexBuffer; import dan200.computercraft.core.terminal.Terminal; import dan200.computercraft.shared.config.Config; import dan200.computercraft.shared.peripheral.monitor.ClientMonitor; +import dan200.computercraft.shared.peripheral.monitor.MonitorBlockEntity; import dan200.computercraft.shared.peripheral.monitor.MonitorRenderer; -import dan200.computercraft.shared.peripheral.monitor.TileMonitor; import dan200.computercraft.shared.util.DirectionUtil; import net.minecraft.Util; import net.minecraft.client.renderer.MultiBufferSource; @@ -47,24 +47,24 @@ import static dan200.computercraft.client.render.text.FixedWidthFontRenderer.FON import static dan200.computercraft.client.render.text.FixedWidthFontRenderer.FONT_WIDTH; import static dan200.computercraft.core.util.Nullability.assertNonNull; -public class TileEntityMonitorRenderer implements BlockEntityRenderer { - private static final Logger LOG = LoggerFactory.getLogger(TileEntityMonitorRenderer.class); +public class MonitorBlockEntityRenderer implements BlockEntityRenderer { + private static final Logger LOG = LoggerFactory.getLogger(MonitorBlockEntityRenderer.class); /** - * {@link TileMonitor#RENDER_MARGIN}, but a tiny bit of additional padding to ensure that there is no space between + * {@link MonitorBlockEntity#RENDER_MARGIN}, but a tiny bit of additional padding to ensure that there is no space between * the monitor frame and contents. */ - private static final float MARGIN = (float) (TileMonitor.RENDER_MARGIN * 1.1); + private static final float MARGIN = (float) (MonitorBlockEntity.RENDER_MARGIN * 1.1); private static final Matrix3f IDENTITY_NORMAL = Util.make(new Matrix3f(), Matrix3f::setIdentity); private static @Nullable ByteBuffer backingBuffer; - public TileEntityMonitorRenderer(BlockEntityRendererProvider.Context context) { + public MonitorBlockEntityRenderer(BlockEntityRendererProvider.Context context) { } @Override - public void render(TileMonitor monitor, float partialTicks, PoseStack transform, MultiBufferSource bufferSource, int lightmapCoord, int overlayLight) { + public void render(MonitorBlockEntity monitor, float partialTicks, PoseStack transform, MultiBufferSource bufferSource, int lightmapCoord, int overlayLight) { // Render from the origin monitor var originTerminal = monitor.getClientMonitor(); @@ -103,12 +103,12 @@ public class TileEntityMonitorRenderer implements BlockEntityRenderer draw) { - var sink = ShaderMod.get().getQuadEmitter(size, TileEntityMonitorRenderer::getBuffer); + var sink = ShaderMod.get().getQuadEmitter(size, MonitorBlockEntityRenderer::getBuffer); var buffer = sink.buffer(); draw.accept(sink); diff --git a/src/main/java/dan200/computercraft/client/render/MonitorHighlightRenderer.java b/projects/common/src/client/java/dan200/computercraft/client/render/monitor/MonitorHighlightRenderer.java similarity index 95% rename from src/main/java/dan200/computercraft/client/render/MonitorHighlightRenderer.java rename to projects/common/src/client/java/dan200/computercraft/client/render/monitor/MonitorHighlightRenderer.java index 6fabb68f9..8eeae13e2 100644 --- a/src/main/java/dan200/computercraft/client/render/MonitorHighlightRenderer.java +++ b/projects/common/src/client/java/dan200/computercraft/client/render/monitor/MonitorHighlightRenderer.java @@ -3,13 +3,13 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.client.render; +package dan200.computercraft.client.render.monitor; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.math.Matrix3f; import com.mojang.math.Matrix4f; -import dan200.computercraft.shared.peripheral.monitor.TileMonitor; +import dan200.computercraft.shared.peripheral.monitor.MonitorBlockEntity; import net.minecraft.client.Camera; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; @@ -36,7 +36,7 @@ public final class MonitorHighlightRenderer { var pos = hit.getBlockPos(); var tile = world.getBlockEntity(pos); - if (!(tile instanceof TileMonitor monitor)) return false; + if (!(tile instanceof MonitorBlockEntity monitor)) return false; // Determine which sides are part of the external faces of the monitor, and so which need to be rendered. var faces = EnumSet.allOf(Direction.class); diff --git a/src/main/java/dan200/computercraft/client/render/monitor/MonitorRenderState.java b/projects/common/src/client/java/dan200/computercraft/client/render/monitor/MonitorRenderState.java similarity index 97% rename from src/main/java/dan200/computercraft/client/render/monitor/MonitorRenderState.java rename to projects/common/src/client/java/dan200/computercraft/client/render/monitor/MonitorRenderState.java index a71b9c309..66efb4249 100644 --- a/src/main/java/dan200/computercraft/client/render/monitor/MonitorRenderState.java +++ b/projects/common/src/client/java/dan200/computercraft/client/render/monitor/MonitorRenderState.java @@ -7,8 +7,8 @@ package dan200.computercraft.client.render.monitor; import com.google.errorprone.annotations.concurrent.GuardedBy; import com.mojang.blaze3d.platform.GlStateManager; -import dan200.computercraft.client.util.DirectBuffers; -import dan200.computercraft.client.util.DirectVertexBuffer; +import dan200.computercraft.client.render.vbo.DirectBuffers; +import dan200.computercraft.client.render.vbo.DirectVertexBuffer; import dan200.computercraft.shared.peripheral.monitor.ClientMonitor; import dan200.computercraft.shared.peripheral.monitor.MonitorRenderer; import net.minecraft.core.BlockPos; diff --git a/src/main/java/dan200/computercraft/client/render/MonitorTextureBufferShader.java b/projects/common/src/client/java/dan200/computercraft/client/render/monitor/MonitorTextureBufferShader.java similarity index 96% rename from src/main/java/dan200/computercraft/client/render/MonitorTextureBufferShader.java rename to projects/common/src/client/java/dan200/computercraft/client/render/monitor/MonitorTextureBufferShader.java index c8b74c521..a4edec66e 100644 --- a/src/main/java/dan200/computercraft/client/render/MonitorTextureBufferShader.java +++ b/projects/common/src/client/java/dan200/computercraft/client/render/monitor/MonitorTextureBufferShader.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.client.render; +package dan200.computercraft.client.render.monitor; import com.mojang.blaze3d.shaders.Uniform; import com.mojang.blaze3d.vertex.VertexFormat; @@ -13,7 +13,6 @@ import dan200.computercraft.core.terminal.Terminal; import dan200.computercraft.core.terminal.TextBuffer; import dan200.computercraft.core.util.Colour; import net.minecraft.client.renderer.ShaderInstance; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceProvider; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -38,7 +37,7 @@ public class MonitorTextureBufferShader extends ShaderInstance { private final @Nullable Uniform cursorBlink; - public MonitorTextureBufferShader(ResourceProvider provider, ResourceLocation location, VertexFormat format) throws IOException { + public MonitorTextureBufferShader(ResourceProvider provider, String location, VertexFormat format) throws IOException { super(provider, location, format); monitorData = GL31.glGetUniformBlockIndex(getId(), "MonitorData"); if (monitorData == -1) throw new IllegalStateException("Could not find MonitorData uniform."); diff --git a/src/main/java/dan200/computercraft/client/render/text/DirectFixedWidthFontRenderer.java b/projects/common/src/client/java/dan200/computercraft/client/render/text/DirectFixedWidthFontRenderer.java similarity index 100% rename from src/main/java/dan200/computercraft/client/render/text/DirectFixedWidthFontRenderer.java rename to projects/common/src/client/java/dan200/computercraft/client/render/text/DirectFixedWidthFontRenderer.java diff --git a/src/main/java/dan200/computercraft/client/render/text/FixedWidthFontRenderer.java b/projects/common/src/client/java/dan200/computercraft/client/render/text/FixedWidthFontRenderer.java similarity index 100% rename from src/main/java/dan200/computercraft/client/render/text/FixedWidthFontRenderer.java rename to projects/common/src/client/java/dan200/computercraft/client/render/text/FixedWidthFontRenderer.java diff --git a/src/main/java/dan200/computercraft/client/util/DirectBuffers.java b/projects/common/src/client/java/dan200/computercraft/client/render/vbo/DirectBuffers.java similarity index 98% rename from src/main/java/dan200/computercraft/client/util/DirectBuffers.java rename to projects/common/src/client/java/dan200/computercraft/client/render/vbo/DirectBuffers.java index daae88dda..ff4453e72 100644 --- a/src/main/java/dan200/computercraft/client/util/DirectBuffers.java +++ b/projects/common/src/client/java/dan200/computercraft/client/render/vbo/DirectBuffers.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.client.util; +package dan200.computercraft.client.render.vbo; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; diff --git a/src/main/java/dan200/computercraft/client/util/DirectVertexBuffer.java b/projects/common/src/client/java/dan200/computercraft/client/render/vbo/DirectVertexBuffer.java similarity index 98% rename from src/main/java/dan200/computercraft/client/util/DirectVertexBuffer.java rename to projects/common/src/client/java/dan200/computercraft/client/render/vbo/DirectVertexBuffer.java index 25ddfddb0..cdf134cf1 100644 --- a/src/main/java/dan200/computercraft/client/util/DirectVertexBuffer.java +++ b/projects/common/src/client/java/dan200/computercraft/client/render/vbo/DirectVertexBuffer.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.client.util; +package dan200.computercraft.client.render.vbo; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.BufferUploader; diff --git a/src/main/java/dan200/computercraft/client/sound/DfpwmStream.java b/projects/common/src/client/java/dan200/computercraft/client/sound/DfpwmStream.java similarity index 100% rename from src/main/java/dan200/computercraft/client/sound/DfpwmStream.java rename to projects/common/src/client/java/dan200/computercraft/client/sound/DfpwmStream.java diff --git a/src/main/java/dan200/computercraft/client/sound/SpeakerInstance.java b/projects/common/src/client/java/dan200/computercraft/client/sound/SpeakerInstance.java similarity index 100% rename from src/main/java/dan200/computercraft/client/sound/SpeakerInstance.java rename to projects/common/src/client/java/dan200/computercraft/client/sound/SpeakerInstance.java diff --git a/src/main/java/dan200/computercraft/client/sound/SpeakerManager.java b/projects/common/src/client/java/dan200/computercraft/client/sound/SpeakerManager.java similarity index 100% rename from src/main/java/dan200/computercraft/client/sound/SpeakerManager.java rename to projects/common/src/client/java/dan200/computercraft/client/sound/SpeakerManager.java diff --git a/src/main/java/dan200/computercraft/client/sound/SpeakerSound.java b/projects/common/src/client/java/dan200/computercraft/client/sound/SpeakerSound.java similarity index 94% rename from src/main/java/dan200/computercraft/client/sound/SpeakerSound.java rename to projects/common/src/client/java/dan200/computercraft/client/sound/SpeakerSound.java index 78749cece..e0be0aac2 100644 --- a/src/main/java/dan200/computercraft/client/sound/SpeakerSound.java +++ b/projects/common/src/client/java/dan200/computercraft/client/sound/SpeakerSound.java @@ -5,6 +5,7 @@ */ package dan200.computercraft.client.sound; +import dan200.computercraft.annotations.ForgeOverride; import dan200.computercraft.shared.peripheral.speaker.SpeakerPosition; import net.minecraft.client.resources.sounds.AbstractSoundInstance; import net.minecraft.client.resources.sounds.Sound; @@ -61,9 +62,9 @@ public class SpeakerSound extends AbstractSoundInstance implements TickableSound } } - @Override + @ForgeOverride public CompletableFuture getStream(SoundBufferLibrary soundBuffers, Sound sound, boolean looping) { - return stream != null ? CompletableFuture.completedFuture(stream) : super.getStream(soundBuffers, sound, looping); + return stream != null ? CompletableFuture.completedFuture(stream) : soundBuffers.getStream(sound.getPath(), looping); } public @Nullable AudioStream getStream() { diff --git a/src/main/java/dan200/computercraft/client/turtle/TurtleModemModeller.java b/projects/common/src/client/java/dan200/computercraft/client/turtle/TurtleModemModeller.java similarity index 100% rename from src/main/java/dan200/computercraft/client/turtle/TurtleModemModeller.java rename to projects/common/src/client/java/dan200/computercraft/client/turtle/TurtleModemModeller.java diff --git a/src/main/java/dan200/computercraft/client/turtle/TurtleUpgradeModellers.java b/projects/common/src/client/java/dan200/computercraft/client/turtle/TurtleUpgradeModellers.java similarity index 96% rename from src/main/java/dan200/computercraft/client/turtle/TurtleUpgradeModellers.java rename to projects/common/src/client/java/dan200/computercraft/client/turtle/TurtleUpgradeModellers.java index 4cfdb4c6c..db5efd966 100644 --- a/src/main/java/dan200/computercraft/client/turtle/TurtleUpgradeModellers.java +++ b/projects/common/src/client/java/dan200/computercraft/client/turtle/TurtleUpgradeModellers.java @@ -12,8 +12,8 @@ import dan200.computercraft.api.turtle.ITurtleAccess; import dan200.computercraft.api.turtle.ITurtleUpgrade; import dan200.computercraft.api.turtle.TurtleSide; import dan200.computercraft.api.turtle.TurtleUpgradeSerialiser; -import dan200.computercraft.shared.TurtleUpgrades; -import dan200.computercraft.shared.UpgradeManager; +import dan200.computercraft.impl.TurtleUpgrades; +import dan200.computercraft.impl.UpgradeManager; import net.minecraft.client.Minecraft; import javax.annotation.Nullable; diff --git a/projects/common/src/main/java/dan200/computercraft/annotations/ForgeOverride.java b/projects/common/src/main/java/dan200/computercraft/annotations/ForgeOverride.java new file mode 100644 index 000000000..76370f176 --- /dev/null +++ b/projects/common/src/main/java/dan200/computercraft/annotations/ForgeOverride.java @@ -0,0 +1,17 @@ +/* + * This file is part of ComputerCraft - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. + * Send enquiries to dratcliffe@gmail.com + */ +package dan200.computercraft.annotations; + +import java.lang.annotation.*; + +/** + * Equivalent to {@link Override}, but for Forge-specific methods. + */ +@Documented +@Retention(RetentionPolicy.SOURCE) +@Target(ElementType.METHOD) +public @interface ForgeOverride { +} diff --git a/src/main/java/dan200/computercraft/data/BlockModelGenerator.java b/projects/common/src/main/java/dan200/computercraft/data/BlockModelProvider.java similarity index 90% rename from src/main/java/dan200/computercraft/data/BlockModelGenerator.java rename to projects/common/src/main/java/dan200/computercraft/data/BlockModelProvider.java index 67d95dc58..583df2b77 100644 --- a/src/main/java/dan200/computercraft/data/BlockModelGenerator.java +++ b/projects/common/src/main/java/dan200/computercraft/data/BlockModelProvider.java @@ -8,16 +8,16 @@ package dan200.computercraft.data; import com.google.gson.JsonObject; import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.shared.ModRegistry; -import dan200.computercraft.shared.computer.blocks.BlockComputer; -import dan200.computercraft.shared.peripheral.diskdrive.BlockDiskDrive; -import dan200.computercraft.shared.peripheral.modem.wired.BlockCable; -import dan200.computercraft.shared.peripheral.modem.wired.BlockWiredModemFull; +import dan200.computercraft.shared.computer.blocks.ComputerBlock; +import dan200.computercraft.shared.peripheral.diskdrive.DiskDriveBlock; +import dan200.computercraft.shared.peripheral.modem.wired.CableBlock; import dan200.computercraft.shared.peripheral.modem.wired.CableModemVariant; -import dan200.computercraft.shared.peripheral.modem.wireless.BlockWirelessModem; -import dan200.computercraft.shared.peripheral.monitor.BlockMonitor; +import dan200.computercraft.shared.peripheral.modem.wired.WiredModemFullBlock; +import dan200.computercraft.shared.peripheral.modem.wireless.WirelessModemBlock; +import dan200.computercraft.shared.peripheral.monitor.MonitorBlock; import dan200.computercraft.shared.peripheral.monitor.MonitorEdgeState; -import dan200.computercraft.shared.peripheral.printer.BlockPrinter; -import dan200.computercraft.shared.turtle.blocks.BlockTurtle; +import dan200.computercraft.shared.peripheral.printer.PrinterBlock; +import dan200.computercraft.shared.turtle.blocks.TurtleBlock; import dan200.computercraft.shared.util.DirectionUtil; import net.minecraft.core.Direction; import net.minecraft.data.models.BlockModelGenerators; @@ -37,7 +37,7 @@ import java.util.function.Function; import static net.minecraft.data.models.model.ModelLocationUtils.getModelLocation; import static net.minecraft.data.models.model.TextureMapping.getBlockTexture; -class BlockModelGenerator { +class BlockModelProvider { private static final ModelTemplate MONITOR_BASE = new ModelTemplate( Optional.of(new ResourceLocation(ComputerCraftAPI.MOD_ID, "block/monitor_base")), Optional.empty(), @@ -96,7 +96,7 @@ class BlockModelGenerator { var diskDrive = ModRegistry.Blocks.DISK_DRIVE.get(); generators.blockStateOutput.accept(MultiVariantGenerator.multiVariant(diskDrive) .with(createHorizontalFacingDispatch()) - .with(createModelDispatch(BlockDiskDrive.STATE, value -> { + .with(createModelDispatch(DiskDriveBlock.STATE, value -> { var textureSuffix = switch (value) { case EMPTY -> "_front"; case INVALID -> "_front_rejected"; @@ -116,7 +116,7 @@ class BlockModelGenerator { var printer = ModRegistry.Blocks.PRINTER.get(); generators.blockStateOutput.accept(MultiVariantGenerator.multiVariant(printer) .with(createHorizontalFacingDispatch()) - .with(createModelDispatch(BlockPrinter.TOP, BlockPrinter.BOTTOM, (top, bottom) -> { + .with(createModelDispatch(PrinterBlock.TOP, PrinterBlock.BOTTOM, (top, bottom) -> { String model, texture; if (top && bottom) { model = "_both_full"; @@ -140,10 +140,10 @@ class BlockModelGenerator { generators.delegateItemModel(printer, getModelLocation(printer, "_empty")); } - private static void registerComputer(BlockModelGenerators generators, BlockComputer block) { + private static void registerComputer(BlockModelGenerators generators, ComputerBlock block) { generators.blockStateOutput.accept(MultiVariantGenerator.multiVariant(block) .with(createHorizontalFacingDispatch()) - .with(createModelDispatch(BlockComputer.STATE, state -> ModelTemplates.CUBE_ORIENTABLE.createWithSuffix( + .with(createModelDispatch(ComputerBlock.STATE, state -> ModelTemplates.CUBE_ORIENTABLE.createWithSuffix( block, "_" + state.getSerializedName(), TextureMapping.orientableCube(block).put(TextureSlot.FRONT, getBlockTexture(block, "_front" + state.getTexture())), generators.modelOutput @@ -152,7 +152,7 @@ class BlockModelGenerator { generators.delegateItemModel(block, getModelLocation(block, "_blinking")); } - private static void registerTurtle(BlockModelGenerators generators, BlockTurtle block) { + private static void registerTurtle(BlockModelGenerators generators, TurtleBlock block) { var model = TURTLE.create(block, TextureMapping.defaultTexture(block), generators.modelOutput); generators.blockStateOutput.accept( MultiVariantGenerator.multiVariant(block, Variant.variant().with(VariantProperties.MODEL, model)) @@ -167,10 +167,10 @@ class BlockModelGenerator { }); } - private static void registerWirelessModem(BlockModelGenerators generators, BlockWirelessModem block) { + private static void registerWirelessModem(BlockModelGenerators generators, WirelessModemBlock block) { generators.blockStateOutput.accept(MultiVariantGenerator.multiVariant(block) .with(createFacingDispatch()) - .with(createModelDispatch(BlockWirelessModem.ON, + .with(createModelDispatch(WirelessModemBlock.ON, on -> modemModel(generators, getModelLocation(block, on ? "_on" : "_off"), getBlockTexture(block, "_face" + (on ? "_on" : ""))) ))); generators.delegateItemModel(block, getModelLocation(block, "_off")); @@ -179,7 +179,7 @@ class BlockModelGenerator { private static void registerWiredModems(BlockModelGenerators generators) { var fullBlock = ModRegistry.Blocks.WIRED_MODEM_FULL.get(); generators.blockStateOutput.accept(MultiVariantGenerator.multiVariant(fullBlock) - .with(createModelDispatch(BlockWiredModemFull.MODEM_ON, BlockWiredModemFull.PERIPHERAL_ON, (on, peripheral) -> { + .with(createModelDispatch(WiredModemFullBlock.MODEM_ON, WiredModemFullBlock.PERIPHERAL_ON, (on, peripheral) -> { var suffix = (on ? "_on" : "_off") + (peripheral ? "_peripheral" : ""); var faceTexture = new ResourceLocation(ComputerCraftAPI.MOD_ID, "block/wired_modem_face" + (peripheral ? "_peripheral" : "") + (on ? "_on" : "")); @@ -207,7 +207,7 @@ class BlockModelGenerator { ); } - private static void registerMonitor(BlockModelGenerators generators, BlockMonitor block) { + private static void registerMonitor(BlockModelGenerators generators, MonitorBlock block) { monitorModel(generators, block, "", 16, 4, 0, 32); monitorModel(generators, block, "_d", 20, 7, 0, 36); monitorModel(generators, block, "_l", 19, 4, 1, 33); @@ -227,13 +227,13 @@ class BlockModelGenerator { generators.blockStateOutput.accept(MultiVariantGenerator.multiVariant(block) .with(createHorizontalFacingDispatch()) - .with(createVerticalFacingDispatch(BlockMonitor.ORIENTATION)) - .with(createModelDispatch(BlockMonitor.STATE, edge -> getModelLocation(block, edge == MonitorEdgeState.NONE ? "" : "_" + edge.getSerializedName()))) + .with(createVerticalFacingDispatch(MonitorBlock.ORIENTATION)) + .with(createModelDispatch(MonitorBlock.STATE, edge -> getModelLocation(block, edge == MonitorEdgeState.NONE ? "" : "_" + edge.getSerializedName()))) ); generators.delegateItemModel(block, monitorModel(generators, block, "_item", 15, 4, 0, 32)); } - private static ResourceLocation monitorModel(BlockModelGenerators generators, BlockMonitor block, String corners, int front, int side, int top, int back) { + private static ResourceLocation monitorModel(BlockModelGenerators generators, MonitorBlock block, String corners, int front, int side, int top, int back) { return MONITOR_BASE.create( getModelLocation(block, corners), new TextureMapping() @@ -253,8 +253,8 @@ class BlockModelGenerator { // Up/Down generator.with( Condition.or( - cableNoNeighbour(Direction.NORTH, Direction.SOUTH, Direction.EAST, Direction.WEST).term(BlockCable.UP, true), - cableNoNeighbour(Direction.NORTH, Direction.SOUTH, Direction.EAST, Direction.WEST).term(BlockCable.DOWN, true) + cableNoNeighbour(Direction.NORTH, Direction.SOUTH, Direction.EAST, Direction.WEST).term(CableBlock.UP, true), + cableNoNeighbour(Direction.NORTH, Direction.SOUTH, Direction.EAST, Direction.WEST).term(CableBlock.DOWN, true) ), Variant.variant().with(VariantProperties.MODEL, coreFacing).with(VariantProperties.X_ROT, VariantProperties.Rotation.R90) ); @@ -263,8 +263,8 @@ class BlockModelGenerator { generator.with( Condition.or( cableNoNeighbour(Direction.UP, Direction.DOWN, Direction.NORTH, Direction.SOUTH, Direction.EAST, Direction.WEST), - cableNoNeighbour(Direction.UP, Direction.DOWN, Direction.EAST, Direction.WEST).term(BlockCable.NORTH, true), - cableNoNeighbour(Direction.UP, Direction.DOWN, Direction.EAST, Direction.WEST).term(BlockCable.SOUTH, true) + cableNoNeighbour(Direction.UP, Direction.DOWN, Direction.EAST, Direction.WEST).term(CableBlock.NORTH, true), + cableNoNeighbour(Direction.UP, Direction.DOWN, Direction.EAST, Direction.WEST).term(CableBlock.SOUTH, true) ), Variant.variant().with(VariantProperties.MODEL, coreFacing).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R0) ); @@ -272,8 +272,8 @@ class BlockModelGenerator { // East/West generator.with( Condition.or( - cableNoNeighbour(Direction.NORTH, Direction.SOUTH, Direction.UP, Direction.DOWN).term(BlockCable.EAST, true), - cableNoNeighbour(Direction.NORTH, Direction.SOUTH, Direction.UP, Direction.DOWN).term(BlockCable.WEST, true) + cableNoNeighbour(Direction.NORTH, Direction.SOUTH, Direction.UP, Direction.DOWN).term(CableBlock.EAST, true), + cableNoNeighbour(Direction.NORTH, Direction.SOUTH, Direction.UP, Direction.DOWN).term(CableBlock.WEST, true) ), Variant.variant().with(VariantProperties.MODEL, coreFacing).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90) ); @@ -286,7 +286,7 @@ class BlockModelGenerator { if (DirectionUtil.FACINGS[i].getAxis() == DirectionUtil.FACINGS[j].getAxis()) continue; rightAngles.add(new Condition.TerminalCondition() - .term(BlockCable.CABLE, true).term(CABLE_DIRECTIONS[i], true).term(CABLE_DIRECTIONS[j], true) + .term(CableBlock.CABLE, true).term(CABLE_DIRECTIONS[i], true).term(CABLE_DIRECTIONS[j], true) ); } } @@ -310,7 +310,7 @@ class BlockModelGenerator { for (var peripheral : BOOLEANS) { var suffix = (on ? "_on" : "_off") + (peripheral ? "_peripheral" : ""); generator.with( - new Condition.TerminalCondition().term(BlockCable.MODEM, CableModemVariant.from(direction, on, peripheral)), + new Condition.TerminalCondition().term(CableBlock.MODEM, CableModemVariant.from(direction, on, peripheral)), Variant.variant() .with(VariantProperties.MODEL, new ResourceLocation(ComputerCraftAPI.MOD_ID, "block/wired_modem" + suffix)) .with(VariantProperties.X_ROT, toXAngle(direction)) @@ -323,11 +323,11 @@ class BlockModelGenerator { generators.blockStateOutput.accept(generator); } - private static final BooleanProperty[] CABLE_DIRECTIONS = { BlockCable.DOWN, BlockCable.UP, BlockCable.NORTH, BlockCable.SOUTH, BlockCable.WEST, BlockCable.EAST }; + private static final BooleanProperty[] CABLE_DIRECTIONS = { CableBlock.DOWN, CableBlock.UP, CableBlock.NORTH, CableBlock.SOUTH, CableBlock.WEST, CableBlock.EAST }; private static final boolean[] BOOLEANS = new boolean[]{ false, true }; private static Condition.TerminalCondition cableNoNeighbour(Direction... directions) { - var condition = new Condition.TerminalCondition().term(BlockCable.CABLE, true); + var condition = new Condition.TerminalCondition().term(CableBlock.CABLE, true); for (var direction : directions) condition.term(CABLE_DIRECTIONS[direction.ordinal()], false); return condition; } diff --git a/src/main/java/dan200/computercraft/data/DataProviders.java b/projects/common/src/main/java/dan200/computercraft/data/DataProviders.java similarity index 87% rename from src/main/java/dan200/computercraft/data/DataProviders.java rename to projects/common/src/main/java/dan200/computercraft/data/DataProviders.java index 6954ac688..1d5db4c2a 100644 --- a/src/main/java/dan200/computercraft/data/DataProviders.java +++ b/projects/common/src/main/java/dan200/computercraft/data/DataProviders.java @@ -32,22 +32,22 @@ public final class DataProviders { } public static void add(DataGenerator generator, GeneratorFactory generators, boolean includeServer, boolean includeClient) { - var turtleUpgrades = new TurtleUpgradeGenerator(generator); - var pocketUpgrades = new PocketUpgradeGenerator(generator); + var turtleUpgrades = new TurtleUpgradeProvider(generator); + var pocketUpgrades = new PocketUpgradeProvider(generator); generator.addProvider(includeServer, turtleUpgrades); generator.addProvider(includeServer, pocketUpgrades); - generator.addProvider(includeServer, generators.recipes(new RecipeGenerator(turtleUpgrades, pocketUpgrades)::addRecipes)); + generator.addProvider(includeServer, generators.recipes(new RecipeProvider(turtleUpgrades, pocketUpgrades)::addRecipes)); var blockTags = generators.blockTags(TagProvider::blockTags); generator.addProvider(includeServer, blockTags); generator.addProvider(includeServer, generators.itemTags(TagProvider::itemTags, blockTags)); - for (var provider : generators.lootTable(LootTableGenerator.getTables())) { + for (var provider : generators.lootTable(LootTableProvider.getTables())) { generator.addProvider(includeServer, provider); } - generator.addProvider(includeClient, generators.models(BlockModelGenerator::addBlockModels, ItemModelGenerator::addItemModels)); + generator.addProvider(includeClient, generators.models(BlockModelProvider::addBlockModels, ItemModelProvider::addItemModels)); } interface GeneratorFactory { diff --git a/src/main/java/dan200/computercraft/data/ItemModelGenerator.java b/projects/common/src/main/java/dan200/computercraft/data/ItemModelProvider.java similarity index 98% rename from src/main/java/dan200/computercraft/data/ItemModelGenerator.java rename to projects/common/src/main/java/dan200/computercraft/data/ItemModelProvider.java index d8deeaa31..f501d2580 100644 --- a/src/main/java/dan200/computercraft/data/ItemModelGenerator.java +++ b/projects/common/src/main/java/dan200/computercraft/data/ItemModelProvider.java @@ -19,8 +19,8 @@ import java.util.Optional; import static net.minecraft.data.models.model.ModelLocationUtils.getModelLocation; -public final class ItemModelGenerator { - private ItemModelGenerator() { +public final class ItemModelProvider { + private ItemModelProvider() { } public static void addItemModels(ItemModelGenerators generators) { diff --git a/src/main/java/dan200/computercraft/data/LootTableGenerator.java b/projects/common/src/main/java/dan200/computercraft/data/LootTableProvider.java similarity index 93% rename from src/main/java/dan200/computercraft/data/LootTableGenerator.java rename to projects/common/src/main/java/dan200/computercraft/data/LootTableProvider.java index 3c06b0fbf..455910a2f 100644 --- a/src/main/java/dan200/computercraft/data/LootTableGenerator.java +++ b/projects/common/src/main/java/dan200/computercraft/data/LootTableProvider.java @@ -12,7 +12,7 @@ import dan200.computercraft.shared.ModRegistry; import dan200.computercraft.shared.data.BlockNamedEntityLootCondition; import dan200.computercraft.shared.data.HasComputerIdLootCondition; import dan200.computercraft.shared.data.PlayerCreativeLootCondition; -import dan200.computercraft.shared.peripheral.modem.wired.BlockCable; +import dan200.computercraft.shared.peripheral.modem.wired.CableBlock; import dan200.computercraft.shared.peripheral.modem.wired.CableModemVariant; import net.minecraft.advancements.critereon.StatePropertiesPredicate; import net.minecraft.resources.ResourceLocation; @@ -36,11 +36,11 @@ import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Supplier; -class LootTableGenerator { +class LootTableProvider { public static List>>, LootContextParamSet>> getTables() { return List.of( - Pair.of(() -> LootTableGenerator::registerBlocks, LootContextParamSets.BLOCK), - Pair.of(() -> LootTableGenerator::registerGeneric, LootContextParamSets.ALL_PARAMS) + Pair.of(() -> LootTableProvider::registerBlocks, LootContextParamSets.BLOCK), + Pair.of(() -> LootTableProvider::registerGeneric, LootContextParamSets.ALL_PARAMS) ); } @@ -67,7 +67,7 @@ class LootTableGenerator { .add(LootItem.lootTableItem(ModRegistry.Items.CABLE.get())) .when(ExplosionCondition.survivesExplosion()) .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModRegistry.Blocks.CABLE.get()) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(BlockCable.CABLE, true)) + .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(CableBlock.CABLE, true)) ) ) .withPool(LootPool.lootPool() @@ -75,7 +75,7 @@ class LootTableGenerator { .add(LootItem.lootTableItem(ModRegistry.Items.WIRED_MODEM.get())) .when(ExplosionCondition.survivesExplosion()) .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModRegistry.Blocks.CABLE.get()) - .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(BlockCable.MODEM, CableModemVariant.None)) + .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(CableBlock.MODEM, CableModemVariant.None)) .invert() ) )); diff --git a/src/main/java/dan200/computercraft/data/ModelProvider.java b/projects/common/src/main/java/dan200/computercraft/data/ModelProvider.java similarity index 100% rename from src/main/java/dan200/computercraft/data/ModelProvider.java rename to projects/common/src/main/java/dan200/computercraft/data/ModelProvider.java diff --git a/src/main/java/dan200/computercraft/data/PocketUpgradeGenerator.java b/projects/common/src/main/java/dan200/computercraft/data/PocketUpgradeProvider.java similarity index 92% rename from src/main/java/dan200/computercraft/data/PocketUpgradeGenerator.java rename to projects/common/src/main/java/dan200/computercraft/data/PocketUpgradeProvider.java index 980d45b45..37a38439f 100644 --- a/src/main/java/dan200/computercraft/data/PocketUpgradeGenerator.java +++ b/projects/common/src/main/java/dan200/computercraft/data/PocketUpgradeProvider.java @@ -16,8 +16,8 @@ import java.util.function.Consumer; import static dan200.computercraft.shared.ModRegistry.Items; import static dan200.computercraft.shared.ModRegistry.PocketUpgradeSerialisers; -class PocketUpgradeGenerator extends PocketUpgradeDataProvider { - PocketUpgradeGenerator(DataGenerator generator) { +class PocketUpgradeProvider extends PocketUpgradeDataProvider { + PocketUpgradeProvider(DataGenerator generator) { super(generator); } diff --git a/src/main/java/dan200/computercraft/data/PrettyJsonWriter.java b/projects/common/src/main/java/dan200/computercraft/data/PrettyJsonWriter.java similarity index 100% rename from src/main/java/dan200/computercraft/data/PrettyJsonWriter.java rename to projects/common/src/main/java/dan200/computercraft/data/PrettyJsonWriter.java diff --git a/src/main/java/dan200/computercraft/data/RecipeGenerator.java b/projects/common/src/main/java/dan200/computercraft/data/RecipeProvider.java similarity index 99% rename from src/main/java/dan200/computercraft/data/RecipeGenerator.java rename to projects/common/src/main/java/dan200/computercraft/data/RecipeProvider.java index fae79684c..9bfc97c45 100644 --- a/src/main/java/dan200/computercraft/data/RecipeGenerator.java +++ b/projects/common/src/main/java/dan200/computercraft/data/RecipeProvider.java @@ -46,12 +46,12 @@ import java.util.function.Consumer; import static dan200.computercraft.api.ComputerCraftTags.Items.COMPUTER; import static dan200.computercraft.api.ComputerCraftTags.Items.WIRED_MODEM; -class RecipeGenerator { +class RecipeProvider { private final RecipeIngredients ingredients = PlatformHelper.get().getRecipeIngredients(); private final TurtleUpgradeDataProvider turtleUpgrades; private final PocketUpgradeDataProvider pocketUpgrades; - RecipeGenerator(TurtleUpgradeDataProvider turtleUpgrades, PocketUpgradeDataProvider pocketUpgrades) { + RecipeProvider(TurtleUpgradeDataProvider turtleUpgrades, PocketUpgradeDataProvider pocketUpgrades) { this.turtleUpgrades = turtleUpgrades; this.pocketUpgrades = pocketUpgrades; } diff --git a/src/main/java/dan200/computercraft/data/RecipeWrapper.java b/projects/common/src/main/java/dan200/computercraft/data/RecipeWrapper.java similarity index 100% rename from src/main/java/dan200/computercraft/data/RecipeWrapper.java rename to projects/common/src/main/java/dan200/computercraft/data/RecipeWrapper.java diff --git a/src/main/java/dan200/computercraft/data/TagProvider.java b/projects/common/src/main/java/dan200/computercraft/data/TagProvider.java similarity index 100% rename from src/main/java/dan200/computercraft/data/TagProvider.java rename to projects/common/src/main/java/dan200/computercraft/data/TagProvider.java diff --git a/src/main/java/dan200/computercraft/data/TurtleUpgradeGenerator.java b/projects/common/src/main/java/dan200/computercraft/data/TurtleUpgradeProvider.java similarity index 95% rename from src/main/java/dan200/computercraft/data/TurtleUpgradeGenerator.java rename to projects/common/src/main/java/dan200/computercraft/data/TurtleUpgradeProvider.java index fbfdc691d..89054d7b8 100644 --- a/src/main/java/dan200/computercraft/data/TurtleUpgradeGenerator.java +++ b/projects/common/src/main/java/dan200/computercraft/data/TurtleUpgradeProvider.java @@ -17,8 +17,8 @@ import java.util.function.Consumer; import static dan200.computercraft.shared.ModRegistry.Items; import static dan200.computercraft.shared.ModRegistry.TurtleSerialisers; -class TurtleUpgradeGenerator extends TurtleUpgradeDataProvider { - TurtleUpgradeGenerator(DataGenerator generator) { +class TurtleUpgradeProvider extends TurtleUpgradeDataProvider { + TurtleUpgradeProvider(DataGenerator generator) { super(generator); } diff --git a/src/main/java/dan200/computercraft/ComputerCraftAPIImpl.java b/projects/common/src/main/java/dan200/computercraft/impl/AbstractComputerCraftAPI.java similarity index 50% rename from src/main/java/dan200/computercraft/ComputerCraftAPIImpl.java rename to projects/common/src/main/java/dan200/computercraft/impl/AbstractComputerCraftAPI.java index 08f4bf4b2..efef71d23 100644 --- a/src/main/java/dan200/computercraft/ComputerCraftAPIImpl.java +++ b/projects/common/src/main/java/dan200/computercraft/impl/AbstractComputerCraftAPI.java @@ -3,14 +3,11 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft; +package dan200.computercraft.impl; -import com.google.auto.service.AutoService; -import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.api.detail.BlockReference; import dan200.computercraft.api.detail.DetailRegistry; import dan200.computercraft.api.detail.IDetailProvider; -import dan200.computercraft.api.filesystem.IMount; import dan200.computercraft.api.filesystem.IWritableMount; import dan200.computercraft.api.lua.GenericSource; import dan200.computercraft.api.lua.ILuaAPIFactory; @@ -18,54 +15,32 @@ import dan200.computercraft.api.media.IMediaProvider; import dan200.computercraft.api.network.IPacketNetwork; import dan200.computercraft.api.network.wired.IWiredElement; import dan200.computercraft.api.network.wired.IWiredNode; -import dan200.computercraft.api.peripheral.IPeripheralProvider; import dan200.computercraft.api.redstone.IBundledRedstoneProvider; import dan200.computercraft.api.turtle.TurtleRefuelHandler; import dan200.computercraft.core.apis.ApiFactories; import dan200.computercraft.core.asm.GenericMethod; import dan200.computercraft.core.filesystem.FileMount; -import dan200.computercraft.impl.ComputerCraftAPIForgeService; -import dan200.computercraft.impl.ComputerCraftAPIService; -import dan200.computercraft.impl.TurtleRefuelHandlers; import dan200.computercraft.impl.detail.DetailRegistryImpl; -import dan200.computercraft.shared.BundledRedstone; -import dan200.computercraft.shared.MediaProviders; -import dan200.computercraft.shared.Peripherals; -import dan200.computercraft.shared.computer.core.ResourceMount; +import dan200.computercraft.impl.network.wired.WiredNode; import dan200.computercraft.shared.computer.core.ServerContext; -import dan200.computercraft.shared.peripheral.generic.GenericPeripheralProvider; -import dan200.computercraft.shared.peripheral.generic.data.BlockData; -import dan200.computercraft.shared.peripheral.generic.data.FluidData; -import dan200.computercraft.shared.peripheral.generic.data.ItemData; +import dan200.computercraft.shared.details.BlockDetails; +import dan200.computercraft.shared.details.ItemDetails; import dan200.computercraft.shared.peripheral.modem.wireless.WirelessNetwork; -import dan200.computercraft.shared.wired.WiredNode; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fml.ModList; -import net.minecraftforge.server.ServerLifecycleHooks; import javax.annotation.Nullable; import java.io.File; import java.io.IOException; import java.io.InputStream; -import static dan200.computercraft.shared.Capabilities.CAPABILITY_WIRED_ELEMENT; - -@AutoService(ComputerCraftAPIService.class) -public final class ComputerCraftAPIImpl implements ComputerCraftAPIForgeService { - private final DetailRegistry itemStackDetails = new DetailRegistryImpl<>(ItemData::fillBasic); - private final DetailRegistry blockDetails = new DetailRegistryImpl<>(BlockData::fillBasic); - private final DetailRegistry fluidStackDetails = new DetailRegistryImpl<>(FluidData::fillBasic); - - private @Nullable String version; +public abstract class AbstractComputerCraftAPI implements ComputerCraftAPIService { + private final DetailRegistry itemStackDetails = new DetailRegistryImpl<>(ItemDetails::fillBasic); + private final DetailRegistry blockDetails = new DetailRegistryImpl<>(BlockDetails::fillBasic); public static @Nullable InputStream getResourceFile(MinecraftServer server, String domain, String subPath) { var manager = server.getResourceManager(); @@ -79,22 +54,14 @@ public final class ComputerCraftAPIImpl implements ComputerCraftAPIForgeService } @Override - public String getInstalledVersion() { - if (version != null) return version; - return version = ModList.get().getModContainerById(ComputerCraftAPI.MOD_ID) - .map(x -> x.getModInfo().getVersion().toString()) - .orElse("unknown"); - } - - @Override - public int createUniqueNumberedSaveDir(Level world, String parentSubPath) { + public final int createUniqueNumberedSaveDir(Level world, String parentSubPath) { var server = world.getServer(); if (server == null) throw new IllegalArgumentException("Cannot find server from provided level"); return ServerContext.get(server).getNextId(parentSubPath); } @Override - public @Nullable IWritableMount createSaveDirMount(Level world, String subPath, long capacity) { + public final @Nullable IWritableMount createSaveDirMount(Level world, String subPath, long capacity) { var server = world.getServer(); if (server == null) throw new IllegalArgumentException("Cannot find server from provided level"); @@ -106,52 +73,57 @@ public final class ComputerCraftAPIImpl implements ComputerCraftAPIForgeService } @Override - public @Nullable IMount createResourceMount(String domain, String subPath) { - var manager = ServerLifecycleHooks.getCurrentServer().getResourceManager(); - var mount = ResourceMount.get(domain, subPath, manager); - return mount.exists("") ? mount : null; - } - - @Override - public void registerPeripheralProvider(IPeripheralProvider provider) { - Peripherals.register(provider); - } - - @Override - public void registerGenericSource(GenericSource source) { + public final void registerGenericSource(GenericSource source) { GenericMethod.register(source); } @Override - public void registerGenericCapability(Capability capability) { - GenericPeripheralProvider.addCapability(capability); - } - - @Override - public void registerBundledRedstoneProvider(IBundledRedstoneProvider provider) { + public final void registerBundledRedstoneProvider(IBundledRedstoneProvider provider) { BundledRedstone.register(provider); } @Override - public int getBundledRedstoneOutput(Level world, BlockPos pos, Direction side) { + public final int getBundledRedstoneOutput(Level world, BlockPos pos, Direction side) { return BundledRedstone.getDefaultOutput(world, pos, side); } @Override - public void registerMediaProvider(IMediaProvider provider) { + public final void registerMediaProvider(IMediaProvider provider) { MediaProviders.register(provider); } @Override - public IPacketNetwork getWirelessNetwork() { + public final IPacketNetwork getWirelessNetwork() { return WirelessNetwork.getUniversal(); } @Override - public void registerAPIFactory(ILuaAPIFactory factory) { + public final void registerAPIFactory(ILuaAPIFactory factory) { ApiFactories.register(factory); } + + @Override + public final IWiredNode createWiredNodeForElement(IWiredElement element) { + return new WiredNode(element); + } + + + @Override + public void registerRefuelHandler(TurtleRefuelHandler handler) { + TurtleRefuelHandlers.register(handler); + } + + @Override + public final DetailRegistry getItemStackDetailRegistry() { + return itemStackDetails; + } + + @Override + public final DetailRegistry getBlockInWorldDetailRegistry() { + return blockDetails; + } + @Override @Deprecated @SuppressWarnings("unchecked") @@ -160,41 +132,8 @@ public final class ComputerCraftAPIImpl implements ComputerCraftAPIForgeService itemStackDetails.addProvider((IDetailProvider) provider); } else if (type == BlockReference.class) { blockDetails.addProvider((IDetailProvider) provider); - } else if (type == FluidStack.class) { - itemStackDetails.addProvider((IDetailProvider) provider); } else { throw new IllegalArgumentException("Unknown detail provider " + type); } } - - @Override - public IWiredNode createWiredNodeForElement(IWiredElement element) { - return new WiredNode(element); - } - - @Override - public LazyOptional getWiredElementAt(BlockGetter world, BlockPos pos, Direction side) { - var tile = world.getBlockEntity(pos); - return tile == null ? LazyOptional.empty() : tile.getCapability(CAPABILITY_WIRED_ELEMENT, side); - } - - @Override - public void registerRefuelHandler(TurtleRefuelHandler handler) { - TurtleRefuelHandlers.register(handler); - } - - @Override - public DetailRegistry getItemStackDetailRegistry() { - return itemStackDetails; - } - - @Override - public DetailRegistry getBlockInWorldDetailRegistry() { - return blockDetails; - } - - @Override - public DetailRegistry getFluidStackDetailRegistry() { - return fluidStackDetails; - } } diff --git a/src/main/java/dan200/computercraft/shared/BundledRedstone.java b/projects/common/src/main/java/dan200/computercraft/impl/BundledRedstone.java similarity index 98% rename from src/main/java/dan200/computercraft/shared/BundledRedstone.java rename to projects/common/src/main/java/dan200/computercraft/impl/BundledRedstone.java index 7a0c87a2f..d1b6cfb09 100644 --- a/src/main/java/dan200/computercraft/shared/BundledRedstone.java +++ b/projects/common/src/main/java/dan200/computercraft/impl/BundledRedstone.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.shared; +package dan200.computercraft.impl; import dan200.computercraft.api.redstone.IBundledRedstoneProvider; import dan200.computercraft.shared.common.DefaultBundledRedstoneProvider; diff --git a/src/main/java/dan200/computercraft/shared/MediaProviders.java b/projects/common/src/main/java/dan200/computercraft/impl/MediaProviders.java similarity index 97% rename from src/main/java/dan200/computercraft/shared/MediaProviders.java rename to projects/common/src/main/java/dan200/computercraft/impl/MediaProviders.java index 62dc4afe7..aa85cce5e 100644 --- a/src/main/java/dan200/computercraft/shared/MediaProviders.java +++ b/projects/common/src/main/java/dan200/computercraft/impl/MediaProviders.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.shared; +package dan200.computercraft.impl; import dan200.computercraft.api.media.IMedia; import dan200.computercraft.api.media.IMediaProvider; diff --git a/src/main/java/dan200/computercraft/shared/PocketUpgrades.java b/projects/common/src/main/java/dan200/computercraft/impl/PocketUpgrades.java similarity index 96% rename from src/main/java/dan200/computercraft/shared/PocketUpgrades.java rename to projects/common/src/main/java/dan200/computercraft/impl/PocketUpgrades.java index 6b2a82ee9..bb4717069 100644 --- a/src/main/java/dan200/computercraft/shared/PocketUpgrades.java +++ b/projects/common/src/main/java/dan200/computercraft/impl/PocketUpgrades.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.shared; +package dan200.computercraft.impl; import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.api.pocket.IPocketUpgrade; diff --git a/src/main/java/dan200/computercraft/impl/TurtleRefuelHandlers.java b/projects/common/src/main/java/dan200/computercraft/impl/TurtleRefuelHandlers.java similarity index 100% rename from src/main/java/dan200/computercraft/impl/TurtleRefuelHandlers.java rename to projects/common/src/main/java/dan200/computercraft/impl/TurtleRefuelHandlers.java diff --git a/src/main/java/dan200/computercraft/shared/TurtleUpgrades.java b/projects/common/src/main/java/dan200/computercraft/impl/TurtleUpgrades.java similarity index 96% rename from src/main/java/dan200/computercraft/shared/TurtleUpgrades.java rename to projects/common/src/main/java/dan200/computercraft/impl/TurtleUpgrades.java index 0bfb4bcb7..d1a710ab5 100644 --- a/src/main/java/dan200/computercraft/shared/TurtleUpgrades.java +++ b/projects/common/src/main/java/dan200/computercraft/impl/TurtleUpgrades.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.shared; +package dan200.computercraft.impl; import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.api.turtle.ITurtleUpgrade; diff --git a/src/main/java/dan200/computercraft/shared/UpgradeManager.java b/projects/common/src/main/java/dan200/computercraft/impl/UpgradeManager.java similarity index 99% rename from src/main/java/dan200/computercraft/shared/UpgradeManager.java rename to projects/common/src/main/java/dan200/computercraft/impl/UpgradeManager.java index a9aaf3dc0..254d10405 100644 --- a/src/main/java/dan200/computercraft/shared/UpgradeManager.java +++ b/projects/common/src/main/java/dan200/computercraft/impl/UpgradeManager.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.shared; +package dan200.computercraft.impl; import com.google.gson.*; import dan200.computercraft.api.ComputerCraftAPI; diff --git a/src/main/java/dan200/computercraft/impl/detail/DetailRegistryImpl.java b/projects/common/src/main/java/dan200/computercraft/impl/detail/DetailRegistryImpl.java similarity index 100% rename from src/main/java/dan200/computercraft/impl/detail/DetailRegistryImpl.java rename to projects/common/src/main/java/dan200/computercraft/impl/detail/DetailRegistryImpl.java diff --git a/src/main/java/dan200/computercraft/shared/wired/InvariantChecker.java b/projects/common/src/main/java/dan200/computercraft/impl/network/wired/InvariantChecker.java similarity index 96% rename from src/main/java/dan200/computercraft/shared/wired/InvariantChecker.java rename to projects/common/src/main/java/dan200/computercraft/impl/network/wired/InvariantChecker.java index 10f12160c..8662bdbff 100644 --- a/src/main/java/dan200/computercraft/shared/wired/InvariantChecker.java +++ b/projects/common/src/main/java/dan200/computercraft/impl/network/wired/InvariantChecker.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.shared.wired; +package dan200.computercraft.impl.network.wired; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/dan200/computercraft/shared/wired/WiredNetwork.java b/projects/common/src/main/java/dan200/computercraft/impl/network/wired/WiredNetwork.java similarity index 99% rename from src/main/java/dan200/computercraft/shared/wired/WiredNetwork.java rename to projects/common/src/main/java/dan200/computercraft/impl/network/wired/WiredNetwork.java index d56b403fb..111bdb93d 100644 --- a/src/main/java/dan200/computercraft/shared/wired/WiredNetwork.java +++ b/projects/common/src/main/java/dan200/computercraft/impl/network/wired/WiredNetwork.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.shared.wired; +package dan200.computercraft.impl.network.wired; import com.google.common.collect.ImmutableMap; import dan200.computercraft.api.network.Packet; diff --git a/src/main/java/dan200/computercraft/shared/wired/WiredNetworkChange.java b/projects/common/src/main/java/dan200/computercraft/impl/network/wired/WiredNetworkChange.java similarity index 98% rename from src/main/java/dan200/computercraft/shared/wired/WiredNetworkChange.java rename to projects/common/src/main/java/dan200/computercraft/impl/network/wired/WiredNetworkChange.java index b6bddb2dc..5c6e6b02b 100644 --- a/src/main/java/dan200/computercraft/shared/wired/WiredNetworkChange.java +++ b/projects/common/src/main/java/dan200/computercraft/impl/network/wired/WiredNetworkChange.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.shared.wired; +package dan200.computercraft.impl.network.wired; import dan200.computercraft.api.network.wired.IWiredNetworkChange; import dan200.computercraft.api.peripheral.IPeripheral; diff --git a/src/main/java/dan200/computercraft/shared/wired/WiredNode.java b/projects/common/src/main/java/dan200/computercraft/impl/network/wired/WiredNode.java similarity index 98% rename from src/main/java/dan200/computercraft/shared/wired/WiredNode.java rename to projects/common/src/main/java/dan200/computercraft/impl/network/wired/WiredNode.java index f34fc0a09..e1c119ace 100644 --- a/src/main/java/dan200/computercraft/shared/wired/WiredNode.java +++ b/projects/common/src/main/java/dan200/computercraft/impl/network/wired/WiredNode.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.shared.wired; +package dan200.computercraft.impl.network.wired; import dan200.computercraft.api.network.IPacketReceiver; import dan200.computercraft.api.network.Packet; diff --git a/src/main/java/dan200/computercraft/mixin/CacheUpdaterMixin.java b/projects/common/src/main/java/dan200/computercraft/mixin/CacheUpdaterMixin.java similarity index 96% rename from src/main/java/dan200/computercraft/mixin/CacheUpdaterMixin.java rename to projects/common/src/main/java/dan200/computercraft/mixin/CacheUpdaterMixin.java index 1428401ff..be8cbe215 100644 --- a/src/main/java/dan200/computercraft/mixin/CacheUpdaterMixin.java +++ b/projects/common/src/main/java/dan200/computercraft/mixin/CacheUpdaterMixin.java @@ -11,7 +11,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyArg; @Mixin(targets = "net/minecraft/data/HashCache$CacheUpdater") -class CacheUpdaterMixin { +public class CacheUpdaterMixin { @SuppressWarnings("UnusedMethod") @ModifyArg( method = "writeIfNeeded", diff --git a/projects/common/src/main/java/dan200/computercraft/mixin/CreativeModeTabAccessor.java b/projects/common/src/main/java/dan200/computercraft/mixin/CreativeModeTabAccessor.java new file mode 100644 index 000000000..80a075392 --- /dev/null +++ b/projects/common/src/main/java/dan200/computercraft/mixin/CreativeModeTabAccessor.java @@ -0,0 +1,16 @@ +/* + * This file is part of ComputerCraft - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. + * Send enquiries to dratcliffe@gmail.com + */ +package dan200.computercraft.mixin; + +import net.minecraft.world.item.CreativeModeTab; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(CreativeModeTab.class) +public interface CreativeModeTabAccessor { + @Accessor("langId") + String computercraft$langId(); +} diff --git a/projects/common/src/main/java/dan200/computercraft/mixin/ExplosionAccessor.java b/projects/common/src/main/java/dan200/computercraft/mixin/ExplosionAccessor.java new file mode 100644 index 000000000..b67669dc9 --- /dev/null +++ b/projects/common/src/main/java/dan200/computercraft/mixin/ExplosionAccessor.java @@ -0,0 +1,20 @@ +/* + * This file is part of ComputerCraft - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. + * Send enquiries to dratcliffe@gmail.com + */ +package dan200.computercraft.mixin; + +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.Explosion; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +import javax.annotation.Nullable; + +@Mixin(Explosion.class) +public interface ExplosionAccessor { + @Nullable + @Accessor("source") + Entity computercraft$getExploder(); +} diff --git a/src/main/java/dan200/computercraft/package-info.java b/projects/common/src/main/java/dan200/computercraft/package-info.java similarity index 100% rename from src/main/java/dan200/computercraft/package-info.java rename to projects/common/src/main/java/dan200/computercraft/package-info.java diff --git a/src/main/java/dan200/computercraft/shared/CommonHooks.java b/projects/common/src/main/java/dan200/computercraft/shared/CommonHooks.java similarity index 97% rename from src/main/java/dan200/computercraft/shared/CommonHooks.java rename to projects/common/src/main/java/dan200/computercraft/shared/CommonHooks.java index 264626311..978f80039 100644 --- a/src/main/java/dan200/computercraft/shared/CommonHooks.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/CommonHooks.java @@ -7,6 +7,8 @@ package dan200.computercraft.shared; import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.core.apis.http.NetworkUtils; +import dan200.computercraft.impl.PocketUpgrades; +import dan200.computercraft.impl.TurtleUpgrades; import dan200.computercraft.shared.computer.core.ResourceMount; import dan200.computercraft.shared.computer.core.ServerContext; import dan200.computercraft.shared.computer.metrics.ComputerMBean; diff --git a/src/main/java/dan200/computercraft/shared/ModRegistry.java b/projects/common/src/main/java/dan200/computercraft/shared/ModRegistry.java similarity index 62% rename from src/main/java/dan200/computercraft/shared/ModRegistry.java rename to projects/common/src/main/java/dan200/computercraft/shared/ModRegistry.java index 31ecf1075..d5e0fec2a 100644 --- a/src/main/java/dan200/computercraft/shared/ModRegistry.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/ModRegistry.java @@ -17,65 +17,62 @@ import dan200.computercraft.shared.command.arguments.ComputersArgumentType; import dan200.computercraft.shared.command.arguments.RepeatArgumentType; import dan200.computercraft.shared.command.arguments.TrackingFieldArgumentType; import dan200.computercraft.shared.common.ColourableRecipe; -import dan200.computercraft.shared.common.ContainerHeldItem; import dan200.computercraft.shared.common.DefaultBundledRedstoneProvider; -import dan200.computercraft.shared.computer.blocks.BlockComputer; -import dan200.computercraft.shared.computer.blocks.TileCommandComputer; -import dan200.computercraft.shared.computer.blocks.TileComputer; +import dan200.computercraft.shared.common.HeldItemMenu; +import dan200.computercraft.shared.computer.blocks.CommandComputerBlockEntity; +import dan200.computercraft.shared.computer.blocks.ComputerBlock; +import dan200.computercraft.shared.computer.blocks.ComputerBlockEntity; import dan200.computercraft.shared.computer.core.ComputerFamily; import dan200.computercraft.shared.computer.inventory.ComputerMenuWithoutInventory; -import dan200.computercraft.shared.computer.inventory.ContainerComputerBase; -import dan200.computercraft.shared.computer.inventory.ContainerViewComputer; -import dan200.computercraft.shared.computer.items.ItemComputer; +import dan200.computercraft.shared.computer.inventory.ViewComputerMenu; +import dan200.computercraft.shared.computer.items.ComputerItem; import dan200.computercraft.shared.computer.recipe.ComputerUpgradeRecipe; import dan200.computercraft.shared.data.BlockNamedEntityLootCondition; import dan200.computercraft.shared.data.ConstantLootConditionSerializer; import dan200.computercraft.shared.data.HasComputerIdLootCondition; import dan200.computercraft.shared.data.PlayerCreativeLootCondition; -import dan200.computercraft.shared.media.items.ItemDisk; -import dan200.computercraft.shared.media.items.ItemPrintout; +import dan200.computercraft.shared.details.BlockDetails; +import dan200.computercraft.shared.details.ItemDetails; +import dan200.computercraft.shared.media.items.DiskItem; import dan200.computercraft.shared.media.items.ItemTreasureDisk; +import dan200.computercraft.shared.media.items.PrintoutItem; import dan200.computercraft.shared.media.items.RecordMedia; import dan200.computercraft.shared.media.recipes.DiskRecipe; import dan200.computercraft.shared.media.recipes.PrintoutRecipe; import dan200.computercraft.shared.network.container.ComputerContainerData; import dan200.computercraft.shared.network.container.ContainerData; import dan200.computercraft.shared.network.container.HeldItemContainerData; -import dan200.computercraft.shared.peripheral.diskdrive.BlockDiskDrive; -import dan200.computercraft.shared.peripheral.diskdrive.ContainerDiskDrive; -import dan200.computercraft.shared.peripheral.diskdrive.TileDiskDrive; -import dan200.computercraft.shared.peripheral.generic.data.BlockData; -import dan200.computercraft.shared.peripheral.generic.data.ItemData; +import dan200.computercraft.shared.peripheral.diskdrive.DiskDriveBlock; +import dan200.computercraft.shared.peripheral.diskdrive.DiskDriveBlockEntity; +import dan200.computercraft.shared.peripheral.diskdrive.DiskDriveMenu; import dan200.computercraft.shared.peripheral.modem.wired.*; -import dan200.computercraft.shared.peripheral.modem.wireless.BlockWirelessModem; -import dan200.computercraft.shared.peripheral.modem.wireless.TileWirelessModem; -import dan200.computercraft.shared.peripheral.monitor.BlockMonitor; -import dan200.computercraft.shared.peripheral.monitor.TileMonitor; -import dan200.computercraft.shared.peripheral.printer.BlockPrinter; -import dan200.computercraft.shared.peripheral.printer.ContainerPrinter; -import dan200.computercraft.shared.peripheral.printer.TilePrinter; -import dan200.computercraft.shared.peripheral.speaker.BlockSpeaker; -import dan200.computercraft.shared.peripheral.speaker.TileSpeaker; +import dan200.computercraft.shared.peripheral.modem.wireless.WirelessModemBlock; +import dan200.computercraft.shared.peripheral.modem.wireless.WirelessModemBlockEntity; +import dan200.computercraft.shared.peripheral.monitor.MonitorBlock; +import dan200.computercraft.shared.peripheral.monitor.MonitorBlockEntity; +import dan200.computercraft.shared.peripheral.printer.PrinterBlock; +import dan200.computercraft.shared.peripheral.printer.PrinterBlockEntity; +import dan200.computercraft.shared.peripheral.printer.PrinterMenu; +import dan200.computercraft.shared.peripheral.speaker.SpeakerBlock; +import dan200.computercraft.shared.peripheral.speaker.SpeakerBlockEntity; import dan200.computercraft.shared.platform.PlatformHelper; import dan200.computercraft.shared.platform.RegistrationHelper; import dan200.computercraft.shared.platform.RegistryEntry; -import dan200.computercraft.shared.pocket.items.ItemPocketComputer; +import dan200.computercraft.shared.pocket.items.PocketComputerItem; import dan200.computercraft.shared.pocket.peripherals.PocketModem; import dan200.computercraft.shared.pocket.peripherals.PocketSpeaker; import dan200.computercraft.shared.pocket.recipes.PocketComputerUpgradeRecipe; import dan200.computercraft.shared.turtle.FurnaceRefuelHandler; -import dan200.computercraft.shared.turtle.blocks.BlockTurtle; -import dan200.computercraft.shared.turtle.blocks.TileTurtle; -import dan200.computercraft.shared.turtle.inventory.ContainerTurtle; -import dan200.computercraft.shared.turtle.items.ItemTurtle; +import dan200.computercraft.shared.turtle.blocks.TurtleBlock; +import dan200.computercraft.shared.turtle.blocks.TurtleBlockEntity; +import dan200.computercraft.shared.turtle.inventory.TurtleMenu; +import dan200.computercraft.shared.turtle.items.TurtleItem; import dan200.computercraft.shared.turtle.recipes.TurtleRecipe; import dan200.computercraft.shared.turtle.recipes.TurtleUpgradeRecipe; import dan200.computercraft.shared.turtle.upgrades.*; -import dan200.computercraft.shared.util.CreativeTabMain; import dan200.computercraft.shared.util.ImpostorRecipe; import dan200.computercraft.shared.util.ImpostorShapelessRecipe; import net.minecraft.commands.synchronization.ArgumentTypeInfo; -import net.minecraft.commands.synchronization.ArgumentTypeInfos; import net.minecraft.commands.synchronization.SingletonArgumentInfo; import net.minecraft.core.BlockPos; import net.minecraft.core.Registry; @@ -83,7 +80,6 @@ import net.minecraft.core.cauldron.CauldronInteraction; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.inventory.MenuType; import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; import net.minecraft.world.item.RecordItem; import net.minecraft.world.item.crafting.CustomRecipe; @@ -107,8 +103,6 @@ import java.util.function.Function; * The functions in this class should be called from a loader-specific class. */ public final class ModRegistry { - private static final CreativeModeTab mainItemGroup = new CreativeTabMain(); - private ModRegistry() { } @@ -133,38 +127,38 @@ public final class ModRegistry { return BlockBehaviour.Properties.of(Material.STONE).strength(1.5f); } - public static final RegistryEntry> COMPUTER_NORMAL = REGISTRY.register("computer_normal", - () -> new BlockComputer<>(computerProperties(), ComputerFamily.NORMAL, BlockEntities.COMPUTER_NORMAL)); - public static final RegistryEntry> COMPUTER_ADVANCED = REGISTRY.register("computer_advanced", - () -> new BlockComputer<>(computerProperties(), ComputerFamily.ADVANCED, BlockEntities.COMPUTER_ADVANCED)); + public static final RegistryEntry> COMPUTER_NORMAL = REGISTRY.register("computer_normal", + () -> new ComputerBlock<>(computerProperties(), ComputerFamily.NORMAL, BlockEntities.COMPUTER_NORMAL)); + public static final RegistryEntry> COMPUTER_ADVANCED = REGISTRY.register("computer_advanced", + () -> new ComputerBlock<>(computerProperties(), ComputerFamily.ADVANCED, BlockEntities.COMPUTER_ADVANCED)); - public static final RegistryEntry> COMPUTER_COMMAND = REGISTRY.register("computer_command", () -> new BlockComputer<>( + public static final RegistryEntry> COMPUTER_COMMAND = REGISTRY.register("computer_command", () -> new ComputerBlock<>( computerProperties().strength(-1, 6000000.0F), ComputerFamily.COMMAND, BlockEntities.COMPUTER_COMMAND )); - public static final RegistryEntry TURTLE_NORMAL = REGISTRY.register("turtle_normal", - () -> new BlockTurtle(turtleProperties(), ComputerFamily.NORMAL, BlockEntities.TURTLE_NORMAL)); - public static final RegistryEntry TURTLE_ADVANCED = REGISTRY.register("turtle_advanced", - () -> new BlockTurtle(turtleProperties(), ComputerFamily.ADVANCED, BlockEntities.TURTLE_ADVANCED)); + public static final RegistryEntry TURTLE_NORMAL = REGISTRY.register("turtle_normal", + () -> new TurtleBlock(turtleProperties(), ComputerFamily.NORMAL, BlockEntities.TURTLE_NORMAL)); + public static final RegistryEntry TURTLE_ADVANCED = REGISTRY.register("turtle_advanced", + () -> new TurtleBlock(turtleProperties(), ComputerFamily.ADVANCED, BlockEntities.TURTLE_ADVANCED)); - public static final RegistryEntry SPEAKER = REGISTRY.register("speaker", () -> new BlockSpeaker(properties())); - public static final RegistryEntry DISK_DRIVE = REGISTRY.register("disk_drive", () -> new BlockDiskDrive(properties())); - public static final RegistryEntry PRINTER = REGISTRY.register("printer", () -> new BlockPrinter(properties())); + public static final RegistryEntry SPEAKER = REGISTRY.register("speaker", () -> new SpeakerBlock(properties())); + public static final RegistryEntry DISK_DRIVE = REGISTRY.register("disk_drive", () -> new DiskDriveBlock(properties())); + public static final RegistryEntry PRINTER = REGISTRY.register("printer", () -> new PrinterBlock(properties())); - public static final RegistryEntry MONITOR_NORMAL = REGISTRY.register("monitor_normal", - () -> new BlockMonitor(properties(), BlockEntities.MONITOR_NORMAL)); - public static final RegistryEntry MONITOR_ADVANCED = REGISTRY.register("monitor_advanced", - () -> new BlockMonitor(properties(), BlockEntities.MONITOR_ADVANCED)); + public static final RegistryEntry MONITOR_NORMAL = REGISTRY.register("monitor_normal", + () -> new MonitorBlock(properties(), BlockEntities.MONITOR_NORMAL)); + public static final RegistryEntry MONITOR_ADVANCED = REGISTRY.register("monitor_advanced", + () -> new MonitorBlock(properties(), BlockEntities.MONITOR_ADVANCED)); - public static final RegistryEntry WIRELESS_MODEM_NORMAL = REGISTRY.register("wireless_modem_normal", - () -> new BlockWirelessModem(properties(), BlockEntities.WIRELESS_MODEM_NORMAL)); - public static final RegistryEntry WIRELESS_MODEM_ADVANCED = REGISTRY.register("wireless_modem_advanced", - () -> new BlockWirelessModem(properties(), BlockEntities.WIRELESS_MODEM_ADVANCED)); + public static final RegistryEntry WIRELESS_MODEM_NORMAL = REGISTRY.register("wireless_modem_normal", + () -> new WirelessModemBlock(properties(), BlockEntities.WIRELESS_MODEM_NORMAL)); + public static final RegistryEntry WIRELESS_MODEM_ADVANCED = REGISTRY.register("wireless_modem_advanced", + () -> new WirelessModemBlock(properties(), BlockEntities.WIRELESS_MODEM_ADVANCED)); - public static final RegistryEntry WIRED_MODEM_FULL = REGISTRY.register("wired_modem_full", - () -> new BlockWiredModemFull(modemProperties())); - public static final RegistryEntry CABLE = REGISTRY.register("cable", () -> new BlockCable(modemProperties())); + public static final RegistryEntry WIRED_MODEM_FULL = REGISTRY.register("wired_modem_full", + () -> new WiredModemFullBlock(modemProperties())); + public static final RegistryEntry CABLE = REGISTRY.register("cable", () -> new CableBlock(modemProperties())); } public static class BlockEntities { @@ -174,74 +168,74 @@ public final class ModRegistry { return REGISTRY.register(block.id().getPath(), () -> PlatformHelper.get().createBlockEntityType(factory, block.get())); } - public static final RegistryEntry> MONITOR_NORMAL = - ofBlock(Blocks.MONITOR_NORMAL, (p, s) -> new TileMonitor(BlockEntities.MONITOR_NORMAL.get(), p, s, false)); - public static final RegistryEntry> MONITOR_ADVANCED = - ofBlock(Blocks.MONITOR_ADVANCED, (p, s) -> new TileMonitor(BlockEntities.MONITOR_ADVANCED.get(), p, s, true)); + public static final RegistryEntry> MONITOR_NORMAL = + ofBlock(Blocks.MONITOR_NORMAL, (p, s) -> new MonitorBlockEntity(BlockEntities.MONITOR_NORMAL.get(), p, s, false)); + public static final RegistryEntry> MONITOR_ADVANCED = + ofBlock(Blocks.MONITOR_ADVANCED, (p, s) -> new MonitorBlockEntity(BlockEntities.MONITOR_ADVANCED.get(), p, s, true)); - public static final RegistryEntry> COMPUTER_NORMAL = - ofBlock(Blocks.COMPUTER_NORMAL, (p, s) -> new TileComputer(BlockEntities.COMPUTER_NORMAL.get(), p, s, ComputerFamily.NORMAL)); - public static final RegistryEntry> COMPUTER_ADVANCED = - ofBlock(Blocks.COMPUTER_ADVANCED, (p, s) -> new TileComputer(BlockEntities.COMPUTER_ADVANCED.get(), p, s, ComputerFamily.ADVANCED)); - public static final RegistryEntry> COMPUTER_COMMAND = - ofBlock(Blocks.COMPUTER_COMMAND, (p, s) -> new TileCommandComputer(BlockEntities.COMPUTER_COMMAND.get(), p, s)); + public static final RegistryEntry> COMPUTER_NORMAL = + ofBlock(Blocks.COMPUTER_NORMAL, (p, s) -> new ComputerBlockEntity(BlockEntities.COMPUTER_NORMAL.get(), p, s, ComputerFamily.NORMAL)); + public static final RegistryEntry> COMPUTER_ADVANCED = + ofBlock(Blocks.COMPUTER_ADVANCED, (p, s) -> new ComputerBlockEntity(BlockEntities.COMPUTER_ADVANCED.get(), p, s, ComputerFamily.ADVANCED)); + public static final RegistryEntry> COMPUTER_COMMAND = + ofBlock(Blocks.COMPUTER_COMMAND, (p, s) -> new CommandComputerBlockEntity(BlockEntities.COMPUTER_COMMAND.get(), p, s)); - public static final RegistryEntry> TURTLE_NORMAL = - ofBlock(Blocks.TURTLE_NORMAL, (p, s) -> new TileTurtle(BlockEntities.TURTLE_NORMAL.get(), p, s, ComputerFamily.NORMAL)); - public static final RegistryEntry> TURTLE_ADVANCED = - ofBlock(Blocks.TURTLE_ADVANCED, (p, s) -> new TileTurtle(BlockEntities.TURTLE_ADVANCED.get(), p, s, ComputerFamily.ADVANCED)); + public static final RegistryEntry> TURTLE_NORMAL = + ofBlock(Blocks.TURTLE_NORMAL, (p, s) -> new TurtleBlockEntity(BlockEntities.TURTLE_NORMAL.get(), p, s, ComputerFamily.NORMAL)); + public static final RegistryEntry> TURTLE_ADVANCED = + ofBlock(Blocks.TURTLE_ADVANCED, (p, s) -> new TurtleBlockEntity(BlockEntities.TURTLE_ADVANCED.get(), p, s, ComputerFamily.ADVANCED)); - public static final RegistryEntry> SPEAKER = - ofBlock(Blocks.SPEAKER, (p, s) -> new TileSpeaker(BlockEntities.SPEAKER.get(), p, s)); - public static final RegistryEntry> DISK_DRIVE = - ofBlock(Blocks.DISK_DRIVE, (p, s) -> new TileDiskDrive(BlockEntities.DISK_DRIVE.get(), p, s)); - public static final RegistryEntry> PRINTER = - ofBlock(Blocks.PRINTER, (p, s) -> new TilePrinter(BlockEntities.PRINTER.get(), p, s)); - public static final RegistryEntry> WIRED_MODEM_FULL = - ofBlock(Blocks.WIRED_MODEM_FULL, (p, s) -> new TileWiredModemFull(BlockEntities.WIRED_MODEM_FULL.get(), p, s)); - public static final RegistryEntry> CABLE = - ofBlock(Blocks.CABLE, (p, s) -> new TileCable(BlockEntities.CABLE.get(), p, s)); + public static final RegistryEntry> SPEAKER = + ofBlock(Blocks.SPEAKER, (p, s) -> new SpeakerBlockEntity(BlockEntities.SPEAKER.get(), p, s)); + public static final RegistryEntry> DISK_DRIVE = + ofBlock(Blocks.DISK_DRIVE, (p, s) -> new DiskDriveBlockEntity(BlockEntities.DISK_DRIVE.get(), p, s)); + public static final RegistryEntry> PRINTER = + ofBlock(Blocks.PRINTER, (p, s) -> new PrinterBlockEntity(BlockEntities.PRINTER.get(), p, s)); + public static final RegistryEntry> WIRED_MODEM_FULL = + ofBlock(Blocks.WIRED_MODEM_FULL, (p, s) -> new WiredModemFullBlockEntity(BlockEntities.WIRED_MODEM_FULL.get(), p, s)); + public static final RegistryEntry> CABLE = + ofBlock(Blocks.CABLE, (p, s) -> new CableBlockEntity(BlockEntities.CABLE.get(), p, s)); - public static final RegistryEntry> WIRELESS_MODEM_NORMAL = - ofBlock(Blocks.WIRELESS_MODEM_NORMAL, (p, s) -> new TileWirelessModem(BlockEntities.WIRELESS_MODEM_NORMAL.get(), p, s, false)); - public static final RegistryEntry> WIRELESS_MODEM_ADVANCED = - ofBlock(Blocks.WIRELESS_MODEM_ADVANCED, (p, s) -> new TileWirelessModem(BlockEntities.WIRELESS_MODEM_ADVANCED.get(), p, s, true)); + public static final RegistryEntry> WIRELESS_MODEM_NORMAL = + ofBlock(Blocks.WIRELESS_MODEM_NORMAL, (p, s) -> new WirelessModemBlockEntity(BlockEntities.WIRELESS_MODEM_NORMAL.get(), p, s, false)); + public static final RegistryEntry> WIRELESS_MODEM_ADVANCED = + ofBlock(Blocks.WIRELESS_MODEM_ADVANCED, (p, s) -> new WirelessModemBlockEntity(BlockEntities.WIRELESS_MODEM_ADVANCED.get(), p, s, true)); } public static final class Items { static final RegistrationHelper REGISTRY = PlatformHelper.get().createRegistrationHelper(Registry.ITEM_REGISTRY); private static Item.Properties properties() { - return new Item.Properties().tab(mainItemGroup); + return new Item.Properties().tab(PlatformHelper.get().getCreativeTab()); } private static RegistryEntry ofBlock(RegistryEntry parent, BiFunction supplier) { return REGISTRY.register(parent.id().getPath(), () -> supplier.apply(parent.get(), properties())); } - public static final RegistryEntry COMPUTER_NORMAL = ofBlock(Blocks.COMPUTER_NORMAL, ItemComputer::new); - public static final RegistryEntry COMPUTER_ADVANCED = ofBlock(Blocks.COMPUTER_ADVANCED, ItemComputer::new); - public static final RegistryEntry COMPUTER_COMMAND = ofBlock(Blocks.COMPUTER_COMMAND, ItemComputer::new); + public static final RegistryEntry COMPUTER_NORMAL = ofBlock(Blocks.COMPUTER_NORMAL, ComputerItem::new); + public static final RegistryEntry COMPUTER_ADVANCED = ofBlock(Blocks.COMPUTER_ADVANCED, ComputerItem::new); + public static final RegistryEntry COMPUTER_COMMAND = ofBlock(Blocks.COMPUTER_COMMAND, ComputerItem::new); - public static final RegistryEntry POCKET_COMPUTER_NORMAL = REGISTRY.register("pocket_computer_normal", - () -> new ItemPocketComputer(properties().stacksTo(1), ComputerFamily.NORMAL)); - public static final RegistryEntry POCKET_COMPUTER_ADVANCED = REGISTRY.register("pocket_computer_advanced", - () -> new ItemPocketComputer(properties().stacksTo(1), ComputerFamily.ADVANCED)); + public static final RegistryEntry POCKET_COMPUTER_NORMAL = REGISTRY.register("pocket_computer_normal", + () -> new PocketComputerItem(properties().stacksTo(1), ComputerFamily.NORMAL)); + public static final RegistryEntry POCKET_COMPUTER_ADVANCED = REGISTRY.register("pocket_computer_advanced", + () -> new PocketComputerItem(properties().stacksTo(1), ComputerFamily.ADVANCED)); - public static final RegistryEntry TURTLE_NORMAL = ofBlock(Blocks.TURTLE_NORMAL, ItemTurtle::new); - public static final RegistryEntry TURTLE_ADVANCED = ofBlock(Blocks.TURTLE_ADVANCED, ItemTurtle::new); + public static final RegistryEntry TURTLE_NORMAL = ofBlock(Blocks.TURTLE_NORMAL, TurtleItem::new); + public static final RegistryEntry TURTLE_ADVANCED = ofBlock(Blocks.TURTLE_ADVANCED, TurtleItem::new); - public static final RegistryEntry DISK = - REGISTRY.register("disk", () -> new ItemDisk(properties().stacksTo(1))); + public static final RegistryEntry DISK = + REGISTRY.register("disk", () -> new DiskItem(properties().stacksTo(1))); public static final RegistryEntry TREASURE_DISK = REGISTRY.register("treasure_disk", () -> new ItemTreasureDisk(properties().stacksTo(1))); - public static final RegistryEntry PRINTED_PAGE = REGISTRY.register("printed_page", - () -> new ItemPrintout(properties().stacksTo(1), ItemPrintout.Type.PAGE)); - public static final RegistryEntry PRINTED_PAGES = REGISTRY.register("printed_pages", - () -> new ItemPrintout(properties().stacksTo(1), ItemPrintout.Type.PAGES)); - public static final RegistryEntry PRINTED_BOOK = REGISTRY.register("printed_book", - () -> new ItemPrintout(properties().stacksTo(1), ItemPrintout.Type.BOOK)); + public static final RegistryEntry PRINTED_PAGE = REGISTRY.register("printed_page", + () -> new PrintoutItem(properties().stacksTo(1), PrintoutItem.Type.PAGE)); + public static final RegistryEntry PRINTED_PAGES = REGISTRY.register("printed_pages", + () -> new PrintoutItem(properties().stacksTo(1), PrintoutItem.Type.PAGES)); + public static final RegistryEntry PRINTED_BOOK = REGISTRY.register("printed_book", + () -> new PrintoutItem(properties().stacksTo(1), PrintoutItem.Type.BOOK)); public static final RegistryEntry SPEAKER = ofBlock(Blocks.SPEAKER, BlockItem::new); public static final RegistryEntry DISK_DRIVE = ofBlock(Blocks.DISK_DRIVE, BlockItem::new); @@ -252,10 +246,10 @@ public final class ModRegistry { public static final RegistryEntry WIRELESS_MODEM_ADVANCED = ofBlock(Blocks.WIRELESS_MODEM_ADVANCED, BlockItem::new); public static final RegistryEntry WIRED_MODEM_FULL = ofBlock(Blocks.WIRED_MODEM_FULL, BlockItem::new); - public static final RegistryEntry CABLE = REGISTRY.register("cable", - () -> new ItemBlockCable.Cable(Blocks.CABLE.get(), properties())); - public static final RegistryEntry WIRED_MODEM = REGISTRY.register("wired_modem", - () -> new ItemBlockCable.WiredModem(Blocks.CABLE.get(), properties())); + public static final RegistryEntry CABLE = REGISTRY.register("cable", + () -> new CableBlockItem.Cable(Blocks.CABLE.get(), properties())); + public static final RegistryEntry WIRED_MODEM = REGISTRY.register("wired_modem", + () -> new CableBlockItem.WiredModem(Blocks.CABLE.get(), properties())); } public static class TurtleSerialisers { @@ -287,29 +281,29 @@ public final class ModRegistry { public static class Menus { static final RegistrationHelper> REGISTRY = PlatformHelper.get().createRegistrationHelper(Registry.MENU_REGISTRY); - public static final RegistryEntry> COMPUTER = REGISTRY.register("computer", + public static final RegistryEntry> COMPUTER = REGISTRY.register("computer", () -> ContainerData.toType(ComputerContainerData::new, (id, inv, data) -> new ComputerMenuWithoutInventory(Menus.COMPUTER.get(), id, inv, data))); - public static final RegistryEntry> POCKET_COMPUTER = REGISTRY.register("pocket_computer", + public static final RegistryEntry> POCKET_COMPUTER = REGISTRY.register("pocket_computer", () -> ContainerData.toType(ComputerContainerData::new, (id, inv, data) -> new ComputerMenuWithoutInventory(Menus.POCKET_COMPUTER.get(), id, inv, data))); - public static final RegistryEntry> POCKET_COMPUTER_NO_TERM = REGISTRY.register("pocket_computer_no_term", + public static final RegistryEntry> POCKET_COMPUTER_NO_TERM = REGISTRY.register("pocket_computer_no_term", () -> ContainerData.toType(ComputerContainerData::new, (id, inv, data) -> new ComputerMenuWithoutInventory(Menus.POCKET_COMPUTER_NO_TERM.get(), id, inv, data))); - public static final RegistryEntry> TURTLE = REGISTRY.register("turtle", - () -> ContainerData.toType(ComputerContainerData::new, ContainerTurtle::ofMenuData)); + public static final RegistryEntry> TURTLE = REGISTRY.register("turtle", + () -> ContainerData.toType(ComputerContainerData::new, TurtleMenu::ofMenuData)); - public static final RegistryEntry> DISK_DRIVE = REGISTRY.register("disk_drive", - () -> new MenuType<>(ContainerDiskDrive::new)); + public static final RegistryEntry> DISK_DRIVE = REGISTRY.register("disk_drive", + () -> new MenuType<>(DiskDriveMenu::new)); - public static final RegistryEntry> PRINTER = REGISTRY.register("printer", - () -> new MenuType<>(ContainerPrinter::new)); + public static final RegistryEntry> PRINTER = REGISTRY.register("printer", + () -> new MenuType<>(PrinterMenu::new)); - public static final RegistryEntry> PRINTOUT = REGISTRY.register("printout", - () -> ContainerData.toType(HeldItemContainerData::new, ContainerHeldItem::createPrintout)); + public static final RegistryEntry> PRINTOUT = REGISTRY.register("printout", + () -> ContainerData.toType(HeldItemContainerData::new, HeldItemMenu::createPrintout)); - public static final RegistryEntry> VIEW_COMPUTER = REGISTRY.register("view_computer", - () -> ContainerData.toType(ComputerContainerData::new, ContainerViewComputer::new)); + public static final RegistryEntry> VIEW_COMPUTER = REGISTRY.register("view_computer", + () -> ContainerData.toType(ComputerContainerData::new, ViewComputerMenu::new)); } static class ArgumentTypes { @@ -317,11 +311,11 @@ public final class ModRegistry { @SuppressWarnings("unchecked") private static > void registerUnsafe(String name, Class type, ArgumentTypeInfo serializer) { - REGISTRY.register(name, () -> ArgumentTypeInfos.registerByClass(type, (ArgumentTypeInfo) serializer)); + REGISTRY.register(name, () -> PlatformHelper.get().registerArgumentTypeInfo(type, (ArgumentTypeInfo) serializer)); } private static > void register(String name, Class type, ArgumentTypeInfo serializer) { - REGISTRY.register(name, () -> ArgumentTypeInfos.registerByClass(type, serializer)); + REGISTRY.register(name, () -> PlatformHelper.get().registerArgumentTypeInfo(type, serializer)); } private static > void register(String name, Class type, T instance) { @@ -391,15 +385,15 @@ public final class ModRegistry { return null; }); - VanillaDetailRegistries.ITEM_STACK.addProvider(ItemData::fill); - VanillaDetailRegistries.BLOCK_IN_WORLD.addProvider(BlockData::fill); + VanillaDetailRegistries.ITEM_STACK.addProvider(ItemDetails::fill); + VanillaDetailRegistries.BLOCK_IN_WORLD.addProvider(BlockDetails::fill); } /** * Register any objects which must be done on the main thread. */ public static void registerMainThread() { - CauldronInteraction.WATER.put(ModRegistry.Items.TURTLE_NORMAL.get(), ItemTurtle.CAULDRON_INTERACTION); - CauldronInteraction.WATER.put(ModRegistry.Items.TURTLE_ADVANCED.get(), ItemTurtle.CAULDRON_INTERACTION); + CauldronInteraction.WATER.put(ModRegistry.Items.TURTLE_NORMAL.get(), TurtleItem.CAULDRON_INTERACTION); + CauldronInteraction.WATER.put(ModRegistry.Items.TURTLE_ADVANCED.get(), TurtleItem.CAULDRON_INTERACTION); } } diff --git a/src/main/java/dan200/computercraft/shared/command/CommandComputerCraft.java b/projects/common/src/main/java/dan200/computercraft/shared/command/CommandComputerCraft.java similarity index 99% rename from src/main/java/dan200/computercraft/shared/command/CommandComputerCraft.java rename to projects/common/src/main/java/dan200/computercraft/shared/command/CommandComputerCraft.java index 71bb3d91d..537db7b9f 100644 --- a/src/main/java/dan200/computercraft/shared/command/CommandComputerCraft.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/command/CommandComputerCraft.java @@ -14,7 +14,7 @@ import dan200.computercraft.shared.command.text.TableBuilder; import dan200.computercraft.shared.computer.core.ComputerFamily; import dan200.computercraft.shared.computer.core.ServerComputer; import dan200.computercraft.shared.computer.core.ServerContext; -import dan200.computercraft.shared.computer.inventory.ContainerViewComputer; +import dan200.computercraft.shared.computer.inventory.ViewComputerMenu; import dan200.computercraft.shared.computer.metrics.basic.Aggregate; import dan200.computercraft.shared.computer.metrics.basic.AggregatedMetric; import dan200.computercraft.shared.computer.metrics.basic.BasicComputerMetricsObserver; @@ -202,7 +202,7 @@ public final class CommandComputerCraft { @Override public AbstractContainerMenu createMenu(int id, Inventory player, Player entity) { - return new ContainerViewComputer(id, player, computer); + return new ViewComputerMenu(id, player, computer); } }); return 1; diff --git a/src/main/java/dan200/computercraft/shared/command/CommandUtils.java b/projects/common/src/main/java/dan200/computercraft/shared/command/CommandUtils.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/command/CommandUtils.java rename to projects/common/src/main/java/dan200/computercraft/shared/command/CommandUtils.java diff --git a/src/main/java/dan200/computercraft/shared/command/Exceptions.java b/projects/common/src/main/java/dan200/computercraft/shared/command/Exceptions.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/command/Exceptions.java rename to projects/common/src/main/java/dan200/computercraft/shared/command/Exceptions.java diff --git a/src/main/java/dan200/computercraft/shared/command/UserLevel.java b/projects/common/src/main/java/dan200/computercraft/shared/command/UserLevel.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/command/UserLevel.java rename to projects/common/src/main/java/dan200/computercraft/shared/command/UserLevel.java diff --git a/src/main/java/dan200/computercraft/shared/command/arguments/ArgumentUtils.java b/projects/common/src/main/java/dan200/computercraft/shared/command/arguments/ArgumentUtils.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/command/arguments/ArgumentUtils.java rename to projects/common/src/main/java/dan200/computercraft/shared/command/arguments/ArgumentUtils.java diff --git a/src/main/java/dan200/computercraft/shared/command/arguments/ChoiceArgumentType.java b/projects/common/src/main/java/dan200/computercraft/shared/command/arguments/ChoiceArgumentType.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/command/arguments/ChoiceArgumentType.java rename to projects/common/src/main/java/dan200/computercraft/shared/command/arguments/ChoiceArgumentType.java diff --git a/src/main/java/dan200/computercraft/shared/command/arguments/ComputerArgumentType.java b/projects/common/src/main/java/dan200/computercraft/shared/command/arguments/ComputerArgumentType.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/command/arguments/ComputerArgumentType.java rename to projects/common/src/main/java/dan200/computercraft/shared/command/arguments/ComputerArgumentType.java diff --git a/src/main/java/dan200/computercraft/shared/command/arguments/ComputersArgumentType.java b/projects/common/src/main/java/dan200/computercraft/shared/command/arguments/ComputersArgumentType.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/command/arguments/ComputersArgumentType.java rename to projects/common/src/main/java/dan200/computercraft/shared/command/arguments/ComputersArgumentType.java diff --git a/src/main/java/dan200/computercraft/shared/command/arguments/RepeatArgumentType.java b/projects/common/src/main/java/dan200/computercraft/shared/command/arguments/RepeatArgumentType.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/command/arguments/RepeatArgumentType.java rename to projects/common/src/main/java/dan200/computercraft/shared/command/arguments/RepeatArgumentType.java diff --git a/src/main/java/dan200/computercraft/shared/command/arguments/TrackingFieldArgumentType.java b/projects/common/src/main/java/dan200/computercraft/shared/command/arguments/TrackingFieldArgumentType.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/command/arguments/TrackingFieldArgumentType.java rename to projects/common/src/main/java/dan200/computercraft/shared/command/arguments/TrackingFieldArgumentType.java diff --git a/src/main/java/dan200/computercraft/shared/command/builder/ArgCommand.java b/projects/common/src/main/java/dan200/computercraft/shared/command/builder/ArgCommand.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/command/builder/ArgCommand.java rename to projects/common/src/main/java/dan200/computercraft/shared/command/builder/ArgCommand.java diff --git a/src/main/java/dan200/computercraft/shared/command/builder/CommandBuilder.java b/projects/common/src/main/java/dan200/computercraft/shared/command/builder/CommandBuilder.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/command/builder/CommandBuilder.java rename to projects/common/src/main/java/dan200/computercraft/shared/command/builder/CommandBuilder.java diff --git a/src/main/java/dan200/computercraft/shared/command/builder/CommandNodeBuilder.java b/projects/common/src/main/java/dan200/computercraft/shared/command/builder/CommandNodeBuilder.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/command/builder/CommandNodeBuilder.java rename to projects/common/src/main/java/dan200/computercraft/shared/command/builder/CommandNodeBuilder.java diff --git a/src/main/java/dan200/computercraft/shared/command/builder/HelpingArgumentBuilder.java b/projects/common/src/main/java/dan200/computercraft/shared/command/builder/HelpingArgumentBuilder.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/command/builder/HelpingArgumentBuilder.java rename to projects/common/src/main/java/dan200/computercraft/shared/command/builder/HelpingArgumentBuilder.java diff --git a/src/main/java/dan200/computercraft/shared/command/text/ChatHelpers.java b/projects/common/src/main/java/dan200/computercraft/shared/command/text/ChatHelpers.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/command/text/ChatHelpers.java rename to projects/common/src/main/java/dan200/computercraft/shared/command/text/ChatHelpers.java diff --git a/src/main/java/dan200/computercraft/shared/command/text/ServerTableFormatter.java b/projects/common/src/main/java/dan200/computercraft/shared/command/text/ServerTableFormatter.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/command/text/ServerTableFormatter.java rename to projects/common/src/main/java/dan200/computercraft/shared/command/text/ServerTableFormatter.java diff --git a/src/main/java/dan200/computercraft/shared/command/text/TableBuilder.java b/projects/common/src/main/java/dan200/computercraft/shared/command/text/TableBuilder.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/command/text/TableBuilder.java rename to projects/common/src/main/java/dan200/computercraft/shared/command/text/TableBuilder.java diff --git a/src/main/java/dan200/computercraft/shared/command/text/TableFormatter.java b/projects/common/src/main/java/dan200/computercraft/shared/command/text/TableFormatter.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/command/text/TableFormatter.java rename to projects/common/src/main/java/dan200/computercraft/shared/command/text/TableFormatter.java diff --git a/src/main/java/dan200/computercraft/shared/common/ColourableRecipe.java b/projects/common/src/main/java/dan200/computercraft/shared/common/ColourableRecipe.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/common/ColourableRecipe.java rename to projects/common/src/main/java/dan200/computercraft/shared/common/ColourableRecipe.java diff --git a/src/main/java/dan200/computercraft/shared/common/DefaultBundledRedstoneProvider.java b/projects/common/src/main/java/dan200/computercraft/shared/common/DefaultBundledRedstoneProvider.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/common/DefaultBundledRedstoneProvider.java rename to projects/common/src/main/java/dan200/computercraft/shared/common/DefaultBundledRedstoneProvider.java diff --git a/src/main/java/dan200/computercraft/shared/common/BlockGeneric.java b/projects/common/src/main/java/dan200/computercraft/shared/common/GenericBlock.java similarity index 82% rename from src/main/java/dan200/computercraft/shared/common/BlockGeneric.java rename to projects/common/src/main/java/dan200/computercraft/shared/common/GenericBlock.java index 688dc50c2..dc4eddee6 100644 --- a/src/main/java/dan200/computercraft/shared/common/BlockGeneric.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/common/GenericBlock.java @@ -5,6 +5,7 @@ */ package dan200.computercraft.shared.common; +import dan200.computercraft.annotations.ForgeOverride; import dan200.computercraft.shared.platform.RegistryEntry; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; @@ -24,10 +25,10 @@ import net.minecraft.world.phys.BlockHitResult; import javax.annotation.Nullable; -public abstract class BlockGeneric extends BaseEntityBlock { - private final RegistryEntry> type; +public abstract class GenericBlock extends BaseEntityBlock { + private final RegistryEntry> type; - public BlockGeneric(Properties settings, RegistryEntry> type) { + public GenericBlock(Properties settings, RegistryEntry> type) { super(settings); this.type = type; } @@ -40,34 +41,34 @@ public abstract class BlockGeneric extends BaseEntityBlock { var tile = world.getBlockEntity(pos); super.onRemove(block, world, pos, replace, bool); world.removeBlockEntity(pos); - if (tile instanceof TileGeneric generic) generic.destroy(); + if (tile instanceof GenericTile generic) generic.destroy(); } @Override @Deprecated public final InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { var tile = world.getBlockEntity(pos); - return tile instanceof TileGeneric generic ? generic.onActivate(player, hand, hit) : InteractionResult.PASS; + return tile instanceof GenericTile generic ? generic.onActivate(player, hand, hit) : InteractionResult.PASS; } @Override @Deprecated public final void neighborChanged(BlockState state, Level world, BlockPos pos, Block neighbourBlock, BlockPos neighbourPos, boolean isMoving) { var tile = world.getBlockEntity(pos); - if (tile instanceof TileGeneric generic) generic.onNeighbourChange(neighbourPos); + if (tile instanceof GenericTile generic) generic.onNeighbourChange(neighbourPos); } - @Override + @ForgeOverride public final void onNeighborChange(BlockState state, LevelReader world, BlockPos pos, BlockPos neighbour) { var tile = world.getBlockEntity(pos); - if (tile instanceof TileGeneric generic) generic.onNeighbourTileEntityChange(neighbour); + if (tile instanceof GenericTile generic) generic.onNeighbourTileEntityChange(neighbour); } @Override @Deprecated public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource rand) { var te = world.getBlockEntity(pos); - if (te instanceof TileGeneric generic) generic.blockTick(); + if (te instanceof GenericTile generic) generic.blockTick(); } @Nullable diff --git a/src/main/java/dan200/computercraft/shared/common/TileGeneric.java b/projects/common/src/main/java/dan200/computercraft/shared/common/GenericTile.java similarity index 89% rename from src/main/java/dan200/computercraft/shared/common/TileGeneric.java rename to projects/common/src/main/java/dan200/computercraft/shared/common/GenericTile.java index 9b84e5fec..37b00b0a8 100644 --- a/src/main/java/dan200/computercraft/shared/common/TileGeneric.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/common/GenericTile.java @@ -5,6 +5,7 @@ */ package dan200.computercraft.shared.common; +import dan200.computercraft.annotations.ForgeOverride; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.Connection; @@ -18,8 +19,8 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; -public abstract class TileGeneric extends BlockEntity { - public TileGeneric(BlockEntityType type, BlockPos pos, BlockState state) { +public abstract class GenericTile extends BlockEntity { + public GenericTile(BlockEntityType type, BlockPos pos, BlockState state) { super(type, pos, state); } @@ -59,13 +60,13 @@ public abstract class TileGeneric extends BlockEntity { player.distanceToSqr(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5) <= range * range; } - @Override + @ForgeOverride // FIXME: Implement this: I'd forgotten about this public final void onDataPacket(Connection net, ClientboundBlockEntityDataPacket packet) { var tag = packet.getTag(); if (tag != null) handleUpdateTag(tag); } - @Override + @ForgeOverride public void handleUpdateTag(CompoundTag tag) { } } diff --git a/src/main/java/dan200/computercraft/shared/common/ContainerHeldItem.java b/projects/common/src/main/java/dan200/computercraft/shared/common/HeldItemMenu.java similarity index 75% rename from src/main/java/dan200/computercraft/shared/common/ContainerHeldItem.java rename to projects/common/src/main/java/dan200/computercraft/shared/common/HeldItemMenu.java index 4b31fe1c2..4a6fafedb 100644 --- a/src/main/java/dan200/computercraft/shared/common/ContainerHeldItem.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/common/HeldItemMenu.java @@ -18,19 +18,19 @@ import net.minecraft.world.item.ItemStack; import javax.annotation.Nullable; -public class ContainerHeldItem extends AbstractContainerMenu { +public class HeldItemMenu extends AbstractContainerMenu { private final ItemStack stack; private final InteractionHand hand; - public ContainerHeldItem(MenuType type, int id, Player player, InteractionHand hand) { + public HeldItemMenu(MenuType type, int id, Player player, InteractionHand hand) { super(type, id); this.hand = hand; stack = player.getItemInHand(hand).copy(); } - public static ContainerHeldItem createPrintout(int id, Inventory inventory, HeldItemContainerData data) { - return new ContainerHeldItem(ModRegistry.Menus.PRINTOUT.get(), id, inventory.player, data.getHand()); + public static HeldItemMenu createPrintout(int id, Inventory inventory, HeldItemContainerData data) { + return new HeldItemMenu(ModRegistry.Menus.PRINTOUT.get(), id, inventory.player, data.getHand()); } public ItemStack getStack() { @@ -51,11 +51,11 @@ public class ContainerHeldItem extends AbstractContainerMenu { } public static class Factory implements MenuProvider { - private final MenuType type; + private final MenuType type; private final Component name; private final InteractionHand hand; - public Factory(MenuType type, ItemStack stack, InteractionHand hand) { + public Factory(MenuType type, ItemStack stack, InteractionHand hand) { this.type = type; name = stack.getHoverName(); this.hand = hand; @@ -69,7 +69,7 @@ public class ContainerHeldItem extends AbstractContainerMenu { @Nullable @Override public AbstractContainerMenu createMenu(int id, Inventory inventory, Player player) { - return new ContainerHeldItem(type, id, player, hand); + return new HeldItemMenu(type, id, player, hand); } } } diff --git a/src/main/java/dan200/computercraft/shared/common/IBundledRedstoneBlock.java b/projects/common/src/main/java/dan200/computercraft/shared/common/IBundledRedstoneBlock.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/common/IBundledRedstoneBlock.java rename to projects/common/src/main/java/dan200/computercraft/shared/common/IBundledRedstoneBlock.java diff --git a/src/main/java/dan200/computercraft/shared/common/IColouredItem.java b/projects/common/src/main/java/dan200/computercraft/shared/common/IColouredItem.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/common/IColouredItem.java rename to projects/common/src/main/java/dan200/computercraft/shared/common/IColouredItem.java diff --git a/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java similarity index 98% rename from src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java index f142d24d8..e05f5feb6 100644 --- a/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java @@ -11,7 +11,7 @@ import dan200.computercraft.api.detail.BlockReference; import dan200.computercraft.api.detail.VanillaDetailRegistries; import dan200.computercraft.api.lua.*; import dan200.computercraft.core.Logging; -import dan200.computercraft.shared.computer.blocks.TileCommandComputer; +import dan200.computercraft.shared.computer.blocks.CommandComputerBlockEntity; import dan200.computercraft.shared.util.NBTUtil; import net.minecraft.commands.CommandSourceStack; import net.minecraft.core.BlockPos; @@ -32,9 +32,9 @@ import java.util.*; public class CommandAPI implements ILuaAPI { private static final Logger LOG = LoggerFactory.getLogger(CommandAPI.class); - private final TileCommandComputer computer; + private final CommandComputerBlockEntity computer; - public CommandAPI(TileCommandComputer computer) { + public CommandAPI(CommandComputerBlockEntity computer) { this.computer = computer; } diff --git a/src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputerBase.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/AbstractComputerBlock.java similarity index 86% rename from src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputerBase.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/AbstractComputerBlock.java index 08bfd0275..10fa50cda 100644 --- a/src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputerBase.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/AbstractComputerBlock.java @@ -6,7 +6,7 @@ package dan200.computercraft.shared.computer.blocks; import dan200.computercraft.api.ComputerCraftAPI; -import dan200.computercraft.shared.common.BlockGeneric; +import dan200.computercraft.shared.common.GenericBlock; import dan200.computercraft.shared.common.IBundledRedstoneBlock; import dan200.computercraft.shared.computer.core.ComputerFamily; import dan200.computercraft.shared.computer.items.IComputerItem; @@ -32,14 +32,14 @@ import net.minecraft.world.phys.Vec3; import javax.annotation.Nullable; -public abstract class BlockComputerBase extends BlockGeneric implements IBundledRedstoneBlock { +public abstract class AbstractComputerBlock extends GenericBlock implements IBundledRedstoneBlock { private static final ResourceLocation DROP = new ResourceLocation(ComputerCraftAPI.MOD_ID, "computer"); private final ComputerFamily family; protected final RegistryEntry> type; private final BlockEntityTicker serverTicker = (level, pos, state, computer) -> computer.serverTick(); - protected BlockComputerBase(Properties settings, ComputerFamily family, RegistryEntry> type) { + protected AbstractComputerBlock(Properties settings, ComputerFamily family, RegistryEntry> type) { super(settings, type); this.family = family; this.type = type; @@ -51,7 +51,7 @@ public abstract class BlockComputerBase extends Bloc super.onPlace(state, world, pos, oldState, isMoving); var tile = world.getBlockEntity(pos); - if (tile instanceof TileComputerBase computer) computer.updateInputsImmediately(); + if (tile instanceof AbstractComputerBlockEntity computer) computer.updateInputsImmediately(); } @Override @@ -64,7 +64,7 @@ public abstract class BlockComputerBase extends Bloc @Deprecated public int getDirectSignal(BlockState state, BlockGetter world, BlockPos pos, Direction incomingSide) { var entity = world.getBlockEntity(pos); - if (!(entity instanceof TileComputerBase computerEntity)) return 0; + if (!(entity instanceof AbstractComputerBlockEntity computerEntity)) return 0; var computer = computerEntity.getServerComputer(); if (computer == null) return 0; @@ -73,7 +73,7 @@ public abstract class BlockComputerBase extends Bloc return computer.getRedstoneOutput(localSide); } - protected abstract ItemStack getItem(TileComputerBase tile); + protected abstract ItemStack getItem(AbstractComputerBlockEntity tile); public ComputerFamily getFamily() { return family; @@ -93,7 +93,7 @@ public abstract class BlockComputerBase extends Bloc @Override public int getBundledRedstoneOutput(Level world, BlockPos pos, Direction side) { var entity = world.getBlockEntity(pos); - if (!(entity instanceof TileComputerBase computerEntity)) return 0; + if (!(entity instanceof AbstractComputerBlockEntity computerEntity)) return 0; var computer = computerEntity.getServerComputer(); if (computer == null) return 0; @@ -106,7 +106,7 @@ public abstract class BlockComputerBase extends Bloc @Deprecated public ItemStack getCloneItemStack(BlockGetter world, BlockPos pos, BlockState state) { var tile = world.getBlockEntity(pos); - if (tile instanceof TileComputerBase computer) { + if (tile instanceof AbstractComputerBlockEntity computer) { var result = getItem(computer); if (!result.isEmpty()) return result; } @@ -129,7 +129,7 @@ public abstract class BlockComputerBase extends Bloc // drop computers for creative players too. var tile = world.getBlockEntity(pos); - if (tile instanceof TileComputerBase computer) { + if (tile instanceof AbstractComputerBlockEntity computer) { var context = new LootContext.Builder(serverWorld) .withRandom(world.random) .withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(pos)) @@ -150,7 +150,7 @@ public abstract class BlockComputerBase extends Bloc super.setPlacedBy(world, pos, state, placer, stack); var tile = world.getBlockEntity(pos); - if (!world.isClientSide && tile instanceof IComputerTile computer && stack.getItem() instanceof IComputerItem item) { + if (!world.isClientSide && tile instanceof IComputerBlockEntity computer && stack.getItem() instanceof IComputerItem item) { var id = item.getComputerID(stack); if (id != -1) computer.setComputerID(id); diff --git a/src/main/java/dan200/computercraft/shared/computer/blocks/TileComputerBase.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/AbstractComputerBlockEntity.java similarity index 95% rename from src/main/java/dan200/computercraft/shared/computer/blocks/TileComputerBase.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/AbstractComputerBlockEntity.java index 848cbed10..03b1b6448 100644 --- a/src/main/java/dan200/computercraft/shared/computer/blocks/TileComputerBase.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/AbstractComputerBlockEntity.java @@ -9,8 +9,8 @@ import com.google.common.base.Strings; import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.core.computer.ComputerSide; -import dan200.computercraft.shared.BundledRedstone; -import dan200.computercraft.shared.common.TileGeneric; +import dan200.computercraft.impl.BundledRedstone; +import dan200.computercraft.shared.common.GenericTile; import dan200.computercraft.shared.computer.core.ComputerFamily; import dan200.computercraft.shared.computer.core.ComputerState; import dan200.computercraft.shared.computer.core.ServerComputer; @@ -39,7 +39,7 @@ import net.minecraft.world.phys.BlockHitResult; import javax.annotation.Nullable; import java.util.Objects; -public abstract class TileComputerBase extends TileGeneric implements IComputerTile, Nameable, MenuProvider { +public abstract class AbstractComputerBlockEntity extends GenericTile implements IComputerBlockEntity, Nameable, MenuProvider { private static final String NBT_ID = "ComputerId"; private static final String NBT_LABEL = "Label"; private static final String NBT_ON = "On"; @@ -58,7 +58,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT private final ComputerFamily family; - public TileComputerBase(BlockEntityType type, BlockPos pos, BlockState state, ComputerFamily family) { + public AbstractComputerBlockEntity(BlockEntityType type, BlockPos pos, BlockState state, ComputerFamily family) { super(type, pos, state); this.family = family; } @@ -79,11 +79,6 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT } } - @Override - public void onChunkUnloaded() { - unload(); - } - @Override public void setRemoved() { unload(); @@ -115,8 +110,8 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT var computer = createServerComputer(); computer.turnOn(); - var stack = getBlockState().getBlock() instanceof BlockComputerBase - ? ((BlockComputerBase) getBlockState().getBlock()).getItem(this) + var stack = getBlockState().getBlock() instanceof AbstractComputerBlock + ? ((AbstractComputerBlock) getBlockState().getBlock()).getItem(this) : ItemStack.EMPTY; new ComputerContainerData(computer, stack).open(player, this); } @@ -364,7 +359,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT computerID = nbt.contains(NBT_ID) ? nbt.getInt(NBT_ID) : -1; } - protected void transferStateFrom(TileComputerBase copy) { + protected void transferStateFrom(AbstractComputerBlockEntity copy) { if (copy.computerID != computerID || copy.instanceID != instanceID) { unload(); instanceID = copy.instanceID; diff --git a/src/main/java/dan200/computercraft/shared/computer/blocks/TileCommandComputer.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/CommandComputerBlockEntity.java similarity index 94% rename from src/main/java/dan200/computercraft/shared/computer/blocks/TileCommandComputer.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/CommandComputerBlockEntity.java index 68d9aea36..74ec4e517 100644 --- a/src/main/java/dan200/computercraft/shared/computer/blocks/TileCommandComputer.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/CommandComputerBlockEntity.java @@ -24,7 +24,7 @@ import net.minecraft.world.phys.Vec3; import java.util.HashMap; import java.util.Map; -public class TileCommandComputer extends TileComputer { +public class CommandComputerBlockEntity extends ComputerBlockEntity { public class CommandReceiver implements CommandSource { private final Map output = new HashMap<>(); @@ -63,7 +63,7 @@ public class TileCommandComputer extends TileComputer { private final CommandReceiver receiver; - public TileCommandComputer(BlockEntityType type, BlockPos pos, BlockState state) { + public CommandComputerBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { super(type, pos, state, ComputerFamily.COMMAND); receiver = new CommandReceiver(); } diff --git a/src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputer.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/ComputerBlock.java similarity index 87% rename from src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputer.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/ComputerBlock.java index 4887bc7c6..9e263e27f 100644 --- a/src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputer.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/ComputerBlock.java @@ -24,11 +24,11 @@ import net.minecraft.world.level.block.state.properties.EnumProperty; import javax.annotation.Nullable; -public class BlockComputer extends BlockComputerBase { +public class ComputerBlock extends AbstractComputerBlock { public static final EnumProperty STATE = EnumProperty.create("state", ComputerState.class); public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; - public BlockComputer(Properties settings, ComputerFamily family, RegistryEntry> type) { + public ComputerBlock(Properties settings, ComputerFamily family, RegistryEntry> type) { super(settings, family, type); registerDefaultState(defaultBlockState() .setValue(FACING, Direction.NORTH) @@ -60,7 +60,7 @@ public class BlockComputer extends BlockComputerBase } @Override - protected ItemStack getItem(TileComputerBase tile) { - return tile instanceof TileComputer ? ComputerItemFactory.create((TileComputer) tile) : ItemStack.EMPTY; + protected ItemStack getItem(AbstractComputerBlockEntity tile) { + return tile instanceof ComputerBlockEntity ? ComputerItemFactory.create((ComputerBlockEntity) tile) : ItemStack.EMPTY; } } diff --git a/src/main/java/dan200/computercraft/shared/computer/blocks/TileComputer.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/ComputerBlockEntity.java similarity index 88% rename from src/main/java/dan200/computercraft/shared/computer/blocks/TileComputer.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/ComputerBlockEntity.java index 3599fdb07..29643a05e 100644 --- a/src/main/java/dan200/computercraft/shared/computer/blocks/TileComputer.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/ComputerBlockEntity.java @@ -24,10 +24,10 @@ import net.minecraft.world.level.block.state.BlockState; import javax.annotation.Nullable; -public class TileComputer extends TileComputerBase { +public class ComputerBlockEntity extends AbstractComputerBlockEntity { private @Nullable IPeripheral peripheral; - public TileComputer(BlockEntityType type, BlockPos pos, BlockState state, ComputerFamily family) { + public ComputerBlockEntity(BlockEntityType type, BlockPos pos, BlockState state, ComputerFamily family) { super(type, pos, state, family); } @@ -47,14 +47,14 @@ public class TileComputer extends TileComputerBase { @Override public Direction getDirection() { - return getBlockState().getValue(BlockComputer.FACING); + return getBlockState().getValue(ComputerBlock.FACING); } @Override protected void updateBlockState(ComputerState newState) { var existing = getBlockState(); - if (existing.getValue(BlockComputer.STATE) != newState) { - getLevel().setBlock(getBlockPos(), existing.setValue(BlockComputer.STATE, newState), 3); + if (existing.getValue(ComputerBlock.STATE) != newState) { + getLevel().setBlock(getBlockPos(), existing.setValue(ComputerBlock.STATE, newState), 3); } } diff --git a/src/main/java/dan200/computercraft/shared/computer/blocks/ComputerPeripheral.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/ComputerPeripheral.java similarity index 95% rename from src/main/java/dan200/computercraft/shared/computer/blocks/ComputerPeripheral.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/ComputerPeripheral.java index 790a19499..c109dae85 100644 --- a/src/main/java/dan200/computercraft/shared/computer/blocks/ComputerPeripheral.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/ComputerPeripheral.java @@ -21,9 +21,9 @@ import javax.annotation.Nullable; */ public class ComputerPeripheral implements IPeripheral { private final String type; - private final TileComputerBase owner; + private final AbstractComputerBlockEntity owner; - public ComputerPeripheral(String type, TileComputerBase owner) { + public ComputerPeripheral(String type, AbstractComputerBlockEntity owner) { this.type = type; this.owner = owner; } diff --git a/src/main/java/dan200/computercraft/shared/computer/blocks/IComputerTile.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/IComputerBlockEntity.java similarity index 92% rename from src/main/java/dan200/computercraft/shared/computer/blocks/IComputerTile.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/IComputerBlockEntity.java index c41130ea0..d50949874 100644 --- a/src/main/java/dan200/computercraft/shared/computer/blocks/IComputerTile.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/computer/blocks/IComputerBlockEntity.java @@ -9,7 +9,7 @@ import dan200.computercraft.shared.computer.core.ComputerFamily; import javax.annotation.Nullable; -public interface IComputerTile { +public interface IComputerBlockEntity { int getComputerID(); void setComputerID(int id); diff --git a/src/main/java/dan200/computercraft/shared/computer/core/ComputerFamily.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/core/ComputerFamily.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/core/ComputerFamily.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/core/ComputerFamily.java diff --git a/src/main/java/dan200/computercraft/shared/computer/core/ComputerState.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/core/ComputerState.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/core/ComputerState.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/core/ComputerState.java diff --git a/src/main/java/dan200/computercraft/shared/computer/core/InputHandler.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/core/InputHandler.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/core/InputHandler.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/core/InputHandler.java diff --git a/src/main/java/dan200/computercraft/shared/computer/core/ResourceMount.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/core/ResourceMount.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/core/ResourceMount.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/core/ResourceMount.java diff --git a/src/main/java/dan200/computercraft/shared/computer/core/ServerComputer.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/core/ServerComputer.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/core/ServerComputer.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/core/ServerComputer.java diff --git a/src/main/java/dan200/computercraft/shared/computer/core/ServerComputerRegistry.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/core/ServerComputerRegistry.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/core/ServerComputerRegistry.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/core/ServerComputerRegistry.java diff --git a/src/main/java/dan200/computercraft/shared/computer/core/ServerContext.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/core/ServerContext.java similarity index 98% rename from src/main/java/dan200/computercraft/shared/computer/core/ServerContext.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/core/ServerContext.java index a71e22826..efea49910 100644 --- a/src/main/java/dan200/computercraft/shared/computer/core/ServerContext.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/computer/core/ServerContext.java @@ -6,7 +6,6 @@ package dan200.computercraft.shared.computer.core; import com.google.common.annotations.VisibleForTesting; -import dan200.computercraft.ComputerCraftAPIImpl; import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.api.filesystem.IMount; import dan200.computercraft.core.ComputerContext; @@ -15,6 +14,7 @@ import dan200.computercraft.core.computer.GlobalEnvironment; import dan200.computercraft.core.computer.mainthread.MainThread; import dan200.computercraft.core.lua.CobaltLuaMachine; import dan200.computercraft.core.lua.ILuaMachine; +import dan200.computercraft.impl.AbstractComputerCraftAPI; import dan200.computercraft.shared.CommonHooks; import dan200.computercraft.shared.computer.metrics.GlobalMetrics; import dan200.computercraft.shared.config.Config; @@ -189,7 +189,7 @@ public final class ServerContext { @Override public @Nullable InputStream createResourceFile(String domain, String subPath) { - return ComputerCraftAPIImpl.getResourceFile(server, domain, subPath); + return AbstractComputerCraftAPI.getResourceFile(server, domain, subPath); } @Override diff --git a/src/main/java/dan200/computercraft/shared/computer/inventory/ContainerComputerBase.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/inventory/AbstractComputerMenu.java similarity index 91% rename from src/main/java/dan200/computercraft/shared/computer/inventory/ContainerComputerBase.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/inventory/AbstractComputerMenu.java index 39b3ff8bb..8814d10b0 100644 --- a/src/main/java/dan200/computercraft/shared/computer/inventory/ContainerComputerBase.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/computer/inventory/AbstractComputerMenu.java @@ -25,20 +25,22 @@ import net.minecraft.world.item.ItemStack; import javax.annotation.Nullable; import java.util.function.Predicate; -public abstract class ContainerComputerBase extends AbstractContainerMenu implements ComputerMenu { +public abstract class AbstractComputerMenu extends AbstractContainerMenu implements ComputerMenu { + public static final int SIDEBAR_WIDTH = 17; + private final Predicate canUse; private final ComputerFamily family; private final ContainerData data; private final @Nullable ServerComputer computer; - private final @Nullable ServerInputState input; + private final @Nullable ServerInputState input; private final @Nullable NetworkedTerminal terminal; private final ItemStack displayStack; - public ContainerComputerBase( - MenuType type, int id, Predicate canUse, + public AbstractComputerMenu( + MenuType type, int id, Predicate canUse, ComputerFamily family, @Nullable ServerComputer computer, @Nullable ComputerContainerData containerData ) { super(type, id); diff --git a/src/main/java/dan200/computercraft/shared/computer/inventory/ComputerMenuWithoutInventory.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/inventory/ComputerMenuWithoutInventory.java similarity index 81% rename from src/main/java/dan200/computercraft/shared/computer/inventory/ComputerMenuWithoutInventory.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/inventory/ComputerMenuWithoutInventory.java index 8ec401979..0ece91d3d 100644 --- a/src/main/java/dan200/computercraft/shared/computer/inventory/ComputerMenuWithoutInventory.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/computer/inventory/ComputerMenuWithoutInventory.java @@ -21,16 +21,16 @@ import java.util.function.Predicate; *

* This adds invisible versions of the player's hotbars slots, to ensure they're synced to the client when changed. */ -public class ComputerMenuWithoutInventory extends ContainerComputerBase { +public class ComputerMenuWithoutInventory extends AbstractComputerMenu { public ComputerMenuWithoutInventory( - MenuType type, int id, Inventory player, Predicate canUse, + MenuType type, int id, Inventory player, Predicate canUse, ServerComputer computer, ComputerFamily family ) { super(type, id, canUse, family, computer, null); addSlots(player); } - public ComputerMenuWithoutInventory(MenuType type, int id, Inventory player, ComputerContainerData menuData) { + public ComputerMenuWithoutInventory(MenuType type, int id, Inventory player, ComputerContainerData menuData) { super(type, id, p -> true, menuData.family(), null, menuData); addSlots(player); } diff --git a/src/main/java/dan200/computercraft/shared/computer/inventory/ContainerViewComputer.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/inventory/ViewComputerMenu.java similarity index 75% rename from src/main/java/dan200/computercraft/shared/computer/inventory/ContainerViewComputer.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/inventory/ViewComputerMenu.java index 85a1c200b..c9ab054a5 100644 --- a/src/main/java/dan200/computercraft/shared/computer/inventory/ContainerViewComputer.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/computer/inventory/ViewComputerMenu.java @@ -6,7 +6,7 @@ package dan200.computercraft.shared.computer.inventory; import dan200.computercraft.shared.ModRegistry; -import dan200.computercraft.shared.computer.blocks.TileCommandComputer; +import dan200.computercraft.shared.computer.blocks.CommandComputerBlockEntity; import dan200.computercraft.shared.computer.core.ComputerFamily; import dan200.computercraft.shared.computer.core.ServerComputer; import dan200.computercraft.shared.computer.core.ServerContext; @@ -15,12 +15,12 @@ import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; -public class ContainerViewComputer extends ComputerMenuWithoutInventory { - public ContainerViewComputer(int id, Inventory player, ServerComputer computer) { +public class ViewComputerMenu extends ComputerMenuWithoutInventory { + public ViewComputerMenu(int id, Inventory player, ServerComputer computer) { super(ModRegistry.Menus.VIEW_COMPUTER.get(), id, player, p -> canInteractWith(computer, p), computer, computer.getFamily()); } - public ContainerViewComputer(int id, Inventory player, ComputerContainerData data) { + public ViewComputerMenu(int id, Inventory player, ComputerContainerData data) { super(ModRegistry.Menus.VIEW_COMPUTER.get(), id, player, data); } @@ -31,7 +31,7 @@ public class ContainerViewComputer extends ComputerMenuWithoutInventory { } // If we're a command computer then ensure we're in creative - if (computer.getFamily() == ComputerFamily.COMMAND && !TileCommandComputer.isCommandUsable(player)) { + if (computer.getFamily() == ComputerFamily.COMMAND && !CommandComputerBlockEntity.isCommandUsable(player)) { return false; } diff --git a/src/main/java/dan200/computercraft/shared/computer/items/ItemComputerBase.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/items/AbstractComputerItem.java similarity index 89% rename from src/main/java/dan200/computercraft/shared/computer/items/ItemComputerBase.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/items/AbstractComputerItem.java index 94884ba89..6583a2644 100644 --- a/src/main/java/dan200/computercraft/shared/computer/items/ItemComputerBase.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/computer/items/AbstractComputerItem.java @@ -8,7 +8,7 @@ package dan200.computercraft.shared.computer.items; import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.api.filesystem.IMount; import dan200.computercraft.api.media.IMedia; -import dan200.computercraft.shared.computer.blocks.BlockComputerBase; +import dan200.computercraft.shared.computer.blocks.AbstractComputerBlock; import dan200.computercraft.shared.computer.core.ComputerFamily; import dan200.computercraft.shared.config.Config; import net.minecraft.ChatFormatting; @@ -21,10 +21,10 @@ import net.minecraft.world.level.Level; import javax.annotation.Nullable; import java.util.List; -public abstract class ItemComputerBase extends BlockItem implements IComputerItem, IMedia { +public abstract class AbstractComputerItem extends BlockItem implements IComputerItem, IMedia { private final ComputerFamily family; - public ItemComputerBase(BlockComputerBase block, Properties settings) { + public AbstractComputerItem(AbstractComputerBlock block, Properties settings) { super(block, settings); family = block.getFamily(); } diff --git a/src/main/java/dan200/computercraft/shared/computer/items/ItemComputer.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/items/ComputerItem.java similarity index 85% rename from src/main/java/dan200/computercraft/shared/computer/items/ItemComputer.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/items/ComputerItem.java index 15599ba13..e2ea2f527 100644 --- a/src/main/java/dan200/computercraft/shared/computer/items/ItemComputer.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/computer/items/ComputerItem.java @@ -5,15 +5,15 @@ */ package dan200.computercraft.shared.computer.items; -import dan200.computercraft.shared.computer.blocks.BlockComputer; +import dan200.computercraft.shared.computer.blocks.ComputerBlock; import dan200.computercraft.shared.computer.core.ComputerFamily; import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; import javax.annotation.Nullable; -public class ItemComputer extends ItemComputerBase { - public ItemComputer(BlockComputer block, Properties settings) { +public class ComputerItem extends AbstractComputerItem { + public ComputerItem(ComputerBlock block, Properties settings) { super(block, settings); } diff --git a/src/main/java/dan200/computercraft/shared/computer/items/ComputerItemFactory.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/items/ComputerItemFactory.java similarity index 88% rename from src/main/java/dan200/computercraft/shared/computer/items/ComputerItemFactory.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/items/ComputerItemFactory.java index a1285291e..6455f9844 100644 --- a/src/main/java/dan200/computercraft/shared/computer/items/ComputerItemFactory.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/computer/items/ComputerItemFactory.java @@ -6,7 +6,7 @@ package dan200.computercraft.shared.computer.items; import dan200.computercraft.shared.ModRegistry; -import dan200.computercraft.shared.computer.blocks.TileComputer; +import dan200.computercraft.shared.computer.blocks.ComputerBlockEntity; import dan200.computercraft.shared.computer.core.ComputerFamily; import net.minecraft.world.item.ItemStack; @@ -16,7 +16,7 @@ public final class ComputerItemFactory { private ComputerItemFactory() { } - public static ItemStack create(TileComputer tile) { + public static ItemStack create(ComputerBlockEntity tile) { return create(tile.getComputerID(), tile.getLabel(), tile.getFamily()); } diff --git a/src/main/java/dan200/computercraft/shared/computer/items/IComputerItem.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/items/IComputerItem.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/items/IComputerItem.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/items/IComputerItem.java diff --git a/src/main/java/dan200/computercraft/shared/computer/menu/ComputerMenu.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/menu/ComputerMenu.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/menu/ComputerMenu.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/menu/ComputerMenu.java diff --git a/src/main/java/dan200/computercraft/shared/computer/menu/ServerInputHandler.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/menu/ServerInputHandler.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/menu/ServerInputHandler.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/menu/ServerInputHandler.java diff --git a/src/main/java/dan200/computercraft/shared/computer/menu/ServerInputState.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/menu/ServerInputState.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/menu/ServerInputState.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/menu/ServerInputState.java diff --git a/src/main/java/dan200/computercraft/shared/computer/metrics/ComputerMBean.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/metrics/ComputerMBean.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/metrics/ComputerMBean.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/metrics/ComputerMBean.java diff --git a/src/main/java/dan200/computercraft/shared/computer/metrics/ComputerMetricsObserver.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/metrics/ComputerMetricsObserver.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/metrics/ComputerMetricsObserver.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/metrics/ComputerMetricsObserver.java diff --git a/src/main/java/dan200/computercraft/shared/computer/metrics/GlobalMetrics.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/metrics/GlobalMetrics.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/metrics/GlobalMetrics.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/metrics/GlobalMetrics.java diff --git a/src/main/java/dan200/computercraft/shared/computer/metrics/basic/Aggregate.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/metrics/basic/Aggregate.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/metrics/basic/Aggregate.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/metrics/basic/Aggregate.java diff --git a/src/main/java/dan200/computercraft/shared/computer/metrics/basic/AggregatedMetric.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/metrics/basic/AggregatedMetric.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/metrics/basic/AggregatedMetric.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/metrics/basic/AggregatedMetric.java diff --git a/src/main/java/dan200/computercraft/shared/computer/metrics/basic/BasicComputerMetricsObserver.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/metrics/basic/BasicComputerMetricsObserver.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/metrics/basic/BasicComputerMetricsObserver.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/metrics/basic/BasicComputerMetricsObserver.java diff --git a/src/main/java/dan200/computercraft/shared/computer/metrics/basic/ComputerMetrics.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/metrics/basic/ComputerMetrics.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/metrics/basic/ComputerMetrics.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/metrics/basic/ComputerMetrics.java diff --git a/src/main/java/dan200/computercraft/shared/computer/recipe/ComputerConvertRecipe.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/recipe/ComputerConvertRecipe.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/recipe/ComputerConvertRecipe.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/recipe/ComputerConvertRecipe.java diff --git a/src/main/java/dan200/computercraft/shared/computer/recipe/ComputerFamilyRecipe.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/recipe/ComputerFamilyRecipe.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/recipe/ComputerFamilyRecipe.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/recipe/ComputerFamilyRecipe.java diff --git a/src/main/java/dan200/computercraft/shared/computer/recipe/ComputerUpgradeRecipe.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/recipe/ComputerUpgradeRecipe.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/recipe/ComputerUpgradeRecipe.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/recipe/ComputerUpgradeRecipe.java diff --git a/src/main/java/dan200/computercraft/shared/computer/terminal/NetworkedTerminal.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/terminal/NetworkedTerminal.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/terminal/NetworkedTerminal.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/terminal/NetworkedTerminal.java diff --git a/src/main/java/dan200/computercraft/shared/computer/terminal/TerminalState.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/terminal/TerminalState.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/terminal/TerminalState.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/terminal/TerminalState.java diff --git a/src/main/java/dan200/computercraft/shared/computer/upload/FileSlice.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/upload/FileSlice.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/upload/FileSlice.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/upload/FileSlice.java diff --git a/src/main/java/dan200/computercraft/shared/computer/upload/FileUpload.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/upload/FileUpload.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/upload/FileUpload.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/upload/FileUpload.java diff --git a/src/main/java/dan200/computercraft/shared/computer/upload/TransferredFile.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/upload/TransferredFile.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/upload/TransferredFile.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/upload/TransferredFile.java diff --git a/src/main/java/dan200/computercraft/shared/computer/upload/TransferredFiles.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/upload/TransferredFiles.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/upload/TransferredFiles.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/upload/TransferredFiles.java diff --git a/src/main/java/dan200/computercraft/shared/computer/upload/UploadResult.java b/projects/common/src/main/java/dan200/computercraft/shared/computer/upload/UploadResult.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/computer/upload/UploadResult.java rename to projects/common/src/main/java/dan200/computercraft/shared/computer/upload/UploadResult.java diff --git a/src/main/java/dan200/computercraft/shared/config/AddressRuleConfig.java b/projects/common/src/main/java/dan200/computercraft/shared/config/AddressRuleConfig.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/config/AddressRuleConfig.java rename to projects/common/src/main/java/dan200/computercraft/shared/config/AddressRuleConfig.java diff --git a/src/main/java/dan200/computercraft/shared/config/Config.java b/projects/common/src/main/java/dan200/computercraft/shared/config/Config.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/config/Config.java rename to projects/common/src/main/java/dan200/computercraft/shared/config/Config.java diff --git a/src/main/java/dan200/computercraft/shared/config/ConfigSpec.java b/projects/common/src/main/java/dan200/computercraft/shared/config/ConfigSpec.java similarity index 98% rename from src/main/java/dan200/computercraft/shared/config/ConfigSpec.java rename to projects/common/src/main/java/dan200/computercraft/shared/config/ConfigSpec.java index a9a1c9863..ceb68a8c7 100644 --- a/src/main/java/dan200/computercraft/shared/config/ConfigSpec.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/config/ConfigSpec.java @@ -14,7 +14,6 @@ import dan200.computercraft.core.apis.http.options.Action; import dan200.computercraft.shared.peripheral.monitor.MonitorRenderer; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.ForgeConfigSpec.ConfigValue; -import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.config.ModConfig; import org.apache.logging.log4j.core.Filter; import org.apache.logging.log4j.core.LoggerContext; @@ -78,8 +77,8 @@ public final class ConfigSpec { private static final ConfigValue monitorDistance; private static final ConfigValue uploadNagDelay; - private static final ForgeConfigSpec serverSpec; - private static final ForgeConfigSpec clientSpec; + public static final ForgeConfigSpec serverSpec; + public static final ForgeConfigSpec clientSpec; private static MarkerFilter logFilter = MarkerFilter.createFilter(Logging.COMPUTER_ERROR.getName(), Filter.Result.ACCEPT, Filter.Result.NEUTRAL); @@ -337,11 +336,6 @@ public final class ConfigSpec { clientSpec = clientBuilder.build(); } - public static void setup() { - ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, serverSpec); - ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, clientSpec); - } - private static void syncServer() { // General Config.computerSpaceLimit = computerSpaceLimit.get(); diff --git a/src/main/java/dan200/computercraft/shared/data/BlockNamedEntityLootCondition.java b/projects/common/src/main/java/dan200/computercraft/shared/data/BlockNamedEntityLootCondition.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/data/BlockNamedEntityLootCondition.java rename to projects/common/src/main/java/dan200/computercraft/shared/data/BlockNamedEntityLootCondition.java diff --git a/src/main/java/dan200/computercraft/shared/data/ConstantLootConditionSerializer.java b/projects/common/src/main/java/dan200/computercraft/shared/data/ConstantLootConditionSerializer.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/data/ConstantLootConditionSerializer.java rename to projects/common/src/main/java/dan200/computercraft/shared/data/ConstantLootConditionSerializer.java diff --git a/src/main/java/dan200/computercraft/shared/data/HasComputerIdLootCondition.java b/projects/common/src/main/java/dan200/computercraft/shared/data/HasComputerIdLootCondition.java similarity index 89% rename from src/main/java/dan200/computercraft/shared/data/HasComputerIdLootCondition.java rename to projects/common/src/main/java/dan200/computercraft/shared/data/HasComputerIdLootCondition.java index 458610058..dbfcbf5ab 100644 --- a/src/main/java/dan200/computercraft/shared/data/HasComputerIdLootCondition.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/data/HasComputerIdLootCondition.java @@ -6,7 +6,7 @@ package dan200.computercraft.shared.data; import dan200.computercraft.shared.ModRegistry; -import dan200.computercraft.shared.computer.blocks.IComputerTile; +import dan200.computercraft.shared.computer.blocks.IComputerBlockEntity; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.parameters.LootContextParam; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; @@ -29,7 +29,7 @@ public final class HasComputerIdLootCondition implements LootItemCondition { @Override public boolean test(LootContext lootContext) { var tile = lootContext.getParamOrNull(LootContextParams.BLOCK_ENTITY); - return tile instanceof IComputerTile computer && computer.getComputerID() >= 0; + return tile instanceof IComputerBlockEntity computer && computer.getComputerID() >= 0; } @Override diff --git a/src/main/java/dan200/computercraft/shared/data/PlayerCreativeLootCondition.java b/projects/common/src/main/java/dan200/computercraft/shared/data/PlayerCreativeLootCondition.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/data/PlayerCreativeLootCondition.java rename to projects/common/src/main/java/dan200/computercraft/shared/data/PlayerCreativeLootCondition.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/generic/data/BlockData.java b/projects/common/src/main/java/dan200/computercraft/shared/details/BlockDetails.java similarity index 84% rename from src/main/java/dan200/computercraft/shared/peripheral/generic/data/BlockData.java rename to projects/common/src/main/java/dan200/computercraft/shared/details/BlockDetails.java index 8a2351ffd..5fba598ad 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/generic/data/BlockData.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/details/BlockDetails.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.shared.peripheral.generic.data; +package dan200.computercraft.shared.details; import dan200.computercraft.api.detail.BlockReference; import dan200.computercraft.shared.platform.Registries; @@ -12,11 +12,11 @@ import net.minecraft.world.level.block.state.properties.Property; import java.util.HashMap; import java.util.Map; -public class BlockData { +public class BlockDetails { public static void fillBasic(Map data, BlockReference block) { var state = block.state(); - data.put("name", DataHelpers.getId(Registries.BLOCKS, state.getBlock())); + data.put("name", DetailHelpers.getId(Registries.BLOCKS, state.getBlock())); Map stateTable = new HashMap<>(); for (Map.Entry, ? extends Comparable> entry : state.getValues().entrySet()) { @@ -27,7 +27,7 @@ public class BlockData { } public static void fill(Map data, BlockReference block) { - data.put("tags", DataHelpers.getTags(block.state().getTags())); + data.put("tags", DetailHelpers.getTags(block.state().getTags())); } @SuppressWarnings({ "unchecked", "rawtypes" }) diff --git a/src/main/java/dan200/computercraft/shared/peripheral/generic/data/DataHelpers.java b/projects/common/src/main/java/dan200/computercraft/shared/details/DetailHelpers.java similarity index 87% rename from src/main/java/dan200/computercraft/shared/peripheral/generic/data/DataHelpers.java rename to projects/common/src/main/java/dan200/computercraft/shared/details/DetailHelpers.java index bbf5ea0f4..7ee1c5686 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/generic/data/DataHelpers.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/details/DetailHelpers.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.shared.peripheral.generic.data; +package dan200.computercraft.shared.details; import dan200.computercraft.shared.platform.Registries; import net.minecraft.core.Holder; @@ -13,8 +13,8 @@ import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; -public final class DataHelpers { - private DataHelpers() { +public final class DetailHelpers { + private DetailHelpers() { } public static Map getTags(Holder.Reference object) { diff --git a/src/main/java/dan200/computercraft/shared/peripheral/generic/data/ItemData.java b/projects/common/src/main/java/dan200/computercraft/shared/details/ItemDetails.java similarity index 91% rename from src/main/java/dan200/computercraft/shared/peripheral/generic/data/ItemData.java rename to projects/common/src/main/java/dan200/computercraft/shared/details/ItemDetails.java index 0a5985e2c..4b28f2f75 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/generic/data/ItemData.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/details/ItemDetails.java @@ -3,9 +3,10 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.shared.peripheral.generic.data; +package dan200.computercraft.shared.details; import com.google.gson.JsonParseException; +import dan200.computercraft.mixin.CreativeModeTabAccessor; import dan200.computercraft.shared.platform.PlatformHelper; import dan200.computercraft.shared.platform.Registries; import dan200.computercraft.shared.util.NBTUtil; @@ -22,9 +23,9 @@ import java.util.*; /** * Data providers for items. */ -public class ItemData { +public class ItemDetails { public static > T fillBasicSafe(T data, ItemStack stack) { - data.put("name", DataHelpers.getId(Registries.ITEMS, stack.getItem())); + data.put("name", DetailHelpers.getId(Registries.ITEMS, stack.getItem())); data.put("count", stack.getCount()); return data; } @@ -48,7 +49,7 @@ public class ItemData { data.put("durability", stack.getItem().getBarWidth(stack) / 13.0); } - data.put("tags", DataHelpers.getTags(stack.getTags())); + data.put("tags", DetailHelpers.getTags(stack.getTags())); data.put("itemGroups", getItemGroups(stack)); var tag = stack.getTag(); @@ -57,7 +58,7 @@ public class ItemData { if (displayTag.contains("Lore", Tag.TAG_LIST)) { var loreTag = displayTag.getList("Lore", Tag.TAG_STRING); data.put("lore", loreTag.stream() - .map(ItemData::parseTextComponent) + .map(ItemDetails::parseTextComponent) .filter(Objects::nonNull) .map(Component::getString) .toList()); @@ -101,7 +102,7 @@ public class ItemData { if (group == null) continue; Map groupData = new HashMap<>(2); - groupData.put("id", group.langId); + groupData.put("id", ((CreativeModeTabAccessor) group).computercraft$langId()); groupData.put("displayName", group.getDisplayName().getString()); groups.add(groupData); } @@ -151,7 +152,7 @@ public class ItemData { var enchantment = entry.getKey(); var level = entry.getValue(); var enchant = new HashMap(3); - enchant.put("name", DataHelpers.getId(Registries.ENCHANTMENTS, enchantment)); + enchant.put("name", DetailHelpers.getId(Registries.ENCHANTMENTS, enchantment)); enchant.put("level", level); enchant.put("displayName", enchantment.getFullname(level).getString()); enchants.add(enchant); diff --git a/src/main/java/dan200/computercraft/shared/integration/RecipeModHelpers.java b/projects/common/src/main/java/dan200/computercraft/shared/integration/RecipeModHelpers.java similarity index 95% rename from src/main/java/dan200/computercraft/shared/integration/RecipeModHelpers.java rename to projects/common/src/main/java/dan200/computercraft/shared/integration/RecipeModHelpers.java index 113356e51..7a7e5b089 100644 --- a/src/main/java/dan200/computercraft/shared/integration/RecipeModHelpers.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/integration/RecipeModHelpers.java @@ -6,8 +6,8 @@ package dan200.computercraft.shared.integration; import dan200.computercraft.api.ComputerCraftAPI; -import dan200.computercraft.shared.PocketUpgrades; -import dan200.computercraft.shared.TurtleUpgrades; +import dan200.computercraft.impl.PocketUpgrades; +import dan200.computercraft.impl.TurtleUpgrades; import dan200.computercraft.shared.computer.core.ComputerFamily; import dan200.computercraft.shared.pocket.items.PocketComputerItemFactory; import dan200.computercraft.shared.turtle.items.TurtleItemFactory; diff --git a/src/main/java/dan200/computercraft/shared/integration/UpgradeRecipeGenerator.java b/projects/common/src/main/java/dan200/computercraft/shared/integration/UpgradeRecipeGenerator.java similarity index 93% rename from src/main/java/dan200/computercraft/shared/integration/UpgradeRecipeGenerator.java rename to projects/common/src/main/java/dan200/computercraft/shared/integration/UpgradeRecipeGenerator.java index c3fb4b5f5..6097aec23 100644 --- a/src/main/java/dan200/computercraft/shared/integration/UpgradeRecipeGenerator.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/integration/UpgradeRecipeGenerator.java @@ -10,11 +10,11 @@ import dan200.computercraft.api.pocket.IPocketUpgrade; import dan200.computercraft.api.turtle.ITurtleUpgrade; import dan200.computercraft.api.turtle.TurtleSide; import dan200.computercraft.api.upgrades.IUpgradeBase; -import dan200.computercraft.shared.PocketUpgrades; -import dan200.computercraft.shared.TurtleUpgrades; -import dan200.computercraft.shared.pocket.items.ItemPocketComputer; +import dan200.computercraft.impl.PocketUpgrades; +import dan200.computercraft.impl.TurtleUpgrades; +import dan200.computercraft.shared.pocket.items.PocketComputerItem; import dan200.computercraft.shared.pocket.items.PocketComputerItemFactory; -import dan200.computercraft.shared.turtle.items.ItemTurtle; +import dan200.computercraft.shared.turtle.items.TurtleItem; import dan200.computercraft.shared.turtle.items.TurtleItemFactory; import net.minecraft.core.NonNullList; import net.minecraft.resources.ResourceLocation; @@ -110,7 +110,7 @@ public class UpgradeRecipeGenerator { public List findRecipesWithInput(ItemStack stack) { setupCache(); - if (stack.getItem() instanceof ItemTurtle item) { + if (stack.getItem() instanceof TurtleItem item) { // Suggest possible upgrades which can be applied to this turtle var left = item.getUpgrade(stack, TurtleSide.LEFT); var right = item.getUpgrade(stack, TurtleSide.RIGHT); @@ -130,9 +130,9 @@ public class UpgradeRecipeGenerator { } return Collections.unmodifiableList(recipes); - } else if (stack.getItem() instanceof ItemPocketComputer) { + } else if (stack.getItem() instanceof PocketComputerItem) { // Suggest possible upgrades which can be applied to this turtle - var back = ItemPocketComputer.getUpgrade(stack); + var back = PocketComputerItem.getUpgrade(stack); if (back != null) return Collections.emptyList(); List recipes = new ArrayList<>(); @@ -178,7 +178,7 @@ public class UpgradeRecipeGenerator { */ public List findRecipesWithOutput(ItemStack stack) { // Find which upgrade this item currently has, and so how we could build it. - if (stack.getItem() instanceof ItemTurtle item) { + if (stack.getItem() instanceof TurtleItem item) { List recipes = new ArrayList<>(0); var left = item.getUpgrade(stack, TurtleSide.LEFT); @@ -202,10 +202,10 @@ public class UpgradeRecipeGenerator { } return Collections.unmodifiableList(recipes); - } else if (stack.getItem() instanceof ItemPocketComputer) { + } else if (stack.getItem() instanceof PocketComputerItem) { List recipes = new ArrayList<>(0); - var back = ItemPocketComputer.getUpgrade(stack); + var back = PocketComputerItem.getUpgrade(stack); if (back != null) { recipes.add(pocket(Ingredient.of(back.getCraftingItem()), Ingredient.of(pocketWith(stack, null)), stack)); } @@ -217,7 +217,7 @@ public class UpgradeRecipeGenerator { } private static ItemStack turtleWith(ItemStack stack, @Nullable ITurtleUpgrade left, @Nullable ITurtleUpgrade right) { - var item = (ItemTurtle) stack.getItem(); + var item = (TurtleItem) stack.getItem(); return TurtleItemFactory.create( item.getComputerID(stack), item.getLabel(stack), item.getColour(stack), item.getFamily(), left, right, item.getFuelLevel(stack), item.getOverlay(stack) @@ -225,7 +225,7 @@ public class UpgradeRecipeGenerator { } private static ItemStack pocketWith(ItemStack stack, @Nullable IPocketUpgrade back) { - var item = (ItemPocketComputer) stack.getItem(); + var item = (PocketComputerItem) stack.getItem(); return PocketComputerItemFactory.create( item.getComputerID(stack), item.getLabel(stack), item.getColour(stack), item.getFamily(), back diff --git a/src/main/java/dan200/computercraft/shared/integration/jei/JEIComputerCraft.java b/projects/common/src/main/java/dan200/computercraft/shared/integration/jei/JEIComputerCraft.java similarity index 93% rename from src/main/java/dan200/computercraft/shared/integration/jei/JEIComputerCraft.java rename to projects/common/src/main/java/dan200/computercraft/shared/integration/jei/JEIComputerCraft.java index c840a9440..c31ca32dd 100644 --- a/src/main/java/dan200/computercraft/shared/integration/jei/JEIComputerCraft.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/integration/jei/JEIComputerCraft.java @@ -9,8 +9,8 @@ import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.api.turtle.TurtleSide; import dan200.computercraft.shared.ModRegistry; import dan200.computercraft.shared.integration.RecipeModHelpers; -import dan200.computercraft.shared.media.items.ItemDisk; -import dan200.computercraft.shared.pocket.items.ItemPocketComputer; +import dan200.computercraft.shared.media.items.DiskItem; +import dan200.computercraft.shared.pocket.items.PocketComputerItem; import dan200.computercraft.shared.turtle.items.ITurtleItem; import mezz.jei.api.IModPlugin; import mezz.jei.api.JeiPlugin; @@ -91,12 +91,12 @@ public class JEIComputerCraft implements IModPlugin { */ private static final IIngredientSubtypeInterpreter pocketSubtype = (stack, ctx) -> { var item = stack.getItem(); - if (!(item instanceof ItemPocketComputer)) return IIngredientSubtypeInterpreter.NONE; + if (!(item instanceof PocketComputerItem)) return IIngredientSubtypeInterpreter.NONE; var name = new StringBuilder("pocket:"); // Add the upgrade to the identifier - var upgrade = ItemPocketComputer.getUpgrade(stack); + var upgrade = PocketComputerItem.getUpgrade(stack); if (upgrade != null) name.append(upgrade.getUpgradeID()); return name.toString(); @@ -107,7 +107,7 @@ public class JEIComputerCraft implements IModPlugin { */ private static final IIngredientSubtypeInterpreter diskSubtype = (stack, ctx) -> { var item = stack.getItem(); - if (!(item instanceof ItemDisk disk)) return IIngredientSubtypeInterpreter.NONE; + if (!(item instanceof DiskItem disk)) return IIngredientSubtypeInterpreter.NONE; var colour = disk.getColour(stack); return colour == -1 ? IIngredientSubtypeInterpreter.NONE : String.format("%06x", colour); diff --git a/src/main/java/dan200/computercraft/shared/integration/jei/RecipeResolver.java b/projects/common/src/main/java/dan200/computercraft/shared/integration/jei/RecipeResolver.java similarity index 86% rename from src/main/java/dan200/computercraft/shared/integration/jei/RecipeResolver.java rename to projects/common/src/main/java/dan200/computercraft/shared/integration/jei/RecipeResolver.java index 8fbeff38e..a286cafad 100644 --- a/src/main/java/dan200/computercraft/shared/integration/jei/RecipeResolver.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/integration/jei/RecipeResolver.java @@ -6,8 +6,8 @@ package dan200.computercraft.shared.integration.jei; import dan200.computercraft.shared.integration.UpgradeRecipeGenerator; -import dan200.computercraft.shared.pocket.items.ItemPocketComputer; -import dan200.computercraft.shared.turtle.items.ItemTurtle; +import dan200.computercraft.shared.pocket.items.PocketComputerItem; +import dan200.computercraft.shared.turtle.items.TurtleItem; import mezz.jei.api.constants.RecipeTypes; import mezz.jei.api.recipe.IFocus; import mezz.jei.api.recipe.RecipeType; @@ -29,10 +29,10 @@ class RecipeResolver implements IRecipeManagerPlugin { return switch (focus.getRole()) { case INPUT -> - stack.getItem() instanceof ItemTurtle || stack.getItem() instanceof ItemPocketComputer || resolver.isUpgrade(stack) + stack.getItem() instanceof TurtleItem || stack.getItem() instanceof PocketComputerItem || resolver.isUpgrade(stack) ? Collections.singletonList(RecipeTypes.CRAFTING) : Collections.emptyList(); - case OUTPUT -> stack.getItem() instanceof ItemTurtle || stack.getItem() instanceof ItemPocketComputer + case OUTPUT -> stack.getItem() instanceof TurtleItem || stack.getItem() instanceof PocketComputerItem ? Collections.singletonList(RecipeTypes.CRAFTING) : Collections.emptyList(); default -> Collections.emptyList(); diff --git a/src/main/java/dan200/computercraft/shared/media/items/ItemDisk.java b/projects/common/src/main/java/dan200/computercraft/shared/media/items/DiskItem.java similarity index 95% rename from src/main/java/dan200/computercraft/shared/media/items/ItemDisk.java rename to projects/common/src/main/java/dan200/computercraft/shared/media/items/DiskItem.java index 0f5c3f85c..bca6cebb9 100644 --- a/src/main/java/dan200/computercraft/shared/media/items/ItemDisk.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/media/items/DiskItem.java @@ -5,6 +5,7 @@ */ package dan200.computercraft.shared.media.items; +import dan200.computercraft.annotations.ForgeOverride; import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.api.filesystem.IMount; import dan200.computercraft.api.media.IMedia; @@ -27,10 +28,10 @@ import net.minecraft.world.level.LevelReader; import javax.annotation.Nullable; import java.util.List; -public class ItemDisk extends Item implements IMedia, IColouredItem { +public class DiskItem extends Item implements IMedia, IColouredItem { private static final String NBT_ID = "DiskId"; - public ItemDisk(Properties settings) { + public DiskItem(Properties settings) { super(settings); } @@ -61,7 +62,7 @@ public class ItemDisk extends Item implements IMedia, IColouredItem { } } - @Override + @ForgeOverride public boolean doesSneakBypassUse(ItemStack stack, LevelReader world, BlockPos pos, Player player) { return true; } diff --git a/src/main/java/dan200/computercraft/shared/media/items/ItemTreasureDisk.java b/projects/common/src/main/java/dan200/computercraft/shared/media/items/ItemTreasureDisk.java similarity index 98% rename from src/main/java/dan200/computercraft/shared/media/items/ItemTreasureDisk.java rename to projects/common/src/main/java/dan200/computercraft/shared/media/items/ItemTreasureDisk.java index 6f57018d8..9818473f3 100644 --- a/src/main/java/dan200/computercraft/shared/media/items/ItemTreasureDisk.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/media/items/ItemTreasureDisk.java @@ -5,6 +5,7 @@ */ package dan200.computercraft.shared.media.items; +import dan200.computercraft.annotations.ForgeOverride; import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.api.filesystem.IMount; import dan200.computercraft.api.media.IMedia; @@ -45,7 +46,7 @@ public class ItemTreasureDisk extends Item implements IMedia { if (!label.isEmpty()) list.add(Component.literal(label)); } - @Override + @ForgeOverride public boolean doesSneakBypassUse(ItemStack stack, LevelReader world, BlockPos pos, Player player) { return true; } diff --git a/src/main/java/dan200/computercraft/shared/media/items/ItemPrintout.java b/projects/common/src/main/java/dan200/computercraft/shared/media/items/PrintoutItem.java similarity index 93% rename from src/main/java/dan200/computercraft/shared/media/items/ItemPrintout.java rename to projects/common/src/main/java/dan200/computercraft/shared/media/items/PrintoutItem.java index 5fc11b372..c547cf0cf 100644 --- a/src/main/java/dan200/computercraft/shared/media/items/ItemPrintout.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/media/items/PrintoutItem.java @@ -6,7 +6,7 @@ package dan200.computercraft.shared.media.items; import dan200.computercraft.shared.ModRegistry; -import dan200.computercraft.shared.common.ContainerHeldItem; +import dan200.computercraft.shared.common.HeldItemMenu; import dan200.computercraft.shared.network.container.HeldItemContainerData; import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; @@ -21,7 +21,7 @@ import net.minecraft.world.level.Level; import javax.annotation.Nullable; import java.util.List; -public class ItemPrintout extends Item { +public class PrintoutItem extends Item { private static final String NBT_TITLE = "Title"; private static final String NBT_PAGES = "Pages"; private static final String NBT_LINE_TEXT = "Text"; @@ -39,7 +39,7 @@ public class ItemPrintout extends Item { private final Type type; - public ItemPrintout(Properties settings, Type type) { + public PrintoutItem(Properties settings, Type type) { super(settings); this.type = type; } @@ -54,7 +54,7 @@ public class ItemPrintout extends Item { public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { if (!world.isClientSide) { new HeldItemContainerData(hand) - .open(player, new ContainerHeldItem.Factory(ModRegistry.Menus.PRINTOUT.get(), player.getItemInHand(hand), hand)); + .open(player, new HeldItemMenu.Factory(ModRegistry.Menus.PRINTOUT.get(), player.getItemInHand(hand), hand)); } return new InteractionResultHolder<>(InteractionResult.SUCCESS, player.getItemInHand(hand)); } diff --git a/src/main/java/dan200/computercraft/shared/media/items/RecordMedia.java b/projects/common/src/main/java/dan200/computercraft/shared/media/items/RecordMedia.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/media/items/RecordMedia.java rename to projects/common/src/main/java/dan200/computercraft/shared/media/items/RecordMedia.java diff --git a/src/main/java/dan200/computercraft/shared/media/recipes/DiskRecipe.java b/projects/common/src/main/java/dan200/computercraft/shared/media/recipes/DiskRecipe.java similarity index 93% rename from src/main/java/dan200/computercraft/shared/media/recipes/DiskRecipe.java rename to projects/common/src/main/java/dan200/computercraft/shared/media/recipes/DiskRecipe.java index d78f8b8f6..a829a605f 100644 --- a/src/main/java/dan200/computercraft/shared/media/recipes/DiskRecipe.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/media/recipes/DiskRecipe.java @@ -7,7 +7,7 @@ package dan200.computercraft.shared.media.recipes; import dan200.computercraft.core.util.Colour; import dan200.computercraft.shared.ModRegistry; -import dan200.computercraft.shared.media.items.ItemDisk; +import dan200.computercraft.shared.media.items.DiskItem; import dan200.computercraft.shared.platform.PlatformHelper; import dan200.computercraft.shared.util.ColourTracker; import dan200.computercraft.shared.util.ColourUtils; @@ -67,7 +67,7 @@ public class DiskRecipe extends CustomRecipe { } } - return ItemDisk.createFromIDAndColour(-1, null, tracker.hasColour() ? tracker.getColour() : Colour.BLUE.getHex()); + return DiskItem.createFromIDAndColour(-1, null, tracker.hasColour() ? tracker.getColour() : Colour.BLUE.getHex()); } @Override @@ -77,7 +77,7 @@ public class DiskRecipe extends CustomRecipe { @Override public ItemStack getResultItem() { - return ItemDisk.createFromIDAndColour(-1, null, Colour.BLUE.getHex()); + return DiskItem.createFromIDAndColour(-1, null, Colour.BLUE.getHex()); } @Override diff --git a/src/main/java/dan200/computercraft/shared/media/recipes/PrintoutRecipe.java b/projects/common/src/main/java/dan200/computercraft/shared/media/recipes/PrintoutRecipe.java similarity index 80% rename from src/main/java/dan200/computercraft/shared/media/recipes/PrintoutRecipe.java rename to projects/common/src/main/java/dan200/computercraft/shared/media/recipes/PrintoutRecipe.java index 137265b04..37512a7ee 100644 --- a/src/main/java/dan200/computercraft/shared/media/recipes/PrintoutRecipe.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/media/recipes/PrintoutRecipe.java @@ -6,7 +6,7 @@ package dan200.computercraft.shared.media.recipes; import dan200.computercraft.shared.ModRegistry; -import dan200.computercraft.shared.media.items.ItemPrintout; +import dan200.computercraft.shared.media.items.PrintoutItem; import dan200.computercraft.shared.platform.PlatformHelper; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.inventory.CraftingContainer; @@ -36,7 +36,7 @@ public final class PrintoutRecipe extends CustomRecipe { @Override public ItemStack getResultItem() { - return ItemPrintout.createMultipleFromTitleAndText(null, null, null); + return PrintoutItem.createMultipleFromTitleAndText(null, null, null); } @Override @@ -57,10 +57,10 @@ public final class PrintoutRecipe extends CustomRecipe { for (var x = 0; x < inventory.getWidth(); x++) { var stack = inventory.getItem(x + y * inventory.getWidth()); if (!stack.isEmpty()) { - if (stack.getItem() instanceof ItemPrintout printout && printout.getType() != ItemPrintout.Type.BOOK) { + if (stack.getItem() instanceof PrintoutItem printout && printout.getType() != PrintoutItem.Type.BOOK) { if (printouts == null) printouts = new ItemStack[9]; printouts[numPrintouts] = stack; - numPages += ItemPrintout.getPageCount(stack); + numPages += PrintoutItem.getPageCount(stack); numPrintouts++; printoutFound = true; } else if (stack.getItem() == Items.PAPER) { @@ -82,18 +82,18 @@ public final class PrintoutRecipe extends CustomRecipe { } // Build some pages with what was passed in - if (numPages <= ItemPrintout.MAX_PAGES && stringFound && printoutFound && numPrintouts >= (leatherFound ? 1 : 2)) { + if (numPages <= PrintoutItem.MAX_PAGES && stringFound && printoutFound && numPrintouts >= (leatherFound ? 1 : 2)) { if (printouts == null) throw new IllegalStateException("Printouts must be non-null"); - var text = new String[numPages * ItemPrintout.LINES_PER_PAGE]; - var colours = new String[numPages * ItemPrintout.LINES_PER_PAGE]; + var text = new String[numPages * PrintoutItem.LINES_PER_PAGE]; + var colours = new String[numPages * PrintoutItem.LINES_PER_PAGE]; var line = 0; for (var printout = 0; printout < numPrintouts; printout++) { var stack = printouts[printout]; - if (stack.getItem() instanceof ItemPrintout) { + if (stack.getItem() instanceof PrintoutItem) { // Add a printout - var pageText = ItemPrintout.getText(printouts[printout]); - var pageColours = ItemPrintout.getColours(printouts[printout]); + var pageText = PrintoutItem.getText(printouts[printout]); + var pageColours = PrintoutItem.getColours(printouts[printout]); for (var pageLine = 0; pageLine < pageText.length; pageLine++) { text[line] = pageText[pageLine]; colours[line] = pageColours[pageLine]; @@ -101,7 +101,7 @@ public final class PrintoutRecipe extends CustomRecipe { } } else { // Add a blank page - for (var pageLine = 0; pageLine < ItemPrintout.LINES_PER_PAGE; pageLine++) { + for (var pageLine = 0; pageLine < PrintoutItem.LINES_PER_PAGE; pageLine++) { text[line] = ""; colours[line] = ""; line++; @@ -110,14 +110,14 @@ public final class PrintoutRecipe extends CustomRecipe { } String title = null; - if (printouts[0].getItem() instanceof ItemPrintout) { - title = ItemPrintout.getTitle(printouts[0]); + if (printouts[0].getItem() instanceof PrintoutItem) { + title = PrintoutItem.getTitle(printouts[0]); } if (leatherFound) { - return ItemPrintout.createBookFromTitleAndText(title, text, colours); + return PrintoutItem.createBookFromTitleAndText(title, text, colours); } else { - return ItemPrintout.createMultipleFromTitleAndText(title, text, colours); + return PrintoutItem.createMultipleFromTitleAndText(title, text, colours); } } diff --git a/src/main/java/dan200/computercraft/shared/network/NetworkMessage.java b/projects/common/src/main/java/dan200/computercraft/shared/network/NetworkMessage.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/network/NetworkMessage.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/NetworkMessage.java diff --git a/src/main/java/dan200/computercraft/shared/network/NetworkMessages.java b/projects/common/src/main/java/dan200/computercraft/shared/network/NetworkMessages.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/network/NetworkMessages.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/NetworkMessages.java diff --git a/src/main/java/dan200/computercraft/shared/network/client/ChatTableClientMessage.java b/projects/common/src/main/java/dan200/computercraft/shared/network/client/ChatTableClientMessage.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/network/client/ChatTableClientMessage.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/client/ChatTableClientMessage.java diff --git a/src/main/java/dan200/computercraft/shared/network/client/ClientNetworkContext.java b/projects/common/src/main/java/dan200/computercraft/shared/network/client/ClientNetworkContext.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/network/client/ClientNetworkContext.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/client/ClientNetworkContext.java diff --git a/src/main/java/dan200/computercraft/shared/network/client/ComputerTerminalClientMessage.java b/projects/common/src/main/java/dan200/computercraft/shared/network/client/ComputerTerminalClientMessage.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/network/client/ComputerTerminalClientMessage.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/client/ComputerTerminalClientMessage.java diff --git a/src/main/java/dan200/computercraft/shared/network/client/MonitorClientMessage.java b/projects/common/src/main/java/dan200/computercraft/shared/network/client/MonitorClientMessage.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/network/client/MonitorClientMessage.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/client/MonitorClientMessage.java diff --git a/src/main/java/dan200/computercraft/shared/network/client/PlayRecordClientMessage.java b/projects/common/src/main/java/dan200/computercraft/shared/network/client/PlayRecordClientMessage.java similarity index 95% rename from src/main/java/dan200/computercraft/shared/network/client/PlayRecordClientMessage.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/client/PlayRecordClientMessage.java index aa9eb3bc9..1e96d643c 100644 --- a/src/main/java/dan200/computercraft/shared/network/client/PlayRecordClientMessage.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/network/client/PlayRecordClientMessage.java @@ -6,6 +6,7 @@ package dan200.computercraft.shared.network.client; import dan200.computercraft.shared.network.NetworkMessage; +import dan200.computercraft.shared.peripheral.diskdrive.DiskDriveBlockEntity; import dan200.computercraft.shared.platform.Registries; import net.minecraft.core.BlockPos; import net.minecraft.network.FriendlyByteBuf; @@ -19,7 +20,7 @@ import java.util.function.BiConsumer; *

* Used by disk drives to play record items. * - * @see dan200.computercraft.shared.peripheral.diskdrive.TileDiskDrive + * @see DiskDriveBlockEntity */ public class PlayRecordClientMessage implements NetworkMessage { private final BlockPos pos; diff --git a/src/main/java/dan200/computercraft/shared/network/client/PocketComputerDataMessage.java b/projects/common/src/main/java/dan200/computercraft/shared/network/client/PocketComputerDataMessage.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/network/client/PocketComputerDataMessage.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/client/PocketComputerDataMessage.java diff --git a/src/main/java/dan200/computercraft/shared/network/client/PocketComputerDeletedClientMessage.java b/projects/common/src/main/java/dan200/computercraft/shared/network/client/PocketComputerDeletedClientMessage.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/network/client/PocketComputerDeletedClientMessage.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/client/PocketComputerDeletedClientMessage.java diff --git a/src/main/java/dan200/computercraft/shared/network/client/SpeakerAudioClientMessage.java b/projects/common/src/main/java/dan200/computercraft/shared/network/client/SpeakerAudioClientMessage.java similarity index 95% rename from src/main/java/dan200/computercraft/shared/network/client/SpeakerAudioClientMessage.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/client/SpeakerAudioClientMessage.java index 1b3df0806..b13383fc2 100644 --- a/src/main/java/dan200/computercraft/shared/network/client/SpeakerAudioClientMessage.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/network/client/SpeakerAudioClientMessage.java @@ -6,6 +6,7 @@ package dan200.computercraft.shared.network.client; import dan200.computercraft.shared.network.NetworkMessage; +import dan200.computercraft.shared.peripheral.speaker.SpeakerBlockEntity; import dan200.computercraft.shared.peripheral.speaker.SpeakerPosition; import net.minecraft.network.FriendlyByteBuf; @@ -20,7 +21,7 @@ import static dan200.computercraft.core.util.Nullability.assertNonNull; *

* Used by speakers to play sounds. * - * @see dan200.computercraft.shared.peripheral.speaker.TileSpeaker + * @see SpeakerBlockEntity */ public class SpeakerAudioClientMessage implements NetworkMessage { private final UUID source; diff --git a/src/main/java/dan200/computercraft/shared/network/client/SpeakerMoveClientMessage.java b/projects/common/src/main/java/dan200/computercraft/shared/network/client/SpeakerMoveClientMessage.java similarity index 92% rename from src/main/java/dan200/computercraft/shared/network/client/SpeakerMoveClientMessage.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/client/SpeakerMoveClientMessage.java index f41c437dd..75a043749 100644 --- a/src/main/java/dan200/computercraft/shared/network/client/SpeakerMoveClientMessage.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/network/client/SpeakerMoveClientMessage.java @@ -6,6 +6,7 @@ package dan200.computercraft.shared.network.client; import dan200.computercraft.shared.network.NetworkMessage; +import dan200.computercraft.shared.peripheral.speaker.SpeakerBlockEntity; import dan200.computercraft.shared.peripheral.speaker.SpeakerPosition; import net.minecraft.network.FriendlyByteBuf; @@ -16,7 +17,7 @@ import java.util.UUID; *

* Used by speakers to play sounds. * - * @see dan200.computercraft.shared.peripheral.speaker.TileSpeaker + * @see SpeakerBlockEntity */ public class SpeakerMoveClientMessage implements NetworkMessage { private final UUID source; diff --git a/src/main/java/dan200/computercraft/shared/network/client/SpeakerPlayClientMessage.java b/projects/common/src/main/java/dan200/computercraft/shared/network/client/SpeakerPlayClientMessage.java similarity index 94% rename from src/main/java/dan200/computercraft/shared/network/client/SpeakerPlayClientMessage.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/client/SpeakerPlayClientMessage.java index 1c8f36894..3c3047bdc 100644 --- a/src/main/java/dan200/computercraft/shared/network/client/SpeakerPlayClientMessage.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/network/client/SpeakerPlayClientMessage.java @@ -6,6 +6,7 @@ package dan200.computercraft.shared.network.client; import dan200.computercraft.shared.network.NetworkMessage; +import dan200.computercraft.shared.peripheral.speaker.SpeakerBlockEntity; import dan200.computercraft.shared.peripheral.speaker.SpeakerPosition; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; @@ -17,7 +18,7 @@ import java.util.UUID; *

* Used by speakers to play sounds. * - * @see dan200.computercraft.shared.peripheral.speaker.TileSpeaker + * @see SpeakerBlockEntity */ public class SpeakerPlayClientMessage implements NetworkMessage { private final UUID source; diff --git a/src/main/java/dan200/computercraft/shared/network/client/SpeakerStopClientMessage.java b/projects/common/src/main/java/dan200/computercraft/shared/network/client/SpeakerStopClientMessage.java similarity index 90% rename from src/main/java/dan200/computercraft/shared/network/client/SpeakerStopClientMessage.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/client/SpeakerStopClientMessage.java index d182e92a9..378cddba0 100644 --- a/src/main/java/dan200/computercraft/shared/network/client/SpeakerStopClientMessage.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/network/client/SpeakerStopClientMessage.java @@ -6,6 +6,7 @@ package dan200.computercraft.shared.network.client; import dan200.computercraft.shared.network.NetworkMessage; +import dan200.computercraft.shared.peripheral.speaker.SpeakerBlockEntity; import net.minecraft.network.FriendlyByteBuf; import java.util.UUID; @@ -15,7 +16,7 @@ import java.util.UUID; *

* Called when a speaker is broken. * - * @see dan200.computercraft.shared.peripheral.speaker.TileSpeaker + * @see SpeakerBlockEntity */ public class SpeakerStopClientMessage implements NetworkMessage { private final UUID source; diff --git a/src/main/java/dan200/computercraft/shared/network/client/UpgradesLoadedMessage.java b/projects/common/src/main/java/dan200/computercraft/shared/network/client/UpgradesLoadedMessage.java similarity index 96% rename from src/main/java/dan200/computercraft/shared/network/client/UpgradesLoadedMessage.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/client/UpgradesLoadedMessage.java index 15902c74b..3eddba7de 100644 --- a/src/main/java/dan200/computercraft/shared/network/client/UpgradesLoadedMessage.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/network/client/UpgradesLoadedMessage.java @@ -11,9 +11,9 @@ import dan200.computercraft.api.turtle.ITurtleUpgrade; import dan200.computercraft.api.turtle.TurtleUpgradeSerialiser; import dan200.computercraft.api.upgrades.IUpgradeBase; import dan200.computercraft.api.upgrades.UpgradeSerialiser; -import dan200.computercraft.shared.PocketUpgrades; -import dan200.computercraft.shared.TurtleUpgrades; -import dan200.computercraft.shared.UpgradeManager; +import dan200.computercraft.impl.PocketUpgrades; +import dan200.computercraft.impl.TurtleUpgrades; +import dan200.computercraft.impl.UpgradeManager; import dan200.computercraft.shared.network.NetworkMessage; import dan200.computercraft.shared.platform.PlatformHelper; import net.minecraft.core.Registry; diff --git a/src/main/java/dan200/computercraft/shared/network/client/UploadResultMessage.java b/projects/common/src/main/java/dan200/computercraft/shared/network/client/UploadResultMessage.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/network/client/UploadResultMessage.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/client/UploadResultMessage.java diff --git a/src/main/java/dan200/computercraft/shared/network/container/ComputerContainerData.java b/projects/common/src/main/java/dan200/computercraft/shared/network/container/ComputerContainerData.java similarity index 97% rename from src/main/java/dan200/computercraft/shared/network/container/ComputerContainerData.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/container/ComputerContainerData.java index 7c6d082ec..0e1c32082 100644 --- a/src/main/java/dan200/computercraft/shared/network/container/ComputerContainerData.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/network/container/ComputerContainerData.java @@ -32,7 +32,7 @@ public class ComputerContainerData implements ContainerData { public void toBytes(FriendlyByteBuf buf) { buf.writeEnum(family); terminal.write(buf); - buf.writeItemStack(displayStack, true); + buf.writeItem(displayStack); } public ComputerFamily family() { diff --git a/src/main/java/dan200/computercraft/shared/network/container/ContainerData.java b/projects/common/src/main/java/dan200/computercraft/shared/network/container/ContainerData.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/network/container/ContainerData.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/container/ContainerData.java diff --git a/src/main/java/dan200/computercraft/shared/network/container/HeldItemContainerData.java b/projects/common/src/main/java/dan200/computercraft/shared/network/container/HeldItemContainerData.java similarity index 84% rename from src/main/java/dan200/computercraft/shared/network/container/HeldItemContainerData.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/container/HeldItemContainerData.java index f7a049ac8..763c90c84 100644 --- a/src/main/java/dan200/computercraft/shared/network/container/HeldItemContainerData.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/network/container/HeldItemContainerData.java @@ -5,15 +5,16 @@ */ package dan200.computercraft.shared.network.container; -import dan200.computercraft.shared.common.ContainerHeldItem; +import dan200.computercraft.shared.common.HeldItemMenu; +import dan200.computercraft.shared.media.items.PrintoutItem; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.InteractionHand; /** * Opens a printout GUI based on the currently held item. * - * @see ContainerHeldItem - * @see dan200.computercraft.shared.media.items.ItemPrintout + * @see HeldItemMenu + * @see PrintoutItem */ public class HeldItemContainerData implements ContainerData { private final InteractionHand hand; diff --git a/src/main/java/dan200/computercraft/shared/network/server/ComputerActionServerMessage.java b/projects/common/src/main/java/dan200/computercraft/shared/network/server/ComputerActionServerMessage.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/network/server/ComputerActionServerMessage.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/server/ComputerActionServerMessage.java diff --git a/src/main/java/dan200/computercraft/shared/network/server/ComputerServerMessage.java b/projects/common/src/main/java/dan200/computercraft/shared/network/server/ComputerServerMessage.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/network/server/ComputerServerMessage.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/server/ComputerServerMessage.java diff --git a/src/main/java/dan200/computercraft/shared/network/server/KeyEventServerMessage.java b/projects/common/src/main/java/dan200/computercraft/shared/network/server/KeyEventServerMessage.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/network/server/KeyEventServerMessage.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/server/KeyEventServerMessage.java diff --git a/src/main/java/dan200/computercraft/shared/network/server/MouseEventServerMessage.java b/projects/common/src/main/java/dan200/computercraft/shared/network/server/MouseEventServerMessage.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/network/server/MouseEventServerMessage.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/server/MouseEventServerMessage.java diff --git a/src/main/java/dan200/computercraft/shared/network/server/QueueEventServerMessage.java b/projects/common/src/main/java/dan200/computercraft/shared/network/server/QueueEventServerMessage.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/network/server/QueueEventServerMessage.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/server/QueueEventServerMessage.java diff --git a/src/main/java/dan200/computercraft/shared/network/server/ServerNetworkContext.java b/projects/common/src/main/java/dan200/computercraft/shared/network/server/ServerNetworkContext.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/network/server/ServerNetworkContext.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/server/ServerNetworkContext.java diff --git a/src/main/java/dan200/computercraft/shared/network/server/UploadFileMessage.java b/projects/common/src/main/java/dan200/computercraft/shared/network/server/UploadFileMessage.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/network/server/UploadFileMessage.java rename to projects/common/src/main/java/dan200/computercraft/shared/network/server/UploadFileMessage.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/commandblock/CommandBlockPeripheral.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/commandblock/CommandBlockPeripheral.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/commandblock/CommandBlockPeripheral.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/commandblock/CommandBlockPeripheral.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/BlockDiskDrive.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDriveBlock.java similarity index 91% rename from src/main/java/dan200/computercraft/shared/peripheral/diskdrive/BlockDiskDrive.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDriveBlock.java index c0e9f158b..d3d583b07 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/BlockDiskDrive.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDriveBlock.java @@ -6,7 +6,7 @@ package dan200.computercraft.shared.peripheral.diskdrive; import dan200.computercraft.shared.ModRegistry; -import dan200.computercraft.shared.common.BlockGeneric; +import dan200.computercraft.shared.common.GenericBlock; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.stats.Stats; @@ -31,13 +31,13 @@ import net.minecraft.world.level.block.state.properties.EnumProperty; import javax.annotation.Nullable; -public class BlockDiskDrive extends BlockGeneric { +public class DiskDriveBlock extends GenericBlock { static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; public static final EnumProperty STATE = EnumProperty.create("state", DiskDriveState.class); - private static final BlockEntityTicker serverTicker = (level, pos, state, drive) -> drive.serverTick(); + private static final BlockEntityTicker serverTicker = (level, pos, state, drive) -> drive.serverTick(); - public BlockDiskDrive(Properties settings) { + public DiskDriveBlock(Properties settings) { super(settings, ModRegistry.BlockEntities.DISK_DRIVE); registerDefaultState(getStateDefinition().any() .setValue(FACING, Direction.NORTH) @@ -84,7 +84,7 @@ public class BlockDiskDrive extends BlockGeneric { @Override public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { - if (stack.hasCustomHoverName() && world.getBlockEntity(pos) instanceof TileDiskDrive drive) { + if (stack.hasCustomHoverName() && world.getBlockEntity(pos) instanceof DiskDriveBlockEntity drive) { drive.customName = stack.getHoverName(); } } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/TileDiskDrive.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDriveBlockEntity.java similarity index 96% rename from src/main/java/dan200/computercraft/shared/peripheral/diskdrive/TileDiskDrive.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDriveBlockEntity.java index 70434163d..bffa2e194 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/TileDiskDrive.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDriveBlockEntity.java @@ -10,8 +10,8 @@ import dan200.computercraft.api.filesystem.IWritableMount; import dan200.computercraft.api.media.IMedia; import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IPeripheral; -import dan200.computercraft.shared.MediaProviders; -import dan200.computercraft.shared.common.TileGeneric; +import dan200.computercraft.impl.MediaProviders; +import dan200.computercraft.shared.common.GenericTile; import dan200.computercraft.shared.network.client.PlayRecordClientMessage; import dan200.computercraft.shared.platform.PlatformHelper; import dan200.computercraft.shared.util.DefaultInventory; @@ -39,7 +39,7 @@ import java.util.Objects; import static dan200.computercraft.core.util.Nullability.assertNonNull; -public final class TileDiskDrive extends TileGeneric implements DefaultInventory, Nameable, MenuProvider { +public final class DiskDriveBlockEntity extends GenericTile implements DefaultInventory, Nameable, MenuProvider { private static final String NBT_NAME = "CustomName"; private static final String NBT_ITEM = "Item"; @@ -63,7 +63,7 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory private boolean restartRecord = false; private boolean ejectQueued; - public TileDiskDrive(BlockEntityType type, BlockPos pos, BlockState state) { + public DiskDriveBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { super(type, pos, state); } @@ -97,7 +97,7 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory } public Direction getDirection() { - return getBlockState().getValue(BlockDiskDrive.FACING); + return getBlockState().getValue(DiskDriveBlock.FACING); } @Override @@ -370,9 +370,9 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory private void updateBlockState(DiskDriveState state) { var blockState = getBlockState(); - if (blockState.getValue(BlockDiskDrive.STATE) == state) return; + if (blockState.getValue(DiskDriveBlock.STATE) == state) return; - getLevel().setBlockAndUpdate(getBlockPos(), blockState.setValue(BlockDiskDrive.STATE, state)); + getLevel().setBlockAndUpdate(getBlockPos(), blockState.setValue(DiskDriveBlock.STATE, state)); } private synchronized void ejectContents(boolean destroyed) { @@ -445,7 +445,7 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory @Override public AbstractContainerMenu createMenu(int id, Inventory inventory, Player player) { - return new ContainerDiskDrive(id, inventory, this); + return new DiskDriveMenu(id, inventory, this); } public IPeripheral peripheral() { diff --git a/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/ContainerDiskDrive.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDriveMenu.java similarity index 91% rename from src/main/java/dan200/computercraft/shared/peripheral/diskdrive/ContainerDiskDrive.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDriveMenu.java index a5f33796d..a4e8b84d1 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/ContainerDiskDrive.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDriveMenu.java @@ -14,10 +14,10 @@ import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.Slot; import net.minecraft.world.item.ItemStack; -public class ContainerDiskDrive extends AbstractContainerMenu { +public class DiskDriveMenu extends AbstractContainerMenu { private final Container inventory; - public ContainerDiskDrive(int id, Inventory player, Container inventory) { + public DiskDriveMenu(int id, Inventory player, Container inventory) { super(ModRegistry.Menus.DISK_DRIVE.get(), id); this.inventory = inventory; @@ -35,7 +35,7 @@ public class ContainerDiskDrive extends AbstractContainerMenu { } } - public ContainerDiskDrive(int id, Inventory player) { + public DiskDriveMenu(int id, Inventory player) { this(id, player, new SimpleContainer(1)); } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDrivePeripheral.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDrivePeripheral.java similarity index 95% rename from src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDrivePeripheral.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDrivePeripheral.java index 0ba7d265a..213556d54 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDrivePeripheral.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDrivePeripheral.java @@ -10,8 +10,8 @@ import dan200.computercraft.api.lua.LuaFunction; import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.core.util.StringUtil; -import dan200.computercraft.shared.MediaProviders; -import dan200.computercraft.shared.media.items.ItemDisk; +import dan200.computercraft.impl.MediaProviders; +import dan200.computercraft.shared.media.items.DiskItem; import javax.annotation.Nullable; import java.util.Optional; @@ -35,9 +35,9 @@ import java.util.Optional; * @cc.module drive */ public class DiskDrivePeripheral implements IPeripheral { - private final TileDiskDrive diskDrive; + private final DiskDriveBlockEntity diskDrive; - DiskDrivePeripheral(TileDiskDrive diskDrive) { + DiskDrivePeripheral(DiskDriveBlockEntity diskDrive) { this.diskDrive = diskDrive; } @@ -177,7 +177,7 @@ public class DiskDrivePeripheral implements IPeripheral { @LuaFunction public final @Nullable Object[] getDiskID() { var disk = diskDrive.getDiskStack(); - return disk.getItem() instanceof ItemDisk ? new Object[]{ ItemDisk.getDiskID(disk) } : null; + return disk.getItem() instanceof DiskItem ? new Object[]{ DiskItem.getDiskID(disk) } : null; } @Override diff --git a/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDriveState.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDriveState.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDriveState.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/DiskDriveState.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/generic/GenericPeripheral.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/generic/GenericPeripheral.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/generic/GenericPeripheral.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/generic/GenericPeripheral.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/generic/SaturatedMethod.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/generic/SaturatedMethod.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/generic/SaturatedMethod.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/generic/SaturatedMethod.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/ModemPeripheral.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/ModemPeripheral.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/modem/ModemPeripheral.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/ModemPeripheral.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/ModemShapes.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/ModemShapes.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/modem/ModemShapes.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/ModemShapes.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/ModemState.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/ModemState.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/modem/ModemState.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/ModemState.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockCable.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/CableBlock.java similarity index 88% rename from src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockCable.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/CableBlock.java index 2e628880c..eaf96e838 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockCable.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/CableBlock.java @@ -6,8 +6,9 @@ package dan200.computercraft.shared.peripheral.modem.wired; import com.google.common.collect.ImmutableMap; +import dan200.computercraft.annotations.ForgeOverride; import dan200.computercraft.shared.ModRegistry; -import dan200.computercraft.shared.common.BlockGeneric; +import dan200.computercraft.shared.common.GenericBlock; import dan200.computercraft.shared.platform.PlatformHelper; import dan200.computercraft.shared.util.WaterloggableHelpers; import dan200.computercraft.shared.util.WorldUtil; @@ -35,7 +36,7 @@ import java.util.EnumMap; import static dan200.computercraft.shared.util.WaterloggableHelpers.WATERLOGGED; import static dan200.computercraft.shared.util.WaterloggableHelpers.getFluidStateForPlacement; -public class BlockCable extends BlockGeneric implements SimpleWaterloggedBlock { +public class CableBlock extends GenericBlock implements SimpleWaterloggedBlock { public static final EnumProperty MODEM = EnumProperty.create("modem", CableModemVariant.class); public static final BooleanProperty CABLE = BooleanProperty.create("cable"); @@ -53,7 +54,7 @@ public class BlockCable extends BlockGeneric implements SimpleWaterloggedBlock { .put(Direction.WEST, WEST).put(Direction.EAST, EAST) .build()); - public BlockCable(Properties settings) { + public CableBlock(Properties settings) { super(settings, ModRegistry.BlockEntities.CABLE); registerDefaultState(getStateDefinition().any() @@ -72,7 +73,7 @@ public class BlockCable extends BlockGeneric implements SimpleWaterloggedBlock { } public static boolean canConnectIn(BlockState state, Direction direction) { - return state.getValue(BlockCable.CABLE) && state.getValue(BlockCable.MODEM).getFacing() != direction; + return state.getValue(CableBlock.CABLE) && state.getValue(CableBlock.MODEM).getFacing() != direction; } public static boolean doesConnectVisually(BlockState state, Level level, BlockPos pos, Direction direction) { @@ -87,8 +88,13 @@ public class BlockCable extends BlockGeneric implements SimpleWaterloggedBlock { return CableShapes.getShape(state); } - @Override + @ForgeOverride public boolean onDestroyedByPlayer(BlockState state, Level world, BlockPos pos, Player player, boolean willHarvest, FluidState fluid) { + playerWillDestroy(world, pos, state, player); + return onDestroyedByPlayer(state, world, pos, player, fluid); + } + + public boolean onDestroyedByPlayer(BlockState state, Level world, BlockPos pos, Player player, FluidState fluid) { if (state.getValue(CABLE) && state.getValue(MODEM).getFacing() != null) { var hit = world.clip(new ClipContext( WorldUtil.getRayStart(player), WorldUtil.getRayEnd(player), @@ -96,8 +102,7 @@ public class BlockCable extends BlockGeneric implements SimpleWaterloggedBlock { )); if (hit.getType() == HitResult.Type.BLOCK) { var tile = world.getBlockEntity(pos); - if (tile instanceof TileCable cable && tile.hasLevel()) { - + if (tile instanceof CableBlockEntity cable && tile.hasLevel()) { ItemStack item; BlockState newState; @@ -122,10 +127,16 @@ public class BlockCable extends BlockGeneric implements SimpleWaterloggedBlock { } } - return super.onDestroyedByPlayer(state, world, pos, player, willHarvest, fluid); + return world.setBlock(pos, fluid.createLegacyBlock(), world.isClientSide ? UPDATE_ALL_IMMEDIATE : UPDATE_ALL); } @Override + @Deprecated + public ItemStack getCloneItemStack(BlockGetter world, BlockPos pos, BlockState state) { + return state.getValue(CABLE) ? new ItemStack(ModRegistry.Items.CABLE.get()) : new ItemStack(ModRegistry.Items.WIRED_MODEM.get()); + } + + @ForgeOverride public ItemStack getCloneItemStack(BlockState state, @Nullable HitResult hit, BlockGetter world, BlockPos pos, Player player) { var modem = state.getValue(MODEM).getFacing(); boolean cable = state.getValue(CABLE); @@ -138,13 +149,12 @@ public class BlockCable extends BlockGeneric implements SimpleWaterloggedBlock { return hit != null && WorldUtil.isVecInside(CableShapes.getModemShape(state), hit.getLocation().subtract(pos.getX(), pos.getY(), pos.getZ())) ? new ItemStack(ModRegistry.Items.WIRED_MODEM.get()) : new ItemStack(ModRegistry.Items.CABLE.get()); - } @Override public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { var tile = world.getBlockEntity(pos); - if (tile instanceof TileCable cable) { + if (tile instanceof CableBlockEntity cable) { if (cable.hasCable()) cable.connectionsChanged(); } @@ -184,7 +194,7 @@ public class BlockCable extends BlockGeneric implements SimpleWaterloggedBlock { var state = defaultBlockState() .setValue(WATERLOGGED, getFluidStateForPlacement(context)); - if (context.getItemInHand().getItem() instanceof ItemBlockCable.Cable) { + if (context.getItemInHand().getItem() instanceof CableBlockItem.Cable) { var world = context.getLevel(); var pos = context.getClickedPos(); return correctConnections(world, pos, state.setValue(CABLE, true)); diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileCable.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/CableBlockEntity.java similarity index 93% rename from src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileCable.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/CableBlockEntity.java index 150388803..da4db4801 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileCable.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/CableBlockEntity.java @@ -11,7 +11,7 @@ import dan200.computercraft.api.network.wired.IWiredNode; import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.shared.ModRegistry; import dan200.computercraft.shared.command.text.ChatHelpers; -import dan200.computercraft.shared.common.TileGeneric; +import dan200.computercraft.shared.common.GenericTile; import dan200.computercraft.shared.peripheral.modem.ModemState; import dan200.computercraft.shared.platform.ComponentAccess; import dan200.computercraft.shared.platform.PlatformHelper; @@ -36,13 +36,13 @@ import net.minecraft.world.phys.Vec3; import javax.annotation.Nullable; import java.util.Collections; -public class TileCable extends TileGeneric { +public class CableBlockEntity extends GenericTile { private static final String NBT_PERIPHERAL_ENABLED = "PeirpheralAccess"; private class CableElement extends WiredModemElement { @Override public Level getLevel() { - return TileCable.this.getLevel(); + return CableBlockEntity.this.getLevel(); } @Override @@ -89,13 +89,13 @@ public class TileCable extends TileGeneric { @Override public Object getTarget() { - return TileCable.this; + return CableBlockEntity.this; } }; private final ComponentAccess connectedElements = PlatformHelper.get().createWiredElementAccess(x -> connectionsChanged()); - public TileCable(BlockEntityType type, BlockPos pos, BlockState state) { + public CableBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { super(type, pos, state); } @@ -115,12 +115,6 @@ public class TileCable extends TileGeneric { } } - @Override - public void onChunkUnloaded() { - super.onChunkUnloaded(); - onRemove(); - } - @Override public void setRemoved() { super.setRemoved(); @@ -145,7 +139,7 @@ public class TileCable extends TileGeneric { @Nullable private Direction getMaybeDirection() { - return getBlockState().getValue(BlockCable.MODEM).getFacing(); + return getBlockState().getValue(CableBlock.MODEM).getFacing(); } private Direction getDirection() { @@ -160,7 +154,7 @@ public class TileCable extends TileGeneric { if (hasCable()) { // Drop the modem and convert to cable Block.popResource(getLevel(), getBlockPos(), new ItemStack(ModRegistry.Items.WIRED_MODEM.get())); - getLevel().setBlockAndUpdate(getBlockPos(), getBlockState().setValue(BlockCable.MODEM, CableModemVariant.None)); + getLevel().setBlockAndUpdate(getBlockPos(), getBlockState().setValue(CableBlock.MODEM, CableModemVariant.None)); modemChanged(); connectionsChanged(); } else { @@ -238,12 +232,12 @@ public class TileCable extends TileGeneric { private void updateBlockState() { var state = getBlockState(); - var oldVariant = state.getValue(BlockCable.MODEM); + var oldVariant = state.getValue(CableBlock.MODEM); var newVariant = CableModemVariant .from(oldVariant.getFacing(), modem.getModemState().isOpen(), peripheralAccessAllowed); if (oldVariant != newVariant) { - level.setBlockAndUpdate(getBlockPos(), state.setValue(BlockCable.MODEM, newVariant)); + level.setBlockAndUpdate(getBlockPos(), state.setValue(CableBlock.MODEM, newVariant)); } } @@ -280,7 +274,7 @@ public class TileCable extends TileGeneric { if (element == null) continue; var node = element.getNode(); - if (BlockCable.canConnectIn(state, facing)) { + if (CableBlock.canConnectIn(state, facing)) { // If we can connect to it then do so this.node.connectTo(node); } else if (this.node.getNetwork() == node.getNetwork()) { @@ -338,7 +332,7 @@ public class TileCable extends TileGeneric { @Nullable public IWiredElement getWiredElement(@Nullable Direction direction) { if (destroyed) return null; - return direction == null || BlockCable.canConnectIn(getBlockState(), direction) ? cable : null; + return direction == null || CableBlock.canConnectIn(getBlockState(), direction) ? cable : null; } @Nullable @@ -352,11 +346,11 @@ public class TileCable extends TileGeneric { } boolean hasCable() { - return getBlockState().getValue(BlockCable.CABLE); + return getBlockState().getValue(CableBlock.CABLE); } public boolean hasModem() { - return getBlockState().getValue(BlockCable.MODEM) != CableModemVariant.None; + return getBlockState().getValue(CableBlock.MODEM) != CableModemVariant.None; } private boolean canAttachPeripheral() { diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/ItemBlockCable.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/CableBlockItem.java similarity index 82% rename from src/main/java/dan200/computercraft/shared/peripheral/modem/wired/ItemBlockCable.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/CableBlockItem.java index 0646506db..f8b8e351e 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/ItemBlockCable.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/CableBlockItem.java @@ -12,7 +12,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.NonNullList; import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; @@ -22,25 +21,25 @@ import net.minecraft.world.level.block.state.BlockState; import javax.annotation.Nullable; -import static dan200.computercraft.shared.peripheral.modem.wired.BlockCable.*; +import static dan200.computercraft.shared.peripheral.modem.wired.CableBlock.*; -public abstract class ItemBlockCable extends BlockItem { +public abstract class CableBlockItem extends BlockItem { private @Nullable String translationKey; - public ItemBlockCable(BlockCable block, Properties settings) { + public CableBlockItem(CableBlock block, Properties settings) { super(block, settings); } - boolean placeAt(Level world, BlockPos pos, BlockState state, @Nullable Player player) { + boolean placeAt(Level world, BlockPos pos, BlockState state) { // TODO: Check entity collision. if (!state.canSurvive(world, pos)) return false; world.setBlock(pos, state, 3); - var soundType = state.getBlock().getSoundType(state, world, pos, player); + var soundType = state.getBlock().getSoundType(state); world.playSound(null, pos, soundType.getPlaceSound(), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F); var tile = world.getBlockEntity(pos); - if (tile instanceof TileCable cable) { + if (tile instanceof CableBlockEntity cable) { cable.modemChanged(); cable.connectionsChanged(); } @@ -49,7 +48,7 @@ public abstract class ItemBlockCable extends BlockItem { } boolean placeAtCorrected(Level world, BlockPos pos, BlockState state) { - return placeAt(world, pos, correctConnections(world, pos, state), null); + return placeAt(world, pos, correctConnections(world, pos, state)); } @Override @@ -65,8 +64,8 @@ public abstract class ItemBlockCable extends BlockItem { return translationKey; } - public static class WiredModem extends ItemBlockCable { - public WiredModem(BlockCable block, Properties settings) { + public static class WiredModem extends CableBlockItem { + public WiredModem(CableBlock block, Properties settings) { super(block, settings); } @@ -85,7 +84,7 @@ public abstract class ItemBlockCable extends BlockItem { var newState = existingState .setValue(MODEM, CableModemVariant.from(side)) .setValue(CONNECTIONS.get(side), existingState.getValue(CABLE)); - if (placeAt(world, pos, newState, context.getPlayer())) { + if (placeAt(world, pos, newState)) { stack.shrink(1); return InteractionResult.SUCCESS; } @@ -95,8 +94,8 @@ public abstract class ItemBlockCable extends BlockItem { } } - public static class Cable extends ItemBlockCable { - public Cable(BlockCable block, Properties settings) { + public static class Cable extends CableBlockItem { + public Cable(CableBlock block, Properties settings) { super(block, settings); } @@ -111,16 +110,16 @@ public abstract class ItemBlockCable extends BlockItem { // Try to add a cable to a modem inside the block we're clicking on. var insidePos = pos.relative(context.getClickedFace().getOpposite()); var insideState = world.getBlockState(insidePos); - if (insideState.getBlock() == ModRegistry.Blocks.CABLE.get() && !insideState.getValue(BlockCable.CABLE) - && placeAtCorrected(world, insidePos, insideState.setValue(BlockCable.CABLE, true))) { + if (insideState.getBlock() == ModRegistry.Blocks.CABLE.get() && !insideState.getValue(CableBlock.CABLE) + && placeAtCorrected(world, insidePos, insideState.setValue(CableBlock.CABLE, true))) { stack.shrink(1); return InteractionResult.SUCCESS; } // Try to add a cable to a modem adjacent to this block var existingState = world.getBlockState(pos); - if (existingState.getBlock() == ModRegistry.Blocks.CABLE.get() && !existingState.getValue(BlockCable.CABLE) - && placeAtCorrected(world, pos, existingState.setValue(BlockCable.CABLE, true))) { + if (existingState.getBlock() == ModRegistry.Blocks.CABLE.get() && !existingState.getValue(CableBlock.CABLE) + && placeAtCorrected(world, pos, existingState.setValue(CableBlock.CABLE, true))) { stack.shrink(1); return InteractionResult.SUCCESS; } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/CableModemVariant.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/CableModemVariant.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/modem/wired/CableModemVariant.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/CableModemVariant.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/CableShapes.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/CableShapes.java similarity index 99% rename from src/main/java/dan200/computercraft/shared/peripheral/modem/wired/CableShapes.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/CableShapes.java index 28c5eba1b..993107622 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/CableShapes.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/CableShapes.java @@ -15,7 +15,7 @@ import net.minecraft.world.phys.shapes.VoxelShape; import java.util.EnumMap; -import static dan200.computercraft.shared.peripheral.modem.wired.BlockCable.*; +import static dan200.computercraft.shared.peripheral.modem.wired.CableBlock.*; public final class CableShapes { private static final double MIN = 0.375; diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/WiredModemElement.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/WiredModemElement.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/modem/wired/WiredModemElement.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/WiredModemElement.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockWiredModemFull.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/WiredModemFullBlock.java similarity index 87% rename from src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockWiredModemFull.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/WiredModemFullBlock.java index 812f0f7bf..9306615d0 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockWiredModemFull.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/WiredModemFullBlock.java @@ -6,17 +6,17 @@ package dan200.computercraft.shared.peripheral.modem.wired; import dan200.computercraft.shared.ModRegistry; -import dan200.computercraft.shared.common.BlockGeneric; +import dan200.computercraft.shared.common.GenericBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BooleanProperty; -public class BlockWiredModemFull extends BlockGeneric { +public class WiredModemFullBlock extends GenericBlock { public static final BooleanProperty MODEM_ON = BooleanProperty.create("modem"); public static final BooleanProperty PERIPHERAL_ON = BooleanProperty.create("peripheral"); - public BlockWiredModemFull(Properties settings) { + public WiredModemFullBlock(Properties settings) { super(settings, ModRegistry.BlockEntities.WIRED_MODEM_FULL); registerDefaultState(getStateDefinition().any() .setValue(MODEM_ON, false) diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileWiredModemFull.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/WiredModemFullBlockEntity.java similarity index 95% rename from src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileWiredModemFull.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/WiredModemFullBlockEntity.java index 79bbe59a6..890ea578e 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileWiredModemFull.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/WiredModemFullBlockEntity.java @@ -10,7 +10,7 @@ import dan200.computercraft.api.network.wired.IWiredElement; import dan200.computercraft.api.network.wired.IWiredNode; import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.shared.command.text.ChatHelpers; -import dan200.computercraft.shared.common.TileGeneric; +import dan200.computercraft.shared.common.GenericTile; import dan200.computercraft.shared.peripheral.modem.ModemState; import dan200.computercraft.shared.platform.ComponentAccess; import dan200.computercraft.shared.platform.PlatformHelper; @@ -33,16 +33,16 @@ import net.minecraft.world.phys.Vec3; import javax.annotation.Nullable; import java.util.*; -import static dan200.computercraft.shared.peripheral.modem.wired.BlockWiredModemFull.MODEM_ON; -import static dan200.computercraft.shared.peripheral.modem.wired.BlockWiredModemFull.PERIPHERAL_ON; +import static dan200.computercraft.shared.peripheral.modem.wired.WiredModemFullBlock.MODEM_ON; +import static dan200.computercraft.shared.peripheral.modem.wired.WiredModemFullBlock.PERIPHERAL_ON; -public class TileWiredModemFull extends TileGeneric { +public class WiredModemFullBlockEntity extends GenericTile { private static final String NBT_PERIPHERAL_ENABLED = "PeripheralAccess"; private static final class FullElement extends WiredModemElement { - private final TileWiredModemFull entity; + private final WiredModemFullBlockEntity entity; - private FullElement(TileWiredModemFull entity) { + private FullElement(WiredModemFullBlockEntity entity) { this.entity = entity; } @@ -90,7 +90,7 @@ public class TileWiredModemFull extends TileGeneric { private int invalidSides = 0; - public TileWiredModemFull(BlockEntityType type, BlockPos pos, BlockState state) { + public WiredModemFullBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { super(type, pos, state); for (var i = 0; i < peripherals.length; i++) { var facing = Direction.from3DDataValue(i); @@ -114,12 +114,6 @@ public class TileWiredModemFull extends TileGeneric { super.destroy(); } - @Override - public void onChunkUnloaded() { - super.onChunkUnloaded(); - doRemove(); - } - @Override public void setRemoved() { super.setRemoved(); @@ -333,7 +327,7 @@ public class TileWiredModemFull extends TileGeneric { @Override public Object getTarget() { - return TileWiredModemFull.this; + return WiredModemFullBlockEntity.this; } }; } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/WiredModemLocalPeripheral.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/WiredModemLocalPeripheral.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/modem/wired/WiredModemLocalPeripheral.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/WiredModemLocalPeripheral.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/WiredModemPeripheral.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/WiredModemPeripheral.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/modem/wired/WiredModemPeripheral.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/WiredModemPeripheral.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/BlockWirelessModem.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/WirelessModemBlock.java similarity index 93% rename from src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/BlockWirelessModem.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/WirelessModemBlock.java index 79339f49d..25bd5abeb 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/BlockWirelessModem.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/WirelessModemBlock.java @@ -5,7 +5,7 @@ */ package dan200.computercraft.shared.peripheral.modem.wireless; -import dan200.computercraft.shared.common.BlockGeneric; +import dan200.computercraft.shared.common.GenericBlock; import dan200.computercraft.shared.peripheral.modem.ModemShapes; import dan200.computercraft.shared.platform.RegistryEntry; import dan200.computercraft.shared.util.WaterloggableHelpers; @@ -34,11 +34,11 @@ import javax.annotation.Nullable; import static dan200.computercraft.shared.util.WaterloggableHelpers.WATERLOGGED; import static dan200.computercraft.shared.util.WaterloggableHelpers.getFluidStateForPlacement; -public class BlockWirelessModem extends BlockGeneric implements SimpleWaterloggedBlock { +public class WirelessModemBlock extends GenericBlock implements SimpleWaterloggedBlock { public static final DirectionProperty FACING = BlockStateProperties.FACING; public static final BooleanProperty ON = BooleanProperty.create("on"); - public BlockWirelessModem(Properties settings, RegistryEntry> type) { + public WirelessModemBlock(Properties settings, RegistryEntry> type) { super(settings, type); registerDefaultState(getStateDefinition().any() .setValue(FACING, Direction.NORTH) diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/TileWirelessModem.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/WirelessModemBlockEntity.java similarity index 85% rename from src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/TileWirelessModem.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/WirelessModemBlockEntity.java index b0d53d7fe..3bad001df 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/TileWirelessModem.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/WirelessModemBlockEntity.java @@ -6,7 +6,7 @@ package dan200.computercraft.shared.peripheral.modem.wireless; import dan200.computercraft.api.peripheral.IPeripheral; -import dan200.computercraft.shared.common.TileGeneric; +import dan200.computercraft.shared.common.GenericTile; import dan200.computercraft.shared.peripheral.modem.ModemPeripheral; import dan200.computercraft.shared.peripheral.modem.ModemState; import dan200.computercraft.shared.util.TickScheduler; @@ -19,11 +19,11 @@ import net.minecraft.world.phys.Vec3; import javax.annotation.Nullable; -public class TileWirelessModem extends TileGeneric { +public class WirelessModemBlockEntity extends GenericTile { private static class Peripheral extends WirelessModemPeripheral { - private final TileWirelessModem entity; + private final WirelessModemBlockEntity entity; - Peripheral(TileWirelessModem entity) { + Peripheral(WirelessModemBlockEntity entity) { super(new ModemState(() -> TickScheduler.schedule(entity.tickToken)), entity.advanced); this.entity = entity; } @@ -56,7 +56,7 @@ public class TileWirelessModem extends TileGeneric { private @Nullable Runnable modemChanged; private final TickScheduler.Token tickToken = new TickScheduler.Token(this); - public TileWirelessModem(BlockEntityType type, BlockPos pos, BlockState state, boolean advanced) { + public WirelessModemBlockEntity(BlockEntityType type, BlockPos pos, BlockState state, boolean advanced) { super(type, pos, state); this.advanced = advanced; modem = new Peripheral(this); @@ -90,14 +90,14 @@ public class TileWirelessModem extends TileGeneric { } private Direction getDirection() { - return getBlockState().getValue(BlockWirelessModem.FACING); + return getBlockState().getValue(WirelessModemBlock.FACING); } private void updateBlockState() { var on = modem.getModemState().isOpen(); var state = getBlockState(); - if (state.getValue(BlockWirelessModem.ON) != on) { - getLevel().setBlockAndUpdate(getBlockPos(), state.setValue(BlockWirelessModem.ON, on)); + if (state.getValue(WirelessModemBlock.ON) != on) { + getLevel().setBlockAndUpdate(getBlockPos(), state.setValue(WirelessModemBlock.ON, on)); } } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/WirelessModemPeripheral.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/WirelessModemPeripheral.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/WirelessModemPeripheral.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/WirelessModemPeripheral.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/WirelessNetwork.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/WirelessNetwork.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/WirelessNetwork.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/WirelessNetwork.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/ClientMonitor.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/ClientMonitor.java similarity index 94% rename from src/main/java/dan200/computercraft/shared/peripheral/monitor/ClientMonitor.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/ClientMonitor.java index 97362c4e9..f91df688d 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/monitor/ClientMonitor.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/ClientMonitor.java @@ -13,17 +13,17 @@ import javax.annotation.Nullable; import java.util.function.Supplier; public final class ClientMonitor { - private final TileMonitor origin; + private final MonitorBlockEntity origin; private @Nullable NetworkedTerminal terminal; private boolean terminalChanged; private @Nullable RenderState state; - public ClientMonitor(TileMonitor origin) { + public ClientMonitor(MonitorBlockEntity origin) { this.origin = origin; } - public TileMonitor getOrigin() { + public MonitorBlockEntity getOrigin() { return origin; } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/Expander.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/Expander.java similarity index 91% rename from src/main/java/dan200/computercraft/shared/peripheral/monitor/Expander.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/Expander.java index e600381e4..2d6dd494e 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/monitor/Expander.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/Expander.java @@ -23,11 +23,11 @@ class Expander { private final Direction down; private final Direction right; - private TileMonitor origin; + private MonitorBlockEntity origin; private int width; private int height; - Expander(TileMonitor origin) { + Expander(MonitorBlockEntity origin) { this.origin = origin; width = origin.getWidth(); height = origin.getHeight(); @@ -72,7 +72,7 @@ class Expander { var otherOffset = isPositive ? (useXAxis ? width : height) : -1; var otherPos = useXAxis ? pos.relative(right, otherOffset) : pos.relative(down, otherOffset); var other = level.getBlockEntity(otherPos); - if (!(other instanceof TileMonitor otherMonitor) || !origin.isCompatible(otherMonitor)) return false; + if (!(other instanceof MonitorBlockEntity otherMonitor) || !origin.isCompatible(otherMonitor)) return false; if (useXAxis) { if (otherMonitor.getYIndex() != 0 || otherMonitor.getHeight() != height) return false; @@ -86,7 +86,7 @@ class Expander { if (!isPositive) { var otherOrigin = level.getBlockEntity(otherMonitor.toWorldPos(0, 0)); - if (!(otherOrigin instanceof TileMonitor originMonitor) || !origin.isCompatible(originMonitor)) { + if (!(otherOrigin instanceof MonitorBlockEntity originMonitor) || !origin.isCompatible(originMonitor)) { return false; } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/BlockMonitor.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorBlock.java similarity index 92% rename from src/main/java/dan200/computercraft/shared/peripheral/monitor/BlockMonitor.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorBlock.java index 757628fc4..a40141cf0 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/monitor/BlockMonitor.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorBlock.java @@ -5,7 +5,7 @@ */ package dan200.computercraft.shared.peripheral.monitor; -import dan200.computercraft.shared.common.BlockGeneric; +import dan200.computercraft.shared.common.GenericBlock; import dan200.computercraft.shared.platform.PlatformHelper; import dan200.computercraft.shared.platform.RegistryEntry; import net.minecraft.core.BlockPos; @@ -27,7 +27,7 @@ import net.minecraft.world.level.block.state.properties.EnumProperty; import javax.annotation.Nullable; -public class BlockMonitor extends BlockGeneric { +public class MonitorBlock extends GenericBlock { public static final DirectionProperty ORIENTATION = DirectionProperty.create("orientation", Direction.UP, Direction.DOWN, Direction.NORTH); @@ -35,7 +35,7 @@ public class BlockMonitor extends BlockGeneric { public static final EnumProperty STATE = EnumProperty.create("state", MonitorEdgeState.class); - public BlockMonitor(Properties settings, RegistryEntry> type) { + public MonitorBlock(Properties settings, RegistryEntry> type) { super(settings, type); // TODO: Test underwater - do we need isSolid at all? registerDefaultState(getStateDefinition().any() @@ -86,7 +86,7 @@ public class BlockMonitor extends BlockGeneric { super.setPlacedBy(world, pos, blockState, livingEntity, itemStack); var entity = world.getBlockEntity(pos); - if (entity instanceof TileMonitor monitor && !world.isClientSide) { + if (entity instanceof MonitorBlockEntity monitor && !world.isClientSide) { // Defer the block update if we're being placed by another TE. See #691 if (livingEntity == null || (livingEntity instanceof ServerPlayer player && PlatformHelper.get().isFakePlayer(player))) { monitor.updateNeighborsDeferred(); diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/TileMonitor.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorBlockEntity.java similarity index 93% rename from src/main/java/dan200/computercraft/shared/peripheral/monitor/TileMonitor.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorBlockEntity.java index b9c233b5b..53ba68f97 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/monitor/TileMonitor.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorBlockEntity.java @@ -6,10 +6,11 @@ package dan200.computercraft.shared.peripheral.monitor; import com.google.common.annotations.VisibleForTesting; +import dan200.computercraft.annotations.ForgeOverride; import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.core.terminal.Terminal; -import dan200.computercraft.shared.common.TileGeneric; +import dan200.computercraft.shared.common.GenericTile; import dan200.computercraft.shared.computer.terminal.TerminalState; import dan200.computercraft.shared.config.Config; import dan200.computercraft.shared.util.TickScheduler; @@ -32,8 +33,8 @@ import java.util.HashSet; import java.util.Set; import java.util.function.Consumer; -public class TileMonitor extends TileGeneric { - private static final Logger LOG = LoggerFactory.getLogger(TileMonitor.class); +public class MonitorBlockEntity extends GenericTile { + private static final Logger LOG = LoggerFactory.getLogger(MonitorBlockEntity.class); public static final double RENDER_BORDER = 2.0 / 16.0; public static final double RENDER_MARGIN = 0.5 / 16.0; @@ -72,7 +73,7 @@ public class TileMonitor extends TileGeneric { TickScheduler.Token tickToken = new TickScheduler.Token(this); - public TileMonitor(BlockEntityType type, BlockPos pos, BlockState state, boolean advanced) { + public MonitorBlockEntity(BlockEntityType type, BlockPos pos, BlockState state, boolean advanced) { super(type, pos, state); this.advanced = advanced; } @@ -98,12 +99,6 @@ public class TileMonitor extends TileGeneric { if (clientMonitor != null && xIndex == 0 && yIndex == 0) clientMonitor.destroy(); } - @Override - public void onChunkUnloaded() { - super.onChunkUnloaded(); - if (clientMonitor != null && xIndex == 0 && yIndex == 0) clientMonitor.destroy(); - } - @Override public InteractionResult onActivate(Player player, InteractionHand hand, BlockHitResult hit) { if (!player.isCrouching() && getFront() == hit.getDirection()) { @@ -195,7 +190,7 @@ public class TileMonitor extends TileGeneric { // Otherwise fetch the origin and attempt to get its monitor // Note this may load chunks, but we don't really have a choice here. var te = level.getBlockEntity(toWorldPos(0, 0)); - if (!(te instanceof TileMonitor monitor)) return null; + if (!(te instanceof MonitorBlockEntity monitor)) return null; return serverMonitor = monitor.createServerMonitor(); } @@ -206,7 +201,7 @@ public class TileMonitor extends TileGeneric { if (clientMonitor != null) return clientMonitor; var te = level.getBlockEntity(toWorldPos(0, 0)); - if (!(te instanceof TileMonitor monitor)) return null; + if (!(te instanceof MonitorBlockEntity monitor)) return null; return clientMonitor = monitor.clientMonitor; } @@ -267,7 +262,7 @@ public class TileMonitor extends TileGeneric { private void updateBlockState() { getLevel().setBlock(getBlockPos(), getBlockState() - .setValue(BlockMonitor.STATE, MonitorEdgeState.fromConnections( + .setValue(MonitorBlock.STATE, MonitorEdgeState.fromConnections( yIndex < height - 1, yIndex > 0, xIndex > 0, xIndex < width - 1)), 2); } @@ -277,12 +272,12 @@ public class TileMonitor extends TileGeneric { // Ensure we're actually a monitor block. This _should_ always be the case, but sometimes there's // fun problems with the block being missing on the client. var state = getBlockState(); - return state.hasProperty(BlockMonitor.FACING) ? state.getValue(BlockMonitor.FACING) : Direction.NORTH; + return state.hasProperty(MonitorBlock.FACING) ? state.getValue(MonitorBlock.FACING) : Direction.NORTH; } public Direction getOrientation() { var state = getBlockState(); - return state.hasProperty(BlockMonitor.ORIENTATION) ? state.getValue(BlockMonitor.ORIENTATION) : Direction.NORTH; + return state.hasProperty(MonitorBlock.ORIENTATION) ? state.getValue(MonitorBlock.ORIENTATION) : Direction.NORTH; } public Direction getFront() { @@ -316,7 +311,7 @@ public class TileMonitor extends TileGeneric { return yIndex; } - boolean isCompatible(TileMonitor other) { + boolean isCompatible(MonitorBlockEntity other) { return !other.destroyed && advanced == other.advanced && getOrientation() == other.getOrientation() && getDirection() == other.getDirection(); } @@ -335,7 +330,7 @@ public class TileMonitor extends TileGeneric { if (world == null || !world.isLoaded(pos)) return MonitorState.UNLOADED; var tile = world.getBlockEntity(pos); - if (!(tile instanceof TileMonitor monitor)) return MonitorState.MISSING; + if (!(tile instanceof MonitorBlockEntity monitor)) return MonitorState.MISSING; return isCompatible(monitor) ? MonitorState.present(monitor) : MonitorState.MISSING; } @@ -397,7 +392,7 @@ public class TileMonitor extends TileGeneric { for (var x = 0; x < width; x++) { for (var y = 0; y < height; y++) { var other = getLevel().getBlockEntity(pos.relative(right, x).relative(down, y)); - if (!(other instanceof TileMonitor monitor) || !isCompatible(monitor)) continue; + if (!(other instanceof MonitorBlockEntity monitor) || !isCompatible(monitor)) continue; monitor.xIndex = x; monitor.yIndex = y; @@ -427,7 +422,7 @@ public class TileMonitor extends TileGeneric { Direction down = getDown(), right = getRight(); var origin = toWorldPos(0, 0); - TileMonitor toLeft = null, toAbove = null, toRight = null, toBelow = null; + MonitorBlockEntity toLeft = null, toAbove = null, toRight = null, toBelow = null; if (xIndex > 0) toLeft = tryResizeAt(pos.relative(right, -xIndex), xIndex, 1); if (yIndex > 0) toAbove = tryResizeAt(origin, width, yIndex); if (xIndex < width - 1) toRight = tryResizeAt(pos.relative(right, 1), width - xIndex - 1, 1); @@ -442,9 +437,9 @@ public class TileMonitor extends TileGeneric { } @Nullable - private TileMonitor tryResizeAt(BlockPos pos, int width, int height) { + private MonitorBlockEntity tryResizeAt(BlockPos pos, int width, int height) { var tile = level.getBlockEntity(pos); - if (tile instanceof TileMonitor monitor && isCompatible(monitor)) { + if (tile instanceof MonitorBlockEntity monitor && isCompatible(monitor)) { monitor.resize(width, height); return monitor; } @@ -532,7 +527,7 @@ public class TileMonitor extends TileGeneric { computers.remove(computer); } - @Override + @ForgeOverride public AABB getRenderBoundingBox() { // We attempt to cache the bounding box to save having to do property lookups (and allocations!) on every frame. // Unfortunately the AABB does depend on quite a lot of state, so we need to add a bunch of extra fields - diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorEdgeState.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorEdgeState.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorEdgeState.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorEdgeState.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorPeripheral.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorPeripheral.java similarity index 97% rename from src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorPeripheral.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorPeripheral.java index 8135e46b9..7e269e3b2 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorPeripheral.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorPeripheral.java @@ -40,9 +40,9 @@ import javax.annotation.Nullable; * } */ public class MonitorPeripheral extends TermMethods implements IPeripheral { - private final TileMonitor monitor; + private final MonitorBlockEntity monitor; - public MonitorPeripheral(TileMonitor monitor) { + public MonitorPeripheral(MonitorBlockEntity monitor) { this.monitor = monitor; } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorRenderer.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorRenderer.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorRenderer.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorRenderer.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorState.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorState.java similarity index 79% rename from src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorState.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorState.java index 3a6724699..2b862e5ea 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorState.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorState.java @@ -12,14 +12,14 @@ final class MonitorState { public static final MonitorState MISSING = new MonitorState(State.MISSING, null); private final State state; - private final @Nullable TileMonitor monitor; + private final @Nullable MonitorBlockEntity monitor; - private MonitorState(State state, @Nullable TileMonitor monitor) { + private MonitorState(State state, @Nullable MonitorBlockEntity monitor) { this.state = state; this.monitor = monitor; } - public static MonitorState present(TileMonitor monitor) { + public static MonitorState present(MonitorBlockEntity monitor) { return new MonitorState(State.PRESENT, monitor); } @@ -32,7 +32,7 @@ final class MonitorState { } @Nullable - public TileMonitor getMonitor() { + public MonitorBlockEntity getMonitor() { return monitor; } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorWatcher.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorWatcher.java similarity index 86% rename from src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorWatcher.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorWatcher.java index 1cb245bc2..44f432ae6 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorWatcher.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorWatcher.java @@ -18,12 +18,12 @@ import java.util.ArrayDeque; import java.util.Queue; public final class MonitorWatcher { - private static final Queue watching = new ArrayDeque<>(); + private static final Queue watching = new ArrayDeque<>(); private MonitorWatcher() { } - static void enqueue(TileMonitor monitor) { + static void enqueue(MonitorBlockEntity monitor) { if (monitor.enqueued) return; monitor.enqueued = true; @@ -35,7 +35,7 @@ public final class MonitorWatcher { // Find all origin monitors who are not already on the queue and send the // monitor data to the player. for (var te : chunk.getBlockEntities().values()) { - if (!(te instanceof TileMonitor monitor)) continue; + if (!(te instanceof MonitorBlockEntity monitor)) continue; var serverMonitor = getMonitor(monitor); if (serverMonitor == null || monitor.enqueued) continue; @@ -51,7 +51,7 @@ public final class MonitorWatcher { var limit = Config.monitorBandwidth; var obeyLimit = limit > 0; - TileMonitor tile; + MonitorBlockEntity tile; while ((!obeyLimit || limit > 0) && (tile = watching.poll()) != null) { tile.enqueued = false; var monitor = getMonitor(tile); @@ -73,11 +73,11 @@ public final class MonitorWatcher { } } - private static @Nullable ServerMonitor getMonitor(TileMonitor monitor) { + private static @Nullable ServerMonitor getMonitor(MonitorBlockEntity monitor) { return !monitor.isRemoved() && monitor.getXIndex() == 0 && monitor.getYIndex() == 0 ? monitor.getCachedServerMonitor() : null; } - private static TerminalState getState(TileMonitor tile, ServerMonitor monitor) { + private static TerminalState getState(MonitorBlockEntity tile, ServerMonitor monitor) { var state = tile.cached; if (state == null) state = tile.cached = new TerminalState(monitor.getTerminal()); return state; diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/ServerMonitor.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/ServerMonitor.java similarity index 83% rename from src/main/java/dan200/computercraft/shared/peripheral/monitor/ServerMonitor.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/ServerMonitor.java index 4b2b065c5..03980c516 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/monitor/ServerMonitor.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/ServerMonitor.java @@ -14,7 +14,7 @@ import javax.annotation.Nullable; import java.util.concurrent.atomic.AtomicBoolean; public class ServerMonitor { - private final TileMonitor origin; + private final MonitorBlockEntity origin; private final boolean colour; private int textScale = 2; @@ -22,7 +22,7 @@ public class ServerMonitor { private final AtomicBoolean resized = new AtomicBoolean(false); private final AtomicBoolean changed = new AtomicBoolean(false); - ServerMonitor(boolean colour, TileMonitor origin) { + ServerMonitor(boolean colour, MonitorBlockEntity origin) { this.colour = colour; this.origin = origin; } @@ -34,11 +34,11 @@ public class ServerMonitor { var textScale = this.textScale * 0.5; var termWidth = (int) Math.max( - Math.round((origin.getWidth() - 2.0 * (TileMonitor.RENDER_BORDER + TileMonitor.RENDER_MARGIN)) / (textScale * 6.0 * TileMonitor.RENDER_PIXEL_SCALE)), + Math.round((origin.getWidth() - 2.0 * (MonitorBlockEntity.RENDER_BORDER + MonitorBlockEntity.RENDER_MARGIN)) / (textScale * 6.0 * MonitorBlockEntity.RENDER_PIXEL_SCALE)), 1.0 ); var termHeight = (int) Math.max( - Math.round((origin.getHeight() - 2.0 * (TileMonitor.RENDER_BORDER + TileMonitor.RENDER_MARGIN)) / (textScale * 9.0 * TileMonitor.RENDER_PIXEL_SCALE)), + Math.round((origin.getHeight() - 2.0 * (MonitorBlockEntity.RENDER_BORDER + MonitorBlockEntity.RENDER_MARGIN)) / (textScale * 9.0 * MonitorBlockEntity.RENDER_PIXEL_SCALE)), 1.0 ); diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/XYPair.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/XYPair.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/monitor/XYPair.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/monitor/XYPair.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/printer/BlockPrinter.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/printer/PrinterBlock.java similarity index 94% rename from src/main/java/dan200/computercraft/shared/peripheral/printer/BlockPrinter.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/printer/PrinterBlock.java index 84830c827..6f7b72acb 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/printer/BlockPrinter.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/printer/PrinterBlock.java @@ -6,7 +6,7 @@ package dan200.computercraft.shared.peripheral.printer; import dan200.computercraft.shared.ModRegistry; -import dan200.computercraft.shared.common.BlockGeneric; +import dan200.computercraft.shared.common.GenericBlock; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.stats.Stats; @@ -28,12 +28,12 @@ import net.minecraft.world.level.block.state.properties.DirectionProperty; import javax.annotation.Nullable; -public class BlockPrinter extends BlockGeneric { +public class PrinterBlock extends GenericBlock { private static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; public static final BooleanProperty TOP = BooleanProperty.create("top"); public static final BooleanProperty BOTTOM = BooleanProperty.create("bottom"); - public BlockPrinter(Properties settings) { + public PrinterBlock(Properties settings) { super(settings, ModRegistry.BlockEntities.PRINTER); registerDefaultState(getStateDefinition().any() .setValue(FACING, Direction.NORTH) @@ -80,7 +80,7 @@ public class BlockPrinter extends BlockGeneric { @Override public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { - if (stack.hasCustomHoverName() && world.getBlockEntity(pos) instanceof TilePrinter printer) { + if (stack.hasCustomHoverName() && world.getBlockEntity(pos) instanceof PrinterBlockEntity printer) { printer.customName = stack.getHoverName(); } } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/printer/TilePrinter.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/printer/PrinterBlockEntity.java similarity index 91% rename from src/main/java/dan200/computercraft/shared/peripheral/printer/TilePrinter.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/printer/PrinterBlockEntity.java index 250efd9cc..1cdadab61 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/printer/TilePrinter.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/printer/PrinterBlockEntity.java @@ -7,9 +7,9 @@ package dan200.computercraft.shared.peripheral.printer; import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.core.terminal.Terminal; -import dan200.computercraft.shared.common.TileGeneric; +import dan200.computercraft.shared.common.GenericTile; import dan200.computercraft.shared.computer.terminal.NetworkedTerminal; -import dan200.computercraft.shared.media.items.ItemPrintout; +import dan200.computercraft.shared.media.items.PrintoutItem; import dan200.computercraft.shared.util.ColourUtils; import dan200.computercraft.shared.util.DefaultSidedInventory; import dan200.computercraft.shared.util.WorldUtil; @@ -32,7 +32,7 @@ import net.minecraft.world.phys.Vec3; import javax.annotation.Nullable; -public final class TilePrinter extends TileGeneric implements DefaultSidedInventory, Nameable, MenuProvider { +public final class PrinterBlockEntity extends GenericTile implements DefaultSidedInventory, Nameable, MenuProvider { private static final String NBT_NAME = "CustomName"; private static final String NBT_PRINTING = "Printing"; private static final String NBT_PAGE_TITLE = "PageTitle"; @@ -50,11 +50,11 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent private final NonNullList inventory = NonNullList.withSize(SLOTS, ItemStack.EMPTY); private @Nullable IPeripheral peripheral; - private final NetworkedTerminal page = new NetworkedTerminal(ItemPrintout.LINE_MAX_LENGTH, ItemPrintout.LINES_PER_PAGE, true); + private final NetworkedTerminal page = new NetworkedTerminal(PrintoutItem.LINE_MAX_LENGTH, PrintoutItem.LINES_PER_PAGE, true); private String pageTitle = ""; private boolean printing = false; - public TilePrinter(BlockEntityType type, BlockPos pos, BlockState state) { + public PrinterBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { super(type, pos, state); } @@ -254,7 +254,7 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent static boolean isPaper(ItemStack stack) { var item = stack.getItem(); return item == Items.PAPER - || (item instanceof ItemPrintout printout && printout.getType() == ItemPrintout.Type.PAGE); + || (item instanceof PrintoutItem printout && printout.getType() == PrintoutItem.Type.PAGE); } private boolean canInputPage() { @@ -275,10 +275,10 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent page.setTextColour(dye.getId()); page.clear(); - if (paperStack.getItem() instanceof ItemPrintout) { - pageTitle = ItemPrintout.getTitle(paperStack); - var text = ItemPrintout.getText(paperStack); - var textColour = ItemPrintout.getColours(paperStack); + if (paperStack.getItem() instanceof PrintoutItem) { + pageTitle = PrintoutItem.getTitle(paperStack); + var text = PrintoutItem.getText(paperStack); + var textColour = PrintoutItem.getColours(paperStack); for (var y = 0; y < page.getHeight(); y++) { page.setLine(y, text[y], textColour[y], ""); } @@ -314,7 +314,7 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent colours[i] = page.getTextColourLine(i).toString(); } - var stack = ItemPrintout.createSingleFromTitleAndText(pageTitle, lines, colours); + var stack = PrintoutItem.createSingleFromTitleAndText(pageTitle, lines, colours); for (var slot : BOTTOM_SLOTS) { if (inventory.get(slot).isEmpty()) { setItem(slot, stack); @@ -362,9 +362,9 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent if (remove || level == null) return; var state = getBlockState(); - if (state.getValue(BlockPrinter.TOP) == top && state.getValue(BlockPrinter.BOTTOM) == bottom) return; + if (state.getValue(PrinterBlock.TOP) == top && state.getValue(PrinterBlock.BOTTOM) == bottom) return; - getLevel().setBlockAndUpdate(getBlockPos(), state.setValue(BlockPrinter.TOP, top).setValue(BlockPrinter.BOTTOM, bottom)); + getLevel().setBlockAndUpdate(getBlockPos(), state.setValue(PrinterBlock.TOP, top).setValue(PrinterBlock.BOTTOM, bottom)); } public IPeripheral peripheral() { @@ -395,6 +395,6 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent @Override public AbstractContainerMenu createMenu(int id, Inventory inventory, Player player) { - return new ContainerPrinter(id, inventory, this); + return new PrinterMenu(id, inventory, this); } } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/printer/ContainerPrinter.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/printer/PrinterMenu.java similarity index 84% rename from src/main/java/dan200/computercraft/shared/peripheral/printer/ContainerPrinter.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/printer/PrinterMenu.java index 25f64a363..5c86fa622 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/printer/ContainerPrinter.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/printer/PrinterMenu.java @@ -18,11 +18,11 @@ import net.minecraft.world.inventory.SimpleContainerData; import net.minecraft.world.inventory.Slot; import net.minecraft.world.item.ItemStack; -public class ContainerPrinter extends AbstractContainerMenu { +public class PrinterMenu extends AbstractContainerMenu { private final Container inventory; private final ContainerData properties; - private ContainerPrinter(int id, Inventory player, Container inventory, ContainerData properties) { + private PrinterMenu(int id, Inventory player, Container inventory, ContainerData properties) { super(ModRegistry.Menus.PRINTER.get(), id); this.properties = properties; this.inventory = inventory; @@ -30,11 +30,11 @@ public class ContainerPrinter extends AbstractContainerMenu { addDataSlots(properties); // Ink slot - addSlot(new ValidatingSlot(inventory, 0, 13, 35, TilePrinter::isInk)); + addSlot(new ValidatingSlot(inventory, 0, 13, 35, PrinterBlockEntity::isInk)); // In-tray for (var x = 0; x < 6; x++) { - addSlot(new ValidatingSlot(inventory, x + 1, 61 + x * 18, 22, TilePrinter::isPaper)); + addSlot(new ValidatingSlot(inventory, x + 1, 61 + x * 18, 22, PrinterBlockEntity::isPaper)); } // Out-tray @@ -53,11 +53,11 @@ public class ContainerPrinter extends AbstractContainerMenu { } } - public ContainerPrinter(int id, Inventory player) { - this(id, player, new SimpleContainer(TilePrinter.SLOTS), new SimpleContainerData(1)); + public PrinterMenu(int id, Inventory player) { + this(id, player, new SimpleContainer(PrinterBlockEntity.SLOTS), new SimpleContainerData(1)); } - public ContainerPrinter(int id, Inventory player, TilePrinter printer) { + public PrinterMenu(int id, Inventory player, PrinterBlockEntity printer) { this(id, player, printer, (SingleIntArray) () -> printer.isPrinting() ? 1 : 0); } @@ -81,7 +81,7 @@ public class ContainerPrinter extends AbstractContainerMenu { if (!moveItemStackTo(stack, 13, 49, true)) return ItemStack.EMPTY; } else { // Transfer from inventory to printer - if (TilePrinter.isInk(stack)) { + if (PrinterBlockEntity.isInk(stack)) { if (!moveItemStackTo(stack, 0, 1, false)) return ItemStack.EMPTY; } else { // Move to the paper slots diff --git a/src/main/java/dan200/computercraft/shared/peripheral/printer/PrinterPeripheral.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/printer/PrinterPeripheral.java similarity index 98% rename from src/main/java/dan200/computercraft/shared/peripheral/printer/PrinterPeripheral.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/printer/PrinterPeripheral.java index 01505bd72..e2e6a1f50 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/printer/PrinterPeripheral.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/printer/PrinterPeripheral.java @@ -26,9 +26,9 @@ import java.util.Optional; * @cc.module printer */ public class PrinterPeripheral implements IPeripheral { - private final TilePrinter printer; + private final PrinterBlockEntity printer; - public PrinterPeripheral(TilePrinter printer) { + public PrinterPeripheral(PrinterBlockEntity printer) { this.printer = printer; } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/speaker/DfpwmState.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/speaker/DfpwmState.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/speaker/DfpwmState.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/speaker/DfpwmState.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/speaker/BlockSpeaker.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerBlock.java similarity index 89% rename from src/main/java/dan200/computercraft/shared/peripheral/speaker/BlockSpeaker.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerBlock.java index 3afead662..2841444bf 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/speaker/BlockSpeaker.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerBlock.java @@ -6,7 +6,7 @@ package dan200.computercraft.shared.peripheral.speaker; import dan200.computercraft.shared.ModRegistry; -import dan200.computercraft.shared.common.BlockGeneric; +import dan200.computercraft.shared.common.GenericBlock; import net.minecraft.core.Direction; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.Level; @@ -24,12 +24,12 @@ import net.minecraft.world.level.block.state.properties.DirectionProperty; import javax.annotation.Nullable; -public class BlockSpeaker extends BlockGeneric { +public class SpeakerBlock extends GenericBlock { private static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; - private static final BlockEntityTicker serverTicker = (level, pos, state, drive) -> drive.serverTick(); + private static final BlockEntityTicker serverTicker = (level, pos, state, drive) -> drive.serverTick(); - public BlockSpeaker(Properties settings) { + public SpeakerBlock(Properties settings) { super(settings, ModRegistry.BlockEntities.SPEAKER); registerDefaultState(getStateDefinition().any() .setValue(FACING, Direction.NORTH)); diff --git a/src/main/java/dan200/computercraft/shared/peripheral/speaker/TileSpeaker.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerBlockEntity.java similarity index 84% rename from src/main/java/dan200/computercraft/shared/peripheral/speaker/TileSpeaker.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerBlockEntity.java index cc099db50..6578a0cd6 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/speaker/TileSpeaker.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerBlockEntity.java @@ -7,7 +7,7 @@ package dan200.computercraft.shared.peripheral.speaker; import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.core.util.Nullability; -import dan200.computercraft.shared.common.TileGeneric; +import dan200.computercraft.shared.common.GenericTile; import dan200.computercraft.shared.network.client.SpeakerStopClientMessage; import dan200.computercraft.shared.platform.PlatformHelper; import net.minecraft.core.BlockPos; @@ -17,10 +17,10 @@ import net.minecraft.world.phys.Vec3; import javax.annotation.Nullable; -public class TileSpeaker extends TileGeneric { +public class SpeakerBlockEntity extends GenericTile { private final SpeakerPeripheral peripheral; - public TileSpeaker(BlockEntityType type, BlockPos pos, BlockState state) { + public SpeakerBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { super(type, pos, state); peripheral = new Peripheral(this); } @@ -42,9 +42,9 @@ public class TileSpeaker extends TileGeneric { } private static final class Peripheral extends SpeakerPeripheral { - private final TileSpeaker speaker; + private final SpeakerBlockEntity speaker; - private Peripheral(TileSpeaker speaker) { + private Peripheral(SpeakerBlockEntity speaker) { this.speaker = speaker; } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerPeripheral.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerPeripheral.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerPeripheral.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerPeripheral.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerPosition.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerPosition.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerPosition.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerPosition.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/speaker/UpgradeSpeakerPeripheral.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/speaker/UpgradeSpeakerPeripheral.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/speaker/UpgradeSpeakerPeripheral.java rename to projects/common/src/main/java/dan200/computercraft/shared/peripheral/speaker/UpgradeSpeakerPeripheral.java diff --git a/src/main/java/dan200/computercraft/shared/platform/ComponentAccess.java b/projects/common/src/main/java/dan200/computercraft/shared/platform/ComponentAccess.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/platform/ComponentAccess.java rename to projects/common/src/main/java/dan200/computercraft/shared/platform/ComponentAccess.java diff --git a/src/main/java/dan200/computercraft/shared/platform/ContainerTransfer.java b/projects/common/src/main/java/dan200/computercraft/shared/platform/ContainerTransfer.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/platform/ContainerTransfer.java rename to projects/common/src/main/java/dan200/computercraft/shared/platform/ContainerTransfer.java diff --git a/src/main/java/dan200/computercraft/shared/platform/PlatformHelper.java b/projects/common/src/main/java/dan200/computercraft/shared/platform/PlatformHelper.java similarity index 95% rename from src/main/java/dan200/computercraft/shared/platform/PlatformHelper.java rename to projects/common/src/main/java/dan200/computercraft/shared/platform/PlatformHelper.java index 05ce03506..5fe50b35a 100644 --- a/src/main/java/dan200/computercraft/shared/platform/PlatformHelper.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/platform/PlatformHelper.java @@ -6,12 +6,14 @@ package dan200.computercraft.shared.platform; import com.mojang.authlib.GameProfile; +import com.mojang.brigadier.arguments.ArgumentType; import dan200.computercraft.api.network.wired.IWiredElement; import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.shared.network.NetworkMessage; import dan200.computercraft.shared.network.client.ClientNetworkContext; import dan200.computercraft.shared.network.container.ContainerData; import dan200.computercraft.shared.util.InventoryUtil; +import net.minecraft.commands.synchronization.ArgumentTypeInfo; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Registry; @@ -66,6 +68,13 @@ public interface PlatformHelper extends dan200.computercraft.impl.PlatformHelper return (PlatformHelper) dan200.computercraft.impl.PlatformHelper.get(); } + /** + * Get ComputerCraft's creative tab all its items should appear under. + * + * @return The creative tab. + */ + CreativeModeTab getCreativeTab(); + /** * Wrap a Minecraft registry in our own abstraction layer. * @@ -105,6 +114,18 @@ public interface PlatformHelper extends dan200.computercraft.impl.PlatformHelper */ BlockEntityType createBlockEntityType(BiFunction factory, Block block); + /** + * Register a new argument type. + * + * @param klass The argument type we're registering. + * @param info The argument type info. + * @param The argument type. + * @param The argument type template. + * @param Argument type info + * @return The registered argument type. + */ + , T extends ArgumentTypeInfo.Template, I extends ArgumentTypeInfo> I registerArgumentTypeInfo(Class klass, I info); + /** * Create a menu type which sends additional data when opened. * diff --git a/src/main/java/dan200/computercraft/shared/platform/RecipeIngredients.java b/projects/common/src/main/java/dan200/computercraft/shared/platform/RecipeIngredients.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/platform/RecipeIngredients.java rename to projects/common/src/main/java/dan200/computercraft/shared/platform/RecipeIngredients.java diff --git a/src/main/java/dan200/computercraft/shared/platform/RegistrationHelper.java b/projects/common/src/main/java/dan200/computercraft/shared/platform/RegistrationHelper.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/platform/RegistrationHelper.java rename to projects/common/src/main/java/dan200/computercraft/shared/platform/RegistrationHelper.java diff --git a/src/main/java/dan200/computercraft/shared/platform/Registries.java b/projects/common/src/main/java/dan200/computercraft/shared/platform/Registries.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/platform/Registries.java rename to projects/common/src/main/java/dan200/computercraft/shared/platform/Registries.java diff --git a/src/main/java/dan200/computercraft/shared/platform/RegistryEntry.java b/projects/common/src/main/java/dan200/computercraft/shared/platform/RegistryEntry.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/platform/RegistryEntry.java rename to projects/common/src/main/java/dan200/computercraft/shared/platform/RegistryEntry.java diff --git a/src/main/java/dan200/computercraft/shared/pocket/apis/PocketAPI.java b/projects/common/src/main/java/dan200/computercraft/shared/pocket/apis/PocketAPI.java similarity index 98% rename from src/main/java/dan200/computercraft/shared/pocket/apis/PocketAPI.java rename to projects/common/src/main/java/dan200/computercraft/shared/pocket/apis/PocketAPI.java index bbb490e61..2abd08536 100644 --- a/src/main/java/dan200/computercraft/shared/pocket/apis/PocketAPI.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/pocket/apis/PocketAPI.java @@ -8,7 +8,7 @@ package dan200.computercraft.shared.pocket.apis; import dan200.computercraft.api.lua.ILuaAPI; import dan200.computercraft.api.lua.LuaFunction; import dan200.computercraft.api.pocket.IPocketUpgrade; -import dan200.computercraft.shared.PocketUpgrades; +import dan200.computercraft.impl.PocketUpgrades; import dan200.computercraft.shared.pocket.core.PocketServerComputer; import net.minecraft.core.NonNullList; import net.minecraft.world.entity.player.Player; diff --git a/src/main/java/dan200/computercraft/shared/pocket/core/PocketServerComputer.java b/projects/common/src/main/java/dan200/computercraft/shared/pocket/core/PocketServerComputer.java similarity index 97% rename from src/main/java/dan200/computercraft/shared/pocket/core/PocketServerComputer.java rename to projects/common/src/main/java/dan200/computercraft/shared/pocket/core/PocketServerComputer.java index 79c62feb6..4fe1157ab 100644 --- a/src/main/java/dan200/computercraft/shared/pocket/core/PocketServerComputer.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/pocket/core/PocketServerComputer.java @@ -16,7 +16,7 @@ import dan200.computercraft.shared.config.Config; import dan200.computercraft.shared.network.client.PocketComputerDataMessage; import dan200.computercraft.shared.network.client.PocketComputerDeletedClientMessage; import dan200.computercraft.shared.platform.PlatformHelper; -import dan200.computercraft.shared.pocket.items.ItemPocketComputer; +import dan200.computercraft.shared.pocket.items.PocketComputerItem; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; @@ -90,7 +90,7 @@ public class PocketServerComputer extends ServerComputer implements IPocketAcces @Override public CompoundTag getUpgradeNBTData() { - return ItemPocketComputer.getUpgradeInfo(stack); + return PocketComputerItem.getUpgradeInfo(stack); } @Override @@ -124,7 +124,7 @@ public class PocketServerComputer extends ServerComputer implements IPocketAcces if (this.upgrade == upgrade) return; synchronized (this) { - ItemPocketComputer.setUpgrade(stack, upgrade); + PocketComputerItem.setUpgrade(stack, upgrade); updateUpgradeNBTData(); this.upgrade = upgrade; invalidatePeripheral(); diff --git a/src/main/java/dan200/computercraft/shared/pocket/inventory/PocketComputerMenuProvider.java b/projects/common/src/main/java/dan200/computercraft/shared/pocket/inventory/PocketComputerMenuProvider.java similarity index 86% rename from src/main/java/dan200/computercraft/shared/pocket/inventory/PocketComputerMenuProvider.java rename to projects/common/src/main/java/dan200/computercraft/shared/pocket/inventory/PocketComputerMenuProvider.java index a192658c6..dee36ebef 100644 --- a/src/main/java/dan200/computercraft/shared/pocket/inventory/PocketComputerMenuProvider.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/pocket/inventory/PocketComputerMenuProvider.java @@ -8,7 +8,7 @@ package dan200.computercraft.shared.pocket.inventory; import dan200.computercraft.shared.ModRegistry; import dan200.computercraft.shared.computer.core.ServerComputer; import dan200.computercraft.shared.computer.inventory.ComputerMenuWithoutInventory; -import dan200.computercraft.shared.pocket.items.ItemPocketComputer; +import dan200.computercraft.shared.pocket.items.PocketComputerItem; import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; import net.minecraft.world.MenuProvider; @@ -24,11 +24,11 @@ import static dan200.computercraft.core.util.Nullability.assertNonNull; public class PocketComputerMenuProvider implements MenuProvider { private final ServerComputer computer; private final Component name; - private final ItemPocketComputer item; + private final PocketComputerItem item; private final InteractionHand hand; private final boolean isTypingOnly; - public PocketComputerMenuProvider(ServerComputer computer, ItemStack stack, ItemPocketComputer item, InteractionHand hand, boolean isTypingOnly) { + public PocketComputerMenuProvider(ServerComputer computer, ItemStack stack, PocketComputerItem item, InteractionHand hand, boolean isTypingOnly) { this.computer = computer; name = stack.getHoverName(); this.item = item; @@ -49,7 +49,7 @@ public class PocketComputerMenuProvider implements MenuProvider { isTypingOnly ? ModRegistry.Menus.POCKET_COMPUTER_NO_TERM.get() : ModRegistry.Menus.POCKET_COMPUTER.get(), id, inventory, p -> { var stack = p.getItemInHand(hand); - return stack.getItem() == item && ItemPocketComputer.getServerComputer(assertNonNull(entity.level.getServer()), stack) == computer; + return stack.getItem() == item && PocketComputerItem.getServerComputer(assertNonNull(entity.level.getServer()), stack) == computer; }, computer, item.getFamily() ); diff --git a/src/main/java/dan200/computercraft/shared/pocket/items/ItemPocketComputer.java b/projects/common/src/main/java/dan200/computercraft/shared/pocket/items/PocketComputerItem.java similarity index 97% rename from src/main/java/dan200/computercraft/shared/pocket/items/ItemPocketComputer.java rename to projects/common/src/main/java/dan200/computercraft/shared/pocket/items/PocketComputerItem.java index 244cf0f9a..5c52dbb01 100644 --- a/src/main/java/dan200/computercraft/shared/pocket/items/ItemPocketComputer.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/pocket/items/PocketComputerItem.java @@ -6,12 +6,13 @@ package dan200.computercraft.shared.pocket.items; import com.google.common.base.Objects; +import dan200.computercraft.annotations.ForgeOverride; import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.api.filesystem.IMount; import dan200.computercraft.api.media.IMedia; import dan200.computercraft.api.pocket.IPocketUpgrade; import dan200.computercraft.core.computer.ComputerSide; -import dan200.computercraft.shared.PocketUpgrades; +import dan200.computercraft.impl.PocketUpgrades; import dan200.computercraft.shared.common.IColouredItem; import dan200.computercraft.shared.computer.core.ComputerFamily; import dan200.computercraft.shared.computer.core.ServerContext; @@ -44,7 +45,7 @@ import net.minecraft.world.level.Level; import javax.annotation.Nullable; import java.util.List; -public class ItemPocketComputer extends Item implements IComputerItem, IMedia, IColouredItem { +public class PocketComputerItem extends Item implements IComputerItem, IMedia, IColouredItem { private static final String NBT_UPGRADE = "Upgrade"; private static final String NBT_UPGRADE_INFO = "UpgradeInfo"; public static final String NBT_LIGHT = "Light"; @@ -55,7 +56,7 @@ public class ItemPocketComputer extends Item implements IComputerItem, IMedia, I private final ComputerFamily family; - public ItemPocketComputer(Properties settings, ComputerFamily family) { + public PocketComputerItem(Properties settings, ComputerFamily family) { super(settings); this.family = family; } @@ -121,7 +122,7 @@ public class ItemPocketComputer extends Item implements IComputerItem, IMedia, I if (changed && inventory != null) inventory.setChanged(); } - @Override + @ForgeOverride public boolean onEntityItemUpdate(ItemStack stack, ItemEntity entity) { if (entity.level.isClientSide || entity.level.getServer() == null) return false; @@ -178,7 +179,7 @@ public class ItemPocketComputer extends Item implements IComputerItem, IMedia, I } @Nullable - @Override + @ForgeOverride public String getCreatorModId(ItemStack stack) { var upgrade = getUpgrade(stack); if (upgrade != null) { @@ -188,7 +189,7 @@ public class ItemPocketComputer extends Item implements IComputerItem, IMedia, I if (mod != null && !mod.equals(ComputerCraftAPI.MOD_ID)) return mod; } - return super.getCreatorModId(stack); + return ComputerCraftAPI.MOD_ID; } public PocketServerComputer createServerComputer(ServerLevel world, Entity entity, @Nullable Container inventory, ItemStack stack) { diff --git a/src/main/java/dan200/computercraft/shared/pocket/items/PocketComputerItemFactory.java b/projects/common/src/main/java/dan200/computercraft/shared/pocket/items/PocketComputerItemFactory.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/pocket/items/PocketComputerItemFactory.java rename to projects/common/src/main/java/dan200/computercraft/shared/pocket/items/PocketComputerItemFactory.java diff --git a/src/main/java/dan200/computercraft/shared/pocket/peripherals/PocketModem.java b/projects/common/src/main/java/dan200/computercraft/shared/pocket/peripherals/PocketModem.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/pocket/peripherals/PocketModem.java rename to projects/common/src/main/java/dan200/computercraft/shared/pocket/peripherals/PocketModem.java diff --git a/src/main/java/dan200/computercraft/shared/pocket/peripherals/PocketModemPeripheral.java b/projects/common/src/main/java/dan200/computercraft/shared/pocket/peripherals/PocketModemPeripheral.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/pocket/peripherals/PocketModemPeripheral.java rename to projects/common/src/main/java/dan200/computercraft/shared/pocket/peripherals/PocketModemPeripheral.java diff --git a/src/main/java/dan200/computercraft/shared/pocket/peripherals/PocketSpeaker.java b/projects/common/src/main/java/dan200/computercraft/shared/pocket/peripherals/PocketSpeaker.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/pocket/peripherals/PocketSpeaker.java rename to projects/common/src/main/java/dan200/computercraft/shared/pocket/peripherals/PocketSpeaker.java diff --git a/src/main/java/dan200/computercraft/shared/pocket/peripherals/PocketSpeakerPeripheral.java b/projects/common/src/main/java/dan200/computercraft/shared/pocket/peripherals/PocketSpeakerPeripheral.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/pocket/peripherals/PocketSpeakerPeripheral.java rename to projects/common/src/main/java/dan200/computercraft/shared/pocket/peripherals/PocketSpeakerPeripheral.java diff --git a/src/main/java/dan200/computercraft/shared/pocket/recipes/PocketComputerUpgradeRecipe.java b/projects/common/src/main/java/dan200/computercraft/shared/pocket/recipes/PocketComputerUpgradeRecipe.java similarity index 92% rename from src/main/java/dan200/computercraft/shared/pocket/recipes/PocketComputerUpgradeRecipe.java rename to projects/common/src/main/java/dan200/computercraft/shared/pocket/recipes/PocketComputerUpgradeRecipe.java index 5aa12f310..a1419cd57 100644 --- a/src/main/java/dan200/computercraft/shared/pocket/recipes/PocketComputerUpgradeRecipe.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/pocket/recipes/PocketComputerUpgradeRecipe.java @@ -6,10 +6,10 @@ package dan200.computercraft.shared.pocket.recipes; import dan200.computercraft.api.pocket.IPocketUpgrade; +import dan200.computercraft.impl.PocketUpgrades; import dan200.computercraft.shared.ModRegistry; -import dan200.computercraft.shared.PocketUpgrades; import dan200.computercraft.shared.computer.core.ComputerFamily; -import dan200.computercraft.shared.pocket.items.ItemPocketComputer; +import dan200.computercraft.shared.pocket.items.PocketComputerItem; import dan200.computercraft.shared.pocket.items.PocketComputerItemFactory; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.inventory.CraftingContainer; @@ -48,7 +48,7 @@ public final class PocketComputerUpgradeRecipe extends CustomRecipe { for (var y = 0; y < inventory.getHeight(); y++) { for (var x = 0; x < inventory.getWidth(); x++) { var item = inventory.getItem(x + y * inventory.getWidth()); - if (!item.isEmpty() && item.getItem() instanceof ItemPocketComputer) { + if (!item.isEmpty() && item.getItem() instanceof PocketComputerItem) { computer = item; computerX = x; computerY = y; @@ -59,8 +59,8 @@ public final class PocketComputerUpgradeRecipe extends CustomRecipe { if (computer.isEmpty()) return ItemStack.EMPTY; - var itemComputer = (ItemPocketComputer) computer.getItem(); - if (ItemPocketComputer.getUpgrade(computer) != null) return ItemStack.EMPTY; + var itemComputer = (PocketComputerItem) computer.getItem(); + if (PocketComputerItem.getUpgrade(computer) != null) return ItemStack.EMPTY; // Check for upgrades around the item IPocketUpgrade upgrade = null; diff --git a/src/main/java/dan200/computercraft/shared/turtle/FurnaceRefuelHandler.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/FurnaceRefuelHandler.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/FurnaceRefuelHandler.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/FurnaceRefuelHandler.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/TurtleUtil.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/TurtleUtil.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/TurtleUtil.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/TurtleUtil.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/apis/TurtleAPI.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/apis/TurtleAPI.java similarity index 99% rename from src/main/java/dan200/computercraft/shared/turtle/apis/TurtleAPI.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/apis/TurtleAPI.java index e2cc47926..81400f4ba 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/apis/TurtleAPI.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/turtle/apis/TurtleAPI.java @@ -13,8 +13,7 @@ import dan200.computercraft.api.turtle.TurtleCommandResult; import dan200.computercraft.api.turtle.TurtleSide; import dan200.computercraft.core.apis.IAPIEnvironment; import dan200.computercraft.core.metrics.Metrics; -import dan200.computercraft.shared.peripheral.generic.data.ItemData; -import dan200.computercraft.shared.peripheral.generic.methods.InventoryMethods; +import dan200.computercraft.shared.details.ItemDetails; import dan200.computercraft.shared.turtle.core.*; import java.util.HashMap; @@ -756,7 +755,7 @@ public class TurtleAPI implements ILuaAPI { * -- count = 13, * -- } * } - * @see InventoryMethods#getItemDetail Describes the information returned by a detailed query. + * @see dan200.computercraft.shared.peripheral.generic.methods.InventoryMethods#getItemDetail Describes the information returned by a detailed query. */ @LuaFunction public final MethodResult getItemDetail(ILuaContext context, Optional slot, Optional detailed) throws LuaException { @@ -772,7 +771,7 @@ public class TurtleAPI implements ILuaAPI { var table = detailed ? VanillaDetailRegistries.ITEM_STACK.getDetails(stack) - : ItemData.fillBasicSafe(new HashMap<>(), stack); + : ItemDetails.fillBasicSafe(new HashMap<>(), stack); return new Object[]{ table }; } diff --git a/src/main/java/dan200/computercraft/shared/turtle/blocks/ITurtleTile.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/blocks/ITurtleBlockEntity.java similarity index 85% rename from src/main/java/dan200/computercraft/shared/turtle/blocks/ITurtleTile.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/blocks/ITurtleBlockEntity.java index 5d480e460..02c2452d7 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/blocks/ITurtleTile.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/turtle/blocks/ITurtleBlockEntity.java @@ -8,13 +8,13 @@ package dan200.computercraft.shared.turtle.blocks; import dan200.computercraft.api.turtle.ITurtleAccess; import dan200.computercraft.api.turtle.ITurtleUpgrade; import dan200.computercraft.api.turtle.TurtleSide; -import dan200.computercraft.shared.computer.blocks.IComputerTile; +import dan200.computercraft.shared.computer.blocks.IComputerBlockEntity; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.phys.Vec3; import javax.annotation.Nullable; -public interface ITurtleTile extends IComputerTile { +public interface ITurtleBlockEntity extends IComputerBlockEntity { int getColour(); @Nullable diff --git a/src/main/java/dan200/computercraft/shared/turtle/blocks/BlockTurtle.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/blocks/TurtleBlock.java similarity index 84% rename from src/main/java/dan200/computercraft/shared/turtle/blocks/BlockTurtle.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/blocks/TurtleBlock.java index 8888ce4ab..17ab2e175 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/blocks/BlockTurtle.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/turtle/blocks/TurtleBlock.java @@ -5,9 +5,11 @@ */ package dan200.computercraft.shared.turtle.blocks; +import dan200.computercraft.annotations.ForgeOverride; import dan200.computercraft.api.turtle.TurtleSide; -import dan200.computercraft.shared.computer.blocks.BlockComputerBase; -import dan200.computercraft.shared.computer.blocks.TileComputerBase; +import dan200.computercraft.mixin.ExplosionAccessor; +import dan200.computercraft.shared.computer.blocks.AbstractComputerBlock; +import dan200.computercraft.shared.computer.blocks.AbstractComputerBlockEntity; import dan200.computercraft.shared.computer.core.ComputerFamily; import dan200.computercraft.shared.platform.RegistryEntry; import dan200.computercraft.shared.turtle.core.TurtleBrain; @@ -44,7 +46,7 @@ import javax.annotation.Nullable; import static dan200.computercraft.shared.util.WaterloggableHelpers.WATERLOGGED; import static dan200.computercraft.shared.util.WaterloggableHelpers.getFluidStateForPlacement; -public class BlockTurtle extends BlockComputerBase implements SimpleWaterloggedBlock { +public class TurtleBlock extends AbstractComputerBlock implements SimpleWaterloggedBlock { public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; private static final VoxelShape DEFAULT_SHAPE = Shapes.box( @@ -52,9 +54,9 @@ public class BlockTurtle extends BlockComputerBase implements Simple 0.875, 0.875, 0.875 ); - private final BlockEntityTicker clientTicker = (level, pos, state, computer) -> computer.clientTick(); + private final BlockEntityTicker clientTicker = (level, pos, state, computer) -> computer.clientTick(); - public BlockTurtle(Properties settings, ComputerFamily family, RegistryEntry> type) { + public TurtleBlock(Properties settings, ComputerFamily family, RegistryEntry> type) { super(settings, family, type); registerDefaultState(getStateDefinition().any() .setValue(FACING, Direction.NORTH) @@ -89,7 +91,7 @@ public class BlockTurtle extends BlockComputerBase implements Simple @Deprecated public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { var tile = world.getBlockEntity(pos); - var offset = tile instanceof TileTurtle turtle ? turtle.getRenderOffset(1.0f) : Vec3.ZERO; + var offset = tile instanceof TurtleBlockEntity turtle ? turtle.getRenderOffset(1.0f) : Vec3.ZERO; return offset.equals(Vec3.ZERO) ? DEFAULT_SHAPE : DEFAULT_SHAPE.move(offset.x, offset.y, offset.z); } @@ -119,7 +121,7 @@ public class BlockTurtle extends BlockComputerBase implements Simple super.setPlacedBy(world, pos, state, entity, stack); var tile = world.getBlockEntity(pos); - if (!world.isClientSide && tile instanceof TileTurtle turtle) { + if (!world.isClientSide && tile instanceof TurtleBlockEntity turtle) { if (entity instanceof Player player) turtle.setOwningPlayer(player.getGameProfile()); if (stack.getItem() instanceof ITurtleItem item) { @@ -141,19 +143,19 @@ public class BlockTurtle extends BlockComputerBase implements Simple } } - @Override + @ForgeOverride public float getExplosionResistance(BlockState state, BlockGetter world, BlockPos pos, Explosion explosion) { - var exploder = explosion.getExploder(); + var exploder = ((ExplosionAccessor) explosion).computercraft$getExploder(); if (getFamily() == ComputerFamily.ADVANCED || exploder instanceof LivingEntity || exploder instanceof AbstractHurtingProjectile) { return 2000; } - return super.getExplosionResistance(state, world, pos, explosion); + return explosionResistance; } @Override - protected ItemStack getItem(TileComputerBase tile) { - return tile instanceof TileTurtle turtle ? TurtleItemFactory.create(turtle) : ItemStack.EMPTY; + protected ItemStack getItem(AbstractComputerBlockEntity tile) { + return tile instanceof TurtleBlockEntity turtle ? TurtleItemFactory.create(turtle) : ItemStack.EMPTY; } @Override diff --git a/src/main/java/dan200/computercraft/shared/turtle/blocks/TileTurtle.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/blocks/TurtleBlockEntity.java similarity index 95% rename from src/main/java/dan200/computercraft/shared/turtle/blocks/TileTurtle.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/blocks/TurtleBlockEntity.java index d89ae9d03..4254caf34 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/blocks/TileTurtle.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/turtle/blocks/TurtleBlockEntity.java @@ -11,16 +11,16 @@ import dan200.computercraft.api.turtle.ITurtleAccess; import dan200.computercraft.api.turtle.ITurtleUpgrade; import dan200.computercraft.api.turtle.TurtleSide; import dan200.computercraft.core.computer.ComputerSide; -import dan200.computercraft.shared.common.TileGeneric; +import dan200.computercraft.shared.common.GenericTile; +import dan200.computercraft.shared.computer.blocks.AbstractComputerBlockEntity; import dan200.computercraft.shared.computer.blocks.ComputerPeripheral; -import dan200.computercraft.shared.computer.blocks.TileComputerBase; import dan200.computercraft.shared.computer.core.ComputerFamily; import dan200.computercraft.shared.computer.core.ComputerState; import dan200.computercraft.shared.computer.core.ServerComputer; import dan200.computercraft.shared.config.Config; import dan200.computercraft.shared.turtle.apis.TurtleAPI; import dan200.computercraft.shared.turtle.core.TurtleBrain; -import dan200.computercraft.shared.turtle.inventory.ContainerTurtle; +import dan200.computercraft.shared.turtle.inventory.TurtleMenu; import dan200.computercraft.shared.util.DefaultInventory; import dan200.computercraft.shared.util.DirectionUtil; import dan200.computercraft.shared.util.RedstoneUtil; @@ -49,7 +49,7 @@ import net.minecraft.world.phys.Vec3; import javax.annotation.Nullable; import java.util.Collections; -public class TileTurtle extends TileComputerBase implements ITurtleTile, DefaultInventory { +public class TurtleBlockEntity extends AbstractComputerBlockEntity implements ITurtleBlockEntity, DefaultInventory { public static final int INVENTORY_SIZE = 16; public static final int INVENTORY_WIDTH = 4; public static final int INVENTORY_HEIGHT = 4; @@ -68,7 +68,7 @@ public class TileTurtle extends TileComputerBase implements ITurtleTile, Default private @Nullable IPeripheral peripheral; private @Nullable Runnable onMoved; - public TileTurtle(BlockEntityType type, BlockPos pos, BlockState state, ComputerFamily family) { + public TurtleBlockEntity(BlockEntityType type, BlockPos pos, BlockState state, ComputerFamily family) { super(type, pos, state, family); } @@ -257,12 +257,12 @@ public class TileTurtle extends TileComputerBase implements ITurtleTile, Default @Override public Direction getDirection() { - return getBlockState().getValue(BlockTurtle.FACING); + return getBlockState().getValue(TurtleBlock.FACING); } public void setDirection(Direction dir) { if (dir.getAxis() == Direction.Axis.Y) dir = Direction.NORTH; - level.setBlockAndUpdate(worldPosition, getBlockState().setValue(BlockTurtle.FACING, dir)); + level.setBlockAndUpdate(worldPosition, getBlockState().setValue(TurtleBlock.FACING, dir)); updateOutput(); updateInputsImmediately(); @@ -436,7 +436,7 @@ public class TileTurtle extends TileComputerBase implements ITurtleTile, Default return upgrade != null && upgrade.getType().isPeripheral(); } - public void transferStateFrom(TileTurtle copy) { + public void transferStateFrom(TurtleBlockEntity copy) { super.transferStateFrom(copy); Collections.copy(inventory, copy.inventory); Collections.copy(previousInventory, copy.previousInventory); @@ -463,6 +463,6 @@ public class TileTurtle extends TileComputerBase implements ITurtleTile, Default @Nullable @Override public AbstractContainerMenu createMenu(int id, Inventory inventory, Player player) { - return ContainerTurtle.ofBrain(id, inventory, brain); + return TurtleMenu.ofBrain(id, inventory, brain); } } diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/InteractDirection.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/InteractDirection.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/core/InteractDirection.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/core/InteractDirection.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/MoveDirection.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/MoveDirection.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/core/MoveDirection.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/core/MoveDirection.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurnDirection.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurnDirection.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/core/TurnDirection.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurnDirection.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleBrain.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleBrain.java similarity index 98% rename from src/main/java/dan200/computercraft/shared/turtle/core/TurtleBrain.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleBrain.java index 25972df66..2cdab16fd 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleBrain.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleBrain.java @@ -13,12 +13,12 @@ import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.turtle.*; import dan200.computercraft.core.computer.ComputerSide; import dan200.computercraft.core.util.Colour; -import dan200.computercraft.shared.TurtleUpgrades; +import dan200.computercraft.impl.TurtleUpgrades; import dan200.computercraft.shared.computer.core.ComputerFamily; import dan200.computercraft.shared.computer.core.ServerComputer; import dan200.computercraft.shared.config.Config; import dan200.computercraft.shared.platform.PlatformHelper; -import dan200.computercraft.shared.turtle.blocks.TileTurtle; +import dan200.computercraft.shared.turtle.blocks.TurtleBlockEntity; import dan200.computercraft.shared.util.Holiday; import dan200.computercraft.shared.util.HolidayUtil; import dan200.computercraft.shared.util.InventoryDelegate; @@ -62,7 +62,7 @@ public class TurtleBrain implements ITurtleAccess { public static final Predicate PUSHABLE_ENTITY = entity -> !entity.isSpectator() && entity.getPistonPushReaction() != PushReaction.IGNORE; - private TileTurtle owner; + private TurtleBlockEntity owner; private @Nullable GameProfile owningPlayer; private final Container inventory = (InventoryDelegate) () -> owner; @@ -86,15 +86,15 @@ public class TurtleBrain implements ITurtleAccess { @Nullable TurtlePlayer cachedPlayer; - public TurtleBrain(TileTurtle turtle) { + public TurtleBrain(TurtleBlockEntity turtle) { owner = turtle; } - public void setOwner(TileTurtle owner) { + public void setOwner(TurtleBlockEntity owner) { this.owner = owner; } - public TileTurtle getOwner() { + public TurtleBlockEntity getOwner() { return owner; } @@ -288,7 +288,7 @@ public class TurtleBrain implements ITurtleAccess { var block = world.getBlockState(pos).getBlock(); if (block == oldBlock.getBlock()) { var newTile = world.getBlockEntity(pos); - if (newTile instanceof TileTurtle newTurtle) { + if (newTile instanceof TurtleBlockEntity newTurtle) { // Copy the old turtle state into the new turtle newTurtle.setLevel(world); newTurtle.transferStateFrom(oldOwner); diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleCommandQueueEntry.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleCommandQueueEntry.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/core/TurtleCommandQueueEntry.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleCommandQueueEntry.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleCompareCommand.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleCompareCommand.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/core/TurtleCompareCommand.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleCompareCommand.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleCompareToCommand.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleCompareToCommand.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/core/TurtleCompareToCommand.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleCompareToCommand.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleCraftCommand.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleCraftCommand.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/core/TurtleCraftCommand.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleCraftCommand.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleDetectCommand.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleDetectCommand.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/core/TurtleDetectCommand.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleDetectCommand.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleDropCommand.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleDropCommand.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/core/TurtleDropCommand.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleDropCommand.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleEquipCommand.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleEquipCommand.java similarity index 97% rename from src/main/java/dan200/computercraft/shared/turtle/core/TurtleEquipCommand.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleEquipCommand.java index e2aaec1c6..3ee641128 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleEquipCommand.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleEquipCommand.java @@ -6,7 +6,7 @@ package dan200.computercraft.shared.turtle.core; import dan200.computercraft.api.turtle.*; -import dan200.computercraft.shared.TurtleUpgrades; +import dan200.computercraft.impl.TurtleUpgrades; import dan200.computercraft.shared.turtle.TurtleUtil; import net.minecraft.world.item.ItemStack; diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleInspectCommand.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleInspectCommand.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/core/TurtleInspectCommand.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleInspectCommand.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleMoveCommand.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleMoveCommand.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/core/TurtleMoveCommand.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleMoveCommand.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlayer.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlayer.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlayer.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlayer.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleRefuelCommand.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleRefuelCommand.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/core/TurtleRefuelCommand.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleRefuelCommand.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleSuckCommand.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleSuckCommand.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/core/TurtleSuckCommand.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleSuckCommand.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleToolCommand.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleToolCommand.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/core/TurtleToolCommand.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleToolCommand.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleTransferToCommand.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleTransferToCommand.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/core/TurtleTransferToCommand.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleTransferToCommand.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleTurnCommand.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleTurnCommand.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/core/TurtleTurnCommand.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/core/TurtleTurnCommand.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/inventory/ContainerTurtle.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/inventory/TurtleMenu.java similarity index 83% rename from src/main/java/dan200/computercraft/shared/turtle/inventory/ContainerTurtle.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/inventory/TurtleMenu.java index ec399b64f..75a9a1476 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/inventory/ContainerTurtle.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/turtle/inventory/TurtleMenu.java @@ -5,13 +5,12 @@ */ package dan200.computercraft.shared.turtle.inventory; -import dan200.computercraft.client.gui.widgets.ComputerSidebar; import dan200.computercraft.shared.ModRegistry; import dan200.computercraft.shared.computer.core.ComputerFamily; import dan200.computercraft.shared.computer.core.ServerComputer; -import dan200.computercraft.shared.computer.inventory.ContainerComputerBase; +import dan200.computercraft.shared.computer.inventory.AbstractComputerMenu; import dan200.computercraft.shared.network.container.ComputerContainerData; -import dan200.computercraft.shared.turtle.blocks.TileTurtle; +import dan200.computercraft.shared.turtle.blocks.TurtleBlockEntity; import dan200.computercraft.shared.turtle.core.TurtleBrain; import dan200.computercraft.shared.util.SingleIntArray; import net.minecraft.world.Container; @@ -26,15 +25,15 @@ import net.minecraft.world.item.ItemStack; import javax.annotation.Nullable; import java.util.function.Predicate; -public final class ContainerTurtle extends ContainerComputerBase { +public final class TurtleMenu extends AbstractComputerMenu { public static final int BORDER = 8; public static final int PLAYER_START_Y = 134; - public static final int TURTLE_START_X = ComputerSidebar.WIDTH + 175; - public static final int PLAYER_START_X = ComputerSidebar.WIDTH + BORDER; + public static final int TURTLE_START_X = SIDEBAR_WIDTH + 175; + public static final int PLAYER_START_X = SIDEBAR_WIDTH + BORDER; private final ContainerData data; - private ContainerTurtle( + private TurtleMenu( int id, Predicate canUse, ComputerFamily family, @Nullable ServerComputer computer, @Nullable ComputerContainerData menuData, Inventory playerInventory, Container inventory, ContainerData data ) { @@ -62,17 +61,17 @@ public final class ContainerTurtle extends ContainerComputerBase { } } - public static ContainerTurtle ofBrain(int id, Inventory player, TurtleBrain turtle) { - return new ContainerTurtle( + public static TurtleMenu ofBrain(int id, Inventory player, TurtleBrain turtle) { + return new TurtleMenu( // Laziness in turtle.getOwner() is important here! id, p -> turtle.getOwner().stillValid(p), turtle.getFamily(), turtle.getOwner().createServerComputer(), null, player, turtle.getInventory(), (SingleIntArray) turtle::getSelectedSlot ); } - public static ContainerTurtle ofMenuData(int id, Inventory player, ComputerContainerData data) { - return new ContainerTurtle( - id, x -> true, data.family(), null, data, player, new SimpleContainer(TileTurtle.INVENTORY_SIZE), new SimpleContainerData(1) + public static TurtleMenu ofMenuData(int id, Inventory player, ComputerContainerData data) { + return new TurtleMenu( + id, x -> true, data.family(), null, data, player, new SimpleContainer(TurtleBlockEntity.INVENTORY_SIZE), new SimpleContainerData(1) ); } diff --git a/src/main/java/dan200/computercraft/shared/turtle/items/ITurtleItem.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/items/ITurtleItem.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/items/ITurtleItem.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/items/ITurtleItem.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/items/ItemTurtle.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/items/TurtleItem.java similarity index 92% rename from src/main/java/dan200/computercraft/shared/turtle/items/ItemTurtle.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/items/TurtleItem.java index 85f501819..6dbc02b0d 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/items/ItemTurtle.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/turtle/items/TurtleItem.java @@ -5,14 +5,15 @@ */ package dan200.computercraft.shared.turtle.items; +import dan200.computercraft.annotations.ForgeOverride; import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.api.turtle.ITurtleUpgrade; import dan200.computercraft.api.turtle.TurtleSide; -import dan200.computercraft.shared.TurtleUpgrades; +import dan200.computercraft.impl.TurtleUpgrades; import dan200.computercraft.shared.common.IColouredItem; import dan200.computercraft.shared.computer.core.ComputerFamily; -import dan200.computercraft.shared.computer.items.ItemComputerBase; -import dan200.computercraft.shared.turtle.blocks.BlockTurtle; +import dan200.computercraft.shared.computer.items.AbstractComputerItem; +import dan200.computercraft.shared.turtle.blocks.TurtleBlock; import net.minecraft.core.NonNullList; import net.minecraft.core.cauldron.CauldronInteraction; import net.minecraft.network.chat.Component; @@ -26,8 +27,8 @@ import javax.annotation.Nullable; import static dan200.computercraft.shared.turtle.core.TurtleBrain.*; -public class ItemTurtle extends ItemComputerBase implements ITurtleItem { - public ItemTurtle(BlockTurtle block, Properties settings) { +public class TurtleItem extends AbstractComputerItem implements ITurtleItem { + public TurtleItem(TurtleBlock block, Properties settings) { super(block, settings); } @@ -89,7 +90,7 @@ public class ItemTurtle extends ItemComputerBase implements ITurtleItem { } @Nullable - @Override + @ForgeOverride public String getCreatorModId(ItemStack stack) { // Determine our "creator mod" from the upgrades. We attempt to find the first non-vanilla/non-CC // upgrade (starting from the left). @@ -106,7 +107,7 @@ public class ItemTurtle extends ItemComputerBase implements ITurtleItem { if (mod != null && !mod.equals(ComputerCraftAPI.MOD_ID)) return mod; } - return super.getCreatorModId(stack); + return ComputerCraftAPI.MOD_ID; } @Override diff --git a/src/main/java/dan200/computercraft/shared/turtle/items/TurtleItemFactory.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/items/TurtleItemFactory.java similarity index 92% rename from src/main/java/dan200/computercraft/shared/turtle/items/TurtleItemFactory.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/items/TurtleItemFactory.java index 75452ffde..f19b29845 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/items/TurtleItemFactory.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/turtle/items/TurtleItemFactory.java @@ -9,7 +9,7 @@ import dan200.computercraft.api.turtle.ITurtleUpgrade; import dan200.computercraft.api.turtle.TurtleSide; import dan200.computercraft.shared.ModRegistry; import dan200.computercraft.shared.computer.core.ComputerFamily; -import dan200.computercraft.shared.turtle.blocks.ITurtleTile; +import dan200.computercraft.shared.turtle.blocks.ITurtleBlockEntity; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; @@ -19,7 +19,7 @@ public final class TurtleItemFactory { private TurtleItemFactory() { } - public static ItemStack create(ITurtleTile turtle) { + public static ItemStack create(ITurtleBlockEntity turtle) { var access = turtle.getAccess(); return create( diff --git a/src/main/java/dan200/computercraft/shared/turtle/recipes/TurtleRecipe.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/recipes/TurtleRecipe.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/recipes/TurtleRecipe.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/recipes/TurtleRecipe.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/recipes/TurtleUpgradeRecipe.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/recipes/TurtleUpgradeRecipe.java similarity index 99% rename from src/main/java/dan200/computercraft/shared/turtle/recipes/TurtleUpgradeRecipe.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/recipes/TurtleUpgradeRecipe.java index 01441d7b5..1f9ecc756 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/recipes/TurtleUpgradeRecipe.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/turtle/recipes/TurtleUpgradeRecipe.java @@ -7,8 +7,8 @@ package dan200.computercraft.shared.turtle.recipes; import dan200.computercraft.api.turtle.ITurtleUpgrade; import dan200.computercraft.api.turtle.TurtleSide; +import dan200.computercraft.impl.TurtleUpgrades; import dan200.computercraft.shared.ModRegistry; -import dan200.computercraft.shared.TurtleUpgrades; import dan200.computercraft.shared.computer.core.ComputerFamily; import dan200.computercraft.shared.turtle.items.ITurtleItem; import dan200.computercraft.shared.turtle.items.TurtleItemFactory; diff --git a/src/main/java/dan200/computercraft/shared/turtle/upgrades/CraftingTablePeripheral.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/upgrades/CraftingTablePeripheral.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/upgrades/CraftingTablePeripheral.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/upgrades/CraftingTablePeripheral.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleCraftingTable.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleCraftingTable.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleCraftingTable.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleCraftingTable.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleInventoryCrafting.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleInventoryCrafting.java similarity index 93% rename from src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleInventoryCrafting.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleInventoryCrafting.java index 5e2d27ff4..653ba2d83 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleInventoryCrafting.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleInventoryCrafting.java @@ -7,7 +7,7 @@ package dan200.computercraft.shared.turtle.upgrades; import dan200.computercraft.api.turtle.ITurtleAccess; import dan200.computercraft.shared.platform.PlatformHelper; -import dan200.computercraft.shared.turtle.blocks.TileTurtle; +import dan200.computercraft.shared.turtle.blocks.TurtleBlockEntity; import dan200.computercraft.shared.turtle.core.TurtlePlayer; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.player.Player; @@ -41,11 +41,11 @@ public class TurtleInventoryCrafting extends CraftingContainer { this.yStart = yStart; // Check the non-relevant parts of the inventory are empty - for (var x = 0; x < TileTurtle.INVENTORY_WIDTH; x++) { - for (var y = 0; y < TileTurtle.INVENTORY_HEIGHT; y++) { + for (var x = 0; x < TurtleBlockEntity.INVENTORY_WIDTH; x++) { + for (var y = 0; y < TurtleBlockEntity.INVENTORY_HEIGHT; y++) { if (x < this.xStart || x >= this.xStart + 3 || y < this.yStart || y >= this.yStart + 3) { - if (!turtle.getInventory().getItem(x + y * TileTurtle.INVENTORY_WIDTH).isEmpty()) { + if (!turtle.getInventory().getItem(x + y * TurtleBlockEntity.INVENTORY_WIDTH).isEmpty()) { return null; } } @@ -122,8 +122,8 @@ public class TurtleInventoryCrafting extends CraftingContainer { private int modifyIndex(int index) { var x = xStart + index % getWidth(); var y = yStart + index / getHeight(); - return x >= 0 && x < TileTurtle.INVENTORY_WIDTH && y >= 0 && y < TileTurtle.INVENTORY_HEIGHT - ? x + y * TileTurtle.INVENTORY_WIDTH + return x >= 0 && x < TurtleBlockEntity.INVENTORY_WIDTH && y >= 0 && y < TurtleBlockEntity.INVENTORY_HEIGHT + ? x + y * TurtleBlockEntity.INVENTORY_WIDTH : -1; } diff --git a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleModem.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleModem.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleModem.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleModem.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleSpeaker.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleSpeaker.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleSpeaker.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleSpeaker.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleTool.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleTool.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleTool.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleTool.java diff --git a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleToolSerialiser.java b/projects/common/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleToolSerialiser.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleToolSerialiser.java rename to projects/common/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleToolSerialiser.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/ArgumentHelpers.java b/projects/common/src/main/java/dan200/computercraft/shared/util/ArgumentHelpers.java similarity index 94% rename from src/main/java/dan200/computercraft/shared/peripheral/generic/methods/ArgumentHelpers.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/ArgumentHelpers.java index cbd470b2f..0c7b645ec 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/ArgumentHelpers.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/util/ArgumentHelpers.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.shared.peripheral.generic.methods; +package dan200.computercraft.shared.util; import dan200.computercraft.api.lua.LuaException; import dan200.computercraft.shared.platform.Registries; @@ -16,7 +16,7 @@ import net.minecraft.resources.ResourceLocation; * This should really be moved into the public API. However, until I have settled on a suitable format, we'll keep it * where it is used. */ -final class ArgumentHelpers { +public final class ArgumentHelpers { private ArgumentHelpers() { } diff --git a/src/main/java/dan200/computercraft/shared/util/ColourTracker.java b/projects/common/src/main/java/dan200/computercraft/shared/util/ColourTracker.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/ColourTracker.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/ColourTracker.java diff --git a/src/main/java/dan200/computercraft/shared/util/ColourUtils.java b/projects/common/src/main/java/dan200/computercraft/shared/util/ColourUtils.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/ColourUtils.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/ColourUtils.java diff --git a/src/main/java/dan200/computercraft/shared/util/DefaultInventory.java b/projects/common/src/main/java/dan200/computercraft/shared/util/DefaultInventory.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/DefaultInventory.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/DefaultInventory.java diff --git a/src/main/java/dan200/computercraft/shared/util/DefaultSidedInventory.java b/projects/common/src/main/java/dan200/computercraft/shared/util/DefaultSidedInventory.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/DefaultSidedInventory.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/DefaultSidedInventory.java diff --git a/src/main/java/dan200/computercraft/shared/util/DirectionUtil.java b/projects/common/src/main/java/dan200/computercraft/shared/util/DirectionUtil.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/DirectionUtil.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/DirectionUtil.java diff --git a/src/main/java/dan200/computercraft/shared/util/DropConsumer.java b/projects/common/src/main/java/dan200/computercraft/shared/util/DropConsumer.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/DropConsumer.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/DropConsumer.java diff --git a/src/main/java/dan200/computercraft/shared/util/Holiday.java b/projects/common/src/main/java/dan200/computercraft/shared/util/Holiday.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/Holiday.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/Holiday.java diff --git a/src/main/java/dan200/computercraft/shared/util/HolidayUtil.java b/projects/common/src/main/java/dan200/computercraft/shared/util/HolidayUtil.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/HolidayUtil.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/HolidayUtil.java diff --git a/src/main/java/dan200/computercraft/shared/util/IDAssigner.java b/projects/common/src/main/java/dan200/computercraft/shared/util/IDAssigner.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/IDAssigner.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/IDAssigner.java diff --git a/src/main/java/dan200/computercraft/shared/util/ImpostorRecipe.java b/projects/common/src/main/java/dan200/computercraft/shared/util/ImpostorRecipe.java similarity index 96% rename from src/main/java/dan200/computercraft/shared/util/ImpostorRecipe.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/ImpostorRecipe.java index 5303d20cb..b65a6a51d 100644 --- a/src/main/java/dan200/computercraft/shared/util/ImpostorRecipe.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/util/ImpostorRecipe.java @@ -68,8 +68,8 @@ public final class ImpostorRecipe extends ShapedRecipe { @Override public void toNetwork(FriendlyByteBuf buf, ImpostorRecipe recipe) { - buf.writeVarInt(recipe.getRecipeWidth()); - buf.writeVarInt(recipe.getRecipeHeight()); + buf.writeVarInt(recipe.getWidth()); + buf.writeVarInt(recipe.getHeight()); buf.writeUtf(recipe.getGroup()); for (var ingredient : recipe.getIngredients()) ingredient.toNetwork(buf); buf.writeItem(recipe.getResultItem()); diff --git a/src/main/java/dan200/computercraft/shared/util/ImpostorShapelessRecipe.java b/projects/common/src/main/java/dan200/computercraft/shared/util/ImpostorShapelessRecipe.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/ImpostorShapelessRecipe.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/ImpostorShapelessRecipe.java diff --git a/src/main/java/dan200/computercraft/shared/util/InventoryDelegate.java b/projects/common/src/main/java/dan200/computercraft/shared/util/InventoryDelegate.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/InventoryDelegate.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/InventoryDelegate.java diff --git a/src/main/java/dan200/computercraft/shared/util/InventoryUtil.java b/projects/common/src/main/java/dan200/computercraft/shared/util/InventoryUtil.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/InventoryUtil.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/InventoryUtil.java diff --git a/src/main/java/dan200/computercraft/shared/util/InvisibleSlot.java b/projects/common/src/main/java/dan200/computercraft/shared/util/InvisibleSlot.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/InvisibleSlot.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/InvisibleSlot.java diff --git a/src/main/java/dan200/computercraft/shared/util/NBTUtil.java b/projects/common/src/main/java/dan200/computercraft/shared/util/NBTUtil.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/NBTUtil.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/NBTUtil.java diff --git a/src/main/java/dan200/computercraft/shared/util/PauseAwareTimer.java b/projects/common/src/main/java/dan200/computercraft/shared/util/PauseAwareTimer.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/PauseAwareTimer.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/PauseAwareTimer.java diff --git a/src/main/java/dan200/computercraft/shared/util/RecipeUtil.java b/projects/common/src/main/java/dan200/computercraft/shared/util/RecipeUtil.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/RecipeUtil.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/RecipeUtil.java diff --git a/src/main/java/dan200/computercraft/shared/util/RedstoneUtil.java b/projects/common/src/main/java/dan200/computercraft/shared/util/RedstoneUtil.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/RedstoneUtil.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/RedstoneUtil.java diff --git a/src/main/java/dan200/computercraft/shared/util/SingleIntArray.java b/projects/common/src/main/java/dan200/computercraft/shared/util/SingleIntArray.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/SingleIntArray.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/SingleIntArray.java diff --git a/src/main/java/dan200/computercraft/shared/util/TickScheduler.java b/projects/common/src/main/java/dan200/computercraft/shared/util/TickScheduler.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/TickScheduler.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/TickScheduler.java diff --git a/src/main/java/dan200/computercraft/shared/util/ValidatingSlot.java b/projects/common/src/main/java/dan200/computercraft/shared/util/ValidatingSlot.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/ValidatingSlot.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/ValidatingSlot.java diff --git a/src/main/java/dan200/computercraft/shared/util/WaterloggableHelpers.java b/projects/common/src/main/java/dan200/computercraft/shared/util/WaterloggableHelpers.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/WaterloggableHelpers.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/WaterloggableHelpers.java diff --git a/src/main/java/dan200/computercraft/shared/util/WorldUtil.java b/projects/common/src/main/java/dan200/computercraft/shared/util/WorldUtil.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/WorldUtil.java rename to projects/common/src/main/java/dan200/computercraft/shared/util/WorldUtil.java diff --git a/src/main/resources/assets/computercraft/lang/da_dk.json b/projects/common/src/main/resources/assets/computercraft/lang/da_dk.json similarity index 100% rename from src/main/resources/assets/computercraft/lang/da_dk.json rename to projects/common/src/main/resources/assets/computercraft/lang/da_dk.json diff --git a/src/main/resources/assets/computercraft/lang/de_de.json b/projects/common/src/main/resources/assets/computercraft/lang/de_de.json similarity index 100% rename from src/main/resources/assets/computercraft/lang/de_de.json rename to projects/common/src/main/resources/assets/computercraft/lang/de_de.json diff --git a/src/main/resources/assets/computercraft/lang/en_us.json b/projects/common/src/main/resources/assets/computercraft/lang/en_us.json similarity index 100% rename from src/main/resources/assets/computercraft/lang/en_us.json rename to projects/common/src/main/resources/assets/computercraft/lang/en_us.json diff --git a/src/main/resources/assets/computercraft/lang/es_es.json b/projects/common/src/main/resources/assets/computercraft/lang/es_es.json similarity index 100% rename from src/main/resources/assets/computercraft/lang/es_es.json rename to projects/common/src/main/resources/assets/computercraft/lang/es_es.json diff --git a/src/main/resources/assets/computercraft/lang/fr_fr.json b/projects/common/src/main/resources/assets/computercraft/lang/fr_fr.json similarity index 100% rename from src/main/resources/assets/computercraft/lang/fr_fr.json rename to projects/common/src/main/resources/assets/computercraft/lang/fr_fr.json diff --git a/src/main/resources/assets/computercraft/lang/it_it.json b/projects/common/src/main/resources/assets/computercraft/lang/it_it.json similarity index 100% rename from src/main/resources/assets/computercraft/lang/it_it.json rename to projects/common/src/main/resources/assets/computercraft/lang/it_it.json diff --git a/src/main/resources/assets/computercraft/lang/ja_jp.json b/projects/common/src/main/resources/assets/computercraft/lang/ja_jp.json similarity index 100% rename from src/main/resources/assets/computercraft/lang/ja_jp.json rename to projects/common/src/main/resources/assets/computercraft/lang/ja_jp.json diff --git a/src/main/resources/assets/computercraft/lang/ko_kr.json b/projects/common/src/main/resources/assets/computercraft/lang/ko_kr.json similarity index 100% rename from src/main/resources/assets/computercraft/lang/ko_kr.json rename to projects/common/src/main/resources/assets/computercraft/lang/ko_kr.json diff --git a/src/main/resources/assets/computercraft/lang/nb_no.json b/projects/common/src/main/resources/assets/computercraft/lang/nb_no.json similarity index 100% rename from src/main/resources/assets/computercraft/lang/nb_no.json rename to projects/common/src/main/resources/assets/computercraft/lang/nb_no.json diff --git a/src/main/resources/assets/computercraft/lang/nl_nl.json b/projects/common/src/main/resources/assets/computercraft/lang/nl_nl.json similarity index 100% rename from src/main/resources/assets/computercraft/lang/nl_nl.json rename to projects/common/src/main/resources/assets/computercraft/lang/nl_nl.json diff --git a/src/main/resources/assets/computercraft/lang/pl_pl.json b/projects/common/src/main/resources/assets/computercraft/lang/pl_pl.json similarity index 100% rename from src/main/resources/assets/computercraft/lang/pl_pl.json rename to projects/common/src/main/resources/assets/computercraft/lang/pl_pl.json diff --git a/src/main/resources/assets/computercraft/lang/pt_br.json b/projects/common/src/main/resources/assets/computercraft/lang/pt_br.json similarity index 100% rename from src/main/resources/assets/computercraft/lang/pt_br.json rename to projects/common/src/main/resources/assets/computercraft/lang/pt_br.json diff --git a/src/main/resources/assets/computercraft/lang/ru_ru.json b/projects/common/src/main/resources/assets/computercraft/lang/ru_ru.json similarity index 100% rename from src/main/resources/assets/computercraft/lang/ru_ru.json rename to projects/common/src/main/resources/assets/computercraft/lang/ru_ru.json diff --git a/src/main/resources/assets/computercraft/lang/sv_se.json b/projects/common/src/main/resources/assets/computercraft/lang/sv_se.json similarity index 100% rename from src/main/resources/assets/computercraft/lang/sv_se.json rename to projects/common/src/main/resources/assets/computercraft/lang/sv_se.json diff --git a/src/main/resources/assets/computercraft/lang/uk_ua.json b/projects/common/src/main/resources/assets/computercraft/lang/uk_ua.json similarity index 100% rename from src/main/resources/assets/computercraft/lang/uk_ua.json rename to projects/common/src/main/resources/assets/computercraft/lang/uk_ua.json diff --git a/src/main/resources/assets/computercraft/lang/vi_vn.json b/projects/common/src/main/resources/assets/computercraft/lang/vi_vn.json similarity index 100% rename from src/main/resources/assets/computercraft/lang/vi_vn.json rename to projects/common/src/main/resources/assets/computercraft/lang/vi_vn.json diff --git a/src/main/resources/assets/computercraft/lang/zh_cn.json b/projects/common/src/main/resources/assets/computercraft/lang/zh_cn.json similarity index 100% rename from src/main/resources/assets/computercraft/lang/zh_cn.json rename to projects/common/src/main/resources/assets/computercraft/lang/zh_cn.json diff --git a/src/main/resources/assets/computercraft/models/block/cable_arm.json b/projects/common/src/main/resources/assets/computercraft/models/block/cable_arm.json similarity index 100% rename from src/main/resources/assets/computercraft/models/block/cable_arm.json rename to projects/common/src/main/resources/assets/computercraft/models/block/cable_arm.json diff --git a/src/main/resources/assets/computercraft/models/block/cable_core_any.json b/projects/common/src/main/resources/assets/computercraft/models/block/cable_core_any.json similarity index 100% rename from src/main/resources/assets/computercraft/models/block/cable_core_any.json rename to projects/common/src/main/resources/assets/computercraft/models/block/cable_core_any.json diff --git a/src/main/resources/assets/computercraft/models/block/cable_core_facing.json b/projects/common/src/main/resources/assets/computercraft/models/block/cable_core_facing.json similarity index 100% rename from src/main/resources/assets/computercraft/models/block/cable_core_facing.json rename to projects/common/src/main/resources/assets/computercraft/models/block/cable_core_facing.json diff --git a/src/main/resources/assets/computercraft/models/block/modem.json b/projects/common/src/main/resources/assets/computercraft/models/block/modem.json similarity index 100% rename from src/main/resources/assets/computercraft/models/block/modem.json rename to projects/common/src/main/resources/assets/computercraft/models/block/modem.json diff --git a/src/main/resources/assets/computercraft/models/block/monitor_base.json b/projects/common/src/main/resources/assets/computercraft/models/block/monitor_base.json similarity index 100% rename from src/main/resources/assets/computercraft/models/block/monitor_base.json rename to projects/common/src/main/resources/assets/computercraft/models/block/monitor_base.json diff --git a/src/main/resources/assets/computercraft/models/block/turtle_base.json b/projects/common/src/main/resources/assets/computercraft/models/block/turtle_base.json similarity index 100% rename from src/main/resources/assets/computercraft/models/block/turtle_base.json rename to projects/common/src/main/resources/assets/computercraft/models/block/turtle_base.json diff --git a/src/main/resources/assets/computercraft/models/block/turtle_colour.json b/projects/common/src/main/resources/assets/computercraft/models/block/turtle_colour.json similarity index 100% rename from src/main/resources/assets/computercraft/models/block/turtle_colour.json rename to projects/common/src/main/resources/assets/computercraft/models/block/turtle_colour.json diff --git a/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 similarity index 100% rename from src/main/resources/assets/computercraft/models/block/turtle_elf_overlay.json rename to projects/common/src/main/resources/assets/computercraft/models/block/turtle_elf_overlay.json diff --git a/src/main/resources/assets/computercraft/models/block/turtle_overlay.json b/projects/common/src/main/resources/assets/computercraft/models/block/turtle_overlay.json similarity index 100% rename from src/main/resources/assets/computercraft/models/block/turtle_overlay.json rename to projects/common/src/main/resources/assets/computercraft/models/block/turtle_overlay.json diff --git a/src/main/resources/assets/computercraft/models/block/turtle_upgrade_base_left.json b/projects/common/src/main/resources/assets/computercraft/models/block/turtle_upgrade_base_left.json similarity index 100% rename from src/main/resources/assets/computercraft/models/block/turtle_upgrade_base_left.json rename to projects/common/src/main/resources/assets/computercraft/models/block/turtle_upgrade_base_left.json diff --git a/src/main/resources/assets/computercraft/models/block/turtle_upgrade_base_right.json b/projects/common/src/main/resources/assets/computercraft/models/block/turtle_upgrade_base_right.json similarity index 100% rename from src/main/resources/assets/computercraft/models/block/turtle_upgrade_base_right.json rename to projects/common/src/main/resources/assets/computercraft/models/block/turtle_upgrade_base_right.json diff --git a/src/main/resources/assets/computercraft/models/item/cable.json b/projects/common/src/main/resources/assets/computercraft/models/item/cable.json similarity index 100% rename from src/main/resources/assets/computercraft/models/item/cable.json rename to projects/common/src/main/resources/assets/computercraft/models/item/cable.json diff --git a/src/main/resources/assets/computercraft/models/item/pocket_computer_advanced.json b/projects/common/src/main/resources/assets/computercraft/models/item/pocket_computer_advanced.json similarity index 100% rename from src/main/resources/assets/computercraft/models/item/pocket_computer_advanced.json rename to projects/common/src/main/resources/assets/computercraft/models/item/pocket_computer_advanced.json diff --git a/src/main/resources/assets/computercraft/models/item/pocket_computer_normal.json b/projects/common/src/main/resources/assets/computercraft/models/item/pocket_computer_normal.json similarity index 100% rename from src/main/resources/assets/computercraft/models/item/pocket_computer_normal.json rename to projects/common/src/main/resources/assets/computercraft/models/item/pocket_computer_normal.json diff --git a/src/main/resources/assets/computercraft/sounds.json b/projects/common/src/main/resources/assets/computercraft/sounds.json similarity index 100% rename from src/main/resources/assets/computercraft/sounds.json rename to projects/common/src/main/resources/assets/computercraft/sounds.json diff --git a/src/main/resources/assets/computercraft/sounds/empty.ogg b/projects/common/src/main/resources/assets/computercraft/sounds/empty.ogg similarity index 100% rename from src/main/resources/assets/computercraft/sounds/empty.ogg rename to projects/common/src/main/resources/assets/computercraft/sounds/empty.ogg diff --git a/src/main/resources/assets/computercraft/textures/block/cable_core.png b/projects/common/src/main/resources/assets/computercraft/textures/block/cable_core.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/cable_core.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/cable_core.png diff --git a/src/main/resources/assets/computercraft/textures/block/cable_side.png b/projects/common/src/main/resources/assets/computercraft/textures/block/cable_side.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/cable_side.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/cable_side.png diff --git a/src/main/resources/assets/computercraft/textures/block/computer_advanced_front.png b/projects/common/src/main/resources/assets/computercraft/textures/block/computer_advanced_front.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/computer_advanced_front.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/computer_advanced_front.png diff --git a/src/main/resources/assets/computercraft/textures/block/computer_advanced_front_blink.png b/projects/common/src/main/resources/assets/computercraft/textures/block/computer_advanced_front_blink.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/computer_advanced_front_blink.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/computer_advanced_front_blink.png diff --git a/src/main/resources/assets/computercraft/textures/block/computer_advanced_front_blink.png.mcmeta b/projects/common/src/main/resources/assets/computercraft/textures/block/computer_advanced_front_blink.png.mcmeta similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/computer_advanced_front_blink.png.mcmeta rename to projects/common/src/main/resources/assets/computercraft/textures/block/computer_advanced_front_blink.png.mcmeta diff --git a/src/main/resources/assets/computercraft/textures/block/computer_advanced_front_on.png b/projects/common/src/main/resources/assets/computercraft/textures/block/computer_advanced_front_on.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/computer_advanced_front_on.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/computer_advanced_front_on.png diff --git a/src/main/resources/assets/computercraft/textures/block/computer_advanced_side.png b/projects/common/src/main/resources/assets/computercraft/textures/block/computer_advanced_side.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/computer_advanced_side.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/computer_advanced_side.png diff --git a/src/main/resources/assets/computercraft/textures/block/computer_advanced_top.png b/projects/common/src/main/resources/assets/computercraft/textures/block/computer_advanced_top.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/computer_advanced_top.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/computer_advanced_top.png diff --git a/src/main/resources/assets/computercraft/textures/block/computer_command_front.png b/projects/common/src/main/resources/assets/computercraft/textures/block/computer_command_front.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/computer_command_front.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/computer_command_front.png diff --git a/src/main/resources/assets/computercraft/textures/block/computer_command_front_blink.png b/projects/common/src/main/resources/assets/computercraft/textures/block/computer_command_front_blink.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/computer_command_front_blink.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/computer_command_front_blink.png diff --git a/src/main/resources/assets/computercraft/textures/block/computer_command_front_blink.png.mcmeta b/projects/common/src/main/resources/assets/computercraft/textures/block/computer_command_front_blink.png.mcmeta similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/computer_command_front_blink.png.mcmeta rename to projects/common/src/main/resources/assets/computercraft/textures/block/computer_command_front_blink.png.mcmeta diff --git a/src/main/resources/assets/computercraft/textures/block/computer_command_front_on.png b/projects/common/src/main/resources/assets/computercraft/textures/block/computer_command_front_on.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/computer_command_front_on.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/computer_command_front_on.png diff --git a/src/main/resources/assets/computercraft/textures/block/computer_command_side.png b/projects/common/src/main/resources/assets/computercraft/textures/block/computer_command_side.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/computer_command_side.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/computer_command_side.png diff --git a/src/main/resources/assets/computercraft/textures/block/computer_command_top.png b/projects/common/src/main/resources/assets/computercraft/textures/block/computer_command_top.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/computer_command_top.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/computer_command_top.png diff --git a/src/main/resources/assets/computercraft/textures/block/computer_normal_front.png b/projects/common/src/main/resources/assets/computercraft/textures/block/computer_normal_front.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/computer_normal_front.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/computer_normal_front.png diff --git a/src/main/resources/assets/computercraft/textures/block/computer_normal_front_blink.png b/projects/common/src/main/resources/assets/computercraft/textures/block/computer_normal_front_blink.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/computer_normal_front_blink.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/computer_normal_front_blink.png diff --git a/src/main/resources/assets/computercraft/textures/block/computer_normal_front_blink.png.mcmeta b/projects/common/src/main/resources/assets/computercraft/textures/block/computer_normal_front_blink.png.mcmeta similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/computer_normal_front_blink.png.mcmeta rename to projects/common/src/main/resources/assets/computercraft/textures/block/computer_normal_front_blink.png.mcmeta diff --git a/src/main/resources/assets/computercraft/textures/block/computer_normal_front_on.png b/projects/common/src/main/resources/assets/computercraft/textures/block/computer_normal_front_on.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/computer_normal_front_on.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/computer_normal_front_on.png diff --git a/src/main/resources/assets/computercraft/textures/block/computer_normal_side.png b/projects/common/src/main/resources/assets/computercraft/textures/block/computer_normal_side.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/computer_normal_side.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/computer_normal_side.png diff --git a/src/main/resources/assets/computercraft/textures/block/computer_normal_top.png b/projects/common/src/main/resources/assets/computercraft/textures/block/computer_normal_top.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/computer_normal_top.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/computer_normal_top.png diff --git a/src/main/resources/assets/computercraft/textures/block/disk_drive_front.png b/projects/common/src/main/resources/assets/computercraft/textures/block/disk_drive_front.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/disk_drive_front.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/disk_drive_front.png diff --git a/src/main/resources/assets/computercraft/textures/block/disk_drive_front_accepted.png b/projects/common/src/main/resources/assets/computercraft/textures/block/disk_drive_front_accepted.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/disk_drive_front_accepted.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/disk_drive_front_accepted.png diff --git a/src/main/resources/assets/computercraft/textures/block/disk_drive_front_rejected.png b/projects/common/src/main/resources/assets/computercraft/textures/block/disk_drive_front_rejected.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/disk_drive_front_rejected.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/disk_drive_front_rejected.png diff --git a/src/main/resources/assets/computercraft/textures/block/disk_drive_side.png b/projects/common/src/main/resources/assets/computercraft/textures/block/disk_drive_side.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/disk_drive_side.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/disk_drive_side.png diff --git a/src/main/resources/assets/computercraft/textures/block/disk_drive_top.png b/projects/common/src/main/resources/assets/computercraft/textures/block/disk_drive_top.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/disk_drive_top.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/disk_drive_top.png diff --git a/src/main/resources/assets/computercraft/textures/block/modem_back.png b/projects/common/src/main/resources/assets/computercraft/textures/block/modem_back.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/modem_back.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/modem_back.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_0.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_0.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_0.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_0.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_1.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_1.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_1.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_1.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_15.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_15.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_15.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_15.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_16.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_16.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_16.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_16.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_17.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_17.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_17.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_17.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_18.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_18.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_18.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_18.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_19.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_19.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_19.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_19.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_2.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_2.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_2.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_2.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_20.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_20.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_20.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_20.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_21.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_21.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_21.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_21.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_22.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_22.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_22.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_22.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_23.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_23.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_23.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_23.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_24.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_24.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_24.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_24.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_25.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_25.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_25.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_25.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_26.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_26.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_26.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_26.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_27.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_27.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_27.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_27.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_28.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_28.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_28.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_28.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_29.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_29.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_29.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_29.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_3.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_3.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_3.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_3.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_30.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_30.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_30.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_30.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_31.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_31.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_31.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_31.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_32.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_32.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_32.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_32.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_33.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_33.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_33.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_33.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_34.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_34.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_34.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_34.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_35.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_35.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_35.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_35.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_36.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_36.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_36.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_36.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_37.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_37.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_37.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_37.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_38.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_38.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_38.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_38.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_39.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_39.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_39.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_39.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_4.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_4.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_4.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_4.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_40.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_40.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_40.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_40.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_41.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_41.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_41.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_41.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_42.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_42.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_42.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_42.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_43.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_43.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_43.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_43.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_44.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_44.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_44.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_44.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_45.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_45.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_45.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_45.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_46.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_46.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_46.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_46.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_47.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_47.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_47.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_47.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_5.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_5.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_5.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_5.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_6.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_6.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_6.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_6.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_advanced_7.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_7.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_advanced_7.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_advanced_7.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_0.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_0.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_0.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_0.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_1.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_1.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_1.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_1.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_15.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_15.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_15.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_15.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_16.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_16.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_16.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_16.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_17.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_17.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_17.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_17.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_18.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_18.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_18.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_18.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_19.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_19.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_19.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_19.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_2.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_2.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_2.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_2.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_20.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_20.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_20.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_20.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_21.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_21.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_21.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_21.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_22.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_22.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_22.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_22.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_23.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_23.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_23.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_23.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_24.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_24.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_24.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_24.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_25.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_25.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_25.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_25.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_26.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_26.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_26.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_26.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_27.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_27.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_27.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_27.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_28.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_28.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_28.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_28.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_29.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_29.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_29.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_29.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_3.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_3.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_3.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_3.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_30.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_30.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_30.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_30.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_31.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_31.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_31.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_31.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_32.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_32.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_32.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_32.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_33.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_33.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_33.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_33.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_34.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_34.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_34.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_34.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_35.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_35.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_35.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_35.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_36.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_36.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_36.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_36.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_37.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_37.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_37.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_37.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_38.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_38.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_38.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_38.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_39.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_39.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_39.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_39.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_4.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_4.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_4.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_4.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_40.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_40.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_40.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_40.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_41.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_41.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_41.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_41.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_42.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_42.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_42.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_42.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_43.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_43.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_43.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_43.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_44.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_44.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_44.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_44.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_45.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_45.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_45.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_45.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_46.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_46.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_46.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_46.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_47.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_47.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_47.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_47.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_5.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_5.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_5.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_5.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_6.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_6.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_6.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_6.png diff --git a/src/main/resources/assets/computercraft/textures/block/monitor_normal_7.png b/projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_7.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/monitor_normal_7.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/monitor_normal_7.png diff --git a/src/main/resources/assets/computercraft/textures/block/printer_front_both_trays.png b/projects/common/src/main/resources/assets/computercraft/textures/block/printer_front_both_trays.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/printer_front_both_trays.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/printer_front_both_trays.png diff --git a/src/main/resources/assets/computercraft/textures/block/printer_front_bottom_tray.png b/projects/common/src/main/resources/assets/computercraft/textures/block/printer_front_bottom_tray.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/printer_front_bottom_tray.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/printer_front_bottom_tray.png diff --git a/src/main/resources/assets/computercraft/textures/block/printer_front_empty.png b/projects/common/src/main/resources/assets/computercraft/textures/block/printer_front_empty.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/printer_front_empty.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/printer_front_empty.png diff --git a/src/main/resources/assets/computercraft/textures/block/printer_front_top_tray.png b/projects/common/src/main/resources/assets/computercraft/textures/block/printer_front_top_tray.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/printer_front_top_tray.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/printer_front_top_tray.png diff --git a/src/main/resources/assets/computercraft/textures/block/printer_side.png b/projects/common/src/main/resources/assets/computercraft/textures/block/printer_side.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/printer_side.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/printer_side.png diff --git a/src/main/resources/assets/computercraft/textures/block/printer_top.png b/projects/common/src/main/resources/assets/computercraft/textures/block/printer_top.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/printer_top.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/printer_top.png diff --git a/src/main/resources/assets/computercraft/textures/block/speaker_front.png b/projects/common/src/main/resources/assets/computercraft/textures/block/speaker_front.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/speaker_front.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/speaker_front.png diff --git a/src/main/resources/assets/computercraft/textures/block/speaker_side.png b/projects/common/src/main/resources/assets/computercraft/textures/block/speaker_side.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/speaker_side.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/speaker_side.png diff --git a/src/main/resources/assets/computercraft/textures/block/speaker_top.png b/projects/common/src/main/resources/assets/computercraft/textures/block/speaker_top.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/speaker_top.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/speaker_top.png diff --git a/src/main/resources/assets/computercraft/textures/block/turtle_advanced.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/turtle_advanced.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/turtle_advanced.png diff --git a/src/main/resources/assets/computercraft/textures/block/turtle_colour.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/turtle_colour.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/turtle_colour.png diff --git a/src/main/resources/assets/computercraft/textures/block/turtle_crafty_face.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_crafty_face.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/turtle_crafty_face.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/turtle_crafty_face.png diff --git a/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 similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/turtle_elf_overlay.png diff --git a/src/main/resources/assets/computercraft/textures/block/turtle_normal.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/turtle_normal.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/turtle_normal.png diff --git a/src/main/resources/assets/computercraft/textures/block/turtle_speaker_face.png b/projects/common/src/main/resources/assets/computercraft/textures/block/turtle_speaker_face.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/turtle_speaker_face.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/turtle_speaker_face.png diff --git a/src/main/resources/assets/computercraft/textures/block/wired_modem_face.png b/projects/common/src/main/resources/assets/computercraft/textures/block/wired_modem_face.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/wired_modem_face.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/wired_modem_face.png diff --git a/src/main/resources/assets/computercraft/textures/block/wired_modem_face_on.png b/projects/common/src/main/resources/assets/computercraft/textures/block/wired_modem_face_on.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/wired_modem_face_on.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/wired_modem_face_on.png diff --git a/src/main/resources/assets/computercraft/textures/block/wired_modem_face_peripheral.png b/projects/common/src/main/resources/assets/computercraft/textures/block/wired_modem_face_peripheral.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/wired_modem_face_peripheral.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/wired_modem_face_peripheral.png diff --git a/src/main/resources/assets/computercraft/textures/block/wired_modem_face_peripheral_on.png b/projects/common/src/main/resources/assets/computercraft/textures/block/wired_modem_face_peripheral_on.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/wired_modem_face_peripheral_on.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/wired_modem_face_peripheral_on.png diff --git a/src/main/resources/assets/computercraft/textures/block/wireless_modem_advanced_face.png b/projects/common/src/main/resources/assets/computercraft/textures/block/wireless_modem_advanced_face.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/wireless_modem_advanced_face.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/wireless_modem_advanced_face.png diff --git a/src/main/resources/assets/computercraft/textures/block/wireless_modem_advanced_face_on.png b/projects/common/src/main/resources/assets/computercraft/textures/block/wireless_modem_advanced_face_on.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/wireless_modem_advanced_face_on.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/wireless_modem_advanced_face_on.png diff --git a/src/main/resources/assets/computercraft/textures/block/wireless_modem_normal_face.png b/projects/common/src/main/resources/assets/computercraft/textures/block/wireless_modem_normal_face.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/wireless_modem_normal_face.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/wireless_modem_normal_face.png diff --git a/src/main/resources/assets/computercraft/textures/block/wireless_modem_normal_face_on.png b/projects/common/src/main/resources/assets/computercraft/textures/block/wireless_modem_normal_face_on.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/block/wireless_modem_normal_face_on.png rename to projects/common/src/main/resources/assets/computercraft/textures/block/wireless_modem_normal_face_on.png diff --git a/src/main/resources/assets/computercraft/textures/gui/blank_screen.png b/projects/common/src/main/resources/assets/computercraft/textures/gui/blank_screen.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/gui/blank_screen.png rename to projects/common/src/main/resources/assets/computercraft/textures/gui/blank_screen.png diff --git a/src/main/resources/assets/computercraft/textures/gui/buttons.png b/projects/common/src/main/resources/assets/computercraft/textures/gui/buttons.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/gui/buttons.png rename to projects/common/src/main/resources/assets/computercraft/textures/gui/buttons.png diff --git a/src/main/resources/assets/computercraft/textures/gui/corners_advanced.png b/projects/common/src/main/resources/assets/computercraft/textures/gui/corners_advanced.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/gui/corners_advanced.png rename to projects/common/src/main/resources/assets/computercraft/textures/gui/corners_advanced.png diff --git a/src/main/resources/assets/computercraft/textures/gui/corners_colour.png b/projects/common/src/main/resources/assets/computercraft/textures/gui/corners_colour.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/gui/corners_colour.png rename to projects/common/src/main/resources/assets/computercraft/textures/gui/corners_colour.png diff --git a/src/main/resources/assets/computercraft/textures/gui/corners_command.png b/projects/common/src/main/resources/assets/computercraft/textures/gui/corners_command.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/gui/corners_command.png rename to projects/common/src/main/resources/assets/computercraft/textures/gui/corners_command.png diff --git a/src/main/resources/assets/computercraft/textures/gui/corners_normal.png b/projects/common/src/main/resources/assets/computercraft/textures/gui/corners_normal.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/gui/corners_normal.png rename to projects/common/src/main/resources/assets/computercraft/textures/gui/corners_normal.png diff --git a/src/main/resources/assets/computercraft/textures/gui/disk_drive.png b/projects/common/src/main/resources/assets/computercraft/textures/gui/disk_drive.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/gui/disk_drive.png rename to projects/common/src/main/resources/assets/computercraft/textures/gui/disk_drive.png diff --git a/src/main/resources/assets/computercraft/textures/gui/printer.png b/projects/common/src/main/resources/assets/computercraft/textures/gui/printer.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/gui/printer.png rename to projects/common/src/main/resources/assets/computercraft/textures/gui/printer.png diff --git a/src/main/resources/assets/computercraft/textures/gui/printout.png b/projects/common/src/main/resources/assets/computercraft/textures/gui/printout.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/gui/printout.png rename to projects/common/src/main/resources/assets/computercraft/textures/gui/printout.png diff --git a/src/main/resources/assets/computercraft/textures/gui/term_font.png b/projects/common/src/main/resources/assets/computercraft/textures/gui/term_font.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/gui/term_font.png rename to projects/common/src/main/resources/assets/computercraft/textures/gui/term_font.png diff --git a/src/main/resources/assets/computercraft/textures/gui/turtle_advanced.png b/projects/common/src/main/resources/assets/computercraft/textures/gui/turtle_advanced.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/gui/turtle_advanced.png rename to projects/common/src/main/resources/assets/computercraft/textures/gui/turtle_advanced.png diff --git a/src/main/resources/assets/computercraft/textures/gui/turtle_normal.png b/projects/common/src/main/resources/assets/computercraft/textures/gui/turtle_normal.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/gui/turtle_normal.png rename to projects/common/src/main/resources/assets/computercraft/textures/gui/turtle_normal.png diff --git a/src/main/resources/assets/computercraft/textures/item/disk_colour.png b/projects/common/src/main/resources/assets/computercraft/textures/item/disk_colour.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/item/disk_colour.png rename to projects/common/src/main/resources/assets/computercraft/textures/item/disk_colour.png diff --git a/src/main/resources/assets/computercraft/textures/item/disk_frame.png b/projects/common/src/main/resources/assets/computercraft/textures/item/disk_frame.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/item/disk_frame.png rename to projects/common/src/main/resources/assets/computercraft/textures/item/disk_frame.png diff --git a/src/main/resources/assets/computercraft/textures/item/pocket_computer_advanced.png b/projects/common/src/main/resources/assets/computercraft/textures/item/pocket_computer_advanced.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/item/pocket_computer_advanced.png rename to projects/common/src/main/resources/assets/computercraft/textures/item/pocket_computer_advanced.png diff --git a/src/main/resources/assets/computercraft/textures/item/pocket_computer_blink.png b/projects/common/src/main/resources/assets/computercraft/textures/item/pocket_computer_blink.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/item/pocket_computer_blink.png rename to projects/common/src/main/resources/assets/computercraft/textures/item/pocket_computer_blink.png diff --git a/src/main/resources/assets/computercraft/textures/item/pocket_computer_blink.png.mcmeta b/projects/common/src/main/resources/assets/computercraft/textures/item/pocket_computer_blink.png.mcmeta similarity index 100% rename from src/main/resources/assets/computercraft/textures/item/pocket_computer_blink.png.mcmeta rename to projects/common/src/main/resources/assets/computercraft/textures/item/pocket_computer_blink.png.mcmeta diff --git a/src/main/resources/assets/computercraft/textures/item/pocket_computer_colour.png b/projects/common/src/main/resources/assets/computercraft/textures/item/pocket_computer_colour.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/item/pocket_computer_colour.png rename to projects/common/src/main/resources/assets/computercraft/textures/item/pocket_computer_colour.png diff --git a/src/main/resources/assets/computercraft/textures/item/pocket_computer_frame.png b/projects/common/src/main/resources/assets/computercraft/textures/item/pocket_computer_frame.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/item/pocket_computer_frame.png rename to projects/common/src/main/resources/assets/computercraft/textures/item/pocket_computer_frame.png diff --git a/src/main/resources/assets/computercraft/textures/item/pocket_computer_light.png b/projects/common/src/main/resources/assets/computercraft/textures/item/pocket_computer_light.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/item/pocket_computer_light.png rename to projects/common/src/main/resources/assets/computercraft/textures/item/pocket_computer_light.png diff --git a/src/main/resources/assets/computercraft/textures/item/pocket_computer_normal.png b/projects/common/src/main/resources/assets/computercraft/textures/item/pocket_computer_normal.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/item/pocket_computer_normal.png rename to projects/common/src/main/resources/assets/computercraft/textures/item/pocket_computer_normal.png diff --git a/src/main/resources/assets/computercraft/textures/item/pocket_computer_on.png b/projects/common/src/main/resources/assets/computercraft/textures/item/pocket_computer_on.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/item/pocket_computer_on.png rename to projects/common/src/main/resources/assets/computercraft/textures/item/pocket_computer_on.png diff --git a/src/main/resources/assets/computercraft/textures/item/printed_book.png b/projects/common/src/main/resources/assets/computercraft/textures/item/printed_book.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/item/printed_book.png rename to projects/common/src/main/resources/assets/computercraft/textures/item/printed_book.png diff --git a/src/main/resources/assets/computercraft/textures/item/printed_page.png b/projects/common/src/main/resources/assets/computercraft/textures/item/printed_page.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/item/printed_page.png rename to projects/common/src/main/resources/assets/computercraft/textures/item/printed_page.png diff --git a/src/main/resources/assets/computercraft/textures/item/printed_pages.png b/projects/common/src/main/resources/assets/computercraft/textures/item/printed_pages.png similarity index 100% rename from src/main/resources/assets/computercraft/textures/item/printed_pages.png rename to projects/common/src/main/resources/assets/computercraft/textures/item/printed_pages.png diff --git a/src/main/resources/assets/computercraft/shaders/core/monitor_tbo.fsh b/projects/common/src/main/resources/assets/minecraft/shaders/core/computercraft/monitor_tbo.fsh similarity index 100% rename from src/main/resources/assets/computercraft/shaders/core/monitor_tbo.fsh rename to projects/common/src/main/resources/assets/minecraft/shaders/core/computercraft/monitor_tbo.fsh diff --git a/src/main/resources/assets/computercraft/shaders/core/monitor_tbo.json b/projects/common/src/main/resources/assets/minecraft/shaders/core/computercraft/monitor_tbo.json similarity index 92% rename from src/main/resources/assets/computercraft/shaders/core/monitor_tbo.json rename to projects/common/src/main/resources/assets/minecraft/shaders/core/computercraft/monitor_tbo.json index 8ae3c3dbf..e6ae648c4 100644 --- a/src/main/resources/assets/computercraft/shaders/core/monitor_tbo.json +++ b/projects/common/src/main/resources/assets/minecraft/shaders/core/computercraft/monitor_tbo.json @@ -1,6 +1,6 @@ { - "vertex": "computercraft:monitor_tbo", - "fragment": "computercraft:monitor_tbo", + "vertex": "computercraft/monitor_tbo", + "fragment": "computercraft/monitor_tbo", "attributes": [ "Position" ], "samplers": [ { "name": "Sampler0" } ], "uniforms": [ diff --git a/src/main/resources/assets/computercraft/shaders/core/monitor_tbo.vsh b/projects/common/src/main/resources/assets/minecraft/shaders/core/computercraft/monitor_tbo.vsh similarity index 100% rename from src/main/resources/assets/computercraft/shaders/core/monitor_tbo.vsh rename to projects/common/src/main/resources/assets/minecraft/shaders/core/computercraft/monitor_tbo.vsh diff --git a/projects/common/src/main/resources/computercraft-common.accesswidener b/projects/common/src/main/resources/computercraft-common.accesswidener new file mode 100644 index 000000000..8469aa0aa --- /dev/null +++ b/projects/common/src/main/resources/computercraft-common.accesswidener @@ -0,0 +1,23 @@ +accessWidener v1 named + +# Additional access wideners for vanilla code. This is a effectively the subset of Fabric's transitive access wideners +# that we actually use + +accessible method net/minecraft/client/renderer/item/ItemProperties register (Lnet/minecraft/world/item/Item;Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/renderer/item/ClampedItemPropertyFunction;)V + +# Containers +accessible class net/minecraft/world/inventory/MenuType$MenuSupplier +accessible method net/minecraft/world/inventory/MenuType (Lnet/minecraft/world/inventory/MenuType$MenuSupplier;)V +accessible class net/minecraft/client/gui/screens/MenuScreens$ScreenConstructor +accessible method net/minecraft/client/gui/screens/MenuScreens register (Lnet/minecraft/world/inventory/MenuType;Lnet/minecraft/client/gui/screens/MenuScreens$ScreenConstructor;)V + +# Data generators +accessible class net/minecraft/data/tags/TagsProvider$TagAppender +accessible field net/minecraft/data/models/BlockModelGenerators blockStateOutput Ljava/util/function/Consumer; +accessible field net/minecraft/data/models/BlockModelGenerators modelOutput Ljava/util/function/BiConsumer; +accessible method net/minecraft/data/models/BlockModelGenerators delegateItemModel (Lnet/minecraft/world/level/block/Block;Lnet/minecraft/resources/ResourceLocation;)V +accessible method net/minecraft/data/models/BlockModelGenerators delegateItemModel (Lnet/minecraft/world/item/Item;Lnet/minecraft/resources/ResourceLocation;)V +accessible method net/minecraft/data/models/BlockModelGenerators createHorizontallyRotatedBlock (Lnet/minecraft/world/level/block/Block;Lnet/minecraft/data/models/model/TexturedModel$Provider;)V +accessible method net/minecraft/data/models/ItemModelGenerators generateFlatItem (Lnet/minecraft/world/item/Item;Lnet/minecraft/data/models/model/ModelTemplate;)V +accessible method net/minecraft/data/models/ItemModelGenerators generateFlatItem (Lnet/minecraft/world/item/Item;Ljava/lang/String;Lnet/minecraft/data/models/model/ModelTemplate;)V +accessible method net/minecraft/data/models/model/TextureSlot create (Ljava/lang/String;)Lnet/minecraft/data/models/model/TextureSlot; diff --git a/projects/common/src/main/resources/computercraft.accesswidener b/projects/common/src/main/resources/computercraft.accesswidener new file mode 100644 index 000000000..785a5b713 --- /dev/null +++ b/projects/common/src/main/resources/computercraft.accesswidener @@ -0,0 +1,34 @@ +accessWidener v1 named + +# Shared vanilla and Fabric access wideners. This should not include things already exposed by Fabric's transitive +# wideners. + +accessible method net/minecraft/client/renderer/RenderType create (Ljava/lang/String;Lcom/mojang/blaze3d/vertex/VertexFormat;Lcom/mojang/blaze3d/vertex/VertexFormat$Mode;IZZLnet/minecraft/client/renderer/RenderType$CompositeState;)Lnet/minecraft/client/renderer/RenderType$CompositeRenderType; +accessible method net/minecraft/world/level/storage/LevelResource (Ljava/lang/String;)V + +# DirectVertexBuffer +accessible field com/mojang/blaze3d/vertex/VertexBuffer vertexBufferId I +accessible field com/mojang/blaze3d/vertex/VertexBuffer indexType Lcom/mojang/blaze3d/vertex/VertexFormat$IndexType; +accessible field com/mojang/blaze3d/vertex/VertexBuffer indexCount I +accessible field com/mojang/blaze3d/vertex/VertexBuffer mode Lcom/mojang/blaze3d/vertex/VertexFormat$Mode; +accessible field com/mojang/blaze3d/vertex/VertexBuffer sequentialIndices Lcom/mojang/blaze3d/systems/RenderSystem$AutoStorageIndexBuffer; +accessible field com/mojang/blaze3d/vertex/VertexBuffer format Lcom/mojang/blaze3d/vertex/VertexFormat; + +# ClientTableFormatter +accessible field net/minecraft/client/gui/components/ChatComponent allMessages Ljava/util/List; +accessible method net/minecraft/client/gui/components/ChatComponent refreshTrimmedMessage ()V + +# ItemPocketRenderer/ItemPrintoutRenderer +accessible method net/minecraft/client/renderer/ItemInHandRenderer calculateMapTilt (F)F +accessible method net/minecraft/client/renderer/ItemInHandRenderer renderMapHand (Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/world/entity/HumanoidArm;)V +accessible method net/minecraft/client/renderer/ItemInHandRenderer renderPlayerArm (Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;IFFLnet/minecraft/world/entity/HumanoidArm;)V + +# SpeakerInstance/SpeakerManager +accessible method com/mojang/blaze3d/audio/Channel pumpBuffers (I)V +accessible field net/minecraft/client/sounds/SoundEngine executor Lnet/minecraft/client/sounds/SoundEngineExecutor; + +# Data generators +accessible field net/minecraft/data/models/ItemModelGenerators output Ljava/util/function/BiConsumer; + +# Turtle model +accessible method net/minecraft/client/renderer/block/model/ItemOverrides ()V diff --git a/projects/common/src/main/resources/computercraft.mixins.json b/projects/common/src/main/resources/computercraft.mixins.json new file mode 100644 index 000000000..444d0fda8 --- /dev/null +++ b/projects/common/src/main/resources/computercraft.mixins.json @@ -0,0 +1,15 @@ +{ + "required": true, + "package": "dan200.computercraft.mixin", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_17", + "injectors": { + "defaultRequire": 1 + }, + "mixins": [ + "CacheUpdaterMixin", + "CreativeModeTabAccessor", + "ExplosionAccessor" + ], + "refmap": "computercraft.refmap.json" +} diff --git a/src/main/resources/pack.mcmeta b/projects/common/src/main/resources/pack.mcmeta similarity index 100% rename from src/main/resources/pack.mcmeta rename to projects/common/src/main/resources/pack.mcmeta diff --git a/src/main/resources/pack.png b/projects/common/src/main/resources/pack.png similarity index 100% rename from src/main/resources/pack.png rename to projects/common/src/main/resources/pack.png diff --git a/projects/common/src/test/java/dan200/computercraft/TestPlatformHelper.java b/projects/common/src/test/java/dan200/computercraft/TestPlatformHelper.java new file mode 100644 index 000000000..4aa6ae1e5 --- /dev/null +++ b/projects/common/src/test/java/dan200/computercraft/TestPlatformHelper.java @@ -0,0 +1,263 @@ +/* + * This file is part of ComputerCraft - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. + * Send enquiries to dratcliffe@gmail.com + */ +package dan200.computercraft; + +import com.google.auto.service.AutoService; +import com.mojang.authlib.GameProfile; +import com.mojang.brigadier.arguments.ArgumentType; +import dan200.computercraft.api.filesystem.IMount; +import dan200.computercraft.api.network.wired.IWiredElement; +import dan200.computercraft.api.peripheral.IPeripheral; +import dan200.computercraft.api.peripheral.IPeripheralProvider; +import dan200.computercraft.impl.AbstractComputerCraftAPI; +import dan200.computercraft.impl.ComputerCraftAPIService; +import dan200.computercraft.shared.network.NetworkMessage; +import dan200.computercraft.shared.network.client.ClientNetworkContext; +import dan200.computercraft.shared.network.container.ContainerData; +import dan200.computercraft.shared.platform.*; +import net.minecraft.commands.synchronization.ArgumentTypeInfo; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Registry; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.tags.TagKey; +import net.minecraft.world.Container; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.CraftingContainer; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Recipe; +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.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.chunk.LevelChunk; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.util.LazyOptional; +import net.minecraftforge.items.IItemHandlerModifiable; + +import javax.annotation.Nullable; +import java.util.Collection; +import java.util.List; +import java.util.function.BiFunction; +import java.util.function.Consumer; +import java.util.function.Function; + +@AutoService({ PlatformHelper.class, dan200.computercraft.impl.PlatformHelper.class, ComputerCraftAPIService.class }) +public class TestPlatformHelper extends AbstractComputerCraftAPI implements PlatformHelper { + @Override + public Registries.RegistryWrapper wrap(ResourceKey> registry) { + throw new UnsupportedOperationException("Cannot query registry inside tests"); + } + + @Override + public RegistrationHelper createRegistrationHelper(ResourceKey> registry) { + throw new UnsupportedOperationException("Cannot query registry inside tests"); + } + + @Override + public ResourceLocation getRegistryKey(ResourceKey> registry, K object) { + throw new UnsupportedOperationException("Cannot query registry inside tests"); + } + + @Override + public K getRegistryObject(ResourceKey> registry, ResourceLocation id) { + throw new UnsupportedOperationException("Cannot query registry inside tests"); + } + + @Override + public BlockEntityType createBlockEntityType(BiFunction factory, Block block) { + throw new UnsupportedOperationException("Cannot create BlockEntityType inside tests"); + } + + @Override + public , T extends ArgumentTypeInfo.Template, I extends ArgumentTypeInfo> I registerArgumentTypeInfo(Class klass, I info) { + throw new UnsupportedOperationException("Cannot register ArgumentTypeInfo inside tests"); + } + + @Override + public void sendToPlayer(NetworkMessage message, ServerPlayer player) { + throw new UnsupportedOperationException("Cannot send NetworkMessages inside tests"); + } + + @Override + public void sendToPlayers(NetworkMessage message, Collection players) { + throw new UnsupportedOperationException("Cannot send NetworkMessages inside tests"); + } + + @Override + public void sendToAllPlayers(NetworkMessage message, MinecraftServer server) { + throw new UnsupportedOperationException("Cannot send NetworkMessages inside tests"); + } + + @Override + public void sendToAllAround(NetworkMessage message, ServerLevel level, Vec3 pos, float distance) { + throw new UnsupportedOperationException("Cannot send NetworkMessages inside tests"); + } + + @Override + public void sendToAllTracking(NetworkMessage message, LevelChunk chunk) { + throw new UnsupportedOperationException("Cannot send NetworkMessages inside tests"); + } + + @Override + public CreativeModeTab getCreativeTab() { + throw new UnsupportedOperationException("Cannot get creative tab inside tests"); + } + + @Override + public List> getDyeTags() { + throw new UnsupportedOperationException("Cannot query tags inside tests"); + } + + @Override + public MenuType createMenuType(Function reader, ContainerData.Factory factory) { + throw new UnsupportedOperationException("Cannot create MenuType inside tests"); + } + + @Override + public void openMenu(Player player, MenuProvider owner, ContainerData menu) { + throw new UnsupportedOperationException("Cannot open menu inside tests"); + } + + @Override + public ComponentAccess createPeripheralAccess(Consumer invalidate) { + throw new UnsupportedOperationException("Cannot interact with the world inside tests"); + } + + @Override + public ComponentAccess createWiredElementAccess(Consumer invalidate) { + throw new UnsupportedOperationException("Cannot interact with the world inside tests"); + } + + @Override + public boolean hasWiredElementIn(Level level, BlockPos pos, Direction direction) { + throw new UnsupportedOperationException("Cannot interact with the world inside tests"); + } + + @Override + public boolean onNotifyNeighbour(Level level, BlockPos pos, BlockState block, Direction direction) { + throw new UnsupportedOperationException("Cannot interact with the world inside tests"); + } + + @Override + public Collection getCreativeTabs(ItemStack stack) { + throw new UnsupportedOperationException("Cannot get creative tabs inside tests"); + } + + @Override + public RecipeIngredients getRecipeIngredients() { + throw new UnsupportedOperationException("Cannot query recipes inside tests"); + } + + @Override + public int getBurnTime(ItemStack stack) { + throw new UnsupportedOperationException("Cannot get burn time inside tests"); + } + + @Override + public ItemStack getCraftingRemainingItem(ItemStack stack) { + return new ItemStack(stack.getItem().getCraftingRemainingItem()); + } + + @Override + public ServerPlayer createFakePlayer(ServerLevel world, GameProfile name) { + throw new UnsupportedOperationException("Cannot interact with the world inside tests"); + } + + @Override + public boolean hasToolUsage(ItemStack stack) { + throw new UnsupportedOperationException("Cannot query item properties inside tests"); + } + + @Override + public InteractionResult canAttackEntity(ServerPlayer player, Entity entity) { + throw new UnsupportedOperationException("Cannot get burn time inside tests"); + } + + @Override + public boolean interactWithEntity(ServerPlayer player, Entity entity, Vec3 hitPos) { + throw new UnsupportedOperationException("Cannot interact with the world inside tests"); + } + + @Override + public InteractionResult useOn(ServerPlayer player, ItemStack stack, BlockHitResult hit) { + throw new UnsupportedOperationException("Cannot interact with the world inside tests"); + } + + @Override + public ContainerTransfer.Slotted wrapContainer(Container container) { + throw new UnsupportedOperationException("Cannot wrap container"); + } + + @Nullable + @Override + public ContainerTransfer getContainer(ServerLevel level, BlockPos pos, Direction side) { + throw new UnsupportedOperationException("Cannot interact with the world inside tests"); + } + + @Override + public List getRecipeRemainingItems(ServerPlayer player, Recipe recipe, CraftingContainer container) { + throw new UnsupportedOperationException("Cannot query recipes inside tests"); + } + + @Override + public void onItemCrafted(ServerPlayer player, CraftingContainer container, ItemStack stack) { + throw new UnsupportedOperationException("Cannot interact with the world inside tests"); + } + + @Override + public String getInstalledVersion() { + return "1.0"; + } + + @Nullable + @Override + public IMount createResourceMount(String domain, String subPath) { + throw new UnsupportedOperationException("Cannot create resource mount"); + } + + @Override + public void registerPeripheralProvider(IPeripheralProvider provider) { + throw new UnsupportedOperationException("Cannot register peripheral provider"); + } + + @Override + public void registerGenericCapability(Capability capability) { + throw new UnsupportedOperationException("Cannot register generic capability"); + } + + @Override + public LazyOptional getWiredElementAt(BlockGetter world, BlockPos pos, Direction side) { + throw new UnsupportedOperationException("Cannot get wired element"); + } + + @Nullable + @Override + public T tryGetRegistryObject(ResourceKey> registry, ResourceLocation id) { + throw new UnsupportedOperationException("Cannot query registries"); + } + + @Override + public IItemHandlerModifiable wrapContainerToItemHandler(Container container) { + throw new UnsupportedOperationException("Cannot wrap item handler "); + } +} diff --git a/src/test/java/dan200/computercraft/client/sound/DfpwmStreamTest.java b/projects/common/src/test/java/dan200/computercraft/client/sound/DfpwmStreamTest.java similarity index 100% rename from src/test/java/dan200/computercraft/client/sound/DfpwmStreamTest.java rename to projects/common/src/test/java/dan200/computercraft/client/sound/DfpwmStreamTest.java diff --git a/src/test/java/dan200/computercraft/shared/wired/NetworkTest.java b/projects/common/src/test/java/dan200/computercraft/impl/network/wired/NetworkTest.java similarity index 99% rename from src/test/java/dan200/computercraft/shared/wired/NetworkTest.java rename to projects/common/src/test/java/dan200/computercraft/impl/network/wired/NetworkTest.java index 427afb8dd..c6e479a56 100644 --- a/src/test/java/dan200/computercraft/shared/wired/NetworkTest.java +++ b/projects/common/src/test/java/dan200/computercraft/impl/network/wired/NetworkTest.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.shared.wired; +package dan200.computercraft.impl.network.wired; import com.google.common.collect.Maps; import com.google.common.collect.Sets; diff --git a/src/test/java/dan200/computercraft/shared/computer/core/ResourceMountTest.java b/projects/common/src/test/java/dan200/computercraft/shared/computer/core/ResourceMountTest.java similarity index 96% rename from src/test/java/dan200/computercraft/shared/computer/core/ResourceMountTest.java rename to projects/common/src/test/java/dan200/computercraft/shared/computer/core/ResourceMountTest.java index ebdc6a0bf..b9b6bc36b 100644 --- a/src/test/java/dan200/computercraft/shared/computer/core/ResourceMountTest.java +++ b/projects/common/src/test/java/dan200/computercraft/shared/computer/core/ResourceMountTest.java @@ -32,7 +32,7 @@ public class ResourceMountTest { var manager = new ReloadableResourceManager(PackType.SERVER_DATA); var done = new CompletableFuture(); manager.createReload(Util.backgroundExecutor(), Util.backgroundExecutor(), done, List.of( - new FolderPackResources(new File("projects/core/src/main/resources")) + new FolderPackResources(new File("../core/src/main/resources")) )); mount = ResourceMount.get("computercraft", "lua/rom", manager); diff --git a/src/test/java/dan200/computercraft/shared/computer/terminal/NetworkedTerminalTest.java b/projects/common/src/test/java/dan200/computercraft/shared/computer/terminal/NetworkedTerminalTest.java similarity index 100% rename from src/test/java/dan200/computercraft/shared/computer/terminal/NetworkedTerminalTest.java rename to projects/common/src/test/java/dan200/computercraft/shared/computer/terminal/NetworkedTerminalTest.java diff --git a/src/test/java/dan200/computercraft/shared/computer/terminal/TerminalStateTest.java b/projects/common/src/test/java/dan200/computercraft/shared/computer/terminal/TerminalStateTest.java similarity index 100% rename from src/test/java/dan200/computercraft/shared/computer/terminal/TerminalStateTest.java rename to projects/common/src/test/java/dan200/computercraft/shared/computer/terminal/TerminalStateTest.java diff --git a/src/test/java/dan200/computercraft/shared/network/server/UploadFileMessageTest.java b/projects/common/src/test/java/dan200/computercraft/shared/network/server/UploadFileMessageTest.java similarity index 96% rename from src/test/java/dan200/computercraft/shared/network/server/UploadFileMessageTest.java rename to projects/common/src/test/java/dan200/computercraft/shared/network/server/UploadFileMessageTest.java index f3965bda6..e89438dc9 100644 --- a/src/test/java/dan200/computercraft/shared/network/server/UploadFileMessageTest.java +++ b/projects/common/src/test/java/dan200/computercraft/shared/network/server/UploadFileMessageTest.java @@ -6,9 +6,9 @@ package dan200.computercraft.shared.network.server; import dan200.computercraft.shared.computer.upload.FileUpload; -import dan200.computercraft.support.FakeContainer; -import dan200.computercraft.support.WithMinecraft; import dan200.computercraft.test.core.ArbitraryByteBuffer; +import dan200.computercraft.test.shared.FakeContainer; +import dan200.computercraft.test.shared.WithMinecraft; import io.netty.buffer.Unpooled; import net.jqwik.api.*; import net.minecraft.network.FriendlyByteBuf; @@ -38,7 +38,7 @@ public class UploadFileMessageTest { @Property(tries = 200) @Tag("slow") public void testRoundTrip(@ForAll("fileUploads") List sentFiles) { - WithMinecraft.Setup.bootstrap(); + WithMinecraft.Setup.bootstrap(); // @Property doesn't run test lifecycle methods. var receivedFiles = receive(roundtripPackets(send(sentFiles))); assertThat(receivedFiles, containsWith(sentFiles, UploadFileMessageTest::uploadEqual)); } diff --git a/src/test/java/dan200/computercraft/shared/peripheral/speaker/DfpwmStateTest.java b/projects/common/src/test/java/dan200/computercraft/shared/peripheral/speaker/DfpwmStateTest.java similarity index 100% rename from src/test/java/dan200/computercraft/shared/peripheral/speaker/DfpwmStateTest.java rename to projects/common/src/test/java/dan200/computercraft/shared/peripheral/speaker/DfpwmStateTest.java diff --git a/src/test/java/dan200/computercraft/support/CustomSampleUploadReporter.java b/projects/common/src/testFixtures/java/dan200/computercraft/test/shared/CustomSampleUploadReporter.java similarity index 87% rename from src/test/java/dan200/computercraft/support/CustomSampleUploadReporter.java rename to projects/common/src/testFixtures/java/dan200/computercraft/test/shared/CustomSampleUploadReporter.java index a92010f1e..e75721ce4 100644 --- a/src/test/java/dan200/computercraft/support/CustomSampleUploadReporter.java +++ b/projects/common/src/testFixtures/java/dan200/computercraft/test/shared/CustomSampleUploadReporter.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.support; +package dan200.computercraft.test.shared; import com.google.auto.service.AutoService; import dan200.computercraft.shared.computer.upload.FileUpload; @@ -21,8 +21,7 @@ public class CustomSampleUploadReporter implements SampleReportingFormat { @Override public Object report(Object value) { - if (value instanceof FileUpload) { - var upload = (FileUpload) value; + if (value instanceof FileUpload upload) { return String.format("FileUpload(name=%s, contents=%s)", upload.getName(), upload.getBytes()); } else { throw new IllegalStateException("Unexpected value " + value); diff --git a/src/test/java/dan200/computercraft/support/FakeContainer.java b/projects/common/src/testFixtures/java/dan200/computercraft/test/shared/FakeContainer.java similarity index 94% rename from src/test/java/dan200/computercraft/support/FakeContainer.java rename to projects/common/src/testFixtures/java/dan200/computercraft/test/shared/FakeContainer.java index af2fcec75..2bf36e3f6 100644 --- a/src/test/java/dan200/computercraft/support/FakeContainer.java +++ b/projects/common/src/testFixtures/java/dan200/computercraft/test/shared/FakeContainer.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.support; +package dan200.computercraft.test.shared; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; diff --git a/src/test/java/dan200/computercraft/support/ItemStackMatcher.java b/projects/common/src/testFixtures/java/dan200/computercraft/test/shared/ItemStackMatcher.java similarity index 95% rename from src/test/java/dan200/computercraft/support/ItemStackMatcher.java rename to projects/common/src/testFixtures/java/dan200/computercraft/test/shared/ItemStackMatcher.java index 8cb1e0ab5..d4e11cfa3 100644 --- a/src/test/java/dan200/computercraft/support/ItemStackMatcher.java +++ b/projects/common/src/testFixtures/java/dan200/computercraft/test/shared/ItemStackMatcher.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.support; +package dan200.computercraft.test.shared; import net.minecraft.world.item.ItemStack; import org.hamcrest.Description; diff --git a/src/test/java/dan200/computercraft/support/WithMinecraft.java b/projects/common/src/testFixtures/java/dan200/computercraft/test/shared/WithMinecraft.java similarity index 96% rename from src/test/java/dan200/computercraft/support/WithMinecraft.java rename to projects/common/src/testFixtures/java/dan200/computercraft/test/shared/WithMinecraft.java index 63e6b7328..cc53dd4f3 100644 --- a/src/test/java/dan200/computercraft/support/WithMinecraft.java +++ b/projects/common/src/testFixtures/java/dan200/computercraft/test/shared/WithMinecraft.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.support; +package dan200.computercraft.test.shared; import net.minecraft.SharedConstants; import net.minecraft.server.Bootstrap; diff --git a/src/test/java/dan200/computercraft/shared/platform/ContainerTransferContract.java b/projects/common/src/testFixtures/java/dan200/computercraft/test/shared/platform/ContainerTransferContract.java similarity index 95% rename from src/test/java/dan200/computercraft/shared/platform/ContainerTransferContract.java rename to projects/common/src/testFixtures/java/dan200/computercraft/test/shared/platform/ContainerTransferContract.java index 537de4dba..746146c16 100644 --- a/src/test/java/dan200/computercraft/shared/platform/ContainerTransferContract.java +++ b/projects/common/src/testFixtures/java/dan200/computercraft/test/shared/platform/ContainerTransferContract.java @@ -3,8 +3,9 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.shared.platform; +package dan200.computercraft.test.shared.platform; +import dan200.computercraft.shared.platform.ContainerTransfer; import net.minecraft.world.Container; import net.minecraft.world.SimpleContainer; import net.minecraft.world.item.ItemStack; @@ -15,7 +16,7 @@ import java.util.Collections; import java.util.IdentityHashMap; import java.util.Set; -import static dan200.computercraft.support.ItemStackMatcher.isStack; +import static dan200.computercraft.test.shared.ItemStackMatcher.isStack; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/src/testMod/java/dan200/computercraft/export/Exporter.java b/projects/common/src/testMod/java/dan200/computercraft/export/Exporter.java similarity index 95% rename from src/testMod/java/dan200/computercraft/export/Exporter.java rename to projects/common/src/testMod/java/dan200/computercraft/export/Exporter.java index 1b65df8ec..d5372c16d 100644 --- a/src/testMod/java/dan200/computercraft/export/Exporter.java +++ b/projects/common/src/testMod/java/dan200/computercraft/export/Exporter.java @@ -15,6 +15,7 @@ import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.builder.RequiredArgumentBuilder; import dan200.computercraft.api.ComputerCraftAPI; +import dan200.computercraft.data.PrettyJsonWriter; import dan200.computercraft.gametest.core.TestHooks; import dan200.computercraft.shared.platform.Registries; import net.minecraft.client.Minecraft; @@ -45,7 +46,7 @@ public class Exporter { LiteralArgumentBuilder.literal("ccexport") .then(RequiredArgumentBuilder.argument("path", StringArgumentType.string()) .executes(c -> { - run(c.getArgument("name", String.class)); + run(c.getArgument("path", String.class)); return 0; }))); } @@ -130,8 +131,8 @@ public class Exporter { } renderer.clearState(); - try (Writer writer = Files.newBufferedWriter(root.resolve("index.json"))) { - GSON.toJson(dump, writer); + try (Writer writer = Files.newBufferedWriter(root.resolve("index.json")); var jsonWriter = new PrettyJsonWriter(writer)) { + GSON.toJson(dump, JsonDump.class, jsonWriter); } } } diff --git a/src/testMod/java/dan200/computercraft/export/ImageRenderer.java b/projects/common/src/testMod/java/dan200/computercraft/export/ImageRenderer.java similarity index 98% rename from src/testMod/java/dan200/computercraft/export/ImageRenderer.java rename to projects/common/src/testMod/java/dan200/computercraft/export/ImageRenderer.java index 1d572f79b..a6abf5a00 100644 --- a/src/testMod/java/dan200/computercraft/export/ImageRenderer.java +++ b/projects/common/src/testMod/java/dan200/computercraft/export/ImageRenderer.java @@ -40,6 +40,7 @@ public class ImageRenderer implements AutoCloseable { RenderSystem.setProjectionMatrix(Matrix4f.orthographic(0, 16, 0, 16, 1000, 3000)); var transform = RenderSystem.getModelViewStack(); + transform.pushPose(); transform.setIdentity(); transform.translate(0.0f, 0.0f, -2000.0f); diff --git a/src/testMod/java/dan200/computercraft/export/JsonDump.java b/projects/common/src/testMod/java/dan200/computercraft/export/JsonDump.java similarity index 100% rename from src/testMod/java/dan200/computercraft/export/JsonDump.java rename to projects/common/src/testMod/java/dan200/computercraft/export/JsonDump.java diff --git a/src/testMod/java/dan200/computercraft/gametest/api/ComputerState.java b/projects/common/src/testMod/java/dan200/computercraft/gametest/api/ComputerState.java similarity index 100% rename from src/testMod/java/dan200/computercraft/gametest/api/ComputerState.java rename to projects/common/src/testMod/java/dan200/computercraft/gametest/api/ComputerState.java diff --git a/src/testMod/java/dan200/computercraft/gametest/api/GameTestHolder.java b/projects/common/src/testMod/java/dan200/computercraft/gametest/api/GameTestHolder.java similarity index 100% rename from src/testMod/java/dan200/computercraft/gametest/api/GameTestHolder.java rename to projects/common/src/testMod/java/dan200/computercraft/gametest/api/GameTestHolder.java diff --git a/src/testMod/java/dan200/computercraft/gametest/core/CCTestCommand.java b/projects/common/src/testMod/java/dan200/computercraft/gametest/core/CCTestCommand.java similarity index 100% rename from src/testMod/java/dan200/computercraft/gametest/core/CCTestCommand.java rename to projects/common/src/testMod/java/dan200/computercraft/gametest/core/CCTestCommand.java diff --git a/src/testMod/java/dan200/computercraft/gametest/core/Copier.java b/projects/common/src/testMod/java/dan200/computercraft/gametest/core/Copier.java similarity index 100% rename from src/testMod/java/dan200/computercraft/gametest/core/Copier.java rename to projects/common/src/testMod/java/dan200/computercraft/gametest/core/Copier.java diff --git a/src/testMod/java/dan200/computercraft/gametest/core/TestAPI.java b/projects/common/src/testMod/java/dan200/computercraft/gametest/core/TestAPI.java similarity index 100% rename from src/testMod/java/dan200/computercraft/gametest/core/TestAPI.java rename to projects/common/src/testMod/java/dan200/computercraft/gametest/core/TestAPI.java diff --git a/src/testMod/java/dan200/computercraft/gametest/core/TestHooks.java b/projects/common/src/testMod/java/dan200/computercraft/gametest/core/TestHooks.java similarity index 100% rename from src/testMod/java/dan200/computercraft/gametest/core/TestHooks.java rename to projects/common/src/testMod/java/dan200/computercraft/gametest/core/TestHooks.java diff --git a/src/testMod/java/dan200/computercraft/mixin/gametest/GameTestHelperAccessor.java b/projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/GameTestHelperAccessor.java similarity index 100% rename from src/testMod/java/dan200/computercraft/mixin/gametest/GameTestHelperAccessor.java rename to projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/GameTestHelperAccessor.java diff --git a/src/testMod/java/dan200/computercraft/mixin/gametest/GameTestInfoAccessor.java b/projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/GameTestInfoAccessor.java similarity index 100% rename from src/testMod/java/dan200/computercraft/mixin/gametest/GameTestInfoAccessor.java rename to projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/GameTestInfoAccessor.java diff --git a/src/testMod/java/dan200/computercraft/mixin/gametest/GameTestSequenceAccessor.java b/projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/GameTestSequenceAccessor.java similarity index 100% rename from src/testMod/java/dan200/computercraft/mixin/gametest/GameTestSequenceAccessor.java rename to projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/GameTestSequenceAccessor.java diff --git a/src/testMod/java/dan200/computercraft/mixin/gametest/GameTestSequenceMixin.java b/projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/GameTestSequenceMixin.java similarity index 100% rename from src/testMod/java/dan200/computercraft/mixin/gametest/GameTestSequenceMixin.java rename to projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/GameTestSequenceMixin.java diff --git a/src/testMod/java/dan200/computercraft/mixin/gametest/TestCommandAccessor.java b/projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/TestCommandAccessor.java similarity index 100% rename from src/testMod/java/dan200/computercraft/mixin/gametest/TestCommandAccessor.java rename to projects/common/src/testMod/java/dan200/computercraft/mixin/gametest/TestCommandAccessor.java diff --git a/src/testMod/kotlin/dan200/computercraft/gametest/Computer_Test.kt b/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Computer_Test.kt similarity index 100% rename from src/testMod/kotlin/dan200/computercraft/gametest/Computer_Test.kt rename to projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Computer_Test.kt diff --git a/src/testMod/kotlin/dan200/computercraft/gametest/CraftOs_Test.kt b/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/CraftOs_Test.kt similarity index 100% rename from src/testMod/kotlin/dan200/computercraft/gametest/CraftOs_Test.kt rename to projects/common/src/testMod/kotlin/dan200/computercraft/gametest/CraftOs_Test.kt diff --git a/src/testMod/kotlin/dan200/computercraft/gametest/Disk_Drive_Test.kt b/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Disk_Drive_Test.kt similarity index 100% rename from src/testMod/kotlin/dan200/computercraft/gametest/Disk_Drive_Test.kt rename to projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Disk_Drive_Test.kt diff --git a/src/testMod/kotlin/dan200/computercraft/gametest/Loot_Test.kt b/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Loot_Test.kt similarity index 100% rename from src/testMod/kotlin/dan200/computercraft/gametest/Loot_Test.kt rename to projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Loot_Test.kt diff --git a/src/testMod/kotlin/dan200/computercraft/gametest/Modem_Test.kt b/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Modem_Test.kt similarity index 95% rename from src/testMod/kotlin/dan200/computercraft/gametest/Modem_Test.kt rename to projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Modem_Test.kt index 79eb0a456..09bbb35c5 100644 --- a/src/testMod/kotlin/dan200/computercraft/gametest/Modem_Test.kt +++ b/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Modem_Test.kt @@ -10,7 +10,7 @@ import dan200.computercraft.core.apis.PeripheralAPI import dan200.computercraft.core.computer.ComputerSide import dan200.computercraft.gametest.api.* import dan200.computercraft.shared.ModRegistry -import dan200.computercraft.shared.peripheral.modem.wired.BlockCable +import dan200.computercraft.shared.peripheral.modem.wired.CableBlock import dan200.computercraft.test.core.assertArrayEquals import dan200.computercraft.test.core.computer.LuaTaskContext import dan200.computercraft.test.core.computer.getApi @@ -38,10 +38,10 @@ class Modem_Test { thenExecute { helper.setBlock( position, - BlockCable.correctConnections( + CableBlock.correctConnections( helper.level, helper.absolutePos(position), - ModRegistry.Blocks.CABLE.get().defaultBlockState().setValue(BlockCable.CABLE, true), + ModRegistry.Blocks.CABLE.get().defaultBlockState().setValue(CableBlock.CABLE, true), ), ) } diff --git a/src/testMod/kotlin/dan200/computercraft/gametest/Monitor_Test.kt b/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Monitor_Test.kt similarity index 100% rename from src/testMod/kotlin/dan200/computercraft/gametest/Monitor_Test.kt rename to projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Monitor_Test.kt diff --git a/src/testMod/kotlin/dan200/computercraft/gametest/Recipe_Test.kt b/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Recipe_Test.kt similarity index 100% rename from src/testMod/kotlin/dan200/computercraft/gametest/Recipe_Test.kt rename to projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Recipe_Test.kt diff --git a/src/testMod/kotlin/dan200/computercraft/gametest/Turtle_Test.kt b/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Turtle_Test.kt similarity index 97% rename from src/testMod/kotlin/dan200/computercraft/gametest/Turtle_Test.kt rename to projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Turtle_Test.kt index 1099c2d01..de19ad006 100644 --- a/src/testMod/kotlin/dan200/computercraft/gametest/Turtle_Test.kt +++ b/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Turtle_Test.kt @@ -14,8 +14,8 @@ import dan200.computercraft.gametest.core.TestHooks import dan200.computercraft.mixin.gametest.GameTestHelperAccessor import dan200.computercraft.mixin.gametest.GameTestInfoAccessor import dan200.computercraft.shared.ModRegistry -import dan200.computercraft.shared.media.items.ItemPrintout -import dan200.computercraft.shared.peripheral.monitor.BlockMonitor +import dan200.computercraft.shared.media.items.PrintoutItem +import dan200.computercraft.shared.peripheral.monitor.MonitorBlock import dan200.computercraft.shared.peripheral.monitor.MonitorEdgeState import dan200.computercraft.shared.turtle.apis.TurtleAPI import dan200.computercraft.shared.util.WaterloggableHelpers @@ -135,7 +135,7 @@ class Turtle_Test { .assertArrayEquals(true, message = "Block was placed") } thenIdle(1) - thenExecute { helper.assertBlockHas(BlockPos(1, 2, 3), BlockMonitor.STATE, MonitorEdgeState.LR) } + thenExecute { helper.assertBlockHas(BlockPos(1, 2, 3), MonitorBlock.STATE, MonitorEdgeState.LR) } } /** @@ -178,8 +178,8 @@ class Turtle_Test { thenExecute { VanillaDetailRegistries.ITEM_STACK.addProvider( object : - BasicItemDetailProvider("printout", ItemPrintout::class.java) { - override fun provideDetails(data: MutableMap, stack: ItemStack, item: ItemPrintout) { + BasicItemDetailProvider("printout", PrintoutItem::class.java) { + override fun provideDetails(data: MutableMap, stack: ItemStack, item: PrintoutItem) { data["type"] = item.type.toString().lowercase() } }, @@ -411,12 +411,13 @@ class Turtle_Test { } } } + thenIdle(2) thenOnComputer("turtle") { turtle.forward().await().assertArrayEquals(true, message = "Moved turtle forward") turtle.back().await().assertArrayEquals(true, message = "Moved turtle forward") TestHooks.LOG.info("[{}] Finished turtle at {}", testInfo, testInfo.`computercraft$getTick`()) } - thenIdle(3) // Should happen immediately, but computers might be slow. + thenIdle(2) // Should happen immediately, but computers might be slow. thenExecute { assertEquals( listOf( diff --git a/src/testMod/kotlin/dan200/computercraft/gametest/api/TestExtensions.kt b/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/api/TestExtensions.kt similarity index 94% rename from src/testMod/kotlin/dan200/computercraft/gametest/api/TestExtensions.kt rename to projects/common/src/testMod/kotlin/dan200/computercraft/gametest/api/TestExtensions.kt index ef3227d80..f8ab09745 100644 --- a/src/testMod/kotlin/dan200/computercraft/gametest/api/TestExtensions.kt +++ b/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/api/TestExtensions.kt @@ -8,7 +8,8 @@ package dan200.computercraft.gametest.api import dan200.computercraft.gametest.core.ManagedComputers import dan200.computercraft.mixin.gametest.GameTestHelperAccessor import dan200.computercraft.mixin.gametest.GameTestSequenceAccessor -import dan200.computercraft.shared.Peripherals +import dan200.computercraft.shared.platform.PlatformHelper +import dan200.computercraft.shared.platform.Registries import dan200.computercraft.test.core.computer.LuaTaskContext import net.minecraft.commands.arguments.blocks.BlockInput import net.minecraft.core.BlockPos @@ -23,7 +24,6 @@ import net.minecraft.world.level.block.entity.BlockEntity import net.minecraft.world.level.block.entity.BlockEntityType import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.properties.Property -import net.minecraftforge.registries.ForgeRegistries /** * Globally usable structures. @@ -139,7 +139,7 @@ fun GameTestHelper.assertBlockIs(pos: BlockPos, predicate: (BlockState) -> Boole fun > GameTestHelper.assertBlockHas(pos: BlockPos, property: Property, value: T, message: String = "") { val state = getBlockState(pos) if (!state.hasProperty(property)) { - val id = ForgeRegistries.BLOCKS.getKey(state.block) + val id = Registries.BLOCKS.getKey(state.block) fail(message, "block $id does not have property ${property.name}", pos) } else if (state.getValue(property) != value) { fail(message, "${property.name} is ${state.getValue(property)}, expected $value", pos) @@ -188,7 +188,8 @@ private fun GameTestHelper.assertContainerExactlyImpl(pos: BlockPos, container: } fun GameTestHelper.assertPeripheral(pos: BlockPos, direction: Direction = Direction.UP, type: String) { - val peripheral = Peripherals.getPeripheral(level, absolutePos(pos), direction) {} + val peripheral = PlatformHelper.get().createPeripheralAccess { } + .get(level, absolutePos(pos).relative(direction), direction.opposite) when { peripheral == null -> fail("No peripheral at position", pos) peripheral.type != type -> fail("Peripheral is of type ${peripheral.type}, expected $type", pos) @@ -196,11 +197,12 @@ fun GameTestHelper.assertPeripheral(pos: BlockPos, direction: Direction = Direct } fun GameTestHelper.assertNoPeripheral(pos: BlockPos, direction: Direction = Direction.UP) { - val peripheral = Peripherals.getPeripheral(level, absolutePos(pos), direction) {} + val peripheral = PlatformHelper.get().createPeripheralAccess { } + .get(level, absolutePos(pos).relative(direction), direction.opposite) if (peripheral != null) fail("Expected no peripheral, got a ${peripheral.type}", pos) } -private fun getName(type: BlockEntityType<*>): ResourceLocation = ForgeRegistries.BLOCK_ENTITY_TYPES.getKey(type)!! +private fun getName(type: BlockEntityType<*>): ResourceLocation = Registries.BLOCK_ENTITY_TYPES.getKey(type)!! /** * Get a [BlockEntity] of a specific type. diff --git a/src/testMod/kotlin/dan200/computercraft/gametest/core/ManagedComputers.kt b/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/core/ManagedComputers.kt similarity index 100% rename from src/testMod/kotlin/dan200/computercraft/gametest/core/ManagedComputers.kt rename to projects/common/src/testMod/kotlin/dan200/computercraft/gametest/core/ManagedComputers.kt diff --git a/src/testMod/resources/computercraft-gametest.mixins.json b/projects/common/src/testMod/resources/computercraft-gametest.mixins.json similarity index 100% rename from src/testMod/resources/computercraft-gametest.mixins.json rename to projects/common/src/testMod/resources/computercraft-gametest.mixins.json diff --git a/src/testMod/resources/data/cctest/computer/startup.lua b/projects/common/src/testMod/resources/data/cctest/computer/startup.lua similarity index 100% rename from src/testMod/resources/data/cctest/computer/startup.lua rename to projects/common/src/testMod/resources/data/cctest/computer/startup.lua diff --git a/src/testMod/resources/data/cctest/computer/tests/craftos_test.sends_basic_rednet_messages.echo.lua b/projects/common/src/testMod/resources/data/cctest/computer/tests/craftos_test.sends_basic_rednet_messages.echo.lua similarity index 100% rename from src/testMod/resources/data/cctest/computer/tests/craftos_test.sends_basic_rednet_messages.echo.lua rename to projects/common/src/testMod/resources/data/cctest/computer/tests/craftos_test.sends_basic_rednet_messages.echo.lua diff --git a/src/testMod/resources/data/cctest/computer/tests/craftos_test.sends_basic_rednet_messages.main.lua b/projects/common/src/testMod/resources/data/cctest/computer/tests/craftos_test.sends_basic_rednet_messages.main.lua similarity index 100% rename from src/testMod/resources/data/cctest/computer/tests/craftos_test.sends_basic_rednet_messages.main.lua rename to projects/common/src/testMod/resources/data/cctest/computer/tests/craftos_test.sends_basic_rednet_messages.main.lua diff --git a/src/testMod/resources/data/cctest/structures/computer_test.computer_peripheral.snbt b/projects/common/src/testMod/resources/data/cctest/structures/computer_test.computer_peripheral.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/computer_test.computer_peripheral.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/computer_test.computer_peripheral.snbt diff --git a/src/testMod/resources/data/cctest/structures/computer_test.no_through_signal.snbt b/projects/common/src/testMod/resources/data/cctest/structures/computer_test.no_through_signal.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/computer_test.no_through_signal.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/computer_test.no_through_signal.snbt diff --git a/src/testMod/resources/data/cctest/structures/computer_test.no_through_signal_reverse.snbt b/projects/common/src/testMod/resources/data/cctest/structures/computer_test.no_through_signal_reverse.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/computer_test.no_through_signal_reverse.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/computer_test.no_through_signal_reverse.snbt diff --git a/src/testMod/resources/data/cctest/structures/computer_test.set_and_destroy.snbt b/projects/common/src/testMod/resources/data/cctest/structures/computer_test.set_and_destroy.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/computer_test.set_and_destroy.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/computer_test.set_and_destroy.snbt diff --git a/src/testMod/resources/data/cctest/structures/craftos_test.sends_basic_rednet_messages.snbt b/projects/common/src/testMod/resources/data/cctest/structures/craftos_test.sends_basic_rednet_messages.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/craftos_test.sends_basic_rednet_messages.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/craftos_test.sends_basic_rednet_messages.snbt diff --git a/src/testMod/resources/data/cctest/structures/default.snbt b/projects/common/src/testMod/resources/data/cctest/structures/default.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/default.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/default.snbt diff --git a/src/testMod/resources/data/cctest/structures/disk_drive_test.adds_removes_mount.snbt b/projects/common/src/testMod/resources/data/cctest/structures/disk_drive_test.adds_removes_mount.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/disk_drive_test.adds_removes_mount.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/disk_drive_test.adds_removes_mount.snbt diff --git a/src/testMod/resources/data/cctest/structures/disk_drive_test.audio_disk.snbt b/projects/common/src/testMod/resources/data/cctest/structures/disk_drive_test.audio_disk.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/disk_drive_test.audio_disk.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/disk_drive_test.audio_disk.snbt diff --git a/src/testMod/resources/data/cctest/structures/disk_drive_test.ejects_disk.snbt b/projects/common/src/testMod/resources/data/cctest/structures/disk_drive_test.ejects_disk.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/disk_drive_test.ejects_disk.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/disk_drive_test.ejects_disk.snbt diff --git a/src/testMod/resources/data/cctest/structures/modem_test.gains_peripherals.snbt b/projects/common/src/testMod/resources/data/cctest/structures/modem_test.gains_peripherals.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/modem_test.gains_peripherals.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/modem_test.gains_peripherals.snbt diff --git a/src/testMod/resources/data/cctest/structures/modem_test.have_peripherals.snbt b/projects/common/src/testMod/resources/data/cctest/structures/modem_test.have_peripherals.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/modem_test.have_peripherals.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/modem_test.have_peripherals.snbt diff --git a/src/testMod/resources/data/cctest/structures/modem_test.transmits_messages.snbt b/projects/common/src/testMod/resources/data/cctest/structures/modem_test.transmits_messages.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/modem_test.transmits_messages.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/modem_test.transmits_messages.snbt diff --git a/src/testMod/resources/data/cctest/structures/monitor_test.ensures_valid_on_place.snbt b/projects/common/src/testMod/resources/data/cctest/structures/monitor_test.ensures_valid_on_place.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/monitor_test.ensures_valid_on_place.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/monitor_test.ensures_valid_on_place.snbt diff --git a/src/testMod/resources/data/cctest/structures/monitor_test.looks_acceptable.snbt b/projects/common/src/testMod/resources/data/cctest/structures/monitor_test.looks_acceptable.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/monitor_test.looks_acceptable.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/monitor_test.looks_acceptable.snbt diff --git a/src/testMod/resources/data/cctest/structures/monitor_test.looks_acceptable_dark.snbt b/projects/common/src/testMod/resources/data/cctest/structures/monitor_test.looks_acceptable_dark.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/monitor_test.looks_acceptable_dark.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/monitor_test.looks_acceptable_dark.snbt diff --git a/src/testMod/resources/data/cctest/structures/printouttest.in_frame_at_night.snbt b/projects/common/src/testMod/resources/data/cctest/structures/printouttest.in_frame_at_night.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/printouttest.in_frame_at_night.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/printouttest.in_frame_at_night.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.attack_entity.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.attack_entity.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.attack_entity.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.attack_entity.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.attack_entity_destroy.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.attack_entity_destroy.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.attack_entity_destroy.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.attack_entity_destroy.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.cleaned_with_cauldrons.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.cleaned_with_cauldrons.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.cleaned_with_cauldrons.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.cleaned_with_cauldrons.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.drop_into_chest.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.drop_into_chest.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.drop_into_chest.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.drop_into_chest.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.drop_into_entity.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.drop_into_entity.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.drop_into_entity.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.drop_into_entity.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.gather_lava.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.gather_lava.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.gather_lava.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.gather_lava.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.hoe_dirt.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.hoe_dirt.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.hoe_dirt.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.hoe_dirt.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.item_detail_provider.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.item_detail_provider.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.item_detail_provider.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.item_detail_provider.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.move_obstruct.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.move_obstruct.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.move_obstruct.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.move_obstruct.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.move_replace.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.move_replace.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.move_replace.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.move_replace.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.move_water.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.move_water.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.move_water.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.move_water.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.no_ghost_peripheral.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.no_ghost_peripheral.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.no_ghost_peripheral.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.no_ghost_peripheral.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.peripheral_change.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.peripheral_change.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.peripheral_change.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.peripheral_change.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.place_lava.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.place_lava.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.place_lava.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.place_lava.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.place_monitor.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.place_monitor.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.place_monitor.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.place_monitor.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.place_waterlogged.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.place_waterlogged.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.place_waterlogged.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.place_waterlogged.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.refuel_basic.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.refuel_basic.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.refuel_basic.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.refuel_basic.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.refuel_container.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.refuel_container.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.refuel_container.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.refuel_container.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.resists_entity_explosions.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.resists_entity_explosions.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.resists_entity_explosions.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.resists_entity_explosions.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.resists_explosions.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.resists_explosions.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.resists_explosions.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.resists_explosions.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.shears_sheep.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.shears_sheep.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.shears_sheep.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.shears_sheep.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.unequip_refreshes_peripheral.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.unequip_refreshes_peripheral.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.unequip_refreshes_peripheral.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.unequip_refreshes_peripheral.snbt diff --git a/src/testMod/resources/data/cctest/structures/turtle_test.use_compostors.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.use_compostors.snbt similarity index 100% rename from src/testMod/resources/data/cctest/structures/turtle_test.use_compostors.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.use_compostors.snbt diff --git a/src/testMod/resources/data/computercraft/loot_tables/treasure_disk.json b/projects/common/src/testMod/resources/data/computercraft/loot_tables/treasure_disk.json similarity index 100% rename from src/testMod/resources/data/computercraft/loot_tables/treasure_disk.json rename to projects/common/src/testMod/resources/data/computercraft/loot_tables/treasure_disk.json diff --git a/src/testMod/resources/data/computercraft/lua/rom/autorun/cctest.lua b/projects/common/src/testMod/resources/data/computercraft/lua/rom/autorun/cctest.lua similarity index 100% rename from src/testMod/resources/data/computercraft/lua/rom/autorun/cctest.lua rename to projects/common/src/testMod/resources/data/computercraft/lua/rom/autorun/cctest.lua diff --git a/src/testMod/resources/pack.mcmeta b/projects/common/src/testMod/resources/pack.mcmeta similarity index 100% rename from src/testMod/resources/pack.mcmeta rename to projects/common/src/testMod/resources/pack.mcmeta diff --git a/projects/core/src/test/java/dan200/computercraft/core/computer/ComputerThreadTest.java b/projects/core/src/test/java/dan200/computercraft/core/computer/ComputerThreadTest.java index 2e6197820..f510030cf 100644 --- a/projects/core/src/test/java/dan200/computercraft/core/computer/ComputerThreadTest.java +++ b/projects/core/src/test/java/dan200/computercraft/core/computer/ComputerThreadTest.java @@ -8,7 +8,10 @@ package dan200.computercraft.core.computer; import dan200.computercraft.core.lua.MachineResult; import dan200.computercraft.test.core.ConcurrentHelpers; import dan200.computercraft.test.core.computer.KotlinComputerManager; -import org.junit.jupiter.api.*; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.api.parallel.ExecutionMode; import org.slf4j.Logger; diff --git a/projects/forge/build.gradle.kts b/projects/forge/build.gradle.kts new file mode 100644 index 000000000..2538c0f60 --- /dev/null +++ b/projects/forge/build.gradle.kts @@ -0,0 +1,338 @@ +import cc.tweaked.gradle.* +import groovy.util.Node +import groovy.util.NodeList +import net.darkhax.curseforgegradle.TaskPublishCurseForge +import net.minecraftforge.gradle.common.util.RunConfig + +plugins { + // Build + id("cc-tweaked.forge") + id("cc-tweaked.gametest") + alias(libs.plugins.mixinGradle) + alias(libs.plugins.shadow) + // Publishing + alias(libs.plugins.curseForgeGradle) + alias(libs.plugins.githubRelease) + alias(libs.plugins.minotaur) + + id("cc-tweaked.illuaminate") + id("cc-tweaked.publishing") + id("cc-tweaked") +} + +val isStable = true +val modVersion: String by extra +val mcVersion: String by extra + +val allProjects = listOf(":core-api", ":core", ":forge-api").map { evaluationDependsOn(it) } +cct { + inlineProject(":common") + allProjects.forEach { externalSources(it) } +} + +sourceSets { + main { + resources.srcDir("src/generated/resources") + } +} + +minecraft { + runs { + // configureEach would be better, but we need to eagerly configure configs or otherwise the run task doesn't + // get set up properly. + all { + lazyToken("minecraft_classpath") { + configurations["shade"].copyRecursive().resolve().joinToString(File.pathSeparator) { it.absolutePath } + } + + property("forge.logging.markers", "REGISTRIES") + property("forge.logging.console.level", "debug") + + forceExit = false + + mods.register("computercraft") { + cct.sourceDirectories.get().forEach { + if (it.classes) sources(it.sourceSet) + } + } + } + + val client by registering { + workingDirectory(file("run")) + } + + val server by registering { + workingDirectory(file("run/server")) + arg("--nogui") + } + + val data by registering { + workingDirectory(file("run")) + args( + "--mod", "computercraft", "--all", + "--output", file("src/generated/resources/"), + "--existing", project(":common").file("src/main/resources/"), + "--existing", file("src/main/resources/"), + ) + property("cct.pretty-json", "true") + } + + fun RunConfig.configureForGameTest() { + val old = lazyTokens.get("minecraft_classpath") + lazyToken("minecraft_classpath") { + // We do some terrible hacks here to basically find all things not already on the runtime classpath + // and add them. /Except/ for our source sets, as those need to load inside the Minecraft classpath. + val testMod = configurations["testModRuntimeClasspath"].resolve() + val implementation = configurations.runtimeClasspath.get().resolve() + val new = (testMod - implementation) + .asSequence() + .filter { it.isFile && !it.name.endsWith("-test-fixtures.jar") } + .map { it.absolutePath } + .joinToString(File.pathSeparator) + if (old == null) new else old.get() + File.pathSeparator + new + } + + property("cctest.sources", project(":common").file("src/testMod/resources/data/cctest").absolutePath) + + arg("--mixin.config=computercraft-gametest.mixins.json") + + mods.register("cctest") { + source(sourceSets["testMod"]) + source(sourceSets["testFixtures"]) + // FIXME: We need this for running in-dev but not from Gradle: + // source(project(":core").sourceSets.testFixtures.get()) + } + } + + val testClient by registering { + workingDirectory(file("run/testClient")) + parent(client.get()) + configureForGameTest() + } + + val gameTestServer by registering { + workingDirectory(file("run/testServer")) + configureForGameTest() + + property("forge.logging.console.level", "info") + } + } +} + +mixin { + add(sourceSets.main.get(), "computercraft.mixins.refmap.json") + config("computercraft.mixins.json") + config("computercraft-client.forge.mixins.json") +} + +reobf { + register("shadowJar") +} + +configurations { + val shade by registering { isTransitive = false } + implementation { extendsFrom(shade.get()) } + register("cctJavadoc") +} + +dependencies { + annotationProcessor("org.spongepowered:mixin:0.8.5-SQUID:processor") + + errorprone(project(":lints")) + + compileOnly(libs.jetbrainsAnnotations) + annotationProcessorEverywhere(libs.autoService) + + libs.bundles.externalMods.forge.compile.get().map { compileOnly(fg.deobf(it)) } + libs.bundles.externalMods.forge.runtime.get().map { runtimeOnly(fg.deobf(it)) } + + implementation(project(":core")) + implementation(commonClasses(project(":forge-api"))) + implementation(clientClasses(project(":forge-api"))) + "shade"(libs.cobalt) + "shade"(libs.netty.http) + + testFixturesApi(libs.bundles.test) + testFixturesApi(libs.bundles.kotlin) + + testImplementation(testFixtures(project(":core"))) + testImplementation(libs.bundles.test) + testImplementation(libs.bundles.kotlin) + testRuntimeOnly(libs.bundles.testRuntime) + + testModImplementation(testFixtures(project(":core"))) + + "cctJavadoc"(libs.cctJavadoc) +} + +illuaminate { + version.set(libs.versions.illuaminate) +} + +// Compile tasks + +val luaJavadoc by tasks.registering(Javadoc::class) { + description = "Generates documentation for Java-side Lua functions." + group = JavaBasePlugin.DOCUMENTATION_GROUP + + source(sourceSets.main.get().java) + source(project(":core").sourceSets.main.get().java) + source(project(":common").sourceSets.main.get().java) + + setDestinationDir(buildDir.resolve("docs/luaJavadoc")) + classpath = sourceSets.main.get().compileClasspath + + options.docletpath = configurations["cctJavadoc"].files.toList() + options.doclet = "cc.tweaked.javadoc.LuaDoclet" + (options as StandardJavadocDocletOptions).noTimestamp(false) + + javadocTool.set( + javaToolchains.javadocToolFor { + languageVersion.set(cc.tweaked.gradle.CCTweakedPlugin.JAVA_VERSION) + }, + ) +} + +tasks.processResources { + inputs.property("modVersion", modVersion) + inputs.property("forgeVersion", libs.versions.forge.get()) + + filesMatching("META-INF/mods.toml") { + expand(mapOf("forgeVersion" to libs.versions.forge.get(), "file" to mapOf("jarVersion" to modVersion))) + } +} + +tasks.jar { + finalizedBy("reobfJar") + archiveClassifier.set("slim") + + from(allProjects.map { zipTree(it.tasks.jar.get().archiveFile) }) +} + +tasks.shadowJar { + finalizedBy("reobfShadowJar") + archiveClassifier.set("") + + from(allProjects.map { zipTree(it.tasks.jar.get().archiveFile) }) + + configurations = listOf(project.configurations["shade"]) + relocate("org.squiddev.cobalt", "cc.tweaked.internal.cobalt") + relocate("io.netty.handler", "cc.tweaked.internal.netty") + // TODO: minimize(): Would be good to support once our build scripts are stabilised. +} + +tasks.assemble { dependsOn("shadowJar") } + +// Check tasks + +tasks.test { + systemProperty("cct.test-files", buildDir.resolve("tmp/testFiles").absolutePath) +} + +val lintLua by tasks.registering(IlluaminateExec::class) { + group = JavaBasePlugin.VERIFICATION_GROUP + description = "Lint Lua (and Lua docs) with illuaminate" + + // Config files + inputs.file(rootProject.file("illuaminate.sexp")).withPropertyName("illuaminate.sexp") + // Sources + inputs.files(rootProject.fileTree("doc")).withPropertyName("docs") + inputs.files(project(":core").fileTree("src/main/resources/data/computercraft/lua")).withPropertyName("lua rom") + inputs.files(luaJavadoc) + + args = listOf("lint") + + doFirst { if (System.getenv("GITHUB_ACTIONS") != null) println("::add-matcher::.github/matchers/illuaminate.json") } + doLast { if (System.getenv("GITHUB_ACTIONS") != null) println("::remove-matcher owner=illuaminate::") } +} + +val runGametest by tasks.registering(JavaExec::class) { + group = LifecycleBasePlugin.VERIFICATION_GROUP + description = "Runs tests on a temporary Minecraft instance." + dependsOn("cleanRunGametest") + + // Copy from runGameTestServer. We do it in this slightly odd way as runGameTestServer + // isn't created until the task is configured (which is no good for us). + val exec = tasks.getByName("runGameTestServer") + dependsOn(exec.dependsOn) + exec.copyToFull(this) +} + +cct.jacoco(runGametest) + +tasks.check { dependsOn(runGametest) } + +// Upload tasks + +val publishCurseForge by tasks.registering(TaskPublishCurseForge::class) { + group = PublishingPlugin.PUBLISH_TASK_GROUP + description = "Upload artifacts to CurseForge" + + apiToken = findProperty("curseForgeApiKey") ?: "" + enabled = apiToken != "" + + val mainFile = upload("282001", tasks.shadowJar.get().archiveFile) + dependsOn(tasks.shadowJar) // Ughr. + mainFile.changelog = + "Release notes can be found on the [GitHub repository](https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v$mcVersion-$modVersion)." + mainFile.changelogType = "markdown" + mainFile.releaseType = if (isStable) "release" else "alpha" + mainFile.gameVersions.add(mcVersion) +} + +tasks.publish { dependsOn(publishCurseForge) } + +modrinth { + token.set(findProperty("modrinthApiKey") as String? ?: "") + projectId.set("gu7yAYhd") + versionNumber.set("$mcVersion-$modVersion") + versionName.set(modVersion) + versionType.set(if (isStable) "release" else "alpha") + uploadFile.set(tasks.shadowJar as Any) + gameVersions.add(mcVersion) + changelog.set("Release notes can be found on the [GitHub repository](https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v$mcVersion-$modVersion).") + + syncBodyFrom.set(provider { file("doc/mod-page.md").readText() }) +} + +tasks.publish { dependsOn(tasks.modrinth) } + +githubRelease { + token(findProperty("githubApiKey") as String? ?: "") + owner.set("cc-tweaked") + repo.set("CC-Tweaked") + targetCommitish.set(cct.gitBranch) + + tagName.set("v$mcVersion-$modVersion") + releaseName.set("[$mcVersion] $modVersion") + body.set( + provider { + "## " + file("src/main/resources/data/computercraft/lua/rom/help/whatsnew.md") + .readLines() + .takeWhile { it != "Type \"help changelog\" to see the full version history." } + .joinToString("\n").trim() + }, + ) + prerelease.set(!isStable) +} + +tasks.publish { dependsOn(tasks.githubRelease) } + +// Don't publish the slim jar +for (cfg in listOf(configurations.apiElements, configurations.runtimeElements)) { + cfg.configure { artifacts.removeIf { it.classifier == "slim" } } +} + +publishing { + publications { + named("maven", MavenPublication::class) { + fg.component(this) + // Remove all dependencies: they're shaded anyway! This is very ugly, but not found a better way :(. + pom.withXml { + for (node in asNode().get("dependencies") as NodeList) { + asNode().remove(node as Node) + } + } + } + } +} diff --git a/src/main/java/dan200/computercraft/client/ForgeClientHooks.java b/projects/forge/src/client/java/dan200/computercraft/client/ForgeClientHooks.java similarity index 99% rename from src/main/java/dan200/computercraft/client/ForgeClientHooks.java rename to projects/forge/src/client/java/dan200/computercraft/client/ForgeClientHooks.java index 8ebac1a0f..613d321c6 100644 --- a/src/main/java/dan200/computercraft/client/ForgeClientHooks.java +++ b/projects/forge/src/client/java/dan200/computercraft/client/ForgeClientHooks.java @@ -80,5 +80,4 @@ public final class ForgeClientHooks { if (!(event.getSound() instanceof SpeakerSound sound) || sound.getStream() == null) return; ClientHooks.onPlayStreaming(event.getEngine(), event.getChannel(), sound.getStream()); } - } diff --git a/src/main/java/dan200/computercraft/client/ForgeClientRegistry.java b/projects/forge/src/client/java/dan200/computercraft/client/ForgeClientRegistry.java similarity index 96% rename from src/main/java/dan200/computercraft/client/ForgeClientRegistry.java rename to projects/forge/src/client/java/dan200/computercraft/client/ForgeClientRegistry.java index 3a348d5ef..df4d516cb 100644 --- a/src/main/java/dan200/computercraft/client/ForgeClientRegistry.java +++ b/projects/forge/src/client/java/dan200/computercraft/client/ForgeClientRegistry.java @@ -6,7 +6,7 @@ package dan200.computercraft.client; import dan200.computercraft.api.ComputerCraftAPI; -import dan200.computercraft.client.render.TurtleModelLoader; +import dan200.computercraft.client.model.turtle.TurtleModelLoader; import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.ModelEvent; diff --git a/src/main/java/dan200/computercraft/client/integration/IrisShaderMod.java b/projects/forge/src/client/java/dan200/computercraft/client/integration/IrisShaderMod.java similarity index 100% rename from src/main/java/dan200/computercraft/client/integration/IrisShaderMod.java rename to projects/forge/src/client/java/dan200/computercraft/client/integration/IrisShaderMod.java diff --git a/src/main/java/dan200/computercraft/client/render/TransformedBakedModel.java b/projects/forge/src/client/java/dan200/computercraft/client/model/TransformedBakedModel.java similarity index 98% rename from src/main/java/dan200/computercraft/client/render/TransformedBakedModel.java rename to projects/forge/src/client/java/dan200/computercraft/client/model/TransformedBakedModel.java index 310119322..65f5b39be 100644 --- a/src/main/java/dan200/computercraft/client/render/TransformedBakedModel.java +++ b/projects/forge/src/client/java/dan200/computercraft/client/model/TransformedBakedModel.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.client.render; +package dan200.computercraft.client.model; import com.mojang.math.Transformation; import net.minecraft.client.renderer.RenderType; diff --git a/src/main/java/dan200/computercraft/client/model/turtle/TurtleModel.java b/projects/forge/src/client/java/dan200/computercraft/client/model/turtle/TurtleModel.java similarity index 95% rename from src/main/java/dan200/computercraft/client/model/turtle/TurtleModel.java rename to projects/forge/src/client/java/dan200/computercraft/client/model/turtle/TurtleModel.java index 0891c2b59..8496bb872 100644 --- a/src/main/java/dan200/computercraft/client/model/turtle/TurtleModel.java +++ b/projects/forge/src/client/java/dan200/computercraft/client/model/turtle/TurtleModel.java @@ -6,7 +6,7 @@ package dan200.computercraft.client.model.turtle; import com.mojang.blaze3d.vertex.PoseStack; -import dan200.computercraft.client.render.TransformedBakedModel; +import dan200.computercraft.client.model.TransformedBakedModel; import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.world.item.ItemStack; diff --git a/src/main/java/dan200/computercraft/client/render/TurtleModelLoader.java b/projects/forge/src/client/java/dan200/computercraft/client/model/turtle/TurtleModelLoader.java similarity index 96% rename from src/main/java/dan200/computercraft/client/render/TurtleModelLoader.java rename to projects/forge/src/client/java/dan200/computercraft/client/model/turtle/TurtleModelLoader.java index 2507c20e9..92118041b 100644 --- a/src/main/java/dan200/computercraft/client/render/TurtleModelLoader.java +++ b/projects/forge/src/client/java/dan200/computercraft/client/model/turtle/TurtleModelLoader.java @@ -3,13 +3,12 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.client.render; +package dan200.computercraft.client.model.turtle; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; import com.mojang.datafixers.util.Pair; import dan200.computercraft.api.ComputerCraftAPI; -import dan200.computercraft.client.model.turtle.TurtleModel; import net.minecraft.client.renderer.block.model.ItemOverrides; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.model.*; diff --git a/src/main/java/dan200/computercraft/client/platform/ClientNetworkContextImpl.java b/projects/forge/src/client/java/dan200/computercraft/client/platform/ClientNetworkContextImpl.java similarity index 100% rename from src/main/java/dan200/computercraft/client/platform/ClientNetworkContextImpl.java rename to projects/forge/src/client/java/dan200/computercraft/client/platform/ClientNetworkContextImpl.java diff --git a/src/main/java/dan200/computercraft/client/platform/ClientPlatformHelperImpl.java b/projects/forge/src/client/java/dan200/computercraft/client/platform/ClientPlatformHelperImpl.java similarity index 93% rename from src/main/java/dan200/computercraft/client/platform/ClientPlatformHelperImpl.java rename to projects/forge/src/client/java/dan200/computercraft/client/platform/ClientPlatformHelperImpl.java index 048424519..c161bbfa5 100644 --- a/src/main/java/dan200/computercraft/client/platform/ClientPlatformHelperImpl.java +++ b/projects/forge/src/client/java/dan200/computercraft/client/platform/ClientPlatformHelperImpl.java @@ -13,14 +13,13 @@ import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.ModelManager; import net.minecraft.resources.ResourceLocation; -@AutoService(dan200.computercraft.impl.client.ClientPlatformHelper.class) +@AutoService(ClientPlatformHelper.class) public class ClientPlatformHelperImpl implements ClientPlatformHelper { @Override public BakedModel getModel(ModelManager manager, ResourceLocation location) { return manager.getModel(location); } - @Override public void sendToServer(NetworkMessage message) { NetworkHandler.sendToServer(message); diff --git a/src/main/java/dan200/computercraft/mixin/BlockRenderDispatcherMixin.java b/projects/forge/src/client/java/dan200/computercraft/mixin/client/BlockRenderDispatcherMixin.java similarity index 89% rename from src/main/java/dan200/computercraft/mixin/BlockRenderDispatcherMixin.java rename to projects/forge/src/client/java/dan200/computercraft/mixin/client/BlockRenderDispatcherMixin.java index cd0a69683..6e9f9f129 100644 --- a/src/main/java/dan200/computercraft/mixin/BlockRenderDispatcherMixin.java +++ b/projects/forge/src/client/java/dan200/computercraft/mixin/client/BlockRenderDispatcherMixin.java @@ -3,12 +3,12 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.mixin; +package dan200.computercraft.mixin.client; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import dan200.computercraft.shared.ModRegistry; -import dan200.computercraft.shared.peripheral.modem.wired.BlockCable; +import dan200.computercraft.shared.peripheral.modem.wired.CableBlock; import dan200.computercraft.shared.peripheral.modem.wired.CableModemVariant; import dan200.computercraft.shared.peripheral.modem.wired.CableShapes; import dan200.computercraft.shared.util.WorldUtil; @@ -62,8 +62,8 @@ public class BlockRenderDispatcherMixin { ) { // Only apply to cables which have both a cable and modem if (state.getBlock() != ModRegistry.Blocks.CABLE.get() - || !state.getValue(BlockCable.CABLE) - || state.getValue(BlockCable.MODEM) == CableModemVariant.None + || !state.getValue(CableBlock.CABLE) + || state.getValue(CableBlock.MODEM) == CableModemVariant.None ) { return; } @@ -76,8 +76,8 @@ public class BlockRenderDispatcherMixin { info.cancel(); var newState = WorldUtil.isVecInside(CableShapes.getModemShape(state), hit.getLocation().subtract(pos.getX(), pos.getY(), pos.getZ())) - ? state.getBlock().defaultBlockState().setValue(BlockCable.MODEM, state.getValue(BlockCable.MODEM)) - : state.setValue(BlockCable.MODEM, CableModemVariant.None); + ? state.getBlock().defaultBlockState().setValue(CableBlock.MODEM, state.getValue(CableBlock.MODEM)) + : state.setValue(CableBlock.MODEM, CableModemVariant.None); var model = blockModelShaper.getBlockModel(newState); var seed = newState.getSeed(pos); diff --git a/src/main/resources/computercraft.mixins.json b/projects/forge/src/client/resources/computercraft-client.forge.mixins.json similarity index 72% rename from src/main/resources/computercraft.mixins.json rename to projects/forge/src/client/resources/computercraft-client.forge.mixins.json index d0cee8b3a..3088dc5d5 100644 --- a/src/main/resources/computercraft.mixins.json +++ b/projects/forge/src/client/resources/computercraft-client.forge.mixins.json @@ -3,13 +3,10 @@ "required": true, "compatibilityLevel": "JAVA_17", "refmap": "computercraft.mixins.refmap.json", - "package": "dan200.computercraft.mixin", + "package": "dan200.computercraft.mixin.client", "client": [ "BlockRenderDispatcherMixin" ], - "mixins": [ - "CacheUpdaterMixin" - ], "injectors": { "defaultRequire": 1 } diff --git a/src/generated/resources/assets/computercraft/blockstates/cable.json b/projects/forge/src/generated/resources/assets/computercraft/blockstates/cable.json similarity index 100% rename from src/generated/resources/assets/computercraft/blockstates/cable.json rename to projects/forge/src/generated/resources/assets/computercraft/blockstates/cable.json diff --git a/src/generated/resources/assets/computercraft/blockstates/computer_advanced.json b/projects/forge/src/generated/resources/assets/computercraft/blockstates/computer_advanced.json similarity index 100% rename from src/generated/resources/assets/computercraft/blockstates/computer_advanced.json rename to projects/forge/src/generated/resources/assets/computercraft/blockstates/computer_advanced.json diff --git a/src/generated/resources/assets/computercraft/blockstates/computer_command.json b/projects/forge/src/generated/resources/assets/computercraft/blockstates/computer_command.json similarity index 100% rename from src/generated/resources/assets/computercraft/blockstates/computer_command.json rename to projects/forge/src/generated/resources/assets/computercraft/blockstates/computer_command.json diff --git a/src/generated/resources/assets/computercraft/blockstates/computer_normal.json b/projects/forge/src/generated/resources/assets/computercraft/blockstates/computer_normal.json similarity index 100% rename from src/generated/resources/assets/computercraft/blockstates/computer_normal.json rename to projects/forge/src/generated/resources/assets/computercraft/blockstates/computer_normal.json diff --git a/src/generated/resources/assets/computercraft/blockstates/disk_drive.json b/projects/forge/src/generated/resources/assets/computercraft/blockstates/disk_drive.json similarity index 100% rename from src/generated/resources/assets/computercraft/blockstates/disk_drive.json rename to projects/forge/src/generated/resources/assets/computercraft/blockstates/disk_drive.json diff --git a/src/generated/resources/assets/computercraft/blockstates/monitor_advanced.json b/projects/forge/src/generated/resources/assets/computercraft/blockstates/monitor_advanced.json similarity index 100% rename from src/generated/resources/assets/computercraft/blockstates/monitor_advanced.json rename to projects/forge/src/generated/resources/assets/computercraft/blockstates/monitor_advanced.json diff --git a/src/generated/resources/assets/computercraft/blockstates/monitor_normal.json b/projects/forge/src/generated/resources/assets/computercraft/blockstates/monitor_normal.json similarity index 100% rename from src/generated/resources/assets/computercraft/blockstates/monitor_normal.json rename to projects/forge/src/generated/resources/assets/computercraft/blockstates/monitor_normal.json diff --git a/src/generated/resources/assets/computercraft/blockstates/printer.json b/projects/forge/src/generated/resources/assets/computercraft/blockstates/printer.json similarity index 100% rename from src/generated/resources/assets/computercraft/blockstates/printer.json rename to projects/forge/src/generated/resources/assets/computercraft/blockstates/printer.json diff --git a/src/generated/resources/assets/computercraft/blockstates/speaker.json b/projects/forge/src/generated/resources/assets/computercraft/blockstates/speaker.json similarity index 100% rename from src/generated/resources/assets/computercraft/blockstates/speaker.json rename to projects/forge/src/generated/resources/assets/computercraft/blockstates/speaker.json diff --git a/src/generated/resources/assets/computercraft/blockstates/turtle_advanced.json b/projects/forge/src/generated/resources/assets/computercraft/blockstates/turtle_advanced.json similarity index 100% rename from src/generated/resources/assets/computercraft/blockstates/turtle_advanced.json rename to projects/forge/src/generated/resources/assets/computercraft/blockstates/turtle_advanced.json diff --git a/src/generated/resources/assets/computercraft/blockstates/turtle_normal.json b/projects/forge/src/generated/resources/assets/computercraft/blockstates/turtle_normal.json similarity index 100% rename from src/generated/resources/assets/computercraft/blockstates/turtle_normal.json rename to projects/forge/src/generated/resources/assets/computercraft/blockstates/turtle_normal.json diff --git a/src/generated/resources/assets/computercraft/blockstates/wired_modem_full.json b/projects/forge/src/generated/resources/assets/computercraft/blockstates/wired_modem_full.json similarity index 100% rename from src/generated/resources/assets/computercraft/blockstates/wired_modem_full.json rename to projects/forge/src/generated/resources/assets/computercraft/blockstates/wired_modem_full.json diff --git a/src/generated/resources/assets/computercraft/blockstates/wireless_modem_advanced.json b/projects/forge/src/generated/resources/assets/computercraft/blockstates/wireless_modem_advanced.json similarity index 100% rename from src/generated/resources/assets/computercraft/blockstates/wireless_modem_advanced.json rename to projects/forge/src/generated/resources/assets/computercraft/blockstates/wireless_modem_advanced.json diff --git a/src/generated/resources/assets/computercraft/blockstates/wireless_modem_normal.json b/projects/forge/src/generated/resources/assets/computercraft/blockstates/wireless_modem_normal.json similarity index 100% rename from src/generated/resources/assets/computercraft/blockstates/wireless_modem_normal.json rename to projects/forge/src/generated/resources/assets/computercraft/blockstates/wireless_modem_normal.json diff --git a/src/generated/resources/assets/computercraft/models/block/computer_advanced_blinking.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/computer_advanced_blinking.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/computer_advanced_blinking.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/computer_advanced_blinking.json diff --git a/src/generated/resources/assets/computercraft/models/block/computer_advanced_off.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/computer_advanced_off.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/computer_advanced_off.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/computer_advanced_off.json diff --git a/src/generated/resources/assets/computercraft/models/block/computer_advanced_on.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/computer_advanced_on.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/computer_advanced_on.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/computer_advanced_on.json diff --git a/src/generated/resources/assets/computercraft/models/block/computer_command_blinking.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/computer_command_blinking.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/computer_command_blinking.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/computer_command_blinking.json diff --git a/src/generated/resources/assets/computercraft/models/block/computer_command_off.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/computer_command_off.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/computer_command_off.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/computer_command_off.json diff --git a/src/generated/resources/assets/computercraft/models/block/computer_command_on.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/computer_command_on.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/computer_command_on.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/computer_command_on.json diff --git a/src/generated/resources/assets/computercraft/models/block/computer_normal_blinking.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/computer_normal_blinking.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/computer_normal_blinking.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/computer_normal_blinking.json diff --git a/src/generated/resources/assets/computercraft/models/block/computer_normal_off.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/computer_normal_off.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/computer_normal_off.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/computer_normal_off.json diff --git a/src/generated/resources/assets/computercraft/models/block/computer_normal_on.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/computer_normal_on.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/computer_normal_on.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/computer_normal_on.json diff --git a/src/generated/resources/assets/computercraft/models/block/disk_drive_empty.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/disk_drive_empty.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/disk_drive_empty.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/disk_drive_empty.json diff --git a/src/generated/resources/assets/computercraft/models/block/disk_drive_full.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/disk_drive_full.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/disk_drive_full.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/disk_drive_full.json diff --git a/src/generated/resources/assets/computercraft/models/block/disk_drive_invalid.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/disk_drive_invalid.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/disk_drive_invalid.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/disk_drive_invalid.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_advanced.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_advanced.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_advanced_d.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_d.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_advanced_d.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_d.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_advanced_item.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_item.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_advanced_item.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_item.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_advanced_l.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_l.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_advanced_l.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_l.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_advanced_ld.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_ld.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_advanced_ld.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_ld.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_advanced_lr.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_lr.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_advanced_lr.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_lr.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_advanced_lrd.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_lrd.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_advanced_lrd.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_lrd.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_advanced_lru.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_lru.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_advanced_lru.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_lru.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_advanced_lrud.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_lrud.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_advanced_lrud.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_lrud.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_advanced_lu.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_lu.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_advanced_lu.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_lu.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_advanced_lud.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_lud.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_advanced_lud.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_lud.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_advanced_r.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_r.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_advanced_r.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_r.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_advanced_rd.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_rd.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_advanced_rd.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_rd.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_advanced_ru.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_ru.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_advanced_ru.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_ru.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_advanced_rud.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_rud.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_advanced_rud.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_rud.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_advanced_u.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_u.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_advanced_u.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_u.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_advanced_ud.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_ud.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_advanced_ud.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_advanced_ud.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_normal.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_normal.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_normal_d.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_d.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_normal_d.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_d.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_normal_item.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_item.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_normal_item.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_item.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_normal_l.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_l.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_normal_l.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_l.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_normal_ld.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_ld.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_normal_ld.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_ld.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_normal_lr.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_lr.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_normal_lr.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_lr.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_normal_lrd.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_lrd.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_normal_lrd.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_lrd.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_normal_lru.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_lru.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_normal_lru.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_lru.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_normal_lrud.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_lrud.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_normal_lrud.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_lrud.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_normal_lu.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_lu.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_normal_lu.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_lu.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_normal_lud.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_lud.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_normal_lud.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_lud.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_normal_r.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_r.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_normal_r.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_r.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_normal_rd.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_rd.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_normal_rd.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_rd.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_normal_ru.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_ru.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_normal_ru.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_ru.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_normal_rud.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_rud.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_normal_rud.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_rud.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_normal_u.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_u.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_normal_u.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_u.json diff --git a/src/generated/resources/assets/computercraft/models/block/monitor_normal_ud.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_ud.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/monitor_normal_ud.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/monitor_normal_ud.json diff --git a/src/generated/resources/assets/computercraft/models/block/printer_both_full.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/printer_both_full.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/printer_both_full.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/printer_both_full.json diff --git a/src/generated/resources/assets/computercraft/models/block/printer_bottom_full.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/printer_bottom_full.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/printer_bottom_full.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/printer_bottom_full.json diff --git a/src/generated/resources/assets/computercraft/models/block/printer_empty.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/printer_empty.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/printer_empty.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/printer_empty.json diff --git a/src/generated/resources/assets/computercraft/models/block/printer_top_full.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/printer_top_full.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/printer_top_full.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/printer_top_full.json diff --git a/src/generated/resources/assets/computercraft/models/block/speaker.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/speaker.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/speaker.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/speaker.json diff --git a/src/generated/resources/assets/computercraft/models/block/turtle_advanced.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_advanced.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/turtle_advanced.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_advanced.json diff --git a/src/generated/resources/assets/computercraft/models/block/turtle_crafting_table_left.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_crafting_table_left.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/turtle_crafting_table_left.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_crafting_table_left.json diff --git a/src/generated/resources/assets/computercraft/models/block/turtle_crafting_table_right.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_crafting_table_right.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/turtle_crafting_table_right.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_crafting_table_right.json diff --git a/src/generated/resources/assets/computercraft/models/block/turtle_modem_advanced_off_left.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_modem_advanced_off_left.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/turtle_modem_advanced_off_left.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_modem_advanced_off_left.json diff --git a/src/generated/resources/assets/computercraft/models/block/turtle_modem_advanced_off_right.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_modem_advanced_off_right.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/turtle_modem_advanced_off_right.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_modem_advanced_off_right.json diff --git a/src/generated/resources/assets/computercraft/models/block/turtle_modem_advanced_on_left.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_modem_advanced_on_left.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/turtle_modem_advanced_on_left.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_modem_advanced_on_left.json diff --git a/src/generated/resources/assets/computercraft/models/block/turtle_modem_advanced_on_right.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_modem_advanced_on_right.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/turtle_modem_advanced_on_right.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_modem_advanced_on_right.json diff --git a/src/generated/resources/assets/computercraft/models/block/turtle_modem_normal_off_left.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_modem_normal_off_left.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/turtle_modem_normal_off_left.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_modem_normal_off_left.json diff --git a/src/generated/resources/assets/computercraft/models/block/turtle_modem_normal_off_right.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_modem_normal_off_right.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/turtle_modem_normal_off_right.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_modem_normal_off_right.json diff --git a/src/generated/resources/assets/computercraft/models/block/turtle_modem_normal_on_left.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_modem_normal_on_left.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/turtle_modem_normal_on_left.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_modem_normal_on_left.json diff --git a/src/generated/resources/assets/computercraft/models/block/turtle_modem_normal_on_right.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_modem_normal_on_right.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/turtle_modem_normal_on_right.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_modem_normal_on_right.json diff --git a/src/generated/resources/assets/computercraft/models/block/turtle_normal.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_normal.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/turtle_normal.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_normal.json diff --git a/src/generated/resources/assets/computercraft/models/block/turtle_speaker_left.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_speaker_left.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/turtle_speaker_left.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_speaker_left.json diff --git a/src/generated/resources/assets/computercraft/models/block/turtle_speaker_right.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_speaker_right.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/turtle_speaker_right.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/turtle_speaker_right.json diff --git a/src/generated/resources/assets/computercraft/models/block/wired_modem_full_off.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/wired_modem_full_off.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/wired_modem_full_off.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/wired_modem_full_off.json diff --git a/src/generated/resources/assets/computercraft/models/block/wired_modem_full_off_peripheral.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/wired_modem_full_off_peripheral.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/wired_modem_full_off_peripheral.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/wired_modem_full_off_peripheral.json diff --git a/src/generated/resources/assets/computercraft/models/block/wired_modem_full_on.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/wired_modem_full_on.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/wired_modem_full_on.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/wired_modem_full_on.json diff --git a/src/generated/resources/assets/computercraft/models/block/wired_modem_full_on_peripheral.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/wired_modem_full_on_peripheral.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/wired_modem_full_on_peripheral.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/wired_modem_full_on_peripheral.json diff --git a/src/generated/resources/assets/computercraft/models/block/wired_modem_off.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/wired_modem_off.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/wired_modem_off.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/wired_modem_off.json diff --git a/src/generated/resources/assets/computercraft/models/block/wired_modem_off_peripheral.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/wired_modem_off_peripheral.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/wired_modem_off_peripheral.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/wired_modem_off_peripheral.json diff --git a/src/generated/resources/assets/computercraft/models/block/wired_modem_on.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/wired_modem_on.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/wired_modem_on.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/wired_modem_on.json diff --git a/src/generated/resources/assets/computercraft/models/block/wired_modem_on_peripheral.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/wired_modem_on_peripheral.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/wired_modem_on_peripheral.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/wired_modem_on_peripheral.json diff --git a/src/generated/resources/assets/computercraft/models/block/wireless_modem_advanced_off.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/wireless_modem_advanced_off.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/wireless_modem_advanced_off.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/wireless_modem_advanced_off.json diff --git a/src/generated/resources/assets/computercraft/models/block/wireless_modem_advanced_on.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/wireless_modem_advanced_on.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/wireless_modem_advanced_on.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/wireless_modem_advanced_on.json diff --git a/src/generated/resources/assets/computercraft/models/block/wireless_modem_normal_off.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/wireless_modem_normal_off.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/wireless_modem_normal_off.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/wireless_modem_normal_off.json diff --git a/src/generated/resources/assets/computercraft/models/block/wireless_modem_normal_on.json b/projects/forge/src/generated/resources/assets/computercraft/models/block/wireless_modem_normal_on.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/block/wireless_modem_normal_on.json rename to projects/forge/src/generated/resources/assets/computercraft/models/block/wireless_modem_normal_on.json diff --git a/src/generated/resources/assets/computercraft/models/item/computer_advanced.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/computer_advanced.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/computer_advanced.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/computer_advanced.json diff --git a/src/generated/resources/assets/computercraft/models/item/computer_command.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/computer_command.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/computer_command.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/computer_command.json diff --git a/src/generated/resources/assets/computercraft/models/item/computer_normal.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/computer_normal.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/computer_normal.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/computer_normal.json diff --git a/src/generated/resources/assets/computercraft/models/item/disk.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/disk.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/disk.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/disk.json diff --git a/src/generated/resources/assets/computercraft/models/item/disk_drive.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/disk_drive.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/disk_drive.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/disk_drive.json diff --git a/src/generated/resources/assets/computercraft/models/item/monitor_advanced.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/monitor_advanced.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/monitor_advanced.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/monitor_advanced.json diff --git a/src/generated/resources/assets/computercraft/models/item/monitor_normal.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/monitor_normal.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/monitor_normal.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/monitor_normal.json diff --git a/src/generated/resources/assets/computercraft/models/item/pocket_computer_advanced_blinking.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/pocket_computer_advanced_blinking.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/pocket_computer_advanced_blinking.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/pocket_computer_advanced_blinking.json diff --git a/src/generated/resources/assets/computercraft/models/item/pocket_computer_advanced_on.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/pocket_computer_advanced_on.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/pocket_computer_advanced_on.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/pocket_computer_advanced_on.json diff --git a/src/generated/resources/assets/computercraft/models/item/pocket_computer_colour.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/pocket_computer_colour.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/pocket_computer_colour.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/pocket_computer_colour.json diff --git a/src/generated/resources/assets/computercraft/models/item/pocket_computer_colour_blinking.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/pocket_computer_colour_blinking.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/pocket_computer_colour_blinking.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/pocket_computer_colour_blinking.json diff --git a/src/generated/resources/assets/computercraft/models/item/pocket_computer_colour_on.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/pocket_computer_colour_on.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/pocket_computer_colour_on.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/pocket_computer_colour_on.json diff --git a/src/generated/resources/assets/computercraft/models/item/pocket_computer_normal_blinking.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/pocket_computer_normal_blinking.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/pocket_computer_normal_blinking.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/pocket_computer_normal_blinking.json diff --git a/src/generated/resources/assets/computercraft/models/item/pocket_computer_normal_on.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/pocket_computer_normal_on.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/pocket_computer_normal_on.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/pocket_computer_normal_on.json diff --git a/src/generated/resources/assets/computercraft/models/item/printed_book.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/printed_book.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/printed_book.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/printed_book.json diff --git a/src/generated/resources/assets/computercraft/models/item/printed_page.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/printed_page.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/printed_page.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/printed_page.json diff --git a/src/generated/resources/assets/computercraft/models/item/printed_pages.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/printed_pages.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/printed_pages.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/printed_pages.json diff --git a/src/generated/resources/assets/computercraft/models/item/printer.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/printer.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/printer.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/printer.json diff --git a/src/generated/resources/assets/computercraft/models/item/speaker.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/speaker.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/speaker.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/speaker.json diff --git a/src/generated/resources/assets/computercraft/models/item/treasure_disk.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/treasure_disk.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/treasure_disk.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/treasure_disk.json diff --git a/src/generated/resources/assets/computercraft/models/item/turtle_advanced.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/turtle_advanced.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/turtle_advanced.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/turtle_advanced.json diff --git a/src/generated/resources/assets/computercraft/models/item/turtle_normal.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/turtle_normal.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/turtle_normal.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/turtle_normal.json diff --git a/src/generated/resources/assets/computercraft/models/item/wired_modem.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/wired_modem.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/wired_modem.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/wired_modem.json diff --git a/src/generated/resources/assets/computercraft/models/item/wired_modem_full.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/wired_modem_full.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/wired_modem_full.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/wired_modem_full.json diff --git a/src/generated/resources/assets/computercraft/models/item/wireless_modem_advanced.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/wireless_modem_advanced.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/wireless_modem_advanced.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/wireless_modem_advanced.json diff --git a/src/generated/resources/assets/computercraft/models/item/wireless_modem_normal.json b/projects/forge/src/generated/resources/assets/computercraft/models/item/wireless_modem_normal.json similarity index 100% rename from src/generated/resources/assets/computercraft/models/item/wireless_modem_normal.json rename to projects/forge/src/generated/resources/assets/computercraft/models/item/wireless_modem_normal.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/cable.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/cable.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/cable.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/cable.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/computer_advanced.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/computer_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/computer_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/computer_advanced.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/computer_advanced_upgrade.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/computer_advanced_upgrade.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/computer_advanced_upgrade.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/computer_advanced_upgrade.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/computer_command.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/computer_command.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/computer_command.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/computer_command.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/computer_normal.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/computer_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/computer_normal.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/computer_normal.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_1.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_1.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_1.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_1.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_10.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_10.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_10.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_10.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_11.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_11.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_11.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_11.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_12.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_12.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_12.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_12.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_13.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_13.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_13.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_13.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_14.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_14.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_14.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_14.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_15.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_15.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_15.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_15.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_16.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_16.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_16.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_16.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_2.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_2.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_2.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_2.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_3.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_3.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_3.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_3.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_4.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_4.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_4.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_4.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_5.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_5.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_5.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_5.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_6.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_6.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_6.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_6.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_7.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_7.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_7.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_7.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_8.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_8.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_8.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_8.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_9.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_9.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_9.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_9.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_drive.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_drive.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_drive.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/disk_drive.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/monitor_advanced.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/monitor_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/monitor_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/monitor_advanced.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/monitor_normal.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/monitor_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/monitor_normal.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/monitor_normal.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_advanced/computercraft/speaker.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_advanced/computercraft/speaker.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_advanced/computercraft/speaker.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_advanced/computercraft/speaker.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_advanced/computercraft/wireless_modem_advanced.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_advanced/computercraft/wireless_modem_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_advanced/computercraft/wireless_modem_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_advanced/computercraft/wireless_modem_advanced.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_advanced/computercraft/wireless_modem_normal.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_advanced/computercraft/wireless_modem_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_advanced/computercraft/wireless_modem_normal.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_advanced/computercraft/wireless_modem_normal.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_computer_advanced.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_computer_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_computer_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_computer_advanced.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_computer_advanced_upgrade.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_computer_advanced_upgrade.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_computer_advanced_upgrade.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_computer_advanced_upgrade.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_computer_normal.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_computer_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_computer_normal.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_computer_normal.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_normal/computercraft/speaker.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_normal/computercraft/speaker.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_normal/computercraft/speaker.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_normal/computercraft/speaker.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_normal/computercraft/wireless_modem_advanced.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_normal/computercraft/wireless_modem_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_normal/computercraft/wireless_modem_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_normal/computercraft/wireless_modem_advanced.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_normal/computercraft/wireless_modem_normal.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_normal/computercraft/wireless_modem_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_normal/computercraft/wireless_modem_normal.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/pocket_normal/computercraft/wireless_modem_normal.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/printed_book.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/printed_book.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/printed_book.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/printed_book.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/printed_pages.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/printed_pages.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/printed_pages.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/printed_pages.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/printer.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/printer.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/printer.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/printer.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/speaker.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/speaker.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/speaker.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/speaker.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/computercraft/speaker.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/computercraft/speaker.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/computercraft/speaker.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/computercraft/speaker.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/computercraft/wireless_modem_advanced.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/computercraft/wireless_modem_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/computercraft/wireless_modem_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/computercraft/wireless_modem_advanced.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/computercraft/wireless_modem_normal.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/computercraft/wireless_modem_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/computercraft/wireless_modem_normal.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/computercraft/wireless_modem_normal.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/crafting_table.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/crafting_table.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/crafting_table.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/crafting_table.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/diamond_axe.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/diamond_axe.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/diamond_axe.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/diamond_axe.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/diamond_hoe.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/diamond_hoe.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/diamond_hoe.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/diamond_hoe.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/diamond_pickaxe.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/diamond_pickaxe.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/diamond_pickaxe.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/diamond_pickaxe.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/diamond_shovel.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/diamond_shovel.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/diamond_shovel.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/diamond_shovel.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/diamond_sword.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/diamond_sword.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/diamond_sword.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced/minecraft/diamond_sword.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced_upgrade.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced_upgrade.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced_upgrade.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_advanced_upgrade.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/computercraft/speaker.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/computercraft/speaker.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/computercraft/speaker.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/computercraft/speaker.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/computercraft/wireless_modem_advanced.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/computercraft/wireless_modem_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/computercraft/wireless_modem_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/computercraft/wireless_modem_advanced.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/computercraft/wireless_modem_normal.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/computercraft/wireless_modem_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/computercraft/wireless_modem_normal.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/computercraft/wireless_modem_normal.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/crafting_table.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/crafting_table.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/crafting_table.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/crafting_table.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/diamond_axe.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/diamond_axe.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/diamond_axe.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/diamond_axe.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/diamond_hoe.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/diamond_hoe.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/diamond_hoe.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/diamond_hoe.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/diamond_pickaxe.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/diamond_pickaxe.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/diamond_pickaxe.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/diamond_pickaxe.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/diamond_shovel.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/diamond_shovel.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/diamond_shovel.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/diamond_shovel.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/diamond_sword.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/diamond_sword.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/diamond_sword.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/turtle_normal/minecraft/diamond_sword.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/wired_modem.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/wired_modem.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/wired_modem.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/wired_modem.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/wired_modem_full_from.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/wired_modem_full_from.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/wired_modem_full_from.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/wired_modem_full_from.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/wired_modem_full_to.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/wired_modem_full_to.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/wired_modem_full_to.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/wired_modem_full_to.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/wireless_modem_advanced.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/wireless_modem_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/wireless_modem_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/wireless_modem_advanced.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/computercraft/wireless_modem_normal.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/wireless_modem_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/computercraft/wireless_modem_normal.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/computercraft/wireless_modem_normal.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/decorations/skull_cloudy.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/decorations/skull_cloudy.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/decorations/skull_cloudy.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/decorations/skull_cloudy.json diff --git a/src/generated/resources/data/computercraft/advancements/recipes/decorations/skull_dan200.json b/projects/forge/src/generated/resources/data/computercraft/advancements/recipes/decorations/skull_dan200.json similarity index 100% rename from src/generated/resources/data/computercraft/advancements/recipes/decorations/skull_dan200.json rename to projects/forge/src/generated/resources/data/computercraft/advancements/recipes/decorations/skull_dan200.json diff --git a/src/generated/resources/data/computercraft/computercraft/pocket_upgrades/speaker.json b/projects/forge/src/generated/resources/data/computercraft/computercraft/pocket_upgrades/speaker.json similarity index 100% rename from src/generated/resources/data/computercraft/computercraft/pocket_upgrades/speaker.json rename to projects/forge/src/generated/resources/data/computercraft/computercraft/pocket_upgrades/speaker.json diff --git a/src/generated/resources/data/computercraft/computercraft/pocket_upgrades/wireless_modem_advanced.json b/projects/forge/src/generated/resources/data/computercraft/computercraft/pocket_upgrades/wireless_modem_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/computercraft/pocket_upgrades/wireless_modem_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/computercraft/pocket_upgrades/wireless_modem_advanced.json diff --git a/src/generated/resources/data/computercraft/computercraft/pocket_upgrades/wireless_modem_normal.json b/projects/forge/src/generated/resources/data/computercraft/computercraft/pocket_upgrades/wireless_modem_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/computercraft/pocket_upgrades/wireless_modem_normal.json rename to projects/forge/src/generated/resources/data/computercraft/computercraft/pocket_upgrades/wireless_modem_normal.json diff --git a/src/generated/resources/data/computercraft/computercraft/turtle_upgrades/speaker.json b/projects/forge/src/generated/resources/data/computercraft/computercraft/turtle_upgrades/speaker.json similarity index 100% rename from src/generated/resources/data/computercraft/computercraft/turtle_upgrades/speaker.json rename to projects/forge/src/generated/resources/data/computercraft/computercraft/turtle_upgrades/speaker.json diff --git a/src/generated/resources/data/computercraft/computercraft/turtle_upgrades/wireless_modem_advanced.json b/projects/forge/src/generated/resources/data/computercraft/computercraft/turtle_upgrades/wireless_modem_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/computercraft/turtle_upgrades/wireless_modem_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/computercraft/turtle_upgrades/wireless_modem_advanced.json diff --git a/src/generated/resources/data/computercraft/computercraft/turtle_upgrades/wireless_modem_normal.json b/projects/forge/src/generated/resources/data/computercraft/computercraft/turtle_upgrades/wireless_modem_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/computercraft/turtle_upgrades/wireless_modem_normal.json rename to projects/forge/src/generated/resources/data/computercraft/computercraft/turtle_upgrades/wireless_modem_normal.json diff --git a/src/generated/resources/data/computercraft/loot_tables/blocks/cable.json b/projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/cable.json similarity index 100% rename from src/generated/resources/data/computercraft/loot_tables/blocks/cable.json rename to projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/cable.json diff --git a/src/generated/resources/data/computercraft/loot_tables/blocks/computer_advanced.json b/projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/computer_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/loot_tables/blocks/computer_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/computer_advanced.json diff --git a/src/generated/resources/data/computercraft/loot_tables/blocks/computer_command.json b/projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/computer_command.json similarity index 100% rename from src/generated/resources/data/computercraft/loot_tables/blocks/computer_command.json rename to projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/computer_command.json diff --git a/src/generated/resources/data/computercraft/loot_tables/blocks/computer_normal.json b/projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/computer_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/loot_tables/blocks/computer_normal.json rename to projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/computer_normal.json diff --git a/src/generated/resources/data/computercraft/loot_tables/blocks/disk_drive.json b/projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/disk_drive.json similarity index 100% rename from src/generated/resources/data/computercraft/loot_tables/blocks/disk_drive.json rename to projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/disk_drive.json diff --git a/src/generated/resources/data/computercraft/loot_tables/blocks/monitor_advanced.json b/projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/monitor_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/loot_tables/blocks/monitor_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/monitor_advanced.json diff --git a/src/generated/resources/data/computercraft/loot_tables/blocks/monitor_normal.json b/projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/monitor_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/loot_tables/blocks/monitor_normal.json rename to projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/monitor_normal.json diff --git a/src/generated/resources/data/computercraft/loot_tables/blocks/printer.json b/projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/printer.json similarity index 100% rename from src/generated/resources/data/computercraft/loot_tables/blocks/printer.json rename to projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/printer.json diff --git a/src/generated/resources/data/computercraft/loot_tables/blocks/speaker.json b/projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/speaker.json similarity index 100% rename from src/generated/resources/data/computercraft/loot_tables/blocks/speaker.json rename to projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/speaker.json diff --git a/src/generated/resources/data/computercraft/loot_tables/blocks/turtle_advanced.json b/projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/turtle_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/loot_tables/blocks/turtle_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/turtle_advanced.json diff --git a/src/generated/resources/data/computercraft/loot_tables/blocks/turtle_normal.json b/projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/turtle_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/loot_tables/blocks/turtle_normal.json rename to projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/turtle_normal.json diff --git a/src/generated/resources/data/computercraft/loot_tables/blocks/wired_modem_full.json b/projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/wired_modem_full.json similarity index 100% rename from src/generated/resources/data/computercraft/loot_tables/blocks/wired_modem_full.json rename to projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/wired_modem_full.json diff --git a/src/generated/resources/data/computercraft/loot_tables/blocks/wireless_modem_advanced.json b/projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/wireless_modem_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/loot_tables/blocks/wireless_modem_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/wireless_modem_advanced.json diff --git a/src/generated/resources/data/computercraft/loot_tables/blocks/wireless_modem_normal.json b/projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/wireless_modem_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/loot_tables/blocks/wireless_modem_normal.json rename to projects/forge/src/generated/resources/data/computercraft/loot_tables/blocks/wireless_modem_normal.json diff --git a/src/generated/resources/data/computercraft/loot_tables/treasure_disk.json b/projects/forge/src/generated/resources/data/computercraft/loot_tables/treasure_disk.json similarity index 100% rename from src/generated/resources/data/computercraft/loot_tables/treasure_disk.json rename to projects/forge/src/generated/resources/data/computercraft/loot_tables/treasure_disk.json diff --git a/src/generated/resources/data/computercraft/recipes/cable.json b/projects/forge/src/generated/resources/data/computercraft/recipes/cable.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/cable.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/cable.json diff --git a/src/generated/resources/data/computercraft/recipes/colour.json b/projects/forge/src/generated/resources/data/computercraft/recipes/colour.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/colour.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/colour.json diff --git a/src/generated/resources/data/computercraft/recipes/computer_advanced.json b/projects/forge/src/generated/resources/data/computercraft/recipes/computer_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/computer_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/computer_advanced.json diff --git a/src/generated/resources/data/computercraft/recipes/computer_advanced_upgrade.json b/projects/forge/src/generated/resources/data/computercraft/recipes/computer_advanced_upgrade.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/computer_advanced_upgrade.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/computer_advanced_upgrade.json diff --git a/src/generated/resources/data/computercraft/recipes/computer_command.json b/projects/forge/src/generated/resources/data/computercraft/recipes/computer_command.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/computer_command.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/computer_command.json diff --git a/src/generated/resources/data/computercraft/recipes/computer_normal.json b/projects/forge/src/generated/resources/data/computercraft/recipes/computer_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/computer_normal.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/computer_normal.json diff --git a/src/generated/resources/data/computercraft/recipes/disk.json b/projects/forge/src/generated/resources/data/computercraft/recipes/disk.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/disk.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/disk.json diff --git a/src/generated/resources/data/computercraft/recipes/disk_1.json b/projects/forge/src/generated/resources/data/computercraft/recipes/disk_1.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/disk_1.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/disk_1.json diff --git a/src/generated/resources/data/computercraft/recipes/disk_10.json b/projects/forge/src/generated/resources/data/computercraft/recipes/disk_10.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/disk_10.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/disk_10.json diff --git a/src/generated/resources/data/computercraft/recipes/disk_11.json b/projects/forge/src/generated/resources/data/computercraft/recipes/disk_11.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/disk_11.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/disk_11.json diff --git a/src/generated/resources/data/computercraft/recipes/disk_12.json b/projects/forge/src/generated/resources/data/computercraft/recipes/disk_12.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/disk_12.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/disk_12.json diff --git a/src/generated/resources/data/computercraft/recipes/disk_13.json b/projects/forge/src/generated/resources/data/computercraft/recipes/disk_13.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/disk_13.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/disk_13.json diff --git a/src/generated/resources/data/computercraft/recipes/disk_14.json b/projects/forge/src/generated/resources/data/computercraft/recipes/disk_14.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/disk_14.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/disk_14.json diff --git a/src/generated/resources/data/computercraft/recipes/disk_15.json b/projects/forge/src/generated/resources/data/computercraft/recipes/disk_15.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/disk_15.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/disk_15.json diff --git a/src/generated/resources/data/computercraft/recipes/disk_16.json b/projects/forge/src/generated/resources/data/computercraft/recipes/disk_16.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/disk_16.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/disk_16.json diff --git a/src/generated/resources/data/computercraft/recipes/disk_2.json b/projects/forge/src/generated/resources/data/computercraft/recipes/disk_2.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/disk_2.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/disk_2.json diff --git a/src/generated/resources/data/computercraft/recipes/disk_3.json b/projects/forge/src/generated/resources/data/computercraft/recipes/disk_3.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/disk_3.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/disk_3.json diff --git a/src/generated/resources/data/computercraft/recipes/disk_4.json b/projects/forge/src/generated/resources/data/computercraft/recipes/disk_4.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/disk_4.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/disk_4.json diff --git a/src/generated/resources/data/computercraft/recipes/disk_5.json b/projects/forge/src/generated/resources/data/computercraft/recipes/disk_5.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/disk_5.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/disk_5.json diff --git a/src/generated/resources/data/computercraft/recipes/disk_6.json b/projects/forge/src/generated/resources/data/computercraft/recipes/disk_6.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/disk_6.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/disk_6.json diff --git a/src/generated/resources/data/computercraft/recipes/disk_7.json b/projects/forge/src/generated/resources/data/computercraft/recipes/disk_7.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/disk_7.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/disk_7.json diff --git a/src/generated/resources/data/computercraft/recipes/disk_8.json b/projects/forge/src/generated/resources/data/computercraft/recipes/disk_8.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/disk_8.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/disk_8.json diff --git a/src/generated/resources/data/computercraft/recipes/disk_9.json b/projects/forge/src/generated/resources/data/computercraft/recipes/disk_9.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/disk_9.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/disk_9.json diff --git a/src/generated/resources/data/computercraft/recipes/disk_drive.json b/projects/forge/src/generated/resources/data/computercraft/recipes/disk_drive.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/disk_drive.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/disk_drive.json diff --git a/src/generated/resources/data/computercraft/recipes/monitor_advanced.json b/projects/forge/src/generated/resources/data/computercraft/recipes/monitor_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/monitor_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/monitor_advanced.json diff --git a/src/generated/resources/data/computercraft/recipes/monitor_normal.json b/projects/forge/src/generated/resources/data/computercraft/recipes/monitor_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/monitor_normal.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/monitor_normal.json diff --git a/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/speaker.json b/projects/forge/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/speaker.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/speaker.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/speaker.json diff --git a/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/wireless_modem_advanced.json b/projects/forge/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/wireless_modem_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/wireless_modem_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/wireless_modem_advanced.json diff --git a/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/wireless_modem_normal.json b/projects/forge/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/wireless_modem_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/wireless_modem_normal.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/pocket_advanced/computercraft/wireless_modem_normal.json diff --git a/src/generated/resources/data/computercraft/recipes/pocket_computer_advanced.json b/projects/forge/src/generated/resources/data/computercraft/recipes/pocket_computer_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/pocket_computer_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/pocket_computer_advanced.json diff --git a/src/generated/resources/data/computercraft/recipes/pocket_computer_advanced_upgrade.json b/projects/forge/src/generated/resources/data/computercraft/recipes/pocket_computer_advanced_upgrade.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/pocket_computer_advanced_upgrade.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/pocket_computer_advanced_upgrade.json diff --git a/src/generated/resources/data/computercraft/recipes/pocket_computer_normal.json b/projects/forge/src/generated/resources/data/computercraft/recipes/pocket_computer_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/pocket_computer_normal.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/pocket_computer_normal.json diff --git a/src/generated/resources/data/computercraft/recipes/pocket_computer_upgrade.json b/projects/forge/src/generated/resources/data/computercraft/recipes/pocket_computer_upgrade.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/pocket_computer_upgrade.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/pocket_computer_upgrade.json diff --git a/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/speaker.json b/projects/forge/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/speaker.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/speaker.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/speaker.json diff --git a/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/wireless_modem_advanced.json b/projects/forge/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/wireless_modem_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/wireless_modem_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/wireless_modem_advanced.json diff --git a/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/wireless_modem_normal.json b/projects/forge/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/wireless_modem_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/wireless_modem_normal.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/pocket_normal/computercraft/wireless_modem_normal.json diff --git a/src/generated/resources/data/computercraft/recipes/printed_book.json b/projects/forge/src/generated/resources/data/computercraft/recipes/printed_book.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/printed_book.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/printed_book.json diff --git a/src/generated/resources/data/computercraft/recipes/printed_pages.json b/projects/forge/src/generated/resources/data/computercraft/recipes/printed_pages.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/printed_pages.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/printed_pages.json diff --git a/src/generated/resources/data/computercraft/recipes/printer.json b/projects/forge/src/generated/resources/data/computercraft/recipes/printer.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/printer.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/printer.json diff --git a/src/generated/resources/data/computercraft/recipes/printout.json b/projects/forge/src/generated/resources/data/computercraft/recipes/printout.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/printout.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/printout.json diff --git a/src/generated/resources/data/computercraft/recipes/skull_cloudy.json b/projects/forge/src/generated/resources/data/computercraft/recipes/skull_cloudy.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/skull_cloudy.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/skull_cloudy.json diff --git a/src/generated/resources/data/computercraft/recipes/skull_dan200.json b/projects/forge/src/generated/resources/data/computercraft/recipes/skull_dan200.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/skull_dan200.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/skull_dan200.json diff --git a/src/generated/resources/data/computercraft/recipes/speaker.json b/projects/forge/src/generated/resources/data/computercraft/recipes/speaker.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/speaker.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/speaker.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_advanced.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/speaker.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/speaker.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/speaker.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/speaker.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/wireless_modem_advanced.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/wireless_modem_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/wireless_modem_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/wireless_modem_advanced.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/wireless_modem_normal.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/wireless_modem_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/wireless_modem_normal.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced/computercraft/wireless_modem_normal.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/crafting_table.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/crafting_table.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/crafting_table.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/crafting_table.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_axe.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_axe.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_axe.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_axe.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_hoe.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_hoe.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_hoe.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_hoe.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_pickaxe.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_pickaxe.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_pickaxe.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_pickaxe.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_shovel.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_shovel.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_shovel.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_shovel.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_sword.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_sword.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_sword.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced/minecraft/diamond_sword.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_advanced_upgrade.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced_upgrade.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_advanced_upgrade.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_advanced_upgrade.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_normal.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_normal.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_normal.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/speaker.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/speaker.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/speaker.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/speaker.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/wireless_modem_advanced.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/wireless_modem_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/wireless_modem_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/wireless_modem_advanced.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/wireless_modem_normal.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/wireless_modem_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/wireless_modem_normal.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_normal/computercraft/wireless_modem_normal.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/crafting_table.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/crafting_table.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/crafting_table.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/crafting_table.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_axe.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_axe.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_axe.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_axe.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_hoe.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_hoe.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_hoe.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_hoe.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_pickaxe.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_pickaxe.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_pickaxe.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_pickaxe.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_shovel.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_shovel.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_shovel.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_shovel.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_sword.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_sword.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_sword.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_normal/minecraft/diamond_sword.json diff --git a/src/generated/resources/data/computercraft/recipes/turtle_upgrade.json b/projects/forge/src/generated/resources/data/computercraft/recipes/turtle_upgrade.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/turtle_upgrade.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/turtle_upgrade.json diff --git a/src/generated/resources/data/computercraft/recipes/wired_modem.json b/projects/forge/src/generated/resources/data/computercraft/recipes/wired_modem.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/wired_modem.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/wired_modem.json diff --git a/src/generated/resources/data/computercraft/recipes/wired_modem_full_from.json b/projects/forge/src/generated/resources/data/computercraft/recipes/wired_modem_full_from.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/wired_modem_full_from.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/wired_modem_full_from.json diff --git a/src/generated/resources/data/computercraft/recipes/wired_modem_full_to.json b/projects/forge/src/generated/resources/data/computercraft/recipes/wired_modem_full_to.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/wired_modem_full_to.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/wired_modem_full_to.json diff --git a/src/generated/resources/data/computercraft/recipes/wireless_modem_advanced.json b/projects/forge/src/generated/resources/data/computercraft/recipes/wireless_modem_advanced.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/wireless_modem_advanced.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/wireless_modem_advanced.json diff --git a/src/generated/resources/data/computercraft/recipes/wireless_modem_normal.json b/projects/forge/src/generated/resources/data/computercraft/recipes/wireless_modem_normal.json similarity index 100% rename from src/generated/resources/data/computercraft/recipes/wireless_modem_normal.json rename to projects/forge/src/generated/resources/data/computercraft/recipes/wireless_modem_normal.json diff --git a/src/generated/resources/data/computercraft/tags/blocks/computer.json b/projects/forge/src/generated/resources/data/computercraft/tags/blocks/computer.json similarity index 100% rename from src/generated/resources/data/computercraft/tags/blocks/computer.json rename to projects/forge/src/generated/resources/data/computercraft/tags/blocks/computer.json diff --git a/src/generated/resources/data/computercraft/tags/blocks/monitor.json b/projects/forge/src/generated/resources/data/computercraft/tags/blocks/monitor.json similarity index 100% rename from src/generated/resources/data/computercraft/tags/blocks/monitor.json rename to projects/forge/src/generated/resources/data/computercraft/tags/blocks/monitor.json diff --git a/src/generated/resources/data/computercraft/tags/blocks/turtle.json b/projects/forge/src/generated/resources/data/computercraft/tags/blocks/turtle.json similarity index 100% rename from src/generated/resources/data/computercraft/tags/blocks/turtle.json rename to projects/forge/src/generated/resources/data/computercraft/tags/blocks/turtle.json diff --git a/src/generated/resources/data/computercraft/tags/blocks/turtle_always_breakable.json b/projects/forge/src/generated/resources/data/computercraft/tags/blocks/turtle_always_breakable.json similarity index 100% rename from src/generated/resources/data/computercraft/tags/blocks/turtle_always_breakable.json rename to projects/forge/src/generated/resources/data/computercraft/tags/blocks/turtle_always_breakable.json diff --git a/src/generated/resources/data/computercraft/tags/blocks/turtle_hoe_harvestable.json b/projects/forge/src/generated/resources/data/computercraft/tags/blocks/turtle_hoe_harvestable.json similarity index 100% rename from src/generated/resources/data/computercraft/tags/blocks/turtle_hoe_harvestable.json rename to projects/forge/src/generated/resources/data/computercraft/tags/blocks/turtle_hoe_harvestable.json diff --git a/src/generated/resources/data/computercraft/tags/blocks/turtle_shovel_harvestable.json b/projects/forge/src/generated/resources/data/computercraft/tags/blocks/turtle_shovel_harvestable.json similarity index 100% rename from src/generated/resources/data/computercraft/tags/blocks/turtle_shovel_harvestable.json rename to projects/forge/src/generated/resources/data/computercraft/tags/blocks/turtle_shovel_harvestable.json diff --git a/src/generated/resources/data/computercraft/tags/blocks/turtle_sword_harvestable.json b/projects/forge/src/generated/resources/data/computercraft/tags/blocks/turtle_sword_harvestable.json similarity index 100% rename from src/generated/resources/data/computercraft/tags/blocks/turtle_sword_harvestable.json rename to projects/forge/src/generated/resources/data/computercraft/tags/blocks/turtle_sword_harvestable.json diff --git a/src/generated/resources/data/computercraft/tags/blocks/wired_modem.json b/projects/forge/src/generated/resources/data/computercraft/tags/blocks/wired_modem.json similarity index 100% rename from src/generated/resources/data/computercraft/tags/blocks/wired_modem.json rename to projects/forge/src/generated/resources/data/computercraft/tags/blocks/wired_modem.json diff --git a/src/generated/resources/data/computercraft/tags/items/computer.json b/projects/forge/src/generated/resources/data/computercraft/tags/items/computer.json similarity index 100% rename from src/generated/resources/data/computercraft/tags/items/computer.json rename to projects/forge/src/generated/resources/data/computercraft/tags/items/computer.json diff --git a/src/generated/resources/data/computercraft/tags/items/monitor.json b/projects/forge/src/generated/resources/data/computercraft/tags/items/monitor.json similarity index 100% rename from src/generated/resources/data/computercraft/tags/items/monitor.json rename to projects/forge/src/generated/resources/data/computercraft/tags/items/monitor.json diff --git a/src/generated/resources/data/computercraft/tags/items/turtle.json b/projects/forge/src/generated/resources/data/computercraft/tags/items/turtle.json similarity index 100% rename from src/generated/resources/data/computercraft/tags/items/turtle.json rename to projects/forge/src/generated/resources/data/computercraft/tags/items/turtle.json diff --git a/src/generated/resources/data/computercraft/tags/items/wired_modem.json b/projects/forge/src/generated/resources/data/computercraft/tags/items/wired_modem.json similarity index 100% rename from src/generated/resources/data/computercraft/tags/items/wired_modem.json rename to projects/forge/src/generated/resources/data/computercraft/tags/items/wired_modem.json diff --git a/src/generated/resources/data/minecraft/computercraft/turtle_upgrades/crafting_table.json b/projects/forge/src/generated/resources/data/minecraft/computercraft/turtle_upgrades/crafting_table.json similarity index 100% rename from src/generated/resources/data/minecraft/computercraft/turtle_upgrades/crafting_table.json rename to projects/forge/src/generated/resources/data/minecraft/computercraft/turtle_upgrades/crafting_table.json diff --git a/src/generated/resources/data/minecraft/computercraft/turtle_upgrades/diamond_axe.json b/projects/forge/src/generated/resources/data/minecraft/computercraft/turtle_upgrades/diamond_axe.json similarity index 100% rename from src/generated/resources/data/minecraft/computercraft/turtle_upgrades/diamond_axe.json rename to projects/forge/src/generated/resources/data/minecraft/computercraft/turtle_upgrades/diamond_axe.json diff --git a/src/generated/resources/data/minecraft/computercraft/turtle_upgrades/diamond_hoe.json b/projects/forge/src/generated/resources/data/minecraft/computercraft/turtle_upgrades/diamond_hoe.json similarity index 100% rename from src/generated/resources/data/minecraft/computercraft/turtle_upgrades/diamond_hoe.json rename to projects/forge/src/generated/resources/data/minecraft/computercraft/turtle_upgrades/diamond_hoe.json diff --git a/src/generated/resources/data/minecraft/computercraft/turtle_upgrades/diamond_pickaxe.json b/projects/forge/src/generated/resources/data/minecraft/computercraft/turtle_upgrades/diamond_pickaxe.json similarity index 100% rename from src/generated/resources/data/minecraft/computercraft/turtle_upgrades/diamond_pickaxe.json rename to projects/forge/src/generated/resources/data/minecraft/computercraft/turtle_upgrades/diamond_pickaxe.json diff --git a/src/generated/resources/data/minecraft/computercraft/turtle_upgrades/diamond_shovel.json b/projects/forge/src/generated/resources/data/minecraft/computercraft/turtle_upgrades/diamond_shovel.json similarity index 100% rename from src/generated/resources/data/minecraft/computercraft/turtle_upgrades/diamond_shovel.json rename to projects/forge/src/generated/resources/data/minecraft/computercraft/turtle_upgrades/diamond_shovel.json diff --git a/src/generated/resources/data/minecraft/computercraft/turtle_upgrades/diamond_sword.json b/projects/forge/src/generated/resources/data/minecraft/computercraft/turtle_upgrades/diamond_sword.json similarity index 100% rename from src/generated/resources/data/minecraft/computercraft/turtle_upgrades/diamond_sword.json rename to projects/forge/src/generated/resources/data/minecraft/computercraft/turtle_upgrades/diamond_sword.json diff --git a/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json b/projects/forge/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json similarity index 100% rename from src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json rename to projects/forge/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json diff --git a/src/generated/resources/data/minecraft/tags/items/piglin_loved.json b/projects/forge/src/generated/resources/data/minecraft/tags/items/piglin_loved.json similarity index 100% rename from src/generated/resources/data/minecraft/tags/items/piglin_loved.json rename to projects/forge/src/generated/resources/data/minecraft/tags/items/piglin_loved.json diff --git a/src/main/java/dan200/computercraft/ComputerCraft.java b/projects/forge/src/main/java/dan200/computercraft/ComputerCraft.java similarity index 92% rename from src/main/java/dan200/computercraft/ComputerCraft.java rename to projects/forge/src/main/java/dan200/computercraft/ComputerCraft.java index d665eaa93..6cfdebb44 100644 --- a/src/main/java/dan200/computercraft/ComputerCraft.java +++ b/projects/forge/src/main/java/dan200/computercraft/ComputerCraft.java @@ -16,7 +16,7 @@ import dan200.computercraft.api.turtle.event.TurtleRefuelEvent; import dan200.computercraft.impl.TurtleRefuelHandlers; import dan200.computercraft.shared.ModRegistry; import dan200.computercraft.shared.config.ConfigSpec; -import dan200.computercraft.shared.peripheral.generic.data.FluidData; +import dan200.computercraft.shared.details.FluidData; import dan200.computercraft.shared.peripheral.generic.methods.EnergyMethods; import dan200.computercraft.shared.peripheral.generic.methods.FluidMethods; import dan200.computercraft.shared.peripheral.generic.methods.InventoryMethods; @@ -25,7 +25,9 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.config.ModConfig; import net.minecraftforge.fml.event.config.ModConfigEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.registries.NewRegistryEvent; @@ -37,9 +39,11 @@ import java.util.OptionalInt; @Mod.EventBusSubscriber(modid = ComputerCraftAPI.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public final class ComputerCraft { public ComputerCraft() { - ConfigSpec.setup(); ModRegistry.register(); + ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, ConfigSpec.serverSpec); + ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, ConfigSpec.clientSpec); + // Register a fallback handler for the turtle refuel event. TurtleRefuelHandlers.register((turtle, stack, slot, limit) -> { @SuppressWarnings("removal") var event = new TurtleRefuelEvent(turtle, stack); diff --git a/src/main/java/dan200/computercraft/data/Generators.java b/projects/forge/src/main/java/dan200/computercraft/data/Generators.java similarity index 100% rename from src/main/java/dan200/computercraft/data/Generators.java rename to projects/forge/src/main/java/dan200/computercraft/data/Generators.java diff --git a/projects/forge/src/main/java/dan200/computercraft/impl/ComputerCraftAPIImpl.java b/projects/forge/src/main/java/dan200/computercraft/impl/ComputerCraftAPIImpl.java new file mode 100644 index 000000000..1baaed4a8 --- /dev/null +++ b/projects/forge/src/main/java/dan200/computercraft/impl/ComputerCraftAPIImpl.java @@ -0,0 +1,84 @@ +/* + * This file is part of ComputerCraft - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. + * Send enquiries to dratcliffe@gmail.com + */ +package dan200.computercraft.impl; + +import com.google.auto.service.AutoService; +import dan200.computercraft.api.ComputerCraftAPI; +import dan200.computercraft.api.detail.DetailRegistry; +import dan200.computercraft.api.detail.IDetailProvider; +import dan200.computercraft.api.filesystem.IMount; +import dan200.computercraft.api.network.wired.IWiredElement; +import dan200.computercraft.api.peripheral.IPeripheralProvider; +import dan200.computercraft.impl.detail.DetailRegistryImpl; +import dan200.computercraft.shared.computer.core.ResourceMount; +import dan200.computercraft.shared.details.FluidData; +import dan200.computercraft.shared.peripheral.generic.GenericPeripheralProvider; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.BlockGetter; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.util.LazyOptional; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fml.ModList; +import net.minecraftforge.server.ServerLifecycleHooks; + +import javax.annotation.Nullable; + +import static dan200.computercraft.shared.Capabilities.CAPABILITY_WIRED_ELEMENT; + +@AutoService(ComputerCraftAPIService.class) +public final class ComputerCraftAPIImpl extends AbstractComputerCraftAPI implements ComputerCraftAPIForgeService { + private final DetailRegistry fluidStackDetails = new DetailRegistryImpl<>(FluidData::fillBasic); + + private @Nullable String version; + + @Override + public String getInstalledVersion() { + if (version != null) return version; + return version = ModList.get().getModContainerById(ComputerCraftAPI.MOD_ID) + .map(x -> x.getModInfo().getVersion().toString()) + .orElse("unknown"); + } + + @Override + public @Nullable IMount createResourceMount(String domain, String subPath) { + var manager = ServerLifecycleHooks.getCurrentServer().getResourceManager(); + var mount = ResourceMount.get(domain, subPath, manager); + return mount.exists("") ? mount : null; + } + + @Override + public void registerPeripheralProvider(IPeripheralProvider provider) { + Peripherals.register(provider); + } + + @Override + public void registerGenericCapability(Capability capability) { + GenericPeripheralProvider.addCapability(capability); + } + + @Override + @Deprecated + @SuppressWarnings("unchecked") + public void registerDetailProvider(Class type, IDetailProvider provider) { + if (type == FluidStack.class) { + fluidStackDetails.addProvider((IDetailProvider) provider); + } else { + super.registerDetailProvider(type, provider); + } + } + + @Override + public LazyOptional getWiredElementAt(BlockGetter world, BlockPos pos, Direction side) { + var tile = world.getBlockEntity(pos); + return tile == null ? LazyOptional.empty() : tile.getCapability(CAPABILITY_WIRED_ELEMENT, side); + } + + @Override + public DetailRegistry getFluidStackDetailRegistry() { + return fluidStackDetails; + } +} diff --git a/src/main/java/dan200/computercraft/shared/Peripherals.java b/projects/forge/src/main/java/dan200/computercraft/impl/Peripherals.java similarity index 95% rename from src/main/java/dan200/computercraft/shared/Peripherals.java rename to projects/forge/src/main/java/dan200/computercraft/impl/Peripherals.java index 87bc76fa4..2a790152a 100644 --- a/src/main/java/dan200/computercraft/shared/Peripherals.java +++ b/projects/forge/src/main/java/dan200/computercraft/impl/Peripherals.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.shared; +package dan200.computercraft.impl; import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheralProvider; @@ -13,7 +13,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.Level; import net.minecraftforge.common.util.NonNullConsumer; -import org.jline.utils.Log; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,7 +55,7 @@ public final class Peripherals { var peripheral = peripheralProvider.getPeripheral(world, pos, side); if (peripheral.isPresent()) return CapabilityUtil.unwrap(peripheral, invalidate); } catch (Exception e) { - Log.error("Peripheral provider " + peripheralProvider + " errored.", e); + LOG.error("Peripheral provider " + peripheralProvider + " errored.", e); } } diff --git a/src/main/java/dan200/computercraft/shared/Capabilities.java b/projects/forge/src/main/java/dan200/computercraft/shared/Capabilities.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/Capabilities.java rename to projects/forge/src/main/java/dan200/computercraft/shared/Capabilities.java diff --git a/src/main/java/dan200/computercraft/shared/ForgeCommonHooks.java b/projects/forge/src/main/java/dan200/computercraft/shared/ForgeCommonHooks.java similarity index 83% rename from src/main/java/dan200/computercraft/shared/ForgeCommonHooks.java rename to projects/forge/src/main/java/dan200/computercraft/shared/ForgeCommonHooks.java index 67ad4329e..70c48915a 100644 --- a/src/main/java/dan200/computercraft/shared/ForgeCommonHooks.java +++ b/projects/forge/src/main/java/dan200/computercraft/shared/ForgeCommonHooks.java @@ -7,19 +7,19 @@ package dan200.computercraft.shared; import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.shared.command.CommandComputerCraft; -import dan200.computercraft.shared.computer.blocks.TileComputer; +import dan200.computercraft.shared.computer.blocks.ComputerBlockEntity; import dan200.computercraft.shared.config.Config; import dan200.computercraft.shared.network.client.UpgradesLoadedMessage; import dan200.computercraft.shared.peripheral.commandblock.CommandBlockPeripheral; -import dan200.computercraft.shared.peripheral.diskdrive.TileDiskDrive; -import dan200.computercraft.shared.peripheral.modem.wired.TileCable; -import dan200.computercraft.shared.peripheral.modem.wired.TileWiredModemFull; -import dan200.computercraft.shared.peripheral.modem.wireless.TileWirelessModem; -import dan200.computercraft.shared.peripheral.monitor.TileMonitor; -import dan200.computercraft.shared.peripheral.printer.TilePrinter; -import dan200.computercraft.shared.peripheral.speaker.TileSpeaker; +import dan200.computercraft.shared.peripheral.diskdrive.DiskDriveBlockEntity; +import dan200.computercraft.shared.peripheral.modem.wired.CableBlockEntity; +import dan200.computercraft.shared.peripheral.modem.wired.WiredModemFullBlockEntity; +import dan200.computercraft.shared.peripheral.modem.wireless.WirelessModemBlockEntity; +import dan200.computercraft.shared.peripheral.monitor.MonitorBlockEntity; +import dan200.computercraft.shared.peripheral.printer.PrinterBlockEntity; +import dan200.computercraft.shared.peripheral.speaker.SpeakerBlockEntity; import dan200.computercraft.shared.platform.PlatformHelper; -import dan200.computercraft.shared.turtle.blocks.TileTurtle; +import dan200.computercraft.shared.turtle.blocks.TurtleBlockEntity; import dan200.computercraft.shared.util.CapabilityProvider; import dan200.computercraft.shared.util.SidedCapabilityProvider; import net.minecraft.resources.ResourceLocation; @@ -100,34 +100,34 @@ public class ForgeCommonHooks { @SubscribeEvent public static void onCapability(AttachCapabilitiesEvent event) { var blockEntity = event.getObject(); - if (blockEntity instanceof TileComputer computer) { + if (blockEntity instanceof ComputerBlockEntity computer) { CapabilityProvider.attach(event, PERIPHERAL, CAPABILITY_PERIPHERAL, computer::peripheral); - } else if (blockEntity instanceof TileTurtle turtle) { + } else if (blockEntity instanceof TurtleBlockEntity turtle) { CapabilityProvider.attach(event, INVENTORY, ITEM_HANDLER, () -> new InvWrapper(turtle)); var peripheral = CapabilityProvider.attach(event, PERIPHERAL, CAPABILITY_PERIPHERAL, turtle::peripheral); turtle.onMoved(peripheral::invalidate); - } else if (blockEntity instanceof TileDiskDrive diskDrive) { + } else if (blockEntity instanceof DiskDriveBlockEntity diskDrive) { CapabilityProvider.attach(event, INVENTORY, ITEM_HANDLER, () -> new InvWrapper(diskDrive)); CapabilityProvider.attach(event, PERIPHERAL, CAPABILITY_PERIPHERAL, diskDrive::peripheral); - } else if (blockEntity instanceof TileCable cable) { + } else if (blockEntity instanceof CableBlockEntity cable) { var peripheralHandler = SidedCapabilityProvider.attach(event, PERIPHERAL, Capabilities.CAPABILITY_PERIPHERAL, cable::getPeripheral); var elementHandler = SidedCapabilityProvider.attach(event, WIRED_ELEMENT, Capabilities.CAPABILITY_WIRED_ELEMENT, cable::getWiredElement); cable.onModemChanged(() -> { peripheralHandler.invalidate(); elementHandler.invalidate(); }); - } else if (blockEntity instanceof TileWiredModemFull modem) { + } else if (blockEntity instanceof WiredModemFullBlockEntity modem) { SidedCapabilityProvider.attach(event, PERIPHERAL, Capabilities.CAPABILITY_PERIPHERAL, modem::getPeripheral); CapabilityProvider.attach(event, WIRED_ELEMENT, Capabilities.CAPABILITY_WIRED_ELEMENT, modem::getElement); - } else if (blockEntity instanceof TileWirelessModem modem) { + } else if (blockEntity instanceof WirelessModemBlockEntity modem) { var peripheral = SidedCapabilityProvider.attach(event, PERIPHERAL, CAPABILITY_PERIPHERAL, modem::getPeripheral); modem.onModemChanged(peripheral::invalidate); - } else if (blockEntity instanceof TileMonitor monitor) { + } else if (blockEntity instanceof MonitorBlockEntity monitor) { CapabilityProvider.attach(event, PERIPHERAL, CAPABILITY_PERIPHERAL, monitor::peripheral); - } else if (blockEntity instanceof TileSpeaker speaker) { + } else if (blockEntity instanceof SpeakerBlockEntity speaker) { CapabilityProvider.attach(event, PERIPHERAL, CAPABILITY_PERIPHERAL, speaker::peripheral); - } else if (blockEntity instanceof TilePrinter printer) { + } else if (blockEntity instanceof PrinterBlockEntity printer) { CapabilityProvider.attach(event, PERIPHERAL, Capabilities.CAPABILITY_PERIPHERAL, printer::peripheral); // We don't need to invalidate here as the block's can't be rotated on the X axis! SidedCapabilityProvider.attach( diff --git a/src/main/java/dan200/computercraft/shared/peripheral/generic/data/FluidData.java b/projects/forge/src/main/java/dan200/computercraft/shared/details/FluidData.java similarity index 80% rename from src/main/java/dan200/computercraft/shared/peripheral/generic/data/FluidData.java rename to projects/forge/src/main/java/dan200/computercraft/shared/details/FluidData.java index da9a161bb..197bfa151 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/generic/data/FluidData.java +++ b/projects/forge/src/main/java/dan200/computercraft/shared/details/FluidData.java @@ -3,7 +3,7 @@ * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. * Send enquiries to dratcliffe@gmail.com */ -package dan200.computercraft.shared.peripheral.generic.data; +package dan200.computercraft.shared.details; import dan200.computercraft.shared.platform.Registries; import net.minecraftforge.fluids.FluidStack; @@ -12,7 +12,7 @@ import java.util.Map; public class FluidData { public static void fillBasic(Map data, FluidStack stack) { - data.put("name", DataHelpers.getId(Registries.FLUIDS, stack.getFluid())); + data.put("name", DetailHelpers.getId(Registries.FLUIDS, stack.getFluid())); data.put("amount", stack.getAmount()); } @@ -20,6 +20,6 @@ public class FluidData { // FluidStack doesn't have a getTags method, so we need to use the deprecated builtInRegistryHolder. @SuppressWarnings("deprecation") var holder = stack.getFluid().builtInRegistryHolder(); - data.put("tags", DataHelpers.getTags(holder)); + data.put("tags", DetailHelpers.getTags(holder)); } } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/generic/GenericPeripheralProvider.java b/projects/forge/src/main/java/dan200/computercraft/shared/peripheral/generic/GenericPeripheralProvider.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/generic/GenericPeripheralProvider.java rename to projects/forge/src/main/java/dan200/computercraft/shared/peripheral/generic/GenericPeripheralProvider.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/EnergyMethods.java b/projects/forge/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/EnergyMethods.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/peripheral/generic/methods/EnergyMethods.java rename to projects/forge/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/EnergyMethods.java diff --git a/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/FluidMethods.java b/projects/forge/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/FluidMethods.java similarity index 98% rename from src/main/java/dan200/computercraft/shared/peripheral/generic/methods/FluidMethods.java rename to projects/forge/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/FluidMethods.java index 5b01d2905..f80aaad27 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/FluidMethods.java +++ b/projects/forge/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/FluidMethods.java @@ -25,7 +25,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Optional; -import static dan200.computercraft.shared.peripheral.generic.methods.ArgumentHelpers.getRegistryEntry; +import static dan200.computercraft.shared.util.ArgumentHelpers.getRegistryEntry; /** * Methods for interacting with tanks and other fluid storage blocks. diff --git a/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/InventoryMethods.java b/projects/forge/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/InventoryMethods.java similarity index 99% rename from src/main/java/dan200/computercraft/shared/peripheral/generic/methods/InventoryMethods.java rename to projects/forge/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/InventoryMethods.java index cbe2143d6..3a494f1b6 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/InventoryMethods.java +++ b/projects/forge/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/InventoryMethods.java @@ -27,7 +27,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Optional; -import static dan200.computercraft.shared.peripheral.generic.methods.ArgumentHelpers.assertBetween; +import static dan200.computercraft.shared.util.ArgumentHelpers.assertBetween; /** * Methods for interacting with inventories. diff --git a/src/main/java/dan200/computercraft/shared/platform/FakePlayerExt.java b/projects/forge/src/main/java/dan200/computercraft/shared/platform/FakePlayerExt.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/platform/FakePlayerExt.java rename to projects/forge/src/main/java/dan200/computercraft/shared/platform/FakePlayerExt.java diff --git a/src/main/java/dan200/computercraft/shared/platform/ForgeContainerTransfer.java b/projects/forge/src/main/java/dan200/computercraft/shared/platform/ForgeContainerTransfer.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/platform/ForgeContainerTransfer.java rename to projects/forge/src/main/java/dan200/computercraft/shared/platform/ForgeContainerTransfer.java diff --git a/src/main/java/dan200/computercraft/shared/platform/NetworkHandler.java b/projects/forge/src/main/java/dan200/computercraft/shared/platform/NetworkHandler.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/platform/NetworkHandler.java rename to projects/forge/src/main/java/dan200/computercraft/shared/platform/NetworkHandler.java diff --git a/src/main/java/dan200/computercraft/shared/platform/PlatformHelperImpl.java b/projects/forge/src/main/java/dan200/computercraft/shared/platform/PlatformHelperImpl.java similarity index 95% rename from src/main/java/dan200/computercraft/shared/platform/PlatformHelperImpl.java rename to projects/forge/src/main/java/dan200/computercraft/shared/platform/PlatformHelperImpl.java index 7595940f2..c4b4a0065 100644 --- a/src/main/java/dan200/computercraft/shared/platform/PlatformHelperImpl.java +++ b/projects/forge/src/main/java/dan200/computercraft/shared/platform/PlatformHelperImpl.java @@ -7,16 +7,20 @@ package dan200.computercraft.shared.platform; import com.google.auto.service.AutoService; import com.mojang.authlib.GameProfile; +import com.mojang.brigadier.arguments.ArgumentType; import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.api.network.wired.IWiredElement; import dan200.computercraft.api.peripheral.IPeripheral; +import dan200.computercraft.impl.Peripherals; import dan200.computercraft.shared.Capabilities; -import dan200.computercraft.shared.Peripherals; +import dan200.computercraft.shared.ModRegistry; import dan200.computercraft.shared.network.NetworkMessage; import dan200.computercraft.shared.network.client.ClientNetworkContext; import dan200.computercraft.shared.network.container.ContainerData; import dan200.computercraft.shared.util.CapabilityUtil; import dan200.computercraft.shared.util.InventoryUtil; +import net.minecraft.commands.synchronization.ArgumentTypeInfo; +import net.minecraft.commands.synchronization.ArgumentTypeInfos; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Registry; @@ -76,6 +80,18 @@ import java.util.function.Supplier; @AutoService(dan200.computercraft.impl.PlatformHelper.class) public class PlatformHelperImpl implements PlatformHelper { + private final CreativeModeTab tab = new CreativeModeTab(ComputerCraftAPI.MOD_ID) { + @Override + public ItemStack makeIcon() { + return new ItemStack(ModRegistry.Blocks.COMPUTER_NORMAL.get()); + } + }; + + @Override + public CreativeModeTab getCreativeTab() { + return tab; + } + @Override public ResourceLocation getRegistryKey(ResourceKey> registry, T object) { var key = RegistryManager.ACTIVE.getRegistry(registry).getKey(object); @@ -111,6 +127,11 @@ public class PlatformHelperImpl implements PlatformHelper { return new BlockEntityType<>(factory::apply, Set.of(block), null); } + @Override + public , T extends ArgumentTypeInfo.Template, I extends ArgumentTypeInfo> I registerArgumentTypeInfo(Class klass, I info) { + return ArgumentTypeInfos.registerByClass(klass, info); + } + @Override public MenuType createMenuType(Function reader, ContainerData.Factory factory) { return IForgeMenuType.create((id, player, data) -> factory.create(id, player, reader.apply(data))); diff --git a/src/main/java/dan200/computercraft/shared/util/CapabilityProvider.java b/projects/forge/src/main/java/dan200/computercraft/shared/util/CapabilityProvider.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/CapabilityProvider.java rename to projects/forge/src/main/java/dan200/computercraft/shared/util/CapabilityProvider.java diff --git a/src/main/java/dan200/computercraft/shared/util/CapabilityUtil.java b/projects/forge/src/main/java/dan200/computercraft/shared/util/CapabilityUtil.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/CapabilityUtil.java rename to projects/forge/src/main/java/dan200/computercraft/shared/util/CapabilityUtil.java diff --git a/src/main/java/dan200/computercraft/shared/util/SidedCapabilityProvider.java b/projects/forge/src/main/java/dan200/computercraft/shared/util/SidedCapabilityProvider.java similarity index 100% rename from src/main/java/dan200/computercraft/shared/util/SidedCapabilityProvider.java rename to projects/forge/src/main/java/dan200/computercraft/shared/util/SidedCapabilityProvider.java diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/projects/forge/src/main/resources/META-INF/accesstransformer.cfg similarity index 94% rename from src/main/resources/META-INF/accesstransformer.cfg rename to projects/forge/src/main/resources/META-INF/accesstransformer.cfg index 40270d9cf..f4269f583 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/projects/forge/src/main/resources/META-INF/accesstransformer.cfg @@ -1,17 +1,3 @@ -# ItemPocketRenderer/ItemPrintoutRenderer -public net.minecraft.client.renderer.ItemInHandRenderer m_109312_(F)F # calculateMapTilt -public net.minecraft.client.renderer.ItemInHandRenderer m_109361_(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/world/entity/HumanoidArm;)V # renderMapHand -public net.minecraft.client.renderer.ItemInHandRenderer m_109346_(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;IFFLnet/minecraft/world/entity/HumanoidArm;)V # renderPlayerArm -# ClientTableFormatter -public net.minecraft.client.gui.components.ChatComponent f_93760_ # allMessages -public net.minecraft.client.gui.components.ChatComponent m_241120_()V # refreshTrimmedMessage -# NoTermComputerScreen -public net.minecraft.client.Minecraft f_91080_ # screen - -# SpeakerInstance/SpeakerManager -public com.mojang.blaze3d.audio.Channel m_83652_(I)V # pumpBuffers -public net.minecraft.client.sounds.SoundEngine f_120223_ # executor - # DirectVertexBuffer protected com.mojang.blaze3d.vertex.VertexBuffer f_231217_ # vertexBufferId protected com.mojang.blaze3d.vertex.VertexBuffer f_166861_ # indexType @@ -20,8 +6,18 @@ protected com.mojang.blaze3d.vertex.VertexBuffer f_166864_ # mode protected com.mojang.blaze3d.vertex.VertexBuffer f_166865_ # sequentialIndices protected com.mojang.blaze3d.vertex.VertexBuffer f_85917_ # format -# ItemData -public net.minecraft.world.item.CreativeModeTab f_40763_ # langId +# ClientTableFormatter +public net.minecraft.client.gui.components.ChatComponent f_93760_ # allMessages +public net.minecraft.client.gui.components.ChatComponent m_241120_()V # refreshTrimmedMessage + +# ItemPocketRenderer/ItemPrintoutRenderer +public net.minecraft.client.renderer.ItemInHandRenderer m_109312_(F)F # calculateMapTilt +public net.minecraft.client.renderer.ItemInHandRenderer m_109361_(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/world/entity/HumanoidArm;)V # renderMapHand +public net.minecraft.client.renderer.ItemInHandRenderer m_109346_(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;IFFLnet/minecraft/world/entity/HumanoidArm;)V # renderPlayerArm + +# SpeakerInstance/SpeakerManager +public com.mojang.blaze3d.audio.Channel m_83652_(I)V # pumpBuffers +public net.minecraft.client.sounds.SoundEngine f_120223_ # executor # Data generators public net.minecraft.data.models.BlockModelGenerators f_124477_ # blockStateOutput diff --git a/src/main/resources/META-INF/mods.toml b/projects/forge/src/main/resources/META-INF/mods.toml similarity index 100% rename from src/main/resources/META-INF/mods.toml rename to projects/forge/src/main/resources/META-INF/mods.toml diff --git a/src/test/java/dan200/computercraft/shared/platform/ForgeContainerTransferTest.java b/projects/forge/src/test/java/dan200/computercraft/shared/platform/ForgeContainerTransferTest.java similarity index 81% rename from src/test/java/dan200/computercraft/shared/platform/ForgeContainerTransferTest.java rename to projects/forge/src/test/java/dan200/computercraft/shared/platform/ForgeContainerTransferTest.java index 6272f1787..3b4aa0cdf 100644 --- a/src/test/java/dan200/computercraft/shared/platform/ForgeContainerTransferTest.java +++ b/projects/forge/src/test/java/dan200/computercraft/shared/platform/ForgeContainerTransferTest.java @@ -5,7 +5,8 @@ */ package dan200.computercraft.shared.platform; -import dan200.computercraft.support.WithMinecraft; +import dan200.computercraft.test.shared.WithMinecraft; +import dan200.computercraft.test.shared.platform.ContainerTransferContract; import net.minecraft.world.Container; import net.minecraftforge.items.wrapper.InvWrapper; diff --git a/src/test/resources/junit-platform.properties b/projects/forge/src/test/resources/junit-platform.properties similarity index 100% rename from src/test/resources/junit-platform.properties rename to projects/forge/src/test/resources/junit-platform.properties diff --git a/src/testMod/java/dan200/computercraft/gametest/core/ClientHooks.java b/projects/forge/src/testMod/java/dan200/computercraft/gametest/core/ClientHooks.java similarity index 100% rename from src/testMod/java/dan200/computercraft/gametest/core/ClientHooks.java rename to projects/forge/src/testMod/java/dan200/computercraft/gametest/core/ClientHooks.java diff --git a/src/testMod/java/dan200/computercraft/gametest/core/TestMod.java b/projects/forge/src/testMod/java/dan200/computercraft/gametest/core/TestMod.java similarity index 100% rename from src/testMod/java/dan200/computercraft/gametest/core/TestMod.java rename to projects/forge/src/testMod/java/dan200/computercraft/gametest/core/TestMod.java diff --git a/src/testMod/resources/META-INF/mods.toml b/projects/forge/src/testMod/resources/META-INF/mods.toml similarity index 100% rename from src/testMod/resources/META-INF/mods.toml rename to projects/forge/src/testMod/resources/META-INF/mods.toml diff --git a/projects/web/build.gradle.kts b/projects/web/build.gradle.kts index 25a05f80b..e7bac6ebf 100644 --- a/projects/web/build.gradle.kts +++ b/projects/web/build.gradle.kts @@ -35,9 +35,9 @@ val illuaminateDocs by tasks.registering(cc.tweaked.gradle.IlluaminateExecToDir: // Config files inputs.file(rootProject.file("illuaminate.sexp")).withPropertyName("illuaminate config") // Sources - inputs.files(fileTree("doc")).withPropertyName("docs") - inputs.files(fileTree("src/main/resources/data/computercraft/lua")).withPropertyName("lua rom") - inputs.files(rootProject.tasks.named("luaJavadoc")) + inputs.files(rootProject.fileTree("doc")).withPropertyName("docs") + inputs.files(project(":core").fileTree("src/main/resources/data/computercraft/lua")).withPropertyName("lua rom") + inputs.files(project(":forge").tasks.named("luaJavadoc")) // Additional assets inputs.files(rollup) inputs.file("src/styles.css").withPropertyName("styles") @@ -57,7 +57,7 @@ val jsxDocs by tasks.registering(cc.tweaked.gradle.NpxExecToDir::class) { inputs.file("tsconfig.json").withPropertyName("Typescript config") // Sources inputs.files(fileTree("src")).withPropertyName("sources") - inputs.file(rootProject.file("src/generated/export/index.json")).withPropertyName("export") + inputs.file(file("src/export/index.json")).withPropertyName("export") inputs.files(illuaminateDocs) // Output directory. Also defined in src/transform.tsx @@ -83,7 +83,7 @@ val docWebsite by tasks.registering(Copy::class) { // Grab illuaminate's assets. HTML files are provided by jsxDocs from(illuaminateDocs) { exclude("**/*.html") } // And item/block images from the data export - from(rootProject.file("src/generated/export/items")) { into("images/items") } + from(file("src/export/items")) { into("images/items") } into(buildDir.resolve("site")) } diff --git a/projects/web/src/export/index.json b/projects/web/src/export/index.json new file mode 100644 index 000000000..1d02b6313 --- /dev/null +++ b/projects/web/src/export/index.json @@ -0,0 +1,400 @@ +{ + "itemNames": { + "computercraft:cable": "Networking Cable", + "computercraft:computer_advanced": "Advanced Computer", + "computercraft:computer_command": "Command Computer", + "computercraft:computer_normal": "Computer", + "computercraft:disk": "Floppy Disk", + "computercraft:disk_drive": "Disk Drive", + "computercraft:monitor_advanced": "Advanced Monitor", + "computercraft:monitor_normal": "Monitor", + "computercraft:pocket_computer_advanced": "Advanced Pocket Computer", + "computercraft:pocket_computer_normal": "Pocket Computer", + "computercraft:printed_book": "Printed Book", + "computercraft:printed_page": "Printed Page", + "computercraft:printed_pages": "Printed Pages", + "computercraft:printer": "Printer", + "computercraft:speaker": "Speaker", + "computercraft:treasure_disk": "Floppy Disk", + "computercraft:turtle_advanced": "Advanced Turtle", + "computercraft:turtle_normal": "Turtle", + "computercraft:wired_modem": "Wired Modem", + "computercraft:wired_modem_full": "Wired Modem", + "computercraft:wireless_modem_advanced": "Ender Modem", + "computercraft:wireless_modem_normal": "Wireless Modem", + "minecraft:black_dye": "Black Dye", + "minecraft:blue_dye": "Blue Dye", + "minecraft:brown_dye": "Brown Dye", + "minecraft:chest": "Chest", + "minecraft:command_block": "Command Block", + "minecraft:cyan_dye": "Cyan Dye", + "minecraft:ender_eye": "Eye of Ender", + "minecraft:ender_pearl": "Ender Pearl", + "minecraft:glass_pane": "Glass Pane", + "minecraft:gold_block": "Block of Gold", + "minecraft:gold_ingot": "Gold Ingot", + "minecraft:golden_apple": "Golden Apple", + "minecraft:gray_dye": "Gray Dye", + "minecraft:green_dye": "Green Dye", + "minecraft:iron_ingot": "Iron Ingot", + "minecraft:leather": "Leather", + "minecraft:light_blue_dye": "Light Blue Dye", + "minecraft:light_gray_dye": "Light Gray Dye", + "minecraft:lime_dye": "Lime Dye", + "minecraft:magenta_dye": "Magenta Dye", + "minecraft:note_block": "Note Block", + "minecraft:orange_dye": "Orange Dye", + "minecraft:pink_dye": "Pink Dye", + "minecraft:purple_dye": "Purple Dye", + "minecraft:red_dye": "Red Dye", + "minecraft:redstone": "Redstone Dust", + "minecraft:stone": "Stone", + "minecraft:string": "String", + "minecraft:white_dye": "White Dye", + "minecraft:yellow_dye": "Yellow Dye" + }, + "recipes": { + "computercraft:cable": { + "inputs": [ + null, + ["minecraft:stone"], + null, + ["minecraft:stone"], + ["minecraft:redstone"], + ["minecraft:stone"], + null, + ["minecraft:stone"], + null + ], + "output": "computercraft:cable", + "count": 6 + }, + "computercraft:computer_advanced": { + "inputs": [ + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:redstone"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:glass_pane"], + ["minecraft:gold_ingot"] + ], + "output": "computercraft:computer_advanced", + "count": 1 + }, + "computercraft:computer_advanced_upgrade": { + "inputs": [ + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["computercraft:computer_advanced"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + null, + ["minecraft:gold_ingot"] + ], + "output": "computercraft:computer_advanced", + "count": 1 + }, + "computercraft:computer_command": { + "inputs": [ + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:command_block"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:glass_pane"], + ["minecraft:gold_ingot"] + ], + "output": "computercraft:computer_command", + "count": 1 + }, + "computercraft:computer_normal": { + "inputs": [ + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:redstone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:glass_pane"], + ["minecraft:stone"] + ], + "output": "computercraft:computer_normal", + "count": 1 + }, + "computercraft:disk_drive": { + "inputs": [ + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:redstone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:redstone"], + ["minecraft:stone"] + ], + "output": "computercraft:disk_drive", + "count": 1 + }, + "computercraft:monitor_advanced": { + "inputs": [ + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:glass_pane"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"] + ], + "output": "computercraft:monitor_advanced", + "count": 4 + }, + "computercraft:monitor_normal": { + "inputs": [ + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:glass_pane"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"] + ], + "output": "computercraft:monitor_normal", + "count": 1 + }, + "computercraft:pocket_computer_advanced": { + "inputs": [ + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:golden_apple"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:glass_pane"], + ["minecraft:gold_ingot"] + ], + "output": "computercraft:pocket_computer_advanced", + "count": 1 + }, + "computercraft:pocket_computer_advanced_upgrade": { + "inputs": [ + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["computercraft:pocket_computer_normal"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + null, + ["minecraft:gold_ingot"] + ], + "output": "computercraft:pocket_computer_advanced", + "count": 1 + }, + "computercraft:pocket_computer_normal": { + "inputs": [ + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:golden_apple"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:glass_pane"], + ["minecraft:stone"] + ], + "output": "computercraft:pocket_computer_normal", + "count": 1 + }, + "computercraft:printed_book": { + "inputs": [ + ["minecraft:leather"], + ["computercraft:printed_page"], + ["minecraft:string"], + null, + null, + null, + null, + null, + null + ], + "output": "computercraft:printed_book", + "count": 1 + }, + "computercraft:printed_pages": { + "inputs": [ + ["computercraft:printed_page"], + ["computercraft:printed_page"], + ["minecraft:string"], + null, + null, + null, + null, + null, + null + ], + "output": "computercraft:printed_pages", + "count": 1 + }, + "computercraft:printer": { + "inputs": [ + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:redstone"], + ["minecraft:stone"], + ["minecraft:stone"], + [ + "minecraft:black_dye", + "minecraft:blue_dye", + "minecraft:brown_dye", + "minecraft:cyan_dye", + "minecraft:gray_dye", + "minecraft:green_dye", + "minecraft:light_blue_dye", + "minecraft:light_gray_dye", + "minecraft:lime_dye", + "minecraft:magenta_dye", + "minecraft:orange_dye", + "minecraft:pink_dye", + "minecraft:purple_dye", + "minecraft:red_dye", + "minecraft:white_dye", + "minecraft:yellow_dye" + ], + ["minecraft:stone"] + ], + "output": "computercraft:printer", + "count": 1 + }, + "computercraft:speaker": { + "inputs": [ + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:note_block"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:redstone"], + ["minecraft:stone"] + ], + "output": "computercraft:speaker", + "count": 1 + }, + "computercraft:turtle_advanced": { + "inputs": [ + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["computercraft:computer_advanced"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:chest"], + ["minecraft:gold_ingot"] + ], + "output": "computercraft:turtle_advanced", + "count": 1 + }, + "computercraft:turtle_advanced_upgrade": { + "inputs": [ + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["computercraft:computer_advanced"], + ["minecraft:gold_ingot"], + null, + ["minecraft:gold_block"], + null + ], + "output": "computercraft:turtle_advanced", + "count": 1 + }, + "computercraft:turtle_normal": { + "inputs": [ + ["minecraft:iron_ingot"], + ["minecraft:iron_ingot"], + ["minecraft:iron_ingot"], + ["minecraft:iron_ingot"], + ["computercraft:computer_normal"], + ["minecraft:iron_ingot"], + ["minecraft:iron_ingot"], + ["minecraft:chest"], + ["minecraft:iron_ingot"] + ], + "output": "computercraft:turtle_normal", + "count": 1 + }, + "computercraft:wired_modem": { + "inputs": [ + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:redstone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"] + ], + "output": "computercraft:wired_modem", + "count": 1 + }, + "computercraft:wired_modem_full_from": { + "inputs": [["computercraft:wired_modem"], null, null, null, null, null, null, null, null], + "output": "computercraft:wired_modem_full", + "count": 1 + }, + "computercraft:wired_modem_full_to": { + "inputs": [["computercraft:wired_modem_full"], null, null, null, null, null, null, null, null], + "output": "computercraft:wired_modem", + "count": 1 + }, + "computercraft:wireless_modem_advanced": { + "inputs": [ + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:ender_eye"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"], + ["minecraft:gold_ingot"] + ], + "output": "computercraft:wireless_modem_advanced", + "count": 1 + }, + "computercraft:wireless_modem_normal": { + "inputs": [ + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:ender_pearl"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"], + ["minecraft:stone"] + ], + "output": "computercraft:wireless_modem_normal", + "count": 1 + } + } +} \ No newline at end of file diff --git a/src/generated/export/items/computercraft/cable.png b/projects/web/src/export/items/computercraft/cable.png similarity index 100% rename from src/generated/export/items/computercraft/cable.png rename to projects/web/src/export/items/computercraft/cable.png diff --git a/src/generated/export/items/computercraft/computer_advanced.png b/projects/web/src/export/items/computercraft/computer_advanced.png similarity index 100% rename from src/generated/export/items/computercraft/computer_advanced.png rename to projects/web/src/export/items/computercraft/computer_advanced.png diff --git a/src/generated/export/items/computercraft/computer_command.png b/projects/web/src/export/items/computercraft/computer_command.png similarity index 100% rename from src/generated/export/items/computercraft/computer_command.png rename to projects/web/src/export/items/computercraft/computer_command.png diff --git a/src/generated/export/items/computercraft/computer_normal.png b/projects/web/src/export/items/computercraft/computer_normal.png similarity index 100% rename from src/generated/export/items/computercraft/computer_normal.png rename to projects/web/src/export/items/computercraft/computer_normal.png diff --git a/src/generated/export/items/computercraft/disk.png b/projects/web/src/export/items/computercraft/disk.png similarity index 100% rename from src/generated/export/items/computercraft/disk.png rename to projects/web/src/export/items/computercraft/disk.png diff --git a/src/generated/export/items/computercraft/disk_drive.png b/projects/web/src/export/items/computercraft/disk_drive.png similarity index 100% rename from src/generated/export/items/computercraft/disk_drive.png rename to projects/web/src/export/items/computercraft/disk_drive.png diff --git a/src/generated/export/items/computercraft/monitor_advanced.png b/projects/web/src/export/items/computercraft/monitor_advanced.png similarity index 100% rename from src/generated/export/items/computercraft/monitor_advanced.png rename to projects/web/src/export/items/computercraft/monitor_advanced.png diff --git a/src/generated/export/items/computercraft/monitor_normal.png b/projects/web/src/export/items/computercraft/monitor_normal.png similarity index 100% rename from src/generated/export/items/computercraft/monitor_normal.png rename to projects/web/src/export/items/computercraft/monitor_normal.png diff --git a/src/generated/export/items/computercraft/pocket_computer_advanced.png b/projects/web/src/export/items/computercraft/pocket_computer_advanced.png similarity index 100% rename from src/generated/export/items/computercraft/pocket_computer_advanced.png rename to projects/web/src/export/items/computercraft/pocket_computer_advanced.png diff --git a/src/generated/export/items/computercraft/pocket_computer_normal.png b/projects/web/src/export/items/computercraft/pocket_computer_normal.png similarity index 100% rename from src/generated/export/items/computercraft/pocket_computer_normal.png rename to projects/web/src/export/items/computercraft/pocket_computer_normal.png diff --git a/src/generated/export/items/computercraft/printed_book.png b/projects/web/src/export/items/computercraft/printed_book.png similarity index 100% rename from src/generated/export/items/computercraft/printed_book.png rename to projects/web/src/export/items/computercraft/printed_book.png diff --git a/src/generated/export/items/computercraft/printed_page.png b/projects/web/src/export/items/computercraft/printed_page.png similarity index 100% rename from src/generated/export/items/computercraft/printed_page.png rename to projects/web/src/export/items/computercraft/printed_page.png diff --git a/src/generated/export/items/computercraft/printed_pages.png b/projects/web/src/export/items/computercraft/printed_pages.png similarity index 100% rename from src/generated/export/items/computercraft/printed_pages.png rename to projects/web/src/export/items/computercraft/printed_pages.png diff --git a/src/generated/export/items/computercraft/printer.png b/projects/web/src/export/items/computercraft/printer.png similarity index 100% rename from src/generated/export/items/computercraft/printer.png rename to projects/web/src/export/items/computercraft/printer.png diff --git a/src/generated/export/items/computercraft/speaker.png b/projects/web/src/export/items/computercraft/speaker.png similarity index 100% rename from src/generated/export/items/computercraft/speaker.png rename to projects/web/src/export/items/computercraft/speaker.png diff --git a/src/generated/export/items/computercraft/treasure_disk.png b/projects/web/src/export/items/computercraft/treasure_disk.png similarity index 100% rename from src/generated/export/items/computercraft/treasure_disk.png rename to projects/web/src/export/items/computercraft/treasure_disk.png diff --git a/src/generated/export/items/computercraft/turtle_advanced.png b/projects/web/src/export/items/computercraft/turtle_advanced.png similarity index 100% rename from src/generated/export/items/computercraft/turtle_advanced.png rename to projects/web/src/export/items/computercraft/turtle_advanced.png diff --git a/src/generated/export/items/computercraft/turtle_normal.png b/projects/web/src/export/items/computercraft/turtle_normal.png similarity index 100% rename from src/generated/export/items/computercraft/turtle_normal.png rename to projects/web/src/export/items/computercraft/turtle_normal.png diff --git a/src/generated/export/items/computercraft/wired_modem.png b/projects/web/src/export/items/computercraft/wired_modem.png similarity index 100% rename from src/generated/export/items/computercraft/wired_modem.png rename to projects/web/src/export/items/computercraft/wired_modem.png diff --git a/src/generated/export/items/computercraft/wired_modem_full.png b/projects/web/src/export/items/computercraft/wired_modem_full.png similarity index 100% rename from src/generated/export/items/computercraft/wired_modem_full.png rename to projects/web/src/export/items/computercraft/wired_modem_full.png diff --git a/src/generated/export/items/computercraft/wireless_modem_advanced.png b/projects/web/src/export/items/computercraft/wireless_modem_advanced.png similarity index 100% rename from src/generated/export/items/computercraft/wireless_modem_advanced.png rename to projects/web/src/export/items/computercraft/wireless_modem_advanced.png diff --git a/src/generated/export/items/computercraft/wireless_modem_normal.png b/projects/web/src/export/items/computercraft/wireless_modem_normal.png similarity index 100% rename from src/generated/export/items/computercraft/wireless_modem_normal.png rename to projects/web/src/export/items/computercraft/wireless_modem_normal.png diff --git a/src/generated/export/items/minecraft/black_dye.png b/projects/web/src/export/items/minecraft/black_dye.png similarity index 100% rename from src/generated/export/items/minecraft/black_dye.png rename to projects/web/src/export/items/minecraft/black_dye.png diff --git a/src/generated/export/items/minecraft/blue_dye.png b/projects/web/src/export/items/minecraft/blue_dye.png similarity index 100% rename from src/generated/export/items/minecraft/blue_dye.png rename to projects/web/src/export/items/minecraft/blue_dye.png diff --git a/src/generated/export/items/minecraft/brown_dye.png b/projects/web/src/export/items/minecraft/brown_dye.png similarity index 100% rename from src/generated/export/items/minecraft/brown_dye.png rename to projects/web/src/export/items/minecraft/brown_dye.png diff --git a/src/generated/export/items/minecraft/chest.png b/projects/web/src/export/items/minecraft/chest.png similarity index 100% rename from src/generated/export/items/minecraft/chest.png rename to projects/web/src/export/items/minecraft/chest.png diff --git a/src/generated/export/items/minecraft/command_block.png b/projects/web/src/export/items/minecraft/command_block.png similarity index 100% rename from src/generated/export/items/minecraft/command_block.png rename to projects/web/src/export/items/minecraft/command_block.png diff --git a/src/generated/export/items/minecraft/cyan_dye.png b/projects/web/src/export/items/minecraft/cyan_dye.png similarity index 100% rename from src/generated/export/items/minecraft/cyan_dye.png rename to projects/web/src/export/items/minecraft/cyan_dye.png diff --git a/src/generated/export/items/minecraft/ender_eye.png b/projects/web/src/export/items/minecraft/ender_eye.png similarity index 100% rename from src/generated/export/items/minecraft/ender_eye.png rename to projects/web/src/export/items/minecraft/ender_eye.png diff --git a/src/generated/export/items/minecraft/ender_pearl.png b/projects/web/src/export/items/minecraft/ender_pearl.png similarity index 100% rename from src/generated/export/items/minecraft/ender_pearl.png rename to projects/web/src/export/items/minecraft/ender_pearl.png diff --git a/src/generated/export/items/minecraft/glass_pane.png b/projects/web/src/export/items/minecraft/glass_pane.png similarity index 100% rename from src/generated/export/items/minecraft/glass_pane.png rename to projects/web/src/export/items/minecraft/glass_pane.png diff --git a/src/generated/export/items/minecraft/gold_block.png b/projects/web/src/export/items/minecraft/gold_block.png similarity index 100% rename from src/generated/export/items/minecraft/gold_block.png rename to projects/web/src/export/items/minecraft/gold_block.png diff --git a/src/generated/export/items/minecraft/gold_ingot.png b/projects/web/src/export/items/minecraft/gold_ingot.png similarity index 100% rename from src/generated/export/items/minecraft/gold_ingot.png rename to projects/web/src/export/items/minecraft/gold_ingot.png diff --git a/src/generated/export/items/minecraft/golden_apple.png b/projects/web/src/export/items/minecraft/golden_apple.png similarity index 100% rename from src/generated/export/items/minecraft/golden_apple.png rename to projects/web/src/export/items/minecraft/golden_apple.png diff --git a/src/generated/export/items/minecraft/gray_dye.png b/projects/web/src/export/items/minecraft/gray_dye.png similarity index 100% rename from src/generated/export/items/minecraft/gray_dye.png rename to projects/web/src/export/items/minecraft/gray_dye.png diff --git a/src/generated/export/items/minecraft/green_dye.png b/projects/web/src/export/items/minecraft/green_dye.png similarity index 100% rename from src/generated/export/items/minecraft/green_dye.png rename to projects/web/src/export/items/minecraft/green_dye.png diff --git a/src/generated/export/items/minecraft/iron_ingot.png b/projects/web/src/export/items/minecraft/iron_ingot.png similarity index 100% rename from src/generated/export/items/minecraft/iron_ingot.png rename to projects/web/src/export/items/minecraft/iron_ingot.png diff --git a/src/generated/export/items/minecraft/leather.png b/projects/web/src/export/items/minecraft/leather.png similarity index 100% rename from src/generated/export/items/minecraft/leather.png rename to projects/web/src/export/items/minecraft/leather.png diff --git a/src/generated/export/items/minecraft/light_blue_dye.png b/projects/web/src/export/items/minecraft/light_blue_dye.png similarity index 100% rename from src/generated/export/items/minecraft/light_blue_dye.png rename to projects/web/src/export/items/minecraft/light_blue_dye.png diff --git a/src/generated/export/items/minecraft/light_gray_dye.png b/projects/web/src/export/items/minecraft/light_gray_dye.png similarity index 100% rename from src/generated/export/items/minecraft/light_gray_dye.png rename to projects/web/src/export/items/minecraft/light_gray_dye.png diff --git a/src/generated/export/items/minecraft/lime_dye.png b/projects/web/src/export/items/minecraft/lime_dye.png similarity index 100% rename from src/generated/export/items/minecraft/lime_dye.png rename to projects/web/src/export/items/minecraft/lime_dye.png diff --git a/src/generated/export/items/minecraft/magenta_dye.png b/projects/web/src/export/items/minecraft/magenta_dye.png similarity index 100% rename from src/generated/export/items/minecraft/magenta_dye.png rename to projects/web/src/export/items/minecraft/magenta_dye.png diff --git a/src/generated/export/items/minecraft/note_block.png b/projects/web/src/export/items/minecraft/note_block.png similarity index 100% rename from src/generated/export/items/minecraft/note_block.png rename to projects/web/src/export/items/minecraft/note_block.png diff --git a/src/generated/export/items/minecraft/orange_dye.png b/projects/web/src/export/items/minecraft/orange_dye.png similarity index 100% rename from src/generated/export/items/minecraft/orange_dye.png rename to projects/web/src/export/items/minecraft/orange_dye.png diff --git a/src/generated/export/items/minecraft/pink_dye.png b/projects/web/src/export/items/minecraft/pink_dye.png similarity index 100% rename from src/generated/export/items/minecraft/pink_dye.png rename to projects/web/src/export/items/minecraft/pink_dye.png diff --git a/src/generated/export/items/minecraft/purple_dye.png b/projects/web/src/export/items/minecraft/purple_dye.png similarity index 100% rename from src/generated/export/items/minecraft/purple_dye.png rename to projects/web/src/export/items/minecraft/purple_dye.png diff --git a/src/generated/export/items/minecraft/red_dye.png b/projects/web/src/export/items/minecraft/red_dye.png similarity index 100% rename from src/generated/export/items/minecraft/red_dye.png rename to projects/web/src/export/items/minecraft/red_dye.png diff --git a/src/generated/export/items/minecraft/redstone.png b/projects/web/src/export/items/minecraft/redstone.png similarity index 100% rename from src/generated/export/items/minecraft/redstone.png rename to projects/web/src/export/items/minecraft/redstone.png diff --git a/src/generated/export/items/minecraft/stone.png b/projects/web/src/export/items/minecraft/stone.png similarity index 100% rename from src/generated/export/items/minecraft/stone.png rename to projects/web/src/export/items/minecraft/stone.png diff --git a/src/generated/export/items/minecraft/string.png b/projects/web/src/export/items/minecraft/string.png similarity index 100% rename from src/generated/export/items/minecraft/string.png rename to projects/web/src/export/items/minecraft/string.png diff --git a/src/generated/export/items/minecraft/white_dye.png b/projects/web/src/export/items/minecraft/white_dye.png similarity index 100% rename from src/generated/export/items/minecraft/white_dye.png rename to projects/web/src/export/items/minecraft/white_dye.png diff --git a/src/generated/export/items/minecraft/yellow_dye.png b/projects/web/src/export/items/minecraft/yellow_dye.png similarity index 100% rename from src/generated/export/items/minecraft/yellow_dye.png rename to projects/web/src/export/items/minecraft/yellow_dye.png diff --git a/projects/web/src/transform.tsx b/projects/web/src/transform.tsx index 5128e5822..4798887ca 100644 --- a/projects/web/src/transform.tsx +++ b/projects/web/src/transform.tsx @@ -39,7 +39,7 @@ const glob = promisify(globModule); } as any }); - const dataExport = JSON.parse(await fs.readFile("../../src/generated/export/index.json", "utf-8")) as DataExport; + const dataExport = JSON.parse(await fs.readFile("src/export/index.json", "utf-8")) as DataExport; for (const file of await glob(base + "/**/*.html")) { const contents = await fs.readFile(file, "utf-8"); diff --git a/settings.gradle.kts b/settings.gradle.kts index a128f6814..be342fdcb 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -22,7 +22,9 @@ include(":core") include(":mc-stubs") include(":forge-stubs") include(":common-api") +include(":common") include(":forge-api") +include(":forge") include(":lints") include(":web") diff --git a/src/generated/export/index.json b/src/generated/export/index.json deleted file mode 100644 index f4bfe9cac..000000000 --- a/src/generated/export/index.json +++ /dev/null @@ -1,760 +0,0 @@ -{ - "itemNames": { - "computercraft:cable": "Networking Cable", - "computercraft:computer_advanced": "Advanced Computer", - "computercraft:computer_command": "Command Computer", - "computercraft:computer_normal": "Computer", - "computercraft:disk": "Floppy Disk", - "computercraft:disk_drive": "Disk Drive", - "computercraft:monitor_advanced": "Advanced Monitor", - "computercraft:monitor_normal": "Monitor", - "computercraft:pocket_computer_advanced": "Advanced Pocket Computer", - "computercraft:pocket_computer_normal": "Pocket Computer", - "computercraft:printed_book": "Printed Book", - "computercraft:printed_page": "Printed Page", - "computercraft:printed_pages": "Printed Pages", - "computercraft:printer": "Printer", - "computercraft:speaker": "Speaker", - "computercraft:treasure_disk": "Floppy Disk", - "computercraft:turtle_advanced": "Advanced Turtle", - "computercraft:turtle_normal": "Turtle", - "computercraft:wired_modem": "Wired Modem", - "computercraft:wired_modem_full": "Wired Modem", - "computercraft:wireless_modem_advanced": "Ender Modem", - "computercraft:wireless_modem_normal": "Wireless Modem", - "minecraft:black_dye": "Black Dye", - "minecraft:blue_dye": "Blue Dye", - "minecraft:brown_dye": "Brown Dye", - "minecraft:chest": "Chest", - "minecraft:command_block": "Command Block", - "minecraft:cyan_dye": "Cyan Dye", - "minecraft:ender_eye": "Eye of Ender", - "minecraft:ender_pearl": "Ender Pearl", - "minecraft:glass_pane": "Glass Pane", - "minecraft:gold_block": "Block of Gold", - "minecraft:gold_ingot": "Gold Ingot", - "minecraft:golden_apple": "Golden Apple", - "minecraft:gray_dye": "Gray Dye", - "minecraft:green_dye": "Green Dye", - "minecraft:iron_ingot": "Iron Ingot", - "minecraft:leather": "Leather", - "minecraft:light_blue_dye": "Light Blue Dye", - "minecraft:light_gray_dye": "Light Gray Dye", - "minecraft:lime_dye": "Lime Dye", - "minecraft:magenta_dye": "Magenta Dye", - "minecraft:note_block": "Note Block", - "minecraft:orange_dye": "Orange Dye", - "minecraft:pink_dye": "Pink Dye", - "minecraft:purple_dye": "Purple Dye", - "minecraft:red_dye": "Red Dye", - "minecraft:redstone": "Redstone Dust", - "minecraft:stone": "Stone", - "minecraft:string": "String", - "minecraft:white_dye": "White Dye", - "minecraft:yellow_dye": "Yellow Dye" - }, - "recipes": { - "computercraft:cable": { - "inputs": [ - null, - [ - "minecraft:stone" - ], - null, - [ - "minecraft:stone" - ], - [ - "minecraft:redstone" - ], - [ - "minecraft:stone" - ], - null, - [ - "minecraft:stone" - ], - null - ], - "output": "computercraft:cable", - "count": 6 - }, - "computercraft:computer_advanced": { - "inputs": [ - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:redstone" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:glass_pane" - ], - [ - "minecraft:gold_ingot" - ] - ], - "output": "computercraft:computer_advanced", - "count": 1 - }, - "computercraft:computer_advanced_upgrade": { - "inputs": [ - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "computercraft:computer_normal" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - null, - [ - "minecraft:gold_ingot" - ] - ], - "output": "computercraft:computer_advanced", - "count": 1 - }, - "computercraft:computer_command": { - "inputs": [ - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:command_block" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:glass_pane" - ], - [ - "minecraft:gold_ingot" - ] - ], - "output": "computercraft:computer_command", - "count": 1 - }, - "computercraft:computer_normal": { - "inputs": [ - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:redstone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:glass_pane" - ], - [ - "minecraft:stone" - ] - ], - "output": "computercraft:computer_normal", - "count": 1 - }, - "computercraft:disk_drive": { - "inputs": [ - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:redstone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:redstone" - ], - [ - "minecraft:stone" - ] - ], - "output": "computercraft:disk_drive", - "count": 1 - }, - "computercraft:monitor_advanced": { - "inputs": [ - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:glass_pane" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ] - ], - "output": "computercraft:monitor_advanced", - "count": 4 - }, - "computercraft:monitor_normal": { - "inputs": [ - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:glass_pane" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ] - ], - "output": "computercraft:monitor_normal", - "count": 1 - }, - "computercraft:pocket_computer_advanced": { - "inputs": [ - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:golden_apple" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:glass_pane" - ], - [ - "minecraft:gold_ingot" - ] - ], - "output": "computercraft:pocket_computer_advanced", - "count": 1 - }, - "computercraft:pocket_computer_advanced_upgrade": { - "inputs": [ - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "computercraft:pocket_computer_normal" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - null, - [ - "minecraft:gold_ingot" - ] - ], - "output": "computercraft:pocket_computer_advanced", - "count": 1 - }, - "computercraft:pocket_computer_normal": { - "inputs": [ - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:golden_apple" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:glass_pane" - ], - [ - "minecraft:stone" - ] - ], - "output": "computercraft:pocket_computer_normal", - "count": 1 - }, - "computercraft:printed_book": { - "inputs": [ - [ - "minecraft:leather" - ], - [ - "computercraft:printed_page" - ], - [ - "minecraft:string" - ], - null, - null, - null, - null, - null, - null - ], - "output": "computercraft:printed_book", - "count": 1 - }, - "computercraft:printed_pages": { - "inputs": [ - [ - "computercraft:printed_page" - ], - [ - "computercraft:printed_page" - ], - [ - "minecraft:string" - ], - null, - null, - null, - null, - null, - null - ], - "output": "computercraft:printed_pages", - "count": 1 - }, - "computercraft:printer": { - "inputs": [ - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:redstone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:black_dye", - "minecraft:blue_dye", - "minecraft:brown_dye", - "minecraft:cyan_dye", - "minecraft:gray_dye", - "minecraft:green_dye", - "minecraft:light_blue_dye", - "minecraft:light_gray_dye", - "minecraft:lime_dye", - "minecraft:magenta_dye", - "minecraft:orange_dye", - "minecraft:pink_dye", - "minecraft:purple_dye", - "minecraft:red_dye", - "minecraft:white_dye", - "minecraft:yellow_dye" - ], - [ - "minecraft:stone" - ] - ], - "output": "computercraft:printer", - "count": 1 - }, - "computercraft:speaker": { - "inputs": [ - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:note_block" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:redstone" - ], - [ - "minecraft:stone" - ] - ], - "output": "computercraft:speaker", - "count": 1 - }, - "computercraft:turtle_advanced": { - "inputs": [ - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "computercraft:computer_advanced" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:chest" - ], - [ - "minecraft:gold_ingot" - ] - ], - "output": "computercraft:turtle_advanced", - "count": 1 - }, - "computercraft:turtle_advanced_upgrade": { - "inputs": [ - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "computercraft:turtle_normal" - ], - [ - "minecraft:gold_ingot" - ], - null, - [ - "minecraft:gold_block" - ], - null - ], - "output": "computercraft:turtle_advanced", - "count": 1 - }, - "computercraft:turtle_normal": { - "inputs": [ - [ - "minecraft:iron_ingot" - ], - [ - "minecraft:iron_ingot" - ], - [ - "minecraft:iron_ingot" - ], - [ - "minecraft:iron_ingot" - ], - [ - "computercraft:computer_normal" - ], - [ - "minecraft:iron_ingot" - ], - [ - "minecraft:iron_ingot" - ], - [ - "minecraft:chest" - ], - [ - "minecraft:iron_ingot" - ] - ], - "output": "computercraft:turtle_normal", - "count": 1 - }, - "computercraft:wired_modem": { - "inputs": [ - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:redstone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ] - ], - "output": "computercraft:wired_modem", - "count": 1 - }, - "computercraft:wired_modem_full_from": { - "inputs": [ - [ - "computercraft:wired_modem" - ], - null, - null, - null, - null, - null, - null, - null, - null - ], - "output": "computercraft:wired_modem_full", - "count": 1 - }, - "computercraft:wired_modem_full_to": { - "inputs": [ - [ - "computercraft:wired_modem_full" - ], - null, - null, - null, - null, - null, - null, - null, - null - ], - "output": "computercraft:wired_modem", - "count": 1 - }, - "computercraft:wireless_modem_advanced": { - "inputs": [ - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:ender_eye" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ], - [ - "minecraft:gold_ingot" - ] - ], - "output": "computercraft:wireless_modem_advanced", - "count": 1 - }, - "computercraft:wireless_modem_normal": { - "inputs": [ - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:ender_pearl" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ], - [ - "minecraft:stone" - ] - ], - "output": "computercraft:wireless_modem_normal", - "count": 1 - } - } -} diff --git a/src/main/java/dan200/computercraft/shared/util/CreativeTabMain.java b/src/main/java/dan200/computercraft/shared/util/CreativeTabMain.java deleted file mode 100644 index 1f4008420..000000000 --- a/src/main/java/dan200/computercraft/shared/util/CreativeTabMain.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This file is part of ComputerCraft - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. - * Send enquiries to dratcliffe@gmail.com - */ -package dan200.computercraft.shared.util; - -import dan200.computercraft.api.ComputerCraftAPI; -import dan200.computercraft.shared.ModRegistry; -import net.minecraft.world.item.CreativeModeTab; -import net.minecraft.world.item.ItemStack; - -public class CreativeTabMain extends CreativeModeTab { - public CreativeTabMain() { - super(ComputerCraftAPI.MOD_ID); - } - - @Override - public ItemStack makeIcon() { - return new ItemStack(ModRegistry.Blocks.COMPUTER_NORMAL.get()); - } -}