diff --git a/build.gradle.kts b/build.gradle.kts index d56e6968f..a17602442 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -24,21 +24,19 @@ val mcVersion: String by extra githubRelease { token(findProperty("githubApiKey") as String? ?: "") - owner.set("cc-tweaked") - repo.set("CC-Tweaked") - targetCommitish.set(cct.gitBranch) + owner = "cc-tweaked" + repo = "CC-Tweaked" + targetCommitish = cct.gitBranch - tagName.set("v$mcVersion-$modVersion") - releaseName.set("[$mcVersion] $modVersion") - body.set( - provider { - "## " + project(":core").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(isUnstable) + tagName = "v$mcVersion-$modVersion" + releaseName = "[$mcVersion] $modVersion" + body = provider { + "## " + project(":core").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 = isUnstable } tasks.publish { dependsOn(tasks.githubRelease) } @@ -118,7 +116,7 @@ idea.project.settings.compiler.javac { } versionCatalogUpdate { - sortByKey.set(false) + sortByKey = false pin { versions.addAll("fastutil", "guava", "netty", "slf4j") } - keep { keepUnusedLibraries.set(true) } + keep { keepUnusedLibraries = true } } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index e03247564..1e9e1df23 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -68,7 +68,7 @@ gradlePlugin { } versionCatalogUpdate { - sortByKey.set(false) - keep { keepUnusedLibraries.set(true) } - catalogFile.set(file("../gradle/libs.versions.toml")) + sortByKey = false + keep { keepUnusedLibraries = true } + catalogFile = file("../gradle/libs.versions.toml") } diff --git a/buildSrc/src/main/kotlin/cc-tweaked.fabric.gradle.kts b/buildSrc/src/main/kotlin/cc-tweaked.fabric.gradle.kts index 7ef28a271..eede5d234 100644 --- a/buildSrc/src/main/kotlin/cc-tweaked.fabric.gradle.kts +++ b/buildSrc/src/main/kotlin/cc-tweaked.fabric.gradle.kts @@ -30,7 +30,7 @@ repositories { loom { splitEnvironmentSourceSets() - splitModDependencies.set(true) + splitModDependencies = true } MinecraftConfigurations.setup(project) diff --git a/buildSrc/src/main/kotlin/cc-tweaked.java-convention.gradle.kts b/buildSrc/src/main/kotlin/cc-tweaked.java-convention.gradle.kts index 71da328d0..3f8c27943 100644 --- a/buildSrc/src/main/kotlin/cc-tweaked.java-convention.gradle.kts +++ b/buildSrc/src/main/kotlin/cc-tweaked.java-convention.gradle.kts @@ -29,7 +29,7 @@ base.archivesName.convention("cc-tweaked-$mcVersion-${project.name}") java { toolchain { - languageVersion.set(CCTweakedPlugin.JAVA_VERSION) + languageVersion= CCTweakedPlugin.JAVA_VERSION } withSourcesJar() @@ -163,8 +163,8 @@ tasks.test { } tasks.withType(JacocoReport::class.java).configureEach { - reports.xml.required.set(true) - reports.html.required.set(true) + reports.xml.required = true + reports.html.required =true } project.plugins.withType(CCTweakedPlugin::class.java) { diff --git a/buildSrc/src/main/kotlin/cc-tweaked.kotlin-convention.gradle.kts b/buildSrc/src/main/kotlin/cc-tweaked.kotlin-convention.gradle.kts deleted file mode 100644 index 1d1bd3c67..000000000 --- a/buildSrc/src/main/kotlin/cc-tweaked.kotlin-convention.gradle.kts +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-FileCopyrightText: 2022 The CC: Tweaked Developers -// -// SPDX-License-Identifier: MPL-2.0 - -import cc.tweaked.gradle.CCTweakedPlugin -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - -plugins { - kotlin("jvm") -} - -kotlin { - jvmToolchain { - languageVersion.set(CCTweakedPlugin.JAVA_VERSION) - } -} - -tasks.withType(KotlinCompile::class.java).configureEach { - // So technically we shouldn't need to do this as the toolchain sets it above. However, the option only appears - // to be set when the task executes, so doesn't get picked up by IDEs. - kotlinOptions.jvmTarget = when { - CCTweakedPlugin.JAVA_VERSION.asInt() > 8 -> CCTweakedPlugin.JAVA_VERSION.toString() - else -> "1.${CCTweakedPlugin.JAVA_VERSION.asInt()}" - } -} diff --git a/buildSrc/src/main/kotlin/cc-tweaked.mod-publishing.gradle.kts b/buildSrc/src/main/kotlin/cc-tweaked.mod-publishing.gradle.kts index f83cd9c77..ec1254e6f 100644 --- a/buildSrc/src/main/kotlin/cc-tweaked.mod-publishing.gradle.kts +++ b/buildSrc/src/main/kotlin/cc-tweaked.mod-publishing.gradle.kts @@ -24,16 +24,16 @@ val modVersion: String by extra val mcVersion: String by extra modrinth { - token.set(findProperty("modrinthApiKey") as String? ?: "") - projectId.set("gu7yAYhd") - versionNumber.set(modVersion) - versionName.set(modVersion) - versionType.set(if (isUnstable) "alpha" else "release") + token = findProperty("modrinthApiKey") as String? ?: "" + projectId = "gu7yAYhd" + versionNumber = modVersion + versionName = modVersion + versionType = if (isUnstable) "alpha" else "release" uploadFile.setProvider(modPublishing.output) 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).") + changelog = "Release notes can be found on the [GitHub repository](https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v$mcVersion-$modVersion)." - syncBodyFrom.set(provider { rootProject.file("doc/mod-page.md").readText() }) + syncBodyFrom = provider { rootProject.file("doc/mod-page.md").readText() } } tasks.publish { dependsOn(tasks.modrinth) } diff --git a/buildSrc/src/main/kotlin/cc-tweaked.mod.gradle.kts b/buildSrc/src/main/kotlin/cc-tweaked.mod.gradle.kts index 07b1427dc..0e720766d 100644 --- a/buildSrc/src/main/kotlin/cc-tweaked.mod.gradle.kts +++ b/buildSrc/src/main/kotlin/cc-tweaked.mod.gradle.kts @@ -13,7 +13,7 @@ import cc.tweaked.gradle.clientClasses import cc.tweaked.gradle.commonClasses plugins { - id("cc-tweaked.kotlin-convention") + kotlin("jvm") id("cc-tweaked.java-convention") } diff --git a/buildSrc/src/main/kotlin/cc-tweaked.publishing.gradle.kts b/buildSrc/src/main/kotlin/cc-tweaked.publishing.gradle.kts index 95c5baff6..51a8dd943 100644 --- a/buildSrc/src/main/kotlin/cc-tweaked.publishing.gradle.kts +++ b/buildSrc/src/main/kotlin/cc-tweaked.publishing.gradle.kts @@ -14,23 +14,23 @@ publishing { from(components["java"]) pom { - name.set("CC: Tweaked") - description.set("CC: Tweaked is a fork of ComputerCraft, adding programmable computers, turtles and more to Minecraft.") - url.set("https://github.com/cc-tweaked/CC-Tweaked") + name = "CC: Tweaked" + description = "CC: Tweaked is a fork of ComputerCraft, adding programmable computers, turtles and more to Minecraft." + url = "https://github.com/cc-tweaked/CC-Tweaked" scm { - url.set("https://github.com/cc-tweaked/CC-Tweaked.git") + url = "https://github.com/cc-tweaked/CC-Tweaked.git" } issueManagement { - system.set("github") - url.set("https://github.com/cc-tweaked/CC-Tweaked/issues") + system = "github" + url = "https://github.com/cc-tweaked/CC-Tweaked/issues" } licenses { license { - name.set("ComputerCraft Public License, Version 1.0") - url.set("https://github.com/cc-tweaked/CC-Tweaked/blob/HEAD/LICENSE") + name = "ComputerCraft Public License, Version 1.0" + url = "https://github.com/cc-tweaked/CC-Tweaked/blob/HEAD/LICENSE" } } } diff --git a/buildSrc/src/main/kotlin/cc/tweaked/gradle/CCTweakedExtension.kt b/buildSrc/src/main/kotlin/cc/tweaked/gradle/CCTweakedExtension.kt index 44d8dfacc..f97bc8084 100644 --- a/buildSrc/src/main/kotlin/cc/tweaked/gradle/CCTweakedExtension.kt +++ b/buildSrc/src/main/kotlin/cc/tweaked/gradle/CCTweakedExtension.kt @@ -40,33 +40,24 @@ abstract class CCTweakedExtension( private val project: Project, private val fs: FileSystemOperations, ) { - /** Get the hash of the latest git commit. */ - val gitHash: Provider = gitProvider(project, "") { - ProcessHelpers.captureOut("git", "-C", project.rootProject.projectDir.absolutePath, "rev-parse", "HEAD").trim() - } - /** Get the current git branch. */ - val gitBranch: Provider = gitProvider(project, "") { - ProcessHelpers.captureOut("git", "-C", project.rootProject.projectDir.absolutePath, "rev-parse", "--abbrev-ref", "HEAD") - .trim() - } + val gitBranch: Provider = + gitProvider("", listOf("rev-parse", "--abbrev-ref", "HEAD")) { it.trim() } /** Get a list of all contributors to the project. */ - val gitContributors: Provider> = gitProvider(project, listOf()) { - ProcessHelpers.captureLines( - "git", "-C", project.rootProject.projectDir.absolutePath, "shortlog", "-ns", - "--group=author", "--group=trailer:co-authored-by", "HEAD", - ) - .asSequence() - .map { - val matcher = COMMIT_COUNTS.matcher(it) - matcher.find() - matcher.group(1) - } - .filter { !IGNORED_USERS.contains(it) } - .toList() - .sortedWith(String.CASE_INSENSITIVE_ORDER) - } + val gitContributors: Provider> = + gitProvider(listOf(), listOf("shortlog", "-ns", "--group=author", "--group=trailer:co-authored-by", "HEAD")) { input -> + input.lineSequence() + .filter { it.isNotEmpty() } + .map { + val matcher = COMMIT_COUNTS.matcher(it) + matcher.find() + matcher.group(1) + } + .filter { !IGNORED_USERS.contains(it) } + .toList() + .sortedWith(String.CASE_INSENSITIVE_ORDER) + } /** * References to other sources @@ -265,26 +256,31 @@ abstract class CCTweakedExtension( for (dep in excludedDeps.get()) spec.exclude(dep) } + private fun gitProvider(default: T, command: List, process: (String) -> T): Provider { + val baseResult = project.providers.exec { + commandLine = listOf("git", "-C", project.rootDir.absolutePath) + command + } + + return project.provider { + val res = try { + baseResult.standardOutput.asText.get() + } catch (e: IOException) { + project.logger.error("Cannot read Git repository: ${e.message}", e) + return@provider default + } catch (e: GradleException) { + project.logger.error("Cannot read Git repository: ${e.message}", e) + return@provider default + } + process(res) + } + } + companion object { private val COMMIT_COUNTS = Pattern.compile("""^\s*[0-9]+\s+(.*)$""") private val IGNORED_USERS = setOf( "GitHub", "Daniel Ratcliffe", "NotSquidDev", "Weblate", ) - private fun gitProvider(project: Project, default: T, supplier: () -> T): Provider { - return project.provider { - try { - supplier() - } catch (e: IOException) { - project.logger.error("Cannot read Git repository: ${e.message}") - default - } catch (e: GradleException) { - project.logger.error("Cannot read Git repository: ${e.message}") - default - } - } - } - private val isIdeSync: Boolean get() = java.lang.Boolean.parseBoolean(System.getProperty("idea.sync.active", "false")) } diff --git a/buildSrc/src/main/kotlin/cc/tweaked/gradle/Node.kt b/buildSrc/src/main/kotlin/cc/tweaked/gradle/Node.kt index a1da1e862..dcd3c5440 100644 --- a/buildSrc/src/main/kotlin/cc/tweaked/gradle/Node.kt +++ b/buildSrc/src/main/kotlin/cc/tweaked/gradle/Node.kt @@ -11,7 +11,9 @@ import org.gradle.api.file.Directory import org.gradle.api.file.DirectoryProperty import org.gradle.api.provider.Provider import org.gradle.api.tasks.* +import org.gradle.process.ExecOperations import java.io.File +import javax.inject.Inject class NodePlugin : Plugin { override fun apply(project: Project) { @@ -43,9 +45,12 @@ abstract class NpmInstall : DefaultTask() { @get:OutputDirectory val nodeModules: Provider = projectRoot.dir("node_modules") + @get:Inject + protected abstract val execOperations: ExecOperations + @TaskAction fun install() { - project.exec { + execOperations.exec { commandLine(ProcessHelpers.getExecutable("npm"), "ci") workingDir = projectRoot.get().asFile } diff --git a/buildSrc/src/main/kotlin/cc/tweaked/gradle/ProcessHelpers.kt b/buildSrc/src/main/kotlin/cc/tweaked/gradle/ProcessHelpers.kt index c16b55441..73ff30597 100644 --- a/buildSrc/src/main/kotlin/cc/tweaked/gradle/ProcessHelpers.kt +++ b/buildSrc/src/main/kotlin/cc/tweaked/gradle/ProcessHelpers.kt @@ -4,45 +4,10 @@ package cc.tweaked.gradle -import org.codehaus.groovy.runtime.ProcessGroovyMethods import org.gradle.api.GradleException -import java.io.BufferedReader import java.io.File -import java.io.InputStreamReader -import java.nio.charset.StandardCharsets internal object ProcessHelpers { - fun startProcess(vararg command: String): Process { - // Something randomly passes in "GIT_DIR=" as an environment variable which clobbers everything else. Don't - // inherit the environment array! - return ProcessBuilder() - .command(*command) - .redirectError(ProcessBuilder.Redirect.INHERIT) - .also { it.environment().clear() } - .start() - } - - fun captureOut(vararg command: String): String { - val process = startProcess(*command) - process.outputStream.close() - - val result = ProcessGroovyMethods.getText(process) - process.waitForOrThrow("Failed to run command") - return result - } - - fun captureLines(vararg command: String): List { - val process = startProcess(*command) - process.outputStream.close() - - val out = BufferedReader(InputStreamReader(process.inputStream, StandardCharsets.UTF_8)).use { reader -> - reader.lines().filter { it.isNotEmpty() }.toList() - } - ProcessGroovyMethods.closeStreams(process) - process.waitForOrThrow("Failed to run command") - return out - } - fun onPath(name: String): Boolean { val path = System.getenv("PATH") ?: return false return path.splitToSequence(File.pathSeparator).any { File(it, name).exists() } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1152fe2db..fb09368a7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -31,9 +31,9 @@ commonsCli = "1.6.0" jetbrainsAnnotations = "24.1.0" jsr305 = "3.0.2" jzlib = "1.1.3" -kotlin = "1.9.21" -kotlin-coroutines = "1.7.3" -nightConfig = "3.6.7" +kotlin = "2.1.0" +kotlin-coroutines = "1.10.1" +nightConfig = "3.8.1" # Minecraft mods emi = "1.0.8+1.20.1" @@ -60,7 +60,7 @@ cctJavadoc = "1.8.3" checkstyle = "10.14.1" errorProne-core = "2.27.0" errorProne-plugin = "3.1.0" -fabric-loom = "1.7.1" +fabric-loom = "1.9.2" githubRelease = "2.5.2" gradleVersions = "0.50.0" ideaExt = "1.1.7" @@ -73,7 +73,7 @@ shadow = "8.3.1" spotless = "6.23.3" taskTree = "2.1.1" teavm = "0.11.0-SQUID.1" -vanillaExtract = "0.1.3" +vanillaExtract = "0.2.0" versionCatalogUpdate = "0.8.1" [libraries] diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index df97d72b8..cea7a793a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index f5feea6d6..f3b75f3b0 100755 --- a/gradlew +++ b/gradlew @@ -86,8 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s -' "$PWD" ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/projects/common/build.gradle.kts b/projects/common/build.gradle.kts index eb1e320e1..3fa723ae3 100644 --- a/projects/common/build.gradle.kts +++ b/projects/common/build.gradle.kts @@ -61,7 +61,7 @@ dependencies { } illuaminate { - version.set(libs.versions.illuaminate) + version = libs.versions.illuaminate } val luaJavadoc by tasks.registering(Javadoc::class) { @@ -82,11 +82,7 @@ val luaJavadoc by tasks.registering(Javadoc::class) { options.addStringOption("project-root", rootProject.file(".").absolutePath) options.noTimestamp(false) - javadocTool.set( - javaToolchains.javadocToolFor { - languageVersion.set(CCTweakedPlugin.JAVA_VERSION) - }, - ) + javadocTool = javaToolchains.javadocToolFor { languageVersion = CCTweakedPlugin.JAVA_VERSION } } val lintLua by tasks.registering(IlluaminateExec::class) { diff --git a/projects/common/src/testMod/java/dan200/computercraft/gametest/core/CCTestCommand.java b/projects/common/src/testMod/java/dan200/computercraft/gametest/core/CCTestCommand.java index 754cbe438..d3b7f285e 100644 --- a/projects/common/src/testMod/java/dan200/computercraft/gametest/core/CCTestCommand.java +++ b/projects/common/src/testMod/java/dan200/computercraft/gametest/core/CCTestCommand.java @@ -7,9 +7,12 @@ package dan200.computercraft.gametest.core; import com.mojang.brigadier.CommandDispatcher; import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.mixin.gametest.TestCommandAccessor; -import dan200.computercraft.shared.ModRegistry; +import dan200.computercraft.shared.computer.items.IComputerItem; import net.minecraft.ChatFormatting; +import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.arguments.item.ItemArgument; +import net.minecraft.commands.arguments.item.ItemInput; import net.minecraft.gametest.framework.GameTestRegistry; import net.minecraft.gametest.framework.StructureUtils; import net.minecraft.nbt.CompoundTag; @@ -25,6 +28,7 @@ import java.io.UncheckedIOException; import java.nio.file.Path; import static dan200.computercraft.core.util.Nullability.assertNonNull; +import static dan200.computercraft.shared.command.builder.CommandBuilder.command; import static dan200.computercraft.shared.command.builder.HelpingArgumentBuilder.choice; import static net.minecraft.commands.Commands.literal; @@ -34,7 +38,7 @@ import static net.minecraft.commands.Commands.literal; class CCTestCommand { public static final LevelResource LOCATION = new LevelResource(ComputerCraftAPI.MOD_ID); - public static void register(CommandDispatcher dispatcher) { + public static void register(CommandDispatcher dispatcher, CommandBuildContext buildContext) { dispatcher.register(choice("cctest") .then(literal("import").executes(context -> { importFiles(context.getSource().getServer()); @@ -82,7 +86,9 @@ class CCTestCommand { return 0; })) - .then(literal("give-computer").executes(context -> { + .then(command("give-computer").arg("item", ItemArgument.item(buildContext)).executes(context -> { + var item = context.getArgument("item", ItemInput.class); + var player = context.getSource().getPlayerOrException(); var pos = StructureUtils.findNearestStructureBlock(player.blockPosition(), 15, player.serverLevel()); if (pos == null) return error(context.getSource(), "No nearby test"); @@ -91,9 +97,11 @@ class CCTestCommand { if (structureBlock == null) return error(context.getSource(), "No nearby structure block"); var info = GameTestRegistry.getTestFunction(structureBlock.getStructurePath()); - var item = ModRegistry.Items.COMPUTER_ADVANCED.get().create(1, info.getTestName()); - if (!player.getInventory().add(item)) { - var itemEntity = player.drop(item, false); + var stack = item.createItemStack(1, false); + stack.getOrCreateTag().putInt(IComputerItem.NBT_ID, 1); + stack.setHoverName(Component.literal(info.getTestName())); + if (!player.getInventory().add(stack)) { + var itemEntity = player.drop(stack, false); if (itemEntity != null) { itemEntity.setNoPickUpDelay(); itemEntity.setThrower(player.getUUID()); diff --git a/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Turtle_Test.kt b/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Turtle_Test.kt index df1c91c13..3a28c0bf1 100644 --- a/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Turtle_Test.kt +++ b/projects/common/src/testMod/kotlin/dan200/computercraft/gametest/Turtle_Test.kt @@ -4,6 +4,7 @@ package dan200.computercraft.gametest +import dan200.computercraft.api.ComputerCraftTags import dan200.computercraft.api.detail.BasicItemDetailProvider import dan200.computercraft.api.detail.VanillaDetailRegistries import dan200.computercraft.api.lua.ObjectArguments @@ -33,10 +34,13 @@ import net.minecraft.gametest.framework.GameTest import net.minecraft.gametest.framework.GameTestHelper import net.minecraft.world.entity.EntityType import net.minecraft.world.entity.item.PrimedTnt +import net.minecraft.world.item.BlockItem import net.minecraft.world.item.ItemStack import net.minecraft.world.item.Items import net.minecraft.world.item.enchantment.Enchantments +import net.minecraft.world.level.block.BeehiveBlock import net.minecraft.world.level.block.Blocks +import net.minecraft.world.level.block.ComposterBlock import net.minecraft.world.level.block.FenceBlock import net.minecraft.world.level.block.entity.BlockEntityType import net.minecraft.world.level.block.state.properties.BlockStateProperties @@ -107,6 +111,58 @@ class Turtle_Test { } } + /** + * Checks that turtles can place boats. These are not a [BlockItem], and so behave slightly differently. + * + * See [ComputerCraftTags.Items.TURTLE_CAN_PLACE]. + */ + @GameTest + fun Place_boat(helper: GameTestHelper) = helper.sequence { + thenOnComputer { + turtle.placeDown(ObjectArguments()).await().assertArrayEquals(true, message = "Placed boat") + } + thenExecute { helper.assertEntityPresent(EntityType.BOAT) } + } + + /** + * Checks that turtles can place items into composters. + * + * See [ComputerCraftTags.Blocks.TURTLE_CAN_USE]. + */ + @GameTest + fun Place_into_composter(helper: GameTestHelper) = helper.sequence { + thenOnComputer { + turtle.place(ObjectArguments()).await().assertArrayEquals(true, message = "Placed pumpkin pie") + turtle.getItemDetail(context, Optional.empty(), Optional.empty()).await().assertArrayEquals( + mapOf("name" to "minecraft:pumpkin_pie", "count" to 1), + ) + } + thenExecute { + helper.assertBlockIs(BlockPos(2, 2, 2)) { it.block == Blocks.COMPOSTER && it.getValue(ComposterBlock.LEVEL) == 2 } + } + } + + /** + * Checks that turtles can place bottles into beehives. + * + * See [ComputerCraftTags.Blocks.TURTLE_CAN_USE]. + */ + @GameTest + fun Place_into_beehive(helper: GameTestHelper) = helper.sequence { + thenOnComputer { + turtle.place(ObjectArguments()).await().assertArrayEquals(true, message = "Placed pumpkin pie") + turtle.getItemDetail(context, Optional.of(1), Optional.empty()).await().assertArrayEquals( + mapOf("name" to "minecraft:glass_bottle", "count" to 63), + ) + turtle.getItemDetail(context, Optional.of(2), Optional.empty()).await().assertArrayEquals( + mapOf("name" to "minecraft:honey_bottle", "count" to 1), + ) + } + thenExecute { + helper.assertBlockIs(BlockPos(2, 2, 2)) { it.block == Blocks.BEEHIVE && it.getValue(BeehiveBlock.HONEY_LEVEL) == 0 } + } + } + /** * Checks that calling [net.minecraft.world.item.Item.use] will not place blocks too far away. * @@ -315,11 +371,11 @@ class Turtle_Test { } /** - * Checks turtles can place into compostors. These are non-typical inventories, so + * Checks turtles can place into composters. These are non-typical inventories, so * worth testing. */ @GameTest - fun Use_compostors(helper: GameTestHelper) = helper.sequence { + fun Use_composters(helper: GameTestHelper) = helper.sequence { thenOnComputer { turtle.dropDown(Optional.empty()).await() .assertArrayEquals(true, message = "Item was dropped") @@ -656,6 +712,21 @@ class Turtle_Test { } } + /** + * `turtle.drop` only inserts for the current side. + */ + @GameTest + fun Sided_drop(helper: GameTestHelper) = helper.sequence { + thenOnComputer { + turtle.dropDown(Optional.empty()).await().assertArrayEquals(true) + turtle.getItemDetail(context, Optional.empty(), Optional.empty()).await().assertArrayEquals( + mapOf("name" to "minecraft:coal", "count" to 8), + ) + + turtle.dropDown(Optional.empty()).await().assertArrayEquals(false, "No space for items") + } + } + /** * `turtle.craft` works as expected */ diff --git a/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.place_boat.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.place_boat.snbt new file mode 100644 index 000000000..ef56318f4 --- /dev/null +++ b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.place_boat.snbt @@ -0,0 +1,139 @@ +{ + DataVersion: 3465, + size: [5, 5, 5], + data: [ + {pos: [0, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [0, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [0, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [0, 0, 3], state: "minecraft:polished_andesite"}, + {pos: [0, 0, 4], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 3], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 4], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 3], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 4], state: "minecraft:polished_andesite"}, + {pos: [3, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [3, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [3, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [3, 0, 3], state: "minecraft:polished_andesite"}, + {pos: [3, 0, 4], state: "minecraft:polished_andesite"}, + {pos: [4, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [4, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [4, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [4, 0, 3], state: "minecraft:polished_andesite"}, + {pos: [4, 0, 4], state: "minecraft:polished_andesite"}, + {pos: [0, 1, 0], state: "minecraft:white_stained_glass"}, + {pos: [0, 1, 1], state: "minecraft:white_stained_glass"}, + {pos: [0, 1, 2], state: "minecraft:white_stained_glass"}, + {pos: [0, 1, 3], state: "minecraft:white_stained_glass"}, + {pos: [0, 1, 4], state: "minecraft:white_stained_glass"}, + {pos: [1, 1, 0], state: "minecraft:white_stained_glass"}, + {pos: [1, 1, 1], state: "minecraft:water{level:0}"}, + {pos: [1, 1, 2], state: "minecraft:water{level:0}"}, + {pos: [1, 1, 3], state: "minecraft:water{level:0}"}, + {pos: [1, 1, 4], state: "minecraft:white_stained_glass"}, + {pos: [2, 1, 0], state: "minecraft:white_stained_glass"}, + {pos: [2, 1, 1], state: "minecraft:water{level:0}"}, + {pos: [2, 1, 2], state: "minecraft:water{level:0}"}, + {pos: [2, 1, 3], state: "minecraft:water{level:0}"}, + {pos: [2, 1, 4], state: "minecraft:white_stained_glass"}, + {pos: [3, 1, 0], state: "minecraft:white_stained_glass"}, + {pos: [3, 1, 1], state: "minecraft:water{level:0}"}, + {pos: [3, 1, 2], state: "minecraft:water{level:0}"}, + {pos: [3, 1, 3], state: "minecraft:water{level:0}"}, + {pos: [3, 1, 4], state: "minecraft:white_stained_glass"}, + {pos: [4, 1, 0], state: "minecraft:white_stained_glass"}, + {pos: [4, 1, 1], state: "minecraft:white_stained_glass"}, + {pos: [4, 1, 2], state: "minecraft:white_stained_glass"}, + {pos: [4, 1, 3], state: "minecraft:white_stained_glass"}, + {pos: [4, 1, 4], state: "minecraft:white_stained_glass"}, + {pos: [0, 2, 0], state: "minecraft:air"}, + {pos: [0, 2, 1], state: "minecraft:air"}, + {pos: [0, 2, 2], state: "minecraft:air"}, + {pos: [0, 2, 3], state: "minecraft:air"}, + {pos: [0, 2, 4], state: "minecraft:air"}, + {pos: [1, 2, 0], state: "minecraft:air"}, + {pos: [1, 2, 1], state: "minecraft:air"}, + {pos: [1, 2, 2], state: "minecraft:air"}, + {pos: [1, 2, 3], state: "minecraft:air"}, + {pos: [1, 2, 4], state: "minecraft:air"}, + {pos: [2, 2, 0], state: "minecraft:air"}, + {pos: [2, 2, 1], state: "minecraft:air"}, + {pos: [2, 2, 2], state: "computercraft:turtle_normal{facing:south,waterlogged:false}", nbt: {ComputerId: 1, Fuel: 0, Items: [{Count: 1b, Slot: 0b, id: "minecraft:oak_boat"}], Label: "turtle_test.place_boat", On: 1b, Owner: {LowerId: -9064043055757671503L, Name: "Player747", UpperId: -7218225988027138284L}, Slot: 0, id: "computercraft:turtle_normal"}}, + {pos: [2, 2, 3], state: "minecraft:air"}, + {pos: [2, 2, 4], state: "minecraft:air"}, + {pos: [3, 2, 0], state: "minecraft:air"}, + {pos: [3, 2, 1], state: "minecraft:air"}, + {pos: [3, 2, 2], state: "minecraft:air"}, + {pos: [3, 2, 3], state: "minecraft:air"}, + {pos: [3, 2, 4], state: "minecraft:air"}, + {pos: [4, 2, 0], state: "minecraft:air"}, + {pos: [4, 2, 1], state: "minecraft:air"}, + {pos: [4, 2, 2], state: "minecraft:air"}, + {pos: [4, 2, 3], state: "minecraft:air"}, + {pos: [4, 2, 4], state: "minecraft:air"}, + {pos: [0, 3, 0], state: "minecraft:air"}, + {pos: [0, 3, 1], state: "minecraft:air"}, + {pos: [0, 3, 2], state: "minecraft:air"}, + {pos: [0, 3, 3], state: "minecraft:air"}, + {pos: [0, 3, 4], state: "minecraft:air"}, + {pos: [1, 3, 0], state: "minecraft:air"}, + {pos: [1, 3, 1], state: "minecraft:air"}, + {pos: [1, 3, 2], state: "minecraft:air"}, + {pos: [1, 3, 3], state: "minecraft:air"}, + {pos: [1, 3, 4], state: "minecraft:air"}, + {pos: [2, 3, 0], state: "minecraft:air"}, + {pos: [2, 3, 1], state: "minecraft:air"}, + {pos: [2, 3, 2], state: "minecraft:air"}, + {pos: [2, 3, 3], state: "minecraft:air"}, + {pos: [2, 3, 4], state: "minecraft:air"}, + {pos: [3, 3, 0], state: "minecraft:air"}, + {pos: [3, 3, 1], state: "minecraft:air"}, + {pos: [3, 3, 2], state: "minecraft:air"}, + {pos: [3, 3, 3], state: "minecraft:air"}, + {pos: [3, 3, 4], state: "minecraft:air"}, + {pos: [4, 3, 0], state: "minecraft:air"}, + {pos: [4, 3, 1], state: "minecraft:air"}, + {pos: [4, 3, 2], state: "minecraft:air"}, + {pos: [4, 3, 3], state: "minecraft:air"}, + {pos: [4, 3, 4], state: "minecraft:air"}, + {pos: [0, 4, 0], state: "minecraft:air"}, + {pos: [0, 4, 1], state: "minecraft:air"}, + {pos: [0, 4, 2], state: "minecraft:air"}, + {pos: [0, 4, 3], state: "minecraft:air"}, + {pos: [0, 4, 4], state: "minecraft:air"}, + {pos: [1, 4, 0], state: "minecraft:air"}, + {pos: [1, 4, 1], state: "minecraft:air"}, + {pos: [1, 4, 2], state: "minecraft:air"}, + {pos: [1, 4, 3], state: "minecraft:air"}, + {pos: [1, 4, 4], state: "minecraft:air"}, + {pos: [2, 4, 0], state: "minecraft:air"}, + {pos: [2, 4, 1], state: "minecraft:air"}, + {pos: [2, 4, 2], state: "minecraft:air"}, + {pos: [2, 4, 3], state: "minecraft:air"}, + {pos: [2, 4, 4], state: "minecraft:air"}, + {pos: [3, 4, 0], state: "minecraft:air"}, + {pos: [3, 4, 1], state: "minecraft:air"}, + {pos: [3, 4, 2], state: "minecraft:air"}, + {pos: [3, 4, 3], state: "minecraft:air"}, + {pos: [3, 4, 4], state: "minecraft:air"}, + {pos: [4, 4, 0], state: "minecraft:air"}, + {pos: [4, 4, 1], state: "minecraft:air"}, + {pos: [4, 4, 2], state: "minecraft:air"}, + {pos: [4, 4, 3], state: "minecraft:air"}, + {pos: [4, 4, 4], state: "minecraft:air"} + ], + entities: [], + palette: [ + "minecraft:polished_andesite", + "minecraft:white_stained_glass", + "minecraft:water{level:0}", + "minecraft:air", + "computercraft:turtle_normal{facing:south,waterlogged:false}" + ] +} diff --git a/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.place_into_beehive.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.place_into_beehive.snbt new file mode 100644 index 000000000..7bf01e9c5 --- /dev/null +++ b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.place_into_beehive.snbt @@ -0,0 +1,138 @@ +{ + DataVersion: 3465, + size: [5, 5, 5], + data: [ + {pos: [0, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [0, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [0, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [0, 0, 3], state: "minecraft:polished_andesite"}, + {pos: [0, 0, 4], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 3], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 4], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 3], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 4], state: "minecraft:polished_andesite"}, + {pos: [3, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [3, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [3, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [3, 0, 3], state: "minecraft:polished_andesite"}, + {pos: [3, 0, 4], state: "minecraft:polished_andesite"}, + {pos: [4, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [4, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [4, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [4, 0, 3], state: "minecraft:polished_andesite"}, + {pos: [4, 0, 4], state: "minecraft:polished_andesite"}, + {pos: [0, 1, 0], state: "minecraft:air"}, + {pos: [0, 1, 1], state: "minecraft:air"}, + {pos: [0, 1, 2], state: "minecraft:air"}, + {pos: [0, 1, 3], state: "minecraft:air"}, + {pos: [0, 1, 4], state: "minecraft:air"}, + {pos: [1, 1, 0], state: "minecraft:air"}, + {pos: [1, 1, 1], state: "minecraft:air"}, + {pos: [1, 1, 2], state: "minecraft:air"}, + {pos: [1, 1, 3], state: "minecraft:air"}, + {pos: [1, 1, 4], state: "minecraft:air"}, + {pos: [2, 1, 0], state: "minecraft:air"}, + {pos: [2, 1, 1], state: "computercraft:turtle_normal{facing:south,waterlogged:false}", nbt: {ComputerId: 1, Fuel: 0, Items: [{Count: 64b, Slot: 0b, id: "minecraft:glass_bottle"}], Label: "turtle_test.place_into_beehive", On: 1b, Owner: {LowerId: -8128385952290657367L, Name: "Player771", UpperId: 252869381310723801L}, Slot: 0, id: "computercraft:turtle_normal"}}, + {pos: [2, 1, 2], state: "minecraft:beehive{facing:north,honey_level:5}", nbt: {Bees: [], id: "minecraft:beehive"}}, + {pos: [2, 1, 3], state: "minecraft:air"}, + {pos: [2, 1, 4], state: "minecraft:air"}, + {pos: [3, 1, 0], state: "minecraft:air"}, + {pos: [3, 1, 1], state: "minecraft:air"}, + {pos: [3, 1, 2], state: "minecraft:air"}, + {pos: [3, 1, 3], state: "minecraft:air"}, + {pos: [3, 1, 4], state: "minecraft:air"}, + {pos: [4, 1, 0], state: "minecraft:air"}, + {pos: [4, 1, 1], state: "minecraft:air"}, + {pos: [4, 1, 2], state: "minecraft:air"}, + {pos: [4, 1, 3], state: "minecraft:air"}, + {pos: [4, 1, 4], state: "minecraft:air"}, + {pos: [0, 2, 0], state: "minecraft:air"}, + {pos: [0, 2, 1], state: "minecraft:air"}, + {pos: [0, 2, 2], state: "minecraft:air"}, + {pos: [0, 2, 3], state: "minecraft:air"}, + {pos: [0, 2, 4], state: "minecraft:air"}, + {pos: [1, 2, 0], state: "minecraft:air"}, + {pos: [1, 2, 1], state: "minecraft:air"}, + {pos: [1, 2, 2], state: "minecraft:air"}, + {pos: [1, 2, 3], state: "minecraft:air"}, + {pos: [1, 2, 4], state: "minecraft:air"}, + {pos: [2, 2, 0], state: "minecraft:air"}, + {pos: [2, 2, 1], state: "minecraft:air"}, + {pos: [2, 2, 2], state: "minecraft:air"}, + {pos: [2, 2, 3], state: "minecraft:air"}, + {pos: [2, 2, 4], state: "minecraft:air"}, + {pos: [3, 2, 0], state: "minecraft:air"}, + {pos: [3, 2, 1], state: "minecraft:air"}, + {pos: [3, 2, 2], state: "minecraft:air"}, + {pos: [3, 2, 3], state: "minecraft:air"}, + {pos: [3, 2, 4], state: "minecraft:air"}, + {pos: [4, 2, 0], state: "minecraft:air"}, + {pos: [4, 2, 1], state: "minecraft:air"}, + {pos: [4, 2, 2], state: "minecraft:air"}, + {pos: [4, 2, 3], state: "minecraft:air"}, + {pos: [4, 2, 4], state: "minecraft:air"}, + {pos: [0, 3, 0], state: "minecraft:air"}, + {pos: [0, 3, 1], state: "minecraft:air"}, + {pos: [0, 3, 2], state: "minecraft:air"}, + {pos: [0, 3, 3], state: "minecraft:air"}, + {pos: [0, 3, 4], state: "minecraft:air"}, + {pos: [1, 3, 0], state: "minecraft:air"}, + {pos: [1, 3, 1], state: "minecraft:air"}, + {pos: [1, 3, 2], state: "minecraft:air"}, + {pos: [1, 3, 3], state: "minecraft:air"}, + {pos: [1, 3, 4], state: "minecraft:air"}, + {pos: [2, 3, 0], state: "minecraft:air"}, + {pos: [2, 3, 1], state: "minecraft:air"}, + {pos: [2, 3, 2], state: "minecraft:air"}, + {pos: [2, 3, 3], state: "minecraft:air"}, + {pos: [2, 3, 4], state: "minecraft:air"}, + {pos: [3, 3, 0], state: "minecraft:air"}, + {pos: [3, 3, 1], state: "minecraft:air"}, + {pos: [3, 3, 2], state: "minecraft:air"}, + {pos: [3, 3, 3], state: "minecraft:air"}, + {pos: [3, 3, 4], state: "minecraft:air"}, + {pos: [4, 3, 0], state: "minecraft:air"}, + {pos: [4, 3, 1], state: "minecraft:air"}, + {pos: [4, 3, 2], state: "minecraft:air"}, + {pos: [4, 3, 3], state: "minecraft:air"}, + {pos: [4, 3, 4], state: "minecraft:air"}, + {pos: [0, 4, 0], state: "minecraft:air"}, + {pos: [0, 4, 1], state: "minecraft:air"}, + {pos: [0, 4, 2], state: "minecraft:air"}, + {pos: [0, 4, 3], state: "minecraft:air"}, + {pos: [0, 4, 4], state: "minecraft:air"}, + {pos: [1, 4, 0], state: "minecraft:air"}, + {pos: [1, 4, 1], state: "minecraft:air"}, + {pos: [1, 4, 2], state: "minecraft:air"}, + {pos: [1, 4, 3], state: "minecraft:air"}, + {pos: [1, 4, 4], state: "minecraft:air"}, + {pos: [2, 4, 0], state: "minecraft:air"}, + {pos: [2, 4, 1], state: "minecraft:air"}, + {pos: [2, 4, 2], state: "minecraft:air"}, + {pos: [2, 4, 3], state: "minecraft:air"}, + {pos: [2, 4, 4], state: "minecraft:air"}, + {pos: [3, 4, 0], state: "minecraft:air"}, + {pos: [3, 4, 1], state: "minecraft:air"}, + {pos: [3, 4, 2], state: "minecraft:air"}, + {pos: [3, 4, 3], state: "minecraft:air"}, + {pos: [3, 4, 4], state: "minecraft:air"}, + {pos: [4, 4, 0], state: "minecraft:air"}, + {pos: [4, 4, 1], state: "minecraft:air"}, + {pos: [4, 4, 2], state: "minecraft:air"}, + {pos: [4, 4, 3], state: "minecraft:air"}, + {pos: [4, 4, 4], state: "minecraft:air"} + ], + entities: [], + palette: [ + "minecraft:polished_andesite", + "minecraft:air", + "computercraft:turtle_normal{facing:south,waterlogged:false}", + "minecraft:beehive{facing:north,honey_level:5}" + ] +} diff --git a/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.place_into_composter.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.place_into_composter.snbt new file mode 100644 index 000000000..9b9b17950 --- /dev/null +++ b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.place_into_composter.snbt @@ -0,0 +1,138 @@ +{ + DataVersion: 3465, + size: [5, 5, 5], + data: [ + {pos: [0, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [0, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [0, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [0, 0, 3], state: "minecraft:polished_andesite"}, + {pos: [0, 0, 4], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 3], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 4], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 3], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 4], state: "minecraft:polished_andesite"}, + {pos: [3, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [3, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [3, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [3, 0, 3], state: "minecraft:polished_andesite"}, + {pos: [3, 0, 4], state: "minecraft:polished_andesite"}, + {pos: [4, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [4, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [4, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [4, 0, 3], state: "minecraft:polished_andesite"}, + {pos: [4, 0, 4], state: "minecraft:polished_andesite"}, + {pos: [0, 1, 0], state: "minecraft:air"}, + {pos: [0, 1, 1], state: "minecraft:air"}, + {pos: [0, 1, 2], state: "minecraft:air"}, + {pos: [0, 1, 3], state: "minecraft:air"}, + {pos: [0, 1, 4], state: "minecraft:air"}, + {pos: [1, 1, 0], state: "minecraft:air"}, + {pos: [1, 1, 1], state: "minecraft:air"}, + {pos: [1, 1, 2], state: "minecraft:air"}, + {pos: [1, 1, 3], state: "minecraft:air"}, + {pos: [1, 1, 4], state: "minecraft:air"}, + {pos: [2, 1, 0], state: "minecraft:air"}, + {pos: [2, 1, 1], state: "computercraft:turtle_normal{facing:south,waterlogged:false}", nbt: {ComputerId: 1, Fuel: 0, Items: [{Count: 2b, Slot: 0b, id: "minecraft:pumpkin_pie"}], Label: "turtle_test.place_into_composter", On: 1b, Owner: {LowerId: -8822842774267890833L, Name: "Player328", UpperId: -1898723855450425618L}, Slot: 0, id: "computercraft:turtle_normal"}}, + {pos: [2, 1, 2], state: "minecraft:composter{level:1}"}, + {pos: [2, 1, 3], state: "minecraft:air"}, + {pos: [2, 1, 4], state: "minecraft:air"}, + {pos: [3, 1, 0], state: "minecraft:air"}, + {pos: [3, 1, 1], state: "minecraft:air"}, + {pos: [3, 1, 2], state: "minecraft:air"}, + {pos: [3, 1, 3], state: "minecraft:air"}, + {pos: [3, 1, 4], state: "minecraft:air"}, + {pos: [4, 1, 0], state: "minecraft:air"}, + {pos: [4, 1, 1], state: "minecraft:air"}, + {pos: [4, 1, 2], state: "minecraft:air"}, + {pos: [4, 1, 3], state: "minecraft:air"}, + {pos: [4, 1, 4], state: "minecraft:air"}, + {pos: [0, 2, 0], state: "minecraft:air"}, + {pos: [0, 2, 1], state: "minecraft:air"}, + {pos: [0, 2, 2], state: "minecraft:air"}, + {pos: [0, 2, 3], state: "minecraft:air"}, + {pos: [0, 2, 4], state: "minecraft:air"}, + {pos: [1, 2, 0], state: "minecraft:air"}, + {pos: [1, 2, 1], state: "minecraft:air"}, + {pos: [1, 2, 2], state: "minecraft:air"}, + {pos: [1, 2, 3], state: "minecraft:air"}, + {pos: [1, 2, 4], state: "minecraft:air"}, + {pos: [2, 2, 0], state: "minecraft:air"}, + {pos: [2, 2, 1], state: "minecraft:air"}, + {pos: [2, 2, 2], state: "minecraft:air"}, + {pos: [2, 2, 3], state: "minecraft:air"}, + {pos: [2, 2, 4], state: "minecraft:air"}, + {pos: [3, 2, 0], state: "minecraft:air"}, + {pos: [3, 2, 1], state: "minecraft:air"}, + {pos: [3, 2, 2], state: "minecraft:air"}, + {pos: [3, 2, 3], state: "minecraft:air"}, + {pos: [3, 2, 4], state: "minecraft:air"}, + {pos: [4, 2, 0], state: "minecraft:air"}, + {pos: [4, 2, 1], state: "minecraft:air"}, + {pos: [4, 2, 2], state: "minecraft:air"}, + {pos: [4, 2, 3], state: "minecraft:air"}, + {pos: [4, 2, 4], state: "minecraft:air"}, + {pos: [0, 3, 0], state: "minecraft:air"}, + {pos: [0, 3, 1], state: "minecraft:air"}, + {pos: [0, 3, 2], state: "minecraft:air"}, + {pos: [0, 3, 3], state: "minecraft:air"}, + {pos: [0, 3, 4], state: "minecraft:air"}, + {pos: [1, 3, 0], state: "minecraft:air"}, + {pos: [1, 3, 1], state: "minecraft:air"}, + {pos: [1, 3, 2], state: "minecraft:air"}, + {pos: [1, 3, 3], state: "minecraft:air"}, + {pos: [1, 3, 4], state: "minecraft:air"}, + {pos: [2, 3, 0], state: "minecraft:air"}, + {pos: [2, 3, 1], state: "minecraft:air"}, + {pos: [2, 3, 2], state: "minecraft:air"}, + {pos: [2, 3, 3], state: "minecraft:air"}, + {pos: [2, 3, 4], state: "minecraft:air"}, + {pos: [3, 3, 0], state: "minecraft:air"}, + {pos: [3, 3, 1], state: "minecraft:air"}, + {pos: [3, 3, 2], state: "minecraft:air"}, + {pos: [3, 3, 3], state: "minecraft:air"}, + {pos: [3, 3, 4], state: "minecraft:air"}, + {pos: [4, 3, 0], state: "minecraft:air"}, + {pos: [4, 3, 1], state: "minecraft:air"}, + {pos: [4, 3, 2], state: "minecraft:air"}, + {pos: [4, 3, 3], state: "minecraft:air"}, + {pos: [4, 3, 4], state: "minecraft:air"}, + {pos: [0, 4, 0], state: "minecraft:air"}, + {pos: [0, 4, 1], state: "minecraft:air"}, + {pos: [0, 4, 2], state: "minecraft:air"}, + {pos: [0, 4, 3], state: "minecraft:air"}, + {pos: [0, 4, 4], state: "minecraft:air"}, + {pos: [1, 4, 0], state: "minecraft:air"}, + {pos: [1, 4, 1], state: "minecraft:air"}, + {pos: [1, 4, 2], state: "minecraft:air"}, + {pos: [1, 4, 3], state: "minecraft:air"}, + {pos: [1, 4, 4], state: "minecraft:air"}, + {pos: [2, 4, 0], state: "minecraft:air"}, + {pos: [2, 4, 1], state: "minecraft:air"}, + {pos: [2, 4, 2], state: "minecraft:air"}, + {pos: [2, 4, 3], state: "minecraft:air"}, + {pos: [2, 4, 4], state: "minecraft:air"}, + {pos: [3, 4, 0], state: "minecraft:air"}, + {pos: [3, 4, 1], state: "minecraft:air"}, + {pos: [3, 4, 2], state: "minecraft:air"}, + {pos: [3, 4, 3], state: "minecraft:air"}, + {pos: [3, 4, 4], state: "minecraft:air"}, + {pos: [4, 4, 0], state: "minecraft:air"}, + {pos: [4, 4, 1], state: "minecraft:air"}, + {pos: [4, 4, 2], state: "minecraft:air"}, + {pos: [4, 4, 3], state: "minecraft:air"}, + {pos: [4, 4, 4], state: "minecraft:air"} + ], + entities: [], + palette: [ + "minecraft:polished_andesite", + "minecraft:air", + "minecraft:composter{level:1}", + "computercraft:turtle_normal{facing:south,waterlogged:false}" + ] +} diff --git a/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.sided_drop.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.sided_drop.snbt new file mode 100644 index 000000000..cffd37af2 --- /dev/null +++ b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.sided_drop.snbt @@ -0,0 +1,138 @@ +{ + DataVersion: 3465, + size: [5, 5, 5], + data: [ + {pos: [0, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [0, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [0, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [0, 0, 3], state: "minecraft:polished_andesite"}, + {pos: [0, 0, 4], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 3], state: "minecraft:polished_andesite"}, + {pos: [1, 0, 4], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 3], state: "minecraft:polished_andesite"}, + {pos: [2, 0, 4], state: "minecraft:polished_andesite"}, + {pos: [3, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [3, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [3, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [3, 0, 3], state: "minecraft:polished_andesite"}, + {pos: [3, 0, 4], state: "minecraft:polished_andesite"}, + {pos: [4, 0, 0], state: "minecraft:polished_andesite"}, + {pos: [4, 0, 1], state: "minecraft:polished_andesite"}, + {pos: [4, 0, 2], state: "minecraft:polished_andesite"}, + {pos: [4, 0, 3], state: "minecraft:polished_andesite"}, + {pos: [4, 0, 4], state: "minecraft:polished_andesite"}, + {pos: [0, 1, 0], state: "minecraft:air"}, + {pos: [0, 1, 1], state: "minecraft:air"}, + {pos: [0, 1, 2], state: "minecraft:air"}, + {pos: [0, 1, 3], state: "minecraft:air"}, + {pos: [0, 1, 4], state: "minecraft:air"}, + {pos: [1, 1, 0], state: "minecraft:air"}, + {pos: [1, 1, 1], state: "minecraft:air"}, + {pos: [1, 1, 2], state: "minecraft:air"}, + {pos: [1, 1, 3], state: "minecraft:air"}, + {pos: [1, 1, 4], state: "minecraft:air"}, + {pos: [2, 1, 0], state: "minecraft:air"}, + {pos: [2, 1, 1], state: "minecraft:air"}, + {pos: [2, 1, 2], state: "minecraft:furnace{facing:north,lit:false}", nbt: {BurnTime: 0s, CookTime: 0s, CookTimeTotal: 200s, Items: [{Count: 8b, Slot: 0b, id: "minecraft:coal"}], RecipesUsed: {}, id: "minecraft:furnace"}}, + {pos: [2, 1, 3], state: "minecraft:air"}, + {pos: [2, 1, 4], state: "minecraft:air"}, + {pos: [3, 1, 0], state: "minecraft:air"}, + {pos: [3, 1, 1], state: "minecraft:air"}, + {pos: [3, 1, 2], state: "minecraft:air"}, + {pos: [3, 1, 3], state: "minecraft:air"}, + {pos: [3, 1, 4], state: "minecraft:air"}, + {pos: [4, 1, 0], state: "minecraft:air"}, + {pos: [4, 1, 1], state: "minecraft:air"}, + {pos: [4, 1, 2], state: "minecraft:air"}, + {pos: [4, 1, 3], state: "minecraft:air"}, + {pos: [4, 1, 4], state: "minecraft:air"}, + {pos: [0, 2, 0], state: "minecraft:air"}, + {pos: [0, 2, 1], state: "minecraft:air"}, + {pos: [0, 2, 2], state: "minecraft:air"}, + {pos: [0, 2, 3], state: "minecraft:air"}, + {pos: [0, 2, 4], state: "minecraft:air"}, + {pos: [1, 2, 0], state: "minecraft:air"}, + {pos: [1, 2, 1], state: "minecraft:air"}, + {pos: [1, 2, 2], state: "minecraft:air"}, + {pos: [1, 2, 3], state: "minecraft:air"}, + {pos: [1, 2, 4], state: "minecraft:air"}, + {pos: [2, 2, 0], state: "minecraft:air"}, + {pos: [2, 2, 1], state: "minecraft:air"}, + {pos: [2, 2, 2], state: "computercraft:turtle_normal{facing:north,waterlogged:false}", nbt: {ComputerId: 1, Fuel: 0, Items: [{Count: 64b, Slot: 0b, id: "minecraft:coal"}], Label: "turtle_test.sided_drop", On: 1b, Owner: {LowerId: -5939166093450296082L, Name: "Player58", UpperId: 5394875410161482031L}, Slot: 0, id: "computercraft:turtle_normal"}}, + {pos: [2, 2, 3], state: "minecraft:air"}, + {pos: [2, 2, 4], state: "minecraft:air"}, + {pos: [3, 2, 0], state: "minecraft:air"}, + {pos: [3, 2, 1], state: "minecraft:air"}, + {pos: [3, 2, 2], state: "minecraft:air"}, + {pos: [3, 2, 3], state: "minecraft:air"}, + {pos: [3, 2, 4], state: "minecraft:air"}, + {pos: [4, 2, 0], state: "minecraft:air"}, + {pos: [4, 2, 1], state: "minecraft:air"}, + {pos: [4, 2, 2], state: "minecraft:air"}, + {pos: [4, 2, 3], state: "minecraft:air"}, + {pos: [4, 2, 4], state: "minecraft:air"}, + {pos: [0, 3, 0], state: "minecraft:air"}, + {pos: [0, 3, 1], state: "minecraft:air"}, + {pos: [0, 3, 2], state: "minecraft:air"}, + {pos: [0, 3, 3], state: "minecraft:air"}, + {pos: [0, 3, 4], state: "minecraft:air"}, + {pos: [1, 3, 0], state: "minecraft:air"}, + {pos: [1, 3, 1], state: "minecraft:air"}, + {pos: [1, 3, 2], state: "minecraft:air"}, + {pos: [1, 3, 3], state: "minecraft:air"}, + {pos: [1, 3, 4], state: "minecraft:air"}, + {pos: [2, 3, 0], state: "minecraft:air"}, + {pos: [2, 3, 1], state: "minecraft:air"}, + {pos: [2, 3, 2], state: "minecraft:air"}, + {pos: [2, 3, 3], state: "minecraft:air"}, + {pos: [2, 3, 4], state: "minecraft:air"}, + {pos: [3, 3, 0], state: "minecraft:air"}, + {pos: [3, 3, 1], state: "minecraft:air"}, + {pos: [3, 3, 2], state: "minecraft:air"}, + {pos: [3, 3, 3], state: "minecraft:air"}, + {pos: [3, 3, 4], state: "minecraft:air"}, + {pos: [4, 3, 0], state: "minecraft:air"}, + {pos: [4, 3, 1], state: "minecraft:air"}, + {pos: [4, 3, 2], state: "minecraft:air"}, + {pos: [4, 3, 3], state: "minecraft:air"}, + {pos: [4, 3, 4], state: "minecraft:air"}, + {pos: [0, 4, 0], state: "minecraft:air"}, + {pos: [0, 4, 1], state: "minecraft:air"}, + {pos: [0, 4, 2], state: "minecraft:air"}, + {pos: [0, 4, 3], state: "minecraft:air"}, + {pos: [0, 4, 4], state: "minecraft:air"}, + {pos: [1, 4, 0], state: "minecraft:air"}, + {pos: [1, 4, 1], state: "minecraft:air"}, + {pos: [1, 4, 2], state: "minecraft:air"}, + {pos: [1, 4, 3], state: "minecraft:air"}, + {pos: [1, 4, 4], state: "minecraft:air"}, + {pos: [2, 4, 0], state: "minecraft:air"}, + {pos: [2, 4, 1], state: "minecraft:air"}, + {pos: [2, 4, 2], state: "minecraft:air"}, + {pos: [2, 4, 3], state: "minecraft:air"}, + {pos: [2, 4, 4], state: "minecraft:air"}, + {pos: [3, 4, 0], state: "minecraft:air"}, + {pos: [3, 4, 1], state: "minecraft:air"}, + {pos: [3, 4, 2], state: "minecraft:air"}, + {pos: [3, 4, 3], state: "minecraft:air"}, + {pos: [3, 4, 4], state: "minecraft:air"}, + {pos: [4, 4, 0], state: "minecraft:air"}, + {pos: [4, 4, 1], state: "minecraft:air"}, + {pos: [4, 4, 2], state: "minecraft:air"}, + {pos: [4, 4, 3], state: "minecraft:air"}, + {pos: [4, 4, 4], state: "minecraft:air"} + ], + entities: [], + palette: [ + "minecraft:polished_andesite", + "minecraft:air", + "minecraft:furnace{facing:north,lit:false}", + "computercraft:turtle_normal{facing:north,waterlogged:false}" + ] +} diff --git a/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.use_compostors.snbt b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.use_composters.snbt similarity index 99% rename from projects/common/src/testMod/resources/data/cctest/structures/turtle_test.use_compostors.snbt rename to projects/common/src/testMod/resources/data/cctest/structures/turtle_test.use_composters.snbt index 7bf966662..bd88ffb46 100644 --- a/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.use_compostors.snbt +++ b/projects/common/src/testMod/resources/data/cctest/structures/turtle_test.use_composters.snbt @@ -64,7 +64,7 @@ {pos: [1, 2, 4], state: "minecraft:air"}, {pos: [2, 2, 0], state: "minecraft:air"}, {pos: [2, 2, 1], state: "minecraft:air"}, - {pos: [2, 2, 2], state: "computercraft:turtle_normal{facing:south,waterlogged:false}", nbt: {ComputerId: 1, Fuel: 0, Items: [{Count: 64b, Slot: 0b, id: "minecraft:spruce_sapling"}], Label: "turtle_test.use_compostors", On: 1b, Owner: {LowerId: -6876936588741668278L, Name: "Dev", UpperId: 4039158846114182220L}, Slot: 0, id: "computercraft:turtle_normal"}}, + {pos: [2, 2, 2], state: "computercraft:turtle_normal{facing:south,waterlogged:false}", nbt: {ComputerId: 1, Fuel: 0, Items: [{Count: 64b, Slot: 0b, id: "minecraft:spruce_sapling"}], Label: "turtle_test.use_composters", On: 1b, Owner: {LowerId: -6876936588741668278L, Name: "Dev", UpperId: 4039158846114182220L}, Slot: 0, id: "computercraft:turtle_normal"}}, {pos: [2, 2, 3], state: "minecraft:air"}, {pos: [2, 2, 4], state: "minecraft:air"}, {pos: [3, 2, 0], state: "minecraft:air"}, diff --git a/projects/core/build.gradle.kts b/projects/core/build.gradle.kts index e976ce534..033b0af2f 100644 --- a/projects/core/build.gradle.kts +++ b/projects/core/build.gradle.kts @@ -7,9 +7,9 @@ import cc.tweaked.gradle.getAbsolutePath plugins { `java-library` `java-test-fixtures` + kotlin("jvm") alias(libs.plugins.shadow) - id("cc-tweaked.kotlin-convention") id("cc-tweaked.java-convention") id("cc-tweaked.publishing") id("cc-tweaked") @@ -40,8 +40,6 @@ dependencies { } tasks.processResources { - inputs.property("gitHash", cct.gitHash) - filesMatching("data/computercraft/lua/rom/help/credits.md") { expand(mapOf("gitContributors" to cct.gitContributors.map { it.joinToString("\n") }.get())) } @@ -52,9 +50,9 @@ tasks.test { } val checkChangelog by tasks.registering(cc.tweaked.gradle.CheckChangelog::class) { - version.set(modVersion) - whatsNew.set(file("src/main/resources/data/computercraft/lua/rom/help/whatsnew.md")) - changelog.set(file("src/main/resources/data/computercraft/lua/rom/help/changelog.md")) + version = modVersion + whatsNew = file("src/main/resources/data/computercraft/lua/rom/help/whatsnew.md") + changelog = file("src/main/resources/data/computercraft/lua/rom/help/changelog.md") } tasks.check { dependsOn(checkChangelog) } diff --git a/projects/fabric/build.gradle.kts b/projects/fabric/build.gradle.kts index 67b89e09c..d4aa1229f 100644 --- a/projects/fabric/build.gradle.kts +++ b/projects/fabric/build.gradle.kts @@ -31,10 +31,10 @@ fun addRemappedConfiguration(name: String) { } val capitalName = name.replaceFirstChar { it.titlecase(Locale.ROOT) } loom.addRemapConfiguration("mod$capitalName") { - onCompileClasspath.set(false) - onRuntimeClasspath.set(true) - sourceSet.set(ourSourceSet) - targetConfigurationName.set(name) + onCompileClasspath = false + onRuntimeClasspath = true + sourceSet = ourSourceSet + targetConfigurationName = name } configurations.create(name) { isCanBeConsumed = false @@ -107,8 +107,8 @@ dependencies { } loom { - accessWidenerPath.set(project(":common").file("src/main/resources/computercraft.accesswidener")) - mixin.defaultRefmapName.set("computercraft.refmap.json") + accessWidenerPath = project(":common").file("src/main/resources/computercraft.accesswidener") + mixin.defaultRefmapName = "computercraft.refmap.json" mods { register("computercraft") { @@ -285,7 +285,7 @@ tasks.register("checkClient") { } modPublishing { - output.set(tasks.remapJar) + output = tasks.remapJar } tasks.withType(GenerateModuleMetadata::class).configureEach { isEnabled = false } diff --git a/projects/fabric/src/testMod/java/dan200/computercraft/gametest/core/TestMod.java b/projects/fabric/src/testMod/java/dan200/computercraft/gametest/core/TestMod.java index ac9068030..314d56003 100644 --- a/projects/fabric/src/testMod/java/dan200/computercraft/gametest/core/TestMod.java +++ b/projects/fabric/src/testMod/java/dan200/computercraft/gametest/core/TestMod.java @@ -26,7 +26,7 @@ public class TestMod implements ModInitializer, ClientModInitializer { var phase = new ResourceLocation(ComputerCraftAPI.MOD_ID, "test_mod"); ServerLifecycleEvents.SERVER_STARTED.addPhaseOrdering(Event.DEFAULT_PHASE, phase); ServerLifecycleEvents.SERVER_STARTED.register(phase, TestHooks::onServerStarted); - CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> CCTestCommand.register(dispatcher)); + CommandRegistrationCallback.EVENT.register((dispatcher, buildContext, environment) -> CCTestCommand.register(dispatcher, buildContext)); PlayerBlockBreakEvents.BEFORE.register((level, player, pos, state, blockEntity) -> !TestHooks.onBeforeDestroyBlock(level, pos, state)); TestHooks.loadTests(GameTestRegistry::register); diff --git a/projects/forge/build.gradle.kts b/projects/forge/build.gradle.kts index 4b45dfb0a..b3a147feb 100644 --- a/projects/forge/build.gradle.kts +++ b/projects/forge/build.gradle.kts @@ -233,7 +233,7 @@ tasks.register("checkClient") { // Upload tasks modPublishing { - output.set(tasks.reobfJar) + output = tasks.reobfJar } publishing { diff --git a/projects/forge/src/testMod/java/dan200/computercraft/gametest/core/TestMod.java b/projects/forge/src/testMod/java/dan200/computercraft/gametest/core/TestMod.java index 67cf999bd..95bfab7aa 100644 --- a/projects/forge/src/testMod/java/dan200/computercraft/gametest/core/TestMod.java +++ b/projects/forge/src/testMod/java/dan200/computercraft/gametest/core/TestMod.java @@ -26,7 +26,7 @@ public class TestMod { var bus = MinecraftForge.EVENT_BUS; bus.addListener(EventPriority.LOW, (ServerStartedEvent e) -> TestHooks.onServerStarted(e.getServer())); - bus.addListener((RegisterCommandsEvent e) -> CCTestCommand.register(e.getDispatcher())); + bus.addListener((RegisterCommandsEvent e) -> CCTestCommand.register(e.getDispatcher(), e.getBuildContext())); bus.addListener((BlockEvent.BreakEvent e) -> { if (TestHooks.onBeforeDestroyBlock(e.getLevel(), e.getPos(), e.getState())) e.setCanceled(true); }); diff --git a/projects/lints/build.gradle.kts b/projects/lints/build.gradle.kts index 210b44d7f..61a9bfe80 100644 --- a/projects/lints/build.gradle.kts +++ b/projects/lints/build.gradle.kts @@ -3,7 +3,7 @@ // SPDX-License-Identifier: MPL-2.0 plugins { - id("cc-tweaked.kotlin-convention") + kotlin("jvm") id("cc-tweaked.java-convention") } diff --git a/projects/standalone/build.gradle.kts b/projects/standalone/build.gradle.kts index d1bde4846..d7b717d76 100644 --- a/projects/standalone/build.gradle.kts +++ b/projects/standalone/build.gradle.kts @@ -44,7 +44,7 @@ dependencies { } application { - mainClass.set("cc.tweaked.standalone.Main") + mainClass = "cc.tweaked.standalone.Main" } tasks.named("run", JavaExec::class.java) { diff --git a/projects/web/build.gradle.kts b/projects/web/build.gradle.kts index 887cd4f04..afcb2319f 100644 --- a/projects/web/build.gradle.kts +++ b/projects/web/build.gradle.kts @@ -13,11 +13,11 @@ plugins { val modVersion: String by extra node { - projectRoot.set(rootProject.projectDir) + projectRoot = rootProject.projectDir } illuaminate { - version.set(libs.versions.illuaminate) + version = libs.versions.illuaminate } sourceSets.register("builder") @@ -62,8 +62,8 @@ val compileTeaVM by tasks.registering(JavaExec::class) { ) }, ) - mainClass.set("cc.tweaked.web.builder.Builder") - javaLauncher.set(project.javaToolchains.launcherFor { languageVersion.set(java.toolchain.languageVersion) }) + mainClass = "cc.tweaked.web.builder.Builder" + javaLauncher = project.javaToolchains.launcherFor { languageVersion = java.toolchain.languageVersion } } val rollup by tasks.registering(cc.tweaked.gradle.NpxExecToDir::class) { @@ -81,7 +81,7 @@ val rollup by tasks.registering(cc.tweaked.gradle.NpxExecToDir::class) { inputs.file("rollup.config.js").withPropertyName("Rollup config") // Output directory. Also defined in illuaminate.sexp and rollup.config.js - output.set(layout.buildDirectory.dir("rollup")) + output = layout.buildDirectory.dir("rollup") args = listOf("rollup", "--config", "rollup.config.js") + if (minify) emptyList() else listOf("--configDebug") } @@ -100,7 +100,7 @@ val illuaminateDocs by tasks.registering(cc.tweaked.gradle.IlluaminateExecToDir: inputs.files(rollup) // Output directory. Also defined in illuaminate.sexp. - output.set(layout.buildDirectory.dir("illuaminate")) + output = layout.buildDirectory.dir("illuaminate") args = listOf("doc-gen") workingDir = rootProject.projectDir @@ -119,17 +119,15 @@ val htmlTransform by tasks.registering(cc.tweaked.gradle.NpxExecToDir::class) { inputs.files(illuaminateDocs) // Output directory. - output.set(layout.buildDirectory.dir(name)) + output = layout.buildDirectory.dir(name) - argumentProviders.add { - listOf( - "tsx", - sources.dir.resolve("index.tsx").absolutePath, - illuaminateDocs.get().output.getAbsolutePath(), - sources.dir.resolve("export/index.json").absolutePath, - output.getAbsolutePath(), - ) - } + args( + "tsx", + sources.dir.resolve("index.tsx").absolutePath, + illuaminateDocs.get().output.getAbsolutePath(), + sources.dir.resolve("export/index.json").absolutePath, + output.getAbsolutePath(), + ) } val docWebsite by tasks.registering(Copy::class) {