mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-11-12 03:13:00 +00:00
Compare commits
12 Commits
v1.21.1-1.
...
v1.21.1-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f87984bac | ||
|
|
18f3426f1d | ||
|
|
0ec46fe38e | ||
|
|
569de7fafb | ||
|
|
157ce4fa55 | ||
|
|
b9ed66983d | ||
|
|
d0fbec6c6b | ||
|
|
a683697e8c | ||
|
|
9e233a916f | ||
|
|
5a9e21ccc3 | ||
|
|
5f16909d4b | ||
|
|
00475b9bb0 |
@@ -101,7 +101,7 @@ about how you can build on that until you've covered everything!
|
|||||||
|
|
||||||
[new-issue]: https://github.com/cc-tweaked/CC-Tweaked/issues/new/choose "Create a new issue"
|
[new-issue]: https://github.com/cc-tweaked/CC-Tweaked/issues/new/choose "Create a new issue"
|
||||||
[community]: README.md#community "Get in touch with the community."
|
[community]: README.md#community "Get in touch with the community."
|
||||||
[Adoptium]: https://adoptium.net/temurin/releases?version=17 "Download OpenJDK 17"
|
[Adoptium]: https://adoptium.net/temurin/releases?version=21 "Download OpenJDK 21"
|
||||||
[illuaminate]: https://github.com/SquidDev/illuaminate/ "Illuaminate on GitHub"
|
[illuaminate]: https://github.com/SquidDev/illuaminate/ "Illuaminate on GitHub"
|
||||||
[docs]: https://tweaked.cc/ "CC: Tweaked documentation"
|
[docs]: https://tweaked.cc/ "CC: Tweaked documentation"
|
||||||
[ldoc]: http://stevedonovan.github.io/ldoc/ "ldoc, a Lua documentation generator."
|
[ldoc]: http://stevedonovan.github.io/ldoc/ "ldoc, a Lua documentation generator."
|
||||||
|
|||||||
@@ -4,13 +4,11 @@
|
|||||||
|
|
||||||
import cc.tweaked.gradle.JUnitExt
|
import cc.tweaked.gradle.JUnitExt
|
||||||
import net.fabricmc.loom.api.LoomGradleExtensionAPI
|
import net.fabricmc.loom.api.LoomGradleExtensionAPI
|
||||||
import net.fabricmc.loom.util.gradle.SourceSetHelper
|
|
||||||
import org.jetbrains.gradle.ext.*
|
import org.jetbrains.gradle.ext.*
|
||||||
import org.jetbrains.gradle.ext.Application
|
import org.jetbrains.gradle.ext.Application
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
publishing
|
publishing
|
||||||
alias(libs.plugins.taskTree)
|
|
||||||
alias(libs.plugins.githubRelease)
|
alias(libs.plugins.githubRelease)
|
||||||
alias(libs.plugins.gradleVersions)
|
alias(libs.plugins.gradleVersions)
|
||||||
alias(libs.plugins.versionCatalogUpdate)
|
alias(libs.plugins.versionCatalogUpdate)
|
||||||
@@ -70,7 +68,7 @@ idea.project.settings.runConfigurations {
|
|||||||
val fabricProject = evaluationDependsOn(":fabric")
|
val fabricProject = evaluationDependsOn(":fabric")
|
||||||
val classPathGroup = fabricProject.extensions.getByType<LoomGradleExtensionAPI>().mods
|
val classPathGroup = fabricProject.extensions.getByType<LoomGradleExtensionAPI>().mods
|
||||||
.joinToString(File.pathSeparator + File.pathSeparator) { modSettings ->
|
.joinToString(File.pathSeparator + File.pathSeparator) { modSettings ->
|
||||||
SourceSetHelper.getClasspath(modSettings, project).joinToString(File.pathSeparator) { it.absolutePath }
|
modSettings.modFiles.joinToString(File.pathSeparator) { it.absolutePath }
|
||||||
}
|
}
|
||||||
|
|
||||||
vmParameters = "-ea -Dfabric.classPathGroups=$classPathGroup"
|
vmParameters = "-ea -Dfabric.classPathGroups=$classPathGroup"
|
||||||
@@ -115,8 +113,12 @@ idea.project.settings.compiler.javac {
|
|||||||
.toMap()
|
.toMap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
repositories() {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
versionCatalogUpdate {
|
versionCatalogUpdate {
|
||||||
sortByKey = false
|
sortByKey = false
|
||||||
pin { versions.addAll("fastutil", "guava", "netty", "slf4j") }
|
pin { versions.addAll("fastutil", "guava", "netty", "slf4j") }
|
||||||
keep { keepUnusedLibraries = true }
|
keep { keepUnusedVersions = true }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ repositories {
|
|||||||
name = "Fabric"
|
name = "Fabric"
|
||||||
content {
|
content {
|
||||||
includeGroup("net.fabricmc")
|
includeGroup("net.fabricmc")
|
||||||
|
includeGroup("net.fabricmc.unpick")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,6 +70,6 @@ gradlePlugin {
|
|||||||
|
|
||||||
versionCatalogUpdate {
|
versionCatalogUpdate {
|
||||||
sortByKey = false
|
sortByKey = false
|
||||||
keep { keepUnusedLibraries = true }
|
keep { keepUnusedVersions = true }
|
||||||
catalogFile = file("../gradle/libs.versions.toml")
|
catalogFile = file("../gradle/libs.versions.toml")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,7 @@
|
|||||||
|
|
||||||
/** Default configuration for Fabric projects. */
|
/** Default configuration for Fabric projects. */
|
||||||
|
|
||||||
import cc.tweaked.gradle.CCTweakedExtension
|
import cc.tweaked.gradle.*
|
||||||
import cc.tweaked.gradle.CCTweakedPlugin
|
|
||||||
import cc.tweaked.gradle.IdeaRunConfigurations
|
|
||||||
import cc.tweaked.gradle.MinecraftConfigurations
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
`java-library`
|
`java-library`
|
||||||
@@ -67,3 +64,19 @@ dependencies {
|
|||||||
tasks.ideaSyncTask {
|
tasks.ideaSyncTask {
|
||||||
doLast { IdeaRunConfigurations(project).patch() }
|
doLast { IdeaRunConfigurations(project).patch() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.named("checkDependencyConsistency", DependencyCheck::class.java) {
|
||||||
|
val libs = project.extensions.getByType<VersionCatalogsExtension>().named("libs")
|
||||||
|
// Minecraft depends on lwjgl, but Fabric forces it to a more recent version
|
||||||
|
for (lwjgl in listOf(
|
||||||
|
"lwjgl",
|
||||||
|
"lwjgl-glfw",
|
||||||
|
"lwjgl-jemalloc",
|
||||||
|
"lwjgl-openal",
|
||||||
|
"lwjgl-opengl",
|
||||||
|
"lwjgl-stb",
|
||||||
|
"lwjgl-tinyfd",
|
||||||
|
)) {
|
||||||
|
override("org.lwjgl", lwjgl, "3.3.2")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ plugins {
|
|||||||
checkstyle
|
checkstyle
|
||||||
id("com.diffplug.spotless")
|
id("com.diffplug.spotless")
|
||||||
id("net.ltgt.errorprone")
|
id("net.ltgt.errorprone")
|
||||||
|
// Required for cross-project dependencies in Fabric
|
||||||
|
id("net.fabricmc.fabric-loom-companion")
|
||||||
}
|
}
|
||||||
|
|
||||||
val modVersion: String by extra
|
val modVersion: String by extra
|
||||||
@@ -28,9 +30,9 @@ version = modVersion
|
|||||||
base.archivesName.convention("cc-tweaked-$mcVersion-${project.name}")
|
base.archivesName.convention("cc-tweaked-$mcVersion-${project.name}")
|
||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain {
|
toolchain { languageVersion = CCTweakedPlugin.JDK_VERSION }
|
||||||
languageVersion = CCTweakedPlugin.JAVA_VERSION
|
sourceCompatibility = CCTweakedPlugin.JAVA_VERSION
|
||||||
}
|
targetCompatibility = CCTweakedPlugin.JAVA_VERSION
|
||||||
|
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
}
|
}
|
||||||
@@ -78,6 +80,8 @@ dependencies {
|
|||||||
// Configure default JavaCompile tasks with our arguments.
|
// Configure default JavaCompile tasks with our arguments.
|
||||||
sourceSets.all {
|
sourceSets.all {
|
||||||
tasks.named(compileJavaTaskName, JavaCompile::class.java) {
|
tasks.named(compileJavaTaskName, JavaCompile::class.java) {
|
||||||
|
// Explicitly set release, as that limits the APIs we can use to the right version of Java.
|
||||||
|
options.release = CCTweakedPlugin.JAVA_TARGET.asInt()
|
||||||
|
|
||||||
options.compilerArgs.addAll(
|
options.compilerArgs.addAll(
|
||||||
listOf(
|
listOf(
|
||||||
@@ -100,6 +104,7 @@ sourceSets.all {
|
|||||||
check("NonOverridingEquals", CheckSeverity.OFF) // Peripheral.equals makes this hard to avoid
|
check("NonOverridingEquals", CheckSeverity.OFF) // Peripheral.equals makes this hard to avoid
|
||||||
check("FutureReturnValueIgnored", CheckSeverity.OFF) // Too many false positives with Netty
|
check("FutureReturnValueIgnored", CheckSeverity.OFF) // Too many false positives with Netty
|
||||||
check("InvalidInlineTag", CheckSeverity.OFF) // Triggered by @snippet. Can be removed on Java 21.
|
check("InvalidInlineTag", CheckSeverity.OFF) // Triggered by @snippet. Can be removed on Java 21.
|
||||||
|
option("UnusedMethod:ExemptingMethodAnnotations", "dan200.computercraft.api.lua.LuaFunction")
|
||||||
|
|
||||||
check("NullAway", CheckSeverity.ERROR)
|
check("NullAway", CheckSeverity.ERROR)
|
||||||
option(
|
option(
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
* See notes in [cc.tweaked.gradle.MinecraftConfigurations] for the general design behind these cursed ideas.
|
* See notes in [cc.tweaked.gradle.MinecraftConfigurations] for the general design behind these cursed ideas.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import cc.tweaked.gradle.CCTweakedPlugin
|
||||||
import cc.tweaked.gradle.MinecraftConfigurations
|
import cc.tweaked.gradle.MinecraftConfigurations
|
||||||
import cc.tweaked.gradle.clientClasses
|
import cc.tweaked.gradle.clientClasses
|
||||||
import cc.tweaked.gradle.commonClasses
|
import cc.tweaked.gradle.commonClasses
|
||||||
@@ -52,3 +53,5 @@ dependencies {
|
|||||||
|
|
||||||
testImplementation(testFixtures(project))
|
testImplementation(testFixtures(project))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kotlin.compilerOptions.jvmTarget = CCTweakedPlugin.KOTLIN_TARGET
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ abstract class CCTweakedExtension(private val project: Project) {
|
|||||||
).resolve().single()
|
).resolve().single()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun <T> gitProvider(default: T, command: List<String>, process: (String) -> T): Provider<T> {
|
private fun <T: Any> gitProvider(default: T, command: List<String>, process: (String) -> T): Provider<T> {
|
||||||
val baseResult = project.providers.exec {
|
val baseResult = project.providers.exec {
|
||||||
commandLine = listOf("git", "-C", project.rootDir.absolutePath) + command
|
commandLine = listOf("git", "-C", project.rootDir.absolutePath) + command
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
package cc.tweaked.gradle
|
package cc.tweaked.gradle
|
||||||
|
|
||||||
|
import org.gradle.api.JavaVersion
|
||||||
import org.gradle.api.Plugin
|
import org.gradle.api.Plugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.plugins.JavaPlugin
|
import org.gradle.api.plugins.JavaPlugin
|
||||||
@@ -13,6 +14,7 @@ import org.gradle.plugins.ide.idea.model.IdeaModel
|
|||||||
import org.jetbrains.gradle.ext.IdeaExtPlugin
|
import org.jetbrains.gradle.ext.IdeaExtPlugin
|
||||||
import org.jetbrains.gradle.ext.runConfigurations
|
import org.jetbrains.gradle.ext.runConfigurations
|
||||||
import org.jetbrains.gradle.ext.settings
|
import org.jetbrains.gradle.ext.settings
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures projects to match a shared configuration.
|
* Configures projects to match a shared configuration.
|
||||||
@@ -42,6 +44,17 @@ class CCTweakedPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val JAVA_VERSION = JavaLanguageVersion.of(21)
|
/**
|
||||||
|
* The version we run with. We use Java 21 here, as our Gradle build requires that.
|
||||||
|
*/
|
||||||
|
val JDK_VERSION = JavaLanguageVersion.of(21)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Java version we target. Should be the same as what Minecraft uses.
|
||||||
|
*/
|
||||||
|
val JAVA_TARGET = JavaLanguageVersion.of(21)
|
||||||
|
|
||||||
|
val JAVA_VERSION = JavaVersion.toVersion(JAVA_TARGET.asInt())
|
||||||
|
val KOTLIN_TARGET = JvmTarget.fromTarget(JAVA_TARGET.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,10 @@ abstract class DependencyCheck : DefaultTask() {
|
|||||||
overrides.putAll(project.provider { mutableMapOf(module.get().module.toString() to version) })
|
overrides.putAll(project.provider { mutableMapOf(module.get().module.toString() to version) })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun override(group: String, module: String, version: String) {
|
||||||
|
overrides.put("$group:$module", version)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a configuration to check.
|
* Add a configuration to check.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ class CloseScope : AutoCloseable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Proxy method to avoid overload ambiguity. */
|
/** Proxy method to avoid overload ambiguity. */
|
||||||
fun <T> Property<T>.setProvider(provider: Provider<out T>) = set(provider)
|
fun <T: Any> Property<T >.setProvider(provider: Provider<out T>) = set(provider)
|
||||||
|
|
||||||
/** Short-cut method to get the absolute path of a [FileSystemLocation] provider. */
|
/** Short-cut method to get the absolute path of a [FileSystemLocation] provider. */
|
||||||
fun Provider<out FileSystemLocation>.getAbsolutePath(): String = get().asFile.absolutePath
|
fun Provider<out FileSystemLocation>.getAbsolutePath(): String = get().asFile.absolutePath
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ class MinecraftConfigurations private constructor(private val project: Project)
|
|||||||
|
|
||||||
// Set up an API configuration for clients (to ensure it's consistent with the main source set).
|
// Set up an API configuration for clients (to ensure it's consistent with the main source set).
|
||||||
val clientApi = configurations.maybeCreate(client.apiConfigurationName).apply {
|
val clientApi = configurations.maybeCreate(client.apiConfigurationName).apply {
|
||||||
isVisible = false
|
|
||||||
isCanBeConsumed = false
|
isCanBeConsumed = false
|
||||||
isCanBeResolved = false
|
isCanBeResolved = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ neogradle.subsystems.conventions.runs.enabled=false
|
|||||||
|
|
||||||
# Mod properties
|
# Mod properties
|
||||||
isUnstable=true
|
isUnstable=true
|
||||||
modVersion=1.116.1
|
modVersion=1.116.2
|
||||||
|
|
||||||
# Minecraft properties: We want to configure this here so we can read it in settings.gradle
|
# Minecraft properties: We want to configure this here so we can read it in settings.gradle
|
||||||
mcVersion=1.21.1
|
mcVersion=1.21.1
|
||||||
|
|||||||
@@ -23,17 +23,17 @@ netty = "4.1.97.Final"
|
|||||||
slf4j = "2.0.9"
|
slf4j = "2.0.9"
|
||||||
|
|
||||||
# Core dependencies (independent of Minecraft)
|
# Core dependencies (independent of Minecraft)
|
||||||
asm = "9.6"
|
asm = "9.9"
|
||||||
autoService = "1.1.1"
|
autoService = "1.1.1"
|
||||||
checkerFramework = "3.42.0"
|
checkerFramework = "3.51.1"
|
||||||
cobalt = { strictly = "0.9.6" }
|
cobalt = { strictly = "0.9.7" }
|
||||||
commonsCli = "1.6.0"
|
commonsCli = "1.10.0"
|
||||||
jetbrainsAnnotations = "24.1.0"
|
jetbrainsAnnotations = "26.0.2-1"
|
||||||
jspecify = "1.0.0"
|
jspecify = "1.0.0"
|
||||||
jzlib = "1.1.3"
|
jzlib = "1.1.3"
|
||||||
kotlin = "2.1.10"
|
kotlin = "2.2.21"
|
||||||
kotlin-coroutines = "1.10.1"
|
kotlin-coroutines = "1.10.2"
|
||||||
nightConfig = "3.8.1"
|
nightConfig = "3.8.3"
|
||||||
|
|
||||||
# Minecraft mods
|
# Minecraft mods
|
||||||
emi = "1.1.7+1.21"
|
emi = "1.1.7+1.21"
|
||||||
@@ -48,35 +48,34 @@ sodium-fabric = "mc1.21-0.6.0-beta.1-fabric"
|
|||||||
sodium-forge = "mc1.21-0.6.0-beta.1-neoforge"
|
sodium-forge = "mc1.21-0.6.0-beta.1-neoforge"
|
||||||
mixinExtra = "0.3.5"
|
mixinExtra = "0.3.5"
|
||||||
create-forge = "6.0.0-6"
|
create-forge = "6.0.0-6"
|
||||||
create-fabric = "0.5.1-f-build.1467+mc1.20.1"
|
create-fabric = "6.0.7.0+mc1.20.1-build.1716"
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
hamcrest = "2.2"
|
hamcrest = "3.0"
|
||||||
jqwik = "1.8.2"
|
jqwik = "1.9.3"
|
||||||
junit = "5.11.4"
|
junit = "6.0.1"
|
||||||
junitPlatform = "1.11.4"
|
junitPlatform = "6.0.1"
|
||||||
jmh = "1.37"
|
jmh = "1.37"
|
||||||
|
|
||||||
# Build tools
|
# Build tools
|
||||||
cctJavadoc = "1.8.4"
|
cctJavadoc = "1.8.4"
|
||||||
checkstyle = "10.23.1"
|
checkstyle = "12.1.1"
|
||||||
errorProne-core = "2.38.0"
|
errorProne-core = "2.43.0"
|
||||||
errorProne-plugin = "4.1.0"
|
errorProne-plugin = "4.3.0"
|
||||||
fabric-loom = "1.10.4"
|
fabric-loom = "1.12.3"
|
||||||
githubRelease = "2.5.2"
|
githubRelease = "2.5.2"
|
||||||
gradleVersions = "0.50.0"
|
gradleVersions = "0.53.0"
|
||||||
ideaExt = "1.1.7"
|
ideaExt = "1.3"
|
||||||
illuaminate = "0.1.0-83-g1131f68"
|
illuaminate = "0.1.0-83-g1131f68"
|
||||||
lwjgl = "3.3.3"
|
lwjgl = "3.3.6"
|
||||||
minotaur = "2.8.7"
|
minotaur = "2.8.7"
|
||||||
modDevGradle = "2.0.95"
|
modDevGradle = "2.0.116"
|
||||||
nullAway = "0.12.7"
|
nullAway = "0.12.11"
|
||||||
shadow = "8.3.1"
|
shadow = "9.2.2"
|
||||||
spotless = "7.0.2"
|
spotless = "8.0.0"
|
||||||
taskTree = "2.1.1"
|
teavm = "0.13.0-SQUID.2"
|
||||||
teavm = "0.13.0-SQUID.1"
|
|
||||||
vanillaExtract = "0.2.1"
|
vanillaExtract = "0.2.1"
|
||||||
versionCatalogUpdate = "0.8.1"
|
versionCatalogUpdate = "1.0.1"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
# Normal dependencies
|
# Normal dependencies
|
||||||
@@ -176,7 +175,6 @@ githubRelease = { id = "com.github.breadmoirai.github-release", version.ref = "g
|
|||||||
gradleVersions = { id = "com.github.ben-manes.versions", version.ref = "gradleVersions" }
|
gradleVersions = { id = "com.github.ben-manes.versions", version.ref = "gradleVersions" }
|
||||||
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||||
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
|
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
|
||||||
taskTree = { id = "com.dorongold.task-tree", version.ref = "taskTree" }
|
|
||||||
versionCatalogUpdate = { id = "nl.littlerobots.version-catalog-update", version.ref = "versionCatalogUpdate" }
|
versionCatalogUpdate = { id = "nl.littlerobots.version-catalog-update", version.ref = "versionCatalogUpdate" }
|
||||||
|
|
||||||
[bundles]
|
[bundles]
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
754
package-lock.json
generated
754
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -83,7 +83,7 @@ val luaJavadoc by tasks.registering(Javadoc::class) {
|
|||||||
options.addStringOption("project-root", rootProject.file(".").absolutePath)
|
options.addStringOption("project-root", rootProject.file(".").absolutePath)
|
||||||
options.noTimestamp(false)
|
options.noTimestamp(false)
|
||||||
|
|
||||||
javadocTool = javaToolchains.javadocToolFor { languageVersion = CCTweakedPlugin.JAVA_VERSION }
|
javadocTool = javaToolchains.javadocToolFor { languageVersion = CCTweakedPlugin.JDK_VERSION }
|
||||||
}
|
}
|
||||||
|
|
||||||
val lintLua by tasks.registering(IlluaminateExec::class) {
|
val lintLua by tasks.registering(IlluaminateExec::class) {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
package dan200.computercraft.impl.network.wired;
|
package dan200.computercraft.impl.network.wired;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Contract;
|
|
||||||
import org.jspecify.annotations.Nullable;
|
import org.jspecify.annotations.Nullable;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -61,7 +60,6 @@ final class InvariantChecker {
|
|||||||
return okay;
|
return okay;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Contract("")
|
|
||||||
private static <T> @Nullable T makeNullable(T object) {
|
private static <T> @Nullable T makeNullable(T object) {
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ import java.util.function.UnaryOperator;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers ComputerCraft's registry entries and additional objects, such as {@link CauldronInteraction}s and
|
* Registers ComputerCraft's registry entries and additional objects, such as {@link CauldronInteraction}s and
|
||||||
* {@link DetailProvider}s
|
* {@link DetailProvider}s.
|
||||||
* <p>
|
* <p>
|
||||||
* The functions in this class should be called from a loader-specific class.
|
* The functions in this class should be called from a loader-specific class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stops a sound on the client
|
* Stops a sound on the client.
|
||||||
* <p>
|
* <p>
|
||||||
* Called when a speaker is broken.
|
* Called when a speaker is broken.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -305,7 +305,7 @@ public abstract class WiredModemPeripheral extends ModemPeripheral implements Wi
|
|||||||
return wrappers == null ? null : wrappers.get(remoteName);
|
return wrappers == null ? null : wrappers.get(remoteName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class RemotePeripheralWrapper implements IComputerAccess, GuardedLuaContext.Guard {
|
private static final class RemotePeripheralWrapper implements IComputerAccess, GuardedLuaContext.Guard {
|
||||||
private final WiredModemElement element;
|
private final WiredModemElement element;
|
||||||
private final IPeripheral peripheral;
|
private final IPeripheral peripheral;
|
||||||
private final IComputerAccess computer;
|
private final IComputerAccess computer;
|
||||||
@@ -331,13 +331,13 @@ public abstract class WiredModemPeripheral extends ModemPeripheral implements Wi
|
|||||||
methodMap = methods;
|
methodMap = methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void attach() {
|
private void attach() {
|
||||||
attached = true;
|
attached = true;
|
||||||
peripheral.attach(this);
|
peripheral.attach(this);
|
||||||
computer.queueEvent("peripheral", getAttachmentName());
|
computer.queueEvent("peripheral", getAttachmentName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void detach() {
|
private void detach() {
|
||||||
peripheral.detach(this);
|
peripheral.detach(this);
|
||||||
computer.queueEvent("peripheral_detach", getAttachmentName());
|
computer.queueEvent("peripheral_detach", getAttachmentName());
|
||||||
attached = false;
|
attached = false;
|
||||||
@@ -352,19 +352,19 @@ public abstract class WiredModemPeripheral extends ModemPeripheral implements Wi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getType() {
|
private String getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getAdditionalTypes() {
|
private Set<String> getAdditionalTypes() {
|
||||||
return additionalTypes;
|
return additionalTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<String> getMethodNames() {
|
private Collection<String> getMethodNames() {
|
||||||
return methodMap.keySet();
|
return methodMap.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MethodResult callMethod(ILuaContext context, String methodName, IArguments arguments) throws LuaException {
|
private MethodResult callMethod(ILuaContext context, String methodName, IArguments arguments) throws LuaException {
|
||||||
var method = methodMap.get(methodName);
|
var method = methodMap.get(methodName);
|
||||||
if (method == null) throw new LuaException("No such method " + methodName);
|
if (method == null) throw new LuaException("No such method " + methodName);
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public final class InventoryUtil {
|
|||||||
*/
|
*/
|
||||||
public static int getInventorySlotFromCompartment(Player player, int slot, ItemStack stack) {
|
public static int getInventorySlotFromCompartment(Player player, int slot, ItemStack stack) {
|
||||||
if (stack.isEmpty()) throw new IllegalArgumentException("Cannot search for empty stack");
|
if (stack.isEmpty()) throw new IllegalArgumentException("Cannot search for empty stack");
|
||||||
if (player.getInventory().getItem(slot) == stack) return slot;
|
if (slot >= 0 && slot < Inventory.INVENTORY_SIZE && player.getInventory().getItem(slot) == stack) return slot;
|
||||||
if (player.getInventory().getItem(Inventory.SLOT_OFFHAND) == stack) return Inventory.SLOT_OFFHAND;
|
if (player.getInventory().getItem(Inventory.SLOT_OFFHAND) == stack) return Inventory.SLOT_OFFHAND;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ public class NetworkBenchmark {
|
|||||||
return networks;
|
return networks;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Grid<T> {
|
private static final class Grid<T> {
|
||||||
private final int size;
|
private final int size;
|
||||||
private final T[] box;
|
private final T[] box;
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ public class NetworkBenchmark {
|
|||||||
this.box = (T[]) new Object[size * size * size];
|
this.box = (T[]) new Object[size * size * size];
|
||||||
}
|
}
|
||||||
|
|
||||||
public T get(BlockPos pos) {
|
private T get(BlockPos pos) {
|
||||||
int x = pos.getX(), y = pos.getY(), z = pos.getZ();
|
int x = pos.getX(), y = pos.getY(), z = pos.getZ();
|
||||||
|
|
||||||
return x >= 0 && x < size && y >= 0 && y < size && z >= 0 && z < size
|
return x >= 0 && x < size && y >= 0 && y < size && z >= 0 && z < size
|
||||||
@@ -159,7 +159,7 @@ public class NetworkBenchmark {
|
|||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void forEach(BiConsumer<T, BlockPos> transform) {
|
private void forEach(BiConsumer<T, BlockPos> transform) {
|
||||||
for (var x = 0; x < size; x++) {
|
for (var x = 0; x < size; x++) {
|
||||||
for (var y = 0; y < size; y++) {
|
for (var y = 0; y < size; y++) {
|
||||||
for (var z = 0; z < size; z++) {
|
for (var z = 0; z < size; z++) {
|
||||||
@@ -169,7 +169,7 @@ public class NetworkBenchmark {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void map(BiFunction<T, BlockPos, T> transform) {
|
private void map(BiFunction<T, BlockPos, T> transform) {
|
||||||
for (var x = 0; x < size; x++) {
|
for (var x = 0; x < size; x++) {
|
||||||
for (var y = 0; y < size; y++) {
|
for (var y = 0; y < size; y++) {
|
||||||
for (var z = 0; z < size; z++) {
|
for (var z = 0; z < size; z++) {
|
||||||
|
|||||||
@@ -61,4 +61,14 @@ public class ObjectLuaTable implements LuaTable<Object, Object> {
|
|||||||
public Set<Entry<Object, Object>> entrySet() {
|
public Set<Entry<Object, Object>> entrySet() {
|
||||||
return map.entrySet();
|
return map.entrySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
return this == o || o instanceof Map<?, ?> otherMap && map.equals(otherMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return map.hashCode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
//
|
//
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
|
import cc.tweaked.gradle.CCTweakedPlugin
|
||||||
import cc.tweaked.gradle.getAbsolutePath
|
import cc.tweaked.gradle.getAbsolutePath
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
@@ -39,6 +40,8 @@ dependencies {
|
|||||||
testRuntimeOnly(libs.slf4j.simple)
|
testRuntimeOnly(libs.slf4j.simple)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kotlin.compilerOptions.jvmTarget = CCTweakedPlugin.KOTLIN_TARGET
|
||||||
|
|
||||||
tasks.processResources {
|
tasks.processResources {
|
||||||
inputs.property("gitHash", cct.gitHash)
|
inputs.property("gitHash", cct.gitHash)
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import java.util.*;
|
|||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
public class PeripheralAPI implements ILuaAPI, IAPIEnvironment.IPeripheralChangeListener {
|
public class PeripheralAPI implements ILuaAPI, IAPIEnvironment.IPeripheralChangeListener {
|
||||||
private class PeripheralWrapper extends ComputerAccess implements GuardedLuaContext.Guard {
|
private final class PeripheralWrapper extends ComputerAccess implements GuardedLuaContext.Guard {
|
||||||
private final String side;
|
private final String side;
|
||||||
private final IPeripheral peripheral;
|
private final IPeripheral peripheral;
|
||||||
|
|
||||||
@@ -49,32 +49,32 @@ public class PeripheralAPI implements ILuaAPI, IAPIEnvironment.IPeripheralChange
|
|||||||
methodMap = peripheralMethods.getSelfMethods(peripheral);
|
methodMap = peripheralMethods.getSelfMethods(peripheral);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPeripheral getPeripheral() {
|
private IPeripheral getPeripheral() {
|
||||||
return peripheral;
|
return peripheral;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getType() {
|
private String getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getAdditionalTypes() {
|
private Set<String> getAdditionalTypes() {
|
||||||
return additionalTypes;
|
return additionalTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<String> getMethods() {
|
private Collection<String> getMethods() {
|
||||||
return methodMap.keySet();
|
return methodMap.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized boolean isAttached() {
|
private synchronized boolean isAttached() {
|
||||||
return attached;
|
return attached;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void attach() {
|
private synchronized void attach() {
|
||||||
attached = true;
|
attached = true;
|
||||||
peripheral.attach(this);
|
peripheral.attach(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void detach() {
|
private void detach() {
|
||||||
// Call detach
|
// Call detach
|
||||||
peripheral.detach(this);
|
peripheral.detach(this);
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ public class PeripheralAPI implements ILuaAPI, IAPIEnvironment.IPeripheralChange
|
|||||||
attached = false;
|
attached = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MethodResult call(ILuaContext context, String methodName, IArguments arguments) throws LuaException {
|
private MethodResult call(ILuaContext context, String methodName, IArguments arguments) throws LuaException {
|
||||||
PeripheralMethod method;
|
PeripheralMethod method;
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
method = methodMap.get(methodName);
|
method = methodMap.get(methodName);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import java.net.URI;
|
|||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks a URL using {@link NetworkUtils#getAddress(String, int, boolean)}}
|
* Checks a URL using {@link NetworkUtils#getAddress(String, int, boolean)}.
|
||||||
* <p>
|
* <p>
|
||||||
* This requires a DNS lookup, and so needs to occur off-thread.
|
* This requires a DNS lookup, and so needs to occur off-thread.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public abstract class Resource<T extends Resource<T>> implements Closeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up any pending resources
|
* Clean up any pending resources.
|
||||||
* <p>
|
* <p>
|
||||||
* Note, this may be called multiple times, and so should be thread-safe and
|
* Note, this may be called multiple times, and so should be thread-safe and
|
||||||
* avoid any major side effects.
|
* avoid any major side effects.
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ final class Generator<T> {
|
|||||||
private static final MethodHandle ARG_GET_OBJECT, ARG_GET_ENUM, ARG_OPT_ENUM, ARG_GET_STRING_COERCED, ARG_GET_BYTES_COERCED;
|
private static final MethodHandle ARG_GET_OBJECT, ARG_GET_ENUM, ARG_OPT_ENUM, ARG_GET_STRING_COERCED, ARG_GET_BYTES_COERCED;
|
||||||
|
|
||||||
private record ArgMethods(MethodHandle get, MethodHandle opt) {
|
private record ArgMethods(MethodHandle get, MethodHandle opt) {
|
||||||
public static ArgMethods of(Class<?> type, String name) throws ReflectiveOperationException {
|
private static ArgMethods of(Class<?> type, String name) throws ReflectiveOperationException {
|
||||||
return new ArgMethods(
|
return new ArgMethods(
|
||||||
LOOKUP.findVirtual(IArguments.class, "get" + name, MethodType.methodType(type, int.class)),
|
LOOKUP.findVirtual(IArguments.class, "get" + name, MethodType.methodType(type, int.class)),
|
||||||
LOOKUP.findVirtual(IArguments.class, "opt" + name, MethodType.methodType(Optional.class, int.class))
|
LOOKUP.findVirtual(IArguments.class, "opt" + name, MethodType.methodType(Optional.class, int.class))
|
||||||
@@ -73,6 +73,22 @@ final class Generator<T> {
|
|||||||
addArgType(argMethodMap, Map.class, "Table");
|
addArgType(argMethodMap, Map.class, "Table");
|
||||||
addArgType(argMethodMap, String.class, "String");
|
addArgType(argMethodMap, String.class, "String");
|
||||||
addArgType(argMethodMap, ByteBuffer.class, "Bytes");
|
addArgType(argMethodMap, ByteBuffer.class, "Bytes");
|
||||||
|
argMethodMap.put(LuaTable.class, new ArgMethods(
|
||||||
|
// i -> new ObjectLuaTable(getTable(i))
|
||||||
|
MethodHandles.filterReturnValue(
|
||||||
|
LOOKUP.findVirtual(IArguments.class, "getTable", MethodType.methodType(Map.class, int.class)),
|
||||||
|
LOOKUP.findConstructor(ObjectLuaTable.class, MethodType.methodType(void.class, Map.class))
|
||||||
|
.asType(MethodType.methodType(LuaTable.class, Map.class))
|
||||||
|
),
|
||||||
|
// i -> optTable(i).map(ObjectLuaTable::new)
|
||||||
|
MethodHandles.filterReturnValue(
|
||||||
|
LOOKUP.findVirtual(IArguments.class, "optTable", MethodType.methodType(Optional.class, int.class)),
|
||||||
|
MethodHandles.insertArguments(
|
||||||
|
LOOKUP.findVirtual(Optional.class, "map", MethodType.methodType(Optional.class, Function.class)),
|
||||||
|
1, (Function<Map<?, ?>, LuaTable<?, ?>>) ObjectLuaTable::new
|
||||||
|
)
|
||||||
|
)
|
||||||
|
));
|
||||||
argMethods = Map.copyOf(argMethodMap);
|
argMethods = Map.copyOf(argMethodMap);
|
||||||
|
|
||||||
ARG_TABLE_UNSAFE = ArgMethods.of(LuaTable.class, "TableUnsafe");
|
ARG_TABLE_UNSAFE = ArgMethods.of(LuaTable.class, "TableUnsafe");
|
||||||
@@ -335,10 +351,9 @@ final class Generator<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static @Nullable ArgMethods getArgMethods(Class<?> type, boolean unsafe) {
|
private static @Nullable ArgMethods getArgMethods(Class<?> type, boolean unsafe) {
|
||||||
var getter = argMethods.get(type);
|
|
||||||
if (getter != null) return getter;
|
|
||||||
if (type == LuaTable.class && unsafe) return ARG_TABLE_UNSAFE;
|
if (type == LuaTable.class && unsafe) return ARG_TABLE_UNSAFE;
|
||||||
return null;
|
|
||||||
|
return argMethods.get(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -740,7 +740,7 @@ public final class ComputerThread implements ComputerScheduler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final class ExecutorImpl implements Executor {
|
private final class ExecutorImpl implements Executor {
|
||||||
public static final AtomicReferenceFieldUpdater<ExecutorImpl, ExecutorState> STATE = AtomicReferenceFieldUpdater.newUpdater(
|
private static final AtomicReferenceFieldUpdater<ExecutorImpl, ExecutorState> STATE = AtomicReferenceFieldUpdater.newUpdater(
|
||||||
ExecutorImpl.class, ExecutorState.class, "$state"
|
ExecutorImpl.class, ExecutorState.class, "$state"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -20,13 +20,8 @@ import static org.squiddev.cobalt.Constants.NAME;
|
|||||||
final class VarargArguments implements IArguments {
|
final class VarargArguments implements IArguments {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(VarargArguments.class);
|
private static final Logger LOG = LoggerFactory.getLogger(VarargArguments.class);
|
||||||
|
|
||||||
private static final VarargArguments EMPTY = new VarargArguments(Constants.NONE);
|
|
||||||
private static boolean reportedIllegalGet;
|
private static boolean reportedIllegalGet;
|
||||||
|
|
||||||
static {
|
|
||||||
EMPTY.escapes = EMPTY.closed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final Varargs varargs;
|
private final Varargs varargs;
|
||||||
|
|
||||||
private volatile boolean closed;
|
private volatile boolean closed;
|
||||||
@@ -51,7 +46,7 @@ final class VarargArguments implements IArguments {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static VarargArguments of(Varargs values) {
|
static VarargArguments of(Varargs values) {
|
||||||
return values == Constants.NONE ? EMPTY : new VarargArguments(values);
|
return new VarargArguments(values);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isClosed() {
|
boolean isClosed() {
|
||||||
@@ -138,9 +133,7 @@ final class VarargArguments implements IArguments {
|
|||||||
if (count < 0) throw new IllegalStateException("count cannot be negative");
|
if (count < 0) throw new IllegalStateException("count cannot be negative");
|
||||||
if (count == 0) return this;
|
if (count == 0) return this;
|
||||||
|
|
||||||
var newArgs = varargs.subargs(count + 1);
|
return new VarargArguments(varargs.subargs(count + 1), this, count);
|
||||||
if (newArgs == Constants.NONE) return EMPTY;
|
|
||||||
return new VarargArguments(newArgs, this, count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -616,7 +616,8 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function parse_ident(str, pos)
|
local function parse_ident(str, pos)
|
||||||
local _, last, val = find(str, '^([%a][%w_]*)', pos)
|
local _, last, val = find(str, '^([%w_+.-]+)', pos)
|
||||||
|
if not last then error_at(pos, "Expected object key") end
|
||||||
return val, last + 1
|
return val, last + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -864,7 +865,7 @@ values do not serialise cleanly into JSON.
|
|||||||
A consequence of this is that an empty table will always be serialised to an object,
|
A consequence of this is that an empty table will always be serialised to an object,
|
||||||
not an array. [`textutils.empty_json_array`] may be used to express an empty array.
|
not an array. [`textutils.empty_json_array`] may be used to express an empty array.
|
||||||
|
|
||||||
- Lua strings are an a sequence of raw bytes, and do not have any specific encoding.
|
- Lua strings are a sequence of raw bytes, and do not have any specific encoding.
|
||||||
However, JSON strings must be valid unicode. By default, non-ASCII characters in a
|
However, JSON strings must be valid unicode. By default, non-ASCII characters in a
|
||||||
string are serialised to their unicode code point (for instance, `"\xfe"` is
|
string are serialised to their unicode code point (for instance, `"\xfe"` is
|
||||||
converted to `"\u00fe"`). The `unicode_strings` option may be set to treat all input
|
converted to `"\u00fe"`). The `unicode_strings` option may be set to treat all input
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
# New features in CC: Tweaked 1.116.2
|
||||||
|
|
||||||
|
Several bug fixes:
|
||||||
|
* Update Create compatibility to Create Fabric 6.0.
|
||||||
|
* Various documentation fixes (Zirunis).
|
||||||
|
* Fix crash with Inventorio.
|
||||||
|
* Various fixes to SNBT parsing.
|
||||||
|
* Fix Regex DDoS in string pattern matching.
|
||||||
|
|
||||||
# New features in CC: Tweaked 1.116.1
|
# New features in CC: Tweaked 1.116.1
|
||||||
|
|
||||||
* Update translations.
|
* Update translations.
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
New features in CC: Tweaked 1.116.1
|
New features in CC: Tweaked 1.116.2
|
||||||
|
|
||||||
* Update translations.
|
Several bug fixes:
|
||||||
|
* Update Create compatibility to Create Fabric 6.0.
|
||||||
One bug fix:
|
* Various documentation fixes (Zirunis).
|
||||||
* Fix NPE when mcfunction files contain CC commands.
|
* Fix crash with Inventorio.
|
||||||
|
* Various fixes to SNBT parsing.
|
||||||
|
* Fix Regex DDoS in string pattern matching.
|
||||||
|
|
||||||
Type "help changelog" to see the full version history.
|
Type "help changelog" to see the full version history.
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ Convert between streams of DFPWM audio data and a list of amplitudes.
|
|||||||
DFPWM (Dynamic Filter Pulse Width Modulation) is an audio codec designed by GreaseMonkey. It's a relatively compact
|
DFPWM (Dynamic Filter Pulse Width Modulation) is an audio codec designed by GreaseMonkey. It's a relatively compact
|
||||||
format compared to raw PCM data, only using 1 bit per sample, but is simple enough to encode and decode in real time.
|
format compared to raw PCM data, only using 1 bit per sample, but is simple enough to encode and decode in real time.
|
||||||
|
|
||||||
Typically DFPWM audio is read from [the filesystem][`fs.ReadHandle`] or a [a web request][`http.Response`] as a string,
|
Typically DFPWM audio is read from [the filesystem][`fs.ReadHandle`] or [a web request][`http.Response`] as a string,
|
||||||
and converted a format suitable for [`speaker.playAudio`].
|
and converted to a format suitable for [`speaker.playAudio`].
|
||||||
|
|
||||||
## Encoding and decoding files
|
## Encoding and decoding files
|
||||||
This module exposes two key functions, [`make_decoder`] and [`make_encoder`], which construct a new decoder or encoder.
|
This module exposes two key functions, [`make_decoder`] and [`make_encoder`], which construct a new decoder or encoder.
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import dan200.computercraft.core.computer.ComputerSide;
|
|||||||
import dan200.computercraft.core.methods.LuaMethod;
|
import dan200.computercraft.core.methods.LuaMethod;
|
||||||
import dan200.computercraft.core.methods.NamedMethod;
|
import dan200.computercraft.core.methods.NamedMethod;
|
||||||
import org.hamcrest.Matcher;
|
import org.hamcrest.Matcher;
|
||||||
|
import org.jspecify.annotations.Nullable;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.objectweb.asm.ClassReader;
|
import org.objectweb.asm.ClassReader;
|
||||||
import org.objectweb.asm.ClassVisitor;
|
import org.objectweb.asm.ClassVisitor;
|
||||||
@@ -123,6 +124,17 @@ public class GeneratorTest {
|
|||||||
assertThrows(LuaException.class, () -> apply(methods, new EnumMethods(), "getEnum", "not as side"));
|
assertThrows(LuaException.class, () -> apply(methods, new EnumMethods(), "getEnum", "not as side"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testLuaTable() throws LuaException {
|
||||||
|
var methods = GENERATOR.getMethods(TableMethods.class);
|
||||||
|
assertThat(methods, containsInAnyOrder(named("getTable"), named("optTable")));
|
||||||
|
|
||||||
|
assertThat(apply(methods, new TableMethods(), "getTable", Map.of("x", "y")), one(is(Map.of("x", "y"))));
|
||||||
|
assertThat(apply(methods, new TableMethods(), "optTable", Map.of("x", "y")), one(is(Map.of("x", "y"))));
|
||||||
|
assertThat(apply(methods, new TableMethods(), "optTable"), one(nullValue()));
|
||||||
|
assertThrows(LuaException.class, () -> apply(methods, new TableMethods(), "getTable", "not a table"));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMainThread() throws LuaException {
|
public void testMainThread() throws LuaException {
|
||||||
var methods = GENERATOR.getMethods(MainThread.class);
|
var methods = GENERATOR.getMethods(MainThread.class);
|
||||||
@@ -277,6 +289,18 @@ public class GeneratorTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class TableMethods {
|
||||||
|
@LuaFunction
|
||||||
|
public final LuaTable<?, ?> getTable(LuaTable<?, ?> table) {
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
|
@LuaFunction
|
||||||
|
public final @Nullable LuaTable<?, ?> optTable(Optional<LuaTable<?, ?>> table) {
|
||||||
|
return table.orElse(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class MainThread {
|
public static class MainThread {
|
||||||
@LuaFunction(mainThread = true)
|
@LuaFunction(mainThread = true)
|
||||||
public final void go() {
|
public final void go() {
|
||||||
@@ -288,10 +312,6 @@ public class GeneratorTest {
|
|||||||
public final void withUnsafe(LuaTable<?, ?> table) {
|
public final void withUnsafe(LuaTable<?, ?> table) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@LuaFunction
|
|
||||||
public final void withoutUnsafe(LuaTable<?, ?> table) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@LuaFunction(unsafe = true, mainThread = true)
|
@LuaFunction(unsafe = true, mainThread = true)
|
||||||
public final void invalid(LuaTable<?, ?> table) {
|
public final void invalid(LuaTable<?, ?> table) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -246,11 +246,25 @@ describe("The textutils library", function()
|
|||||||
describe("parses using NBT-style syntax", function()
|
describe("parses using NBT-style syntax", function()
|
||||||
local function exp(x)
|
local function exp(x)
|
||||||
local res, err = textutils.unserializeJSON(x, { nbt_style = true })
|
local res, err = textutils.unserializeJSON(x, { nbt_style = true })
|
||||||
if not res then error(err, 2) end
|
if not res then fail(err) end
|
||||||
return expect(res)
|
return expect(res)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function exp_err(x)
|
||||||
|
local res, err = textutils.unserializeJSON(x, { nbt_style = true })
|
||||||
|
if res ~= nil then
|
||||||
|
fail(("Expected %q not to parse, but returned %s"):format(x, textutils.serialise(res)))
|
||||||
|
end
|
||||||
|
return expect(err)
|
||||||
|
end
|
||||||
|
|
||||||
it("basic objects", function()
|
it("basic objects", function()
|
||||||
exp([[{ a: 1, b:2 }]]):same { a = 1, b = 2 }
|
exp("{ a: 1, b:2 }"):same { a = 1, b = 2 }
|
||||||
|
exp("{0+_-.aA: 1}"):same { ["0+_-.aA"] = 1 }
|
||||||
|
exp("{}"):same {}
|
||||||
|
|
||||||
|
exp_err("{: 123}"):eq("Malformed JSON at position 2: Expected object key")
|
||||||
|
exp_err("{#: 123}"):eq("Malformed JSON at position 2: Expected object key")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("suffixed numbers", function()
|
it("suffixed numbers", function()
|
||||||
@@ -258,10 +272,22 @@ describe("The textutils library", function()
|
|||||||
exp("1.1d"):eq(1.1)
|
exp("1.1d"):eq(1.1)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("strings", function()
|
describe("strings", function()
|
||||||
|
it("empty quoted strings", function()
|
||||||
|
exp("''"):eq("")
|
||||||
|
exp("\"\""):eq("")
|
||||||
|
end)
|
||||||
|
|
||||||
|
pending("unquoted strings", function()
|
||||||
|
exp("hello"):eq("hello")
|
||||||
|
exp("0+_-.aA"):eq("0+_-.aA")
|
||||||
|
end)
|
||||||
|
|
||||||
|
it("quoted strings", function()
|
||||||
exp("'123'"):eq("123")
|
exp("'123'"):eq("123")
|
||||||
exp("\"123\""):eq("123")
|
exp("\"123\""):eq("123")
|
||||||
end)
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
it("typed arrays", function()
|
it("typed arrays", function()
|
||||||
exp("[B; 1, 2, 3]"):same { 1, 2, 3 }
|
exp("[B; 1, 2, 3]"):same { 1, 2, 3 }
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import org.junit.jupiter.api.DisplayNameGeneration;
|
|||||||
import org.junit.jupiter.api.DisplayNameGenerator;
|
import org.junit.jupiter.api.DisplayNameGenerator;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link DisplayNameGenerator} which replaces underscores with spaces. This is equivalent to
|
* A {@link DisplayNameGenerator} which replaces underscores with spaces. This is equivalent to
|
||||||
@@ -17,7 +18,7 @@ import java.lang.reflect.Method;
|
|||||||
*/
|
*/
|
||||||
public class ReplaceUnderscoresDisplayNameGenerator extends DisplayNameGenerator.ReplaceUnderscores {
|
public class ReplaceUnderscoresDisplayNameGenerator extends DisplayNameGenerator.ReplaceUnderscores {
|
||||||
@Override
|
@Override
|
||||||
public String generateDisplayNameForMethod(Class<?> testClass, Method testMethod) {
|
public String generateDisplayNameForMethod(List<Class<?>> enclosingInstanceTypes, Class<?> testClass, Method testMethod) {
|
||||||
return testMethod.getName().replace('_', ' ');
|
return testMethod.getName().replace('_', ' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ configurations {
|
|||||||
val localImplementation by registering {
|
val localImplementation by registering {
|
||||||
isCanBeResolved = false
|
isCanBeResolved = false
|
||||||
isCanBeConsumed = false
|
isCanBeConsumed = false
|
||||||
isVisible = false
|
|
||||||
}
|
}
|
||||||
compileClasspath { extendsFrom(localImplementation.get()) }
|
compileClasspath { extendsFrom(localImplementation.get()) }
|
||||||
runtimeClasspath { extendsFrom(localImplementation.get()) }
|
runtimeClasspath { extendsFrom(localImplementation.get()) }
|
||||||
@@ -118,7 +117,6 @@ dependencies {
|
|||||||
|
|
||||||
loom {
|
loom {
|
||||||
accessWidenerPath = project(":common").file("src/main/resources/computercraft.accesswidener")
|
accessWidenerPath = project(":common").file("src/main/resources/computercraft.accesswidener")
|
||||||
mixin.useLegacyMixinAp = false
|
|
||||||
|
|
||||||
mods {
|
mods {
|
||||||
register("computercraft") {
|
register("computercraft") {
|
||||||
|
|||||||
@@ -39,11 +39,11 @@ public class FabricDataProviders implements DataGeneratorEntrypoint {
|
|||||||
private record PlatformGeneratorsImpl(
|
private record PlatformGeneratorsImpl(
|
||||||
FabricDataGenerator.Pack generator, CompletableFuture<HolderLookup.Provider> registries
|
FabricDataGenerator.Pack generator, CompletableFuture<HolderLookup.Provider> registries
|
||||||
) implements DataProviders.GeneratorSink {
|
) implements DataProviders.GeneratorSink {
|
||||||
public <T extends DataProvider> T addWithFabricOutput(FabricDataGenerator.Pack.Factory<T> factory) {
|
private <T extends DataProvider> T addWithFabricOutput(FabricDataGenerator.Pack.Factory<T> factory) {
|
||||||
return generator.addProvider((FabricDataOutput p) -> new PrettyDataProvider<>(factory.create(p))).provider();
|
return generator.addProvider((FabricDataOutput p) -> new PrettyDataProvider<>(factory.create(p))).provider();
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends DataProvider> T addWithRegistries(FabricDataGenerator.Pack.RegistryDependentFactory<T> factory) {
|
private <T extends DataProvider> T addWithRegistries(FabricDataGenerator.Pack.RegistryDependentFactory<T> factory) {
|
||||||
return generator.addProvider((r, p) -> new PrettyDataProvider<>(factory.create(r, p))).provider();
|
return generator.addProvider((r, p) -> new PrettyDataProvider<>(factory.create(r, p))).provider();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
package dan200.computercraft.shared.integration;
|
package dan200.computercraft.shared.integration;
|
||||||
|
|
||||||
import com.simibubi.create.content.contraptions.BlockMovementChecks;
|
import com.simibubi.create.api.contraption.BlockMovementChecks;
|
||||||
import com.simibubi.create.content.contraptions.BlockMovementChecks.CheckResult;
|
import com.simibubi.create.api.contraption.BlockMovementChecks.CheckResult;
|
||||||
import dan200.computercraft.shared.peripheral.modem.wired.CableBlock;
|
import dan200.computercraft.shared.peripheral.modem.wired.CableBlock;
|
||||||
import dan200.computercraft.shared.peripheral.modem.wireless.WirelessModemBlock;
|
import dan200.computercraft.shared.peripheral.modem.wireless.WirelessModemBlock;
|
||||||
|
|
||||||
|
|||||||
@@ -147,7 +147,6 @@ configurations {
|
|||||||
val localImplementation by registering {
|
val localImplementation by registering {
|
||||||
isCanBeResolved = false
|
isCanBeResolved = false
|
||||||
isCanBeConsumed = false
|
isCanBeConsumed = false
|
||||||
isVisible = false
|
|
||||||
}
|
}
|
||||||
compileClasspath { extendsFrom(localImplementation.get()) }
|
compileClasspath { extendsFrom(localImplementation.get()) }
|
||||||
runtimeClasspath { extendsFrom(localImplementation.get()) }
|
runtimeClasspath { extendsFrom(localImplementation.get()) }
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
//
|
//
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
|
import cc.tweaked.gradle.CCTweakedPlugin
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm")
|
kotlin("jvm")
|
||||||
id("cc-tweaked.java-convention")
|
id("cc-tweaked.java-convention")
|
||||||
@@ -29,6 +31,8 @@ dependencies {
|
|||||||
testRuntimeOnly(libs.bundles.testRuntime)
|
testRuntimeOnly(libs.bundles.testRuntime)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kotlin.compilerOptions.jvmTarget = CCTweakedPlugin.KOTLIN_TARGET
|
||||||
|
|
||||||
tasks.test {
|
tasks.test {
|
||||||
jvmArgs(
|
jvmArgs(
|
||||||
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
|
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import dan200.computercraft.core.terminal.Terminal;
|
|||||||
import dan200.computercraft.core.terminal.TextBuffer;
|
import dan200.computercraft.core.terminal.TextBuffer;
|
||||||
import dan200.computercraft.core.util.Colour;
|
import dan200.computercraft.core.util.Colour;
|
||||||
import org.apache.commons.cli.*;
|
import org.apache.commons.cli.*;
|
||||||
|
import org.apache.commons.cli.help.HelpFormatter;
|
||||||
import org.jetbrains.annotations.Contract;
|
import org.jetbrains.annotations.Contract;
|
||||||
import org.jspecify.annotations.Nullable;
|
import org.jspecify.annotations.Nullable;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
@@ -31,9 +32,8 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.UncheckedIOException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.nio.file.InvalidPathException;
|
import java.nio.file.InvalidPathException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -70,10 +70,10 @@ public class Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private record TermSize(int width, int height) {
|
private record TermSize(int width, int height) {
|
||||||
public static final TermSize DEFAULT = new TermSize(51, 19);
|
private static final TermSize DEFAULT = new TermSize(51, 19);
|
||||||
public static final Pattern PATTERN = Pattern.compile("^(\\d+)x(\\d+)$");
|
private static final Pattern PATTERN = Pattern.compile("^(\\d+)x(\\d+)$");
|
||||||
|
|
||||||
public static TermSize parse(String value) throws ParseException {
|
private static TermSize parse(String value) throws ParseException {
|
||||||
var matcher = TermSize.PATTERN.matcher(value);
|
var matcher = TermSize.PATTERN.matcher(value);
|
||||||
if (!matcher.matches()) throw new ParseException("'" + value + "' is not a valid terminal size.");
|
if (!matcher.matches()) throw new ParseException("'" + value + "' is not a valid terminal size.");
|
||||||
|
|
||||||
@@ -82,9 +82,9 @@ public class Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private record MountPaths(Path src, String dest) {
|
private record MountPaths(Path src, String dest) {
|
||||||
public static final Pattern PATTERN = Pattern.compile("^([^:]+):([^:]+)$");
|
private static final Pattern PATTERN = Pattern.compile("^([^:]+):([^:]+)$");
|
||||||
|
|
||||||
public static MountPaths parse(String value) throws ParseException {
|
private static MountPaths parse(String value) throws ParseException {
|
||||||
var matcher = MountPaths.PATTERN.matcher(value);
|
var matcher = MountPaths.PATTERN.matcher(value);
|
||||||
if (!matcher.matches()) throw new ParseException("'" + value + "' is not a mount spec.");
|
if (!matcher.matches()) throw new ParseException("'" + value + "' is not a mount spec.");
|
||||||
|
|
||||||
@@ -115,26 +115,26 @@ public class Main {
|
|||||||
Option resourceOpt, computerOpt, termSizeOpt, allowLocalDomainsOpt, helpOpt, mountOpt, mountRoOpt;
|
Option resourceOpt, computerOpt, termSizeOpt, allowLocalDomainsOpt, helpOpt, mountOpt, mountRoOpt;
|
||||||
options.addOption(resourceOpt = Option.builder("r").argName("PATH").longOpt("resources").hasArg()
|
options.addOption(resourceOpt = Option.builder("r").argName("PATH").longOpt("resources").hasArg()
|
||||||
.desc("The path to the resources directory")
|
.desc("The path to the resources directory")
|
||||||
.build());
|
.get());
|
||||||
options.addOption(computerOpt = Option.builder("c").argName("PATH").longOpt("computer").hasArg()
|
options.addOption(computerOpt = Option.builder("c").argName("PATH").longOpt("computer").hasArg()
|
||||||
.desc("The root directory of the computer. Defaults to a temporary directory.")
|
.desc("The root directory of the computer. Defaults to a temporary directory.")
|
||||||
.build());
|
.get());
|
||||||
options.addOption(termSizeOpt = Option.builder("t").argName("WIDTHxHEIGHT").longOpt("term-size").hasArg()
|
options.addOption(termSizeOpt = Option.builder("t").argName("WIDTHxHEIGHT").longOpt("term-size").hasArg()
|
||||||
.desc("The size of the terminal, defaults to 51x19.")
|
.desc("The size of the terminal, defaults to 51x19.")
|
||||||
.build());
|
.get());
|
||||||
options.addOption(allowLocalDomainsOpt = Option.builder("L").longOpt("allow-local-domains")
|
options.addOption(allowLocalDomainsOpt = Option.builder("L").longOpt("allow-local-domains")
|
||||||
.desc("Allow accessing local domains with the HTTP API.")
|
.desc("Allow accessing local domains with the HTTP API.")
|
||||||
.build());
|
.get());
|
||||||
options.addOption(mountOpt = Option.builder().longOpt("mount").hasArg().argName("SRC:DEST")
|
options.addOption(mountOpt = Option.builder().longOpt("mount").hasArg().argName("SRC:DEST")
|
||||||
.desc("Mount a folder SRC at directory DEST on the computer.")
|
.desc("Mount a folder SRC at directory DEST on the computer.")
|
||||||
.build());
|
.get());
|
||||||
options.addOption(mountRoOpt = Option.builder().longOpt("mount-ro").hasArg().argName("SRC:DEST")
|
options.addOption(mountRoOpt = Option.builder().longOpt("mount-ro").hasArg().argName("SRC:DEST")
|
||||||
.desc("Mount a read-only folder SRC at directory DEST on the computer.")
|
.desc("Mount a read-only folder SRC at directory DEST on the computer.")
|
||||||
.build());
|
.get());
|
||||||
|
|
||||||
options.addOption(helpOpt = Option.builder("h").longOpt("help")
|
options.addOption(helpOpt = Option.builder("h").longOpt("help")
|
||||||
.desc("Print help message")
|
.desc("Print help message")
|
||||||
.build());
|
.get());
|
||||||
|
|
||||||
Path resourcesDirectory;
|
Path resourcesDirectory;
|
||||||
Path computerDirectory;
|
Path computerDirectory;
|
||||||
@@ -144,7 +144,11 @@ public class Main {
|
|||||||
try {
|
try {
|
||||||
var cli = new DefaultParser().parse(options, args);
|
var cli = new DefaultParser().parse(options, args);
|
||||||
if (cli.hasOption(helpOpt)) {
|
if (cli.hasOption(helpOpt)) {
|
||||||
new HelpFormatter().printHelp("standalone.jar", options, true);
|
try {
|
||||||
|
HelpFormatter.builder().get().printHelp("standalone.jar", "", options, "", true);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new UncheckedIOException(e);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!cli.hasOption(resourceOpt)) throw new ParseException("--resources directory is required");
|
if (!cli.hasOption(resourceOpt)) throw new ParseException("--resources directory is required");
|
||||||
@@ -157,10 +161,7 @@ public class Main {
|
|||||||
readOnlyMounts = getParsedOptionValues(cli, mountRoOpt, MountPaths::parse);
|
readOnlyMounts = getParsedOptionValues(cli, mountRoOpt, MountPaths::parse);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
System.err.println(e.getLocalizedMessage());
|
System.err.println(e.getLocalizedMessage());
|
||||||
|
System.err.println(HelpFormatter.builder().get().toSyntaxOptions(options));
|
||||||
var writer = new PrintWriter(System.err, false, StandardCharsets.UTF_8);
|
|
||||||
new HelpFormatter().printUsage(writer, HelpFormatter.DEFAULT_WIDTH, "standalone.jar", options);
|
|
||||||
writer.flush();
|
|
||||||
|
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import org.jspecify.annotations.Nullable;
|
|||||||
import org.objectweb.asm.ClassReader;
|
import org.objectweb.asm.ClassReader;
|
||||||
import org.objectweb.asm.ClassVisitor;
|
import org.objectweb.asm.ClassVisitor;
|
||||||
import org.objectweb.asm.ClassWriter;
|
import org.objectweb.asm.ClassWriter;
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
import org.objectweb.asm.commons.ClassRemapper;
|
import org.objectweb.asm.commons.ClassRemapper;
|
||||||
import org.objectweb.asm.commons.Remapper;
|
import org.objectweb.asm.commons.Remapper;
|
||||||
|
|
||||||
@@ -38,7 +39,7 @@ public class TransformingClassLoader extends ClassLoader {
|
|||||||
private final Map<String, Path> remappedResources = new HashMap<>();
|
private final Map<String, Path> remappedResources = new HashMap<>();
|
||||||
private final List<BiFunction<String, ClassVisitor, ClassVisitor>> transformers = new ArrayList<>();
|
private final List<BiFunction<String, ClassVisitor, ClassVisitor>> transformers = new ArrayList<>();
|
||||||
|
|
||||||
private final Remapper remapper = new Remapper() {
|
private final Remapper remapper = new Remapper(Opcodes.ASM9) {
|
||||||
@Override
|
@Override
|
||||||
public String map(String internalName) {
|
public String map(String internalName) {
|
||||||
return remappedClasses.getOrDefault(internalName, internalName);
|
return remappedClasses.getOrDefault(internalName, internalName);
|
||||||
|
|||||||
@@ -187,9 +187,9 @@ class EmulatedComputer implements ComputerEnvironment, ComputerHandle {
|
|||||||
public void addFile(String path, JSObject contents) {
|
public void addFile(String path, JSObject contents) {
|
||||||
byte[] bytes;
|
byte[] bytes;
|
||||||
if (JavascriptConv.isArrayBuffer(contents)) {
|
if (JavascriptConv.isArrayBuffer(contents)) {
|
||||||
bytes = bytesOfBuffer(contents.cast());
|
bytes = bytesOfBuffer((ArrayBuffer) contents);
|
||||||
} else {
|
} else {
|
||||||
JSString string = contents.cast();
|
var string = (JSString) contents;
|
||||||
bytes = string.stringValue().getBytes(StandardCharsets.UTF_8);
|
bytes = string.stringValue().getBytes(StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public class THttpRequest extends Resource<THttpRequest> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayBuffer buffer = request.getResponse().cast();
|
var buffer = (ArrayBuffer) request.getResponse();
|
||||||
SeekableByteChannel contents = new ArrayByteChannel(JavascriptConv.asByteArray(buffer));
|
SeekableByteChannel contents = new ArrayByteChannel(JavascriptConv.asByteArray(buffer));
|
||||||
var reader = new ReadHandle(contents, binary);
|
var reader = new ReadHandle(contents, binary);
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ pluginManagement {
|
|||||||
content {
|
content {
|
||||||
includeGroup("fabric-loom")
|
includeGroup("fabric-loom")
|
||||||
includeGroup("net.fabricmc")
|
includeGroup("net.fabricmc")
|
||||||
|
includeGroup("net.fabricmc.unpick")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user