1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-17 06:57:38 +00:00

Compare commits

..

12 Commits

Author SHA1 Message Date
Jonathan Coates
d7305fb975 Bump CC:T to 1.101.2
Yes, it was the shiny parse errors, and not the steady accumulation of
bugs which made me finally do a version bump.
2023-02-14 10:00:24 +00:00
Jonathan Coates
9b3cadf57c Cherry pick several changes back from 1.19.3
The main purpose of this is to backport the improved parse/runtime
errors to older versions. I think they're sufficiently useful that we
should try to make it as widely available as possible.

We've been running them for a week now on SC3 and the released version
and not seen any issues, so I think it's probably stable enough.

This is a pretty lazy commit: I ended up copying the whole ROM over and
then picking up a few other related changes along the way.

 - Trim spaces from file paths (b8fce1eecc)

 - Correctly format 12AM/PM with
   %I (9f48395596)

 - Fix http.request and htpt.websocketAsync not handling a few failure
   edge-cases correctly (3b42f22a4f).

 - Move the internal modules into the main package path, hidden under
   cc.internal (34a31abd9c).

 - Gather code coverage in Java instead of
   Lua (28a55349a9).

 - Make error messages in edit more
   obvious (8cfbfe7ceb).

 - Make mcfly's test methods global. This means we don't need to pass
   stub everywhere (7335a892b5).

 - Improve runtime and parse errors. This comes from numerous commits,
   but chiefly a12b405acf, and
   5502412181.

 - Hide the internal redirect methods in
   multishell (33b6f38339).

Note this does /not/ include the shebang changes (sorry Emma!). I've
tried to avoid adding any user-controllable features, mostly because I
don't know how to handle the versioning otherwise :).
2023-02-14 09:45:03 +00:00
Jonathan Coates
68f6fa9343 Fall back to the default item when rendering non-turtles
Closes #1328. This isn't an actual fix - I have no clue what's going on
there - but it should be less crashy.
2023-02-09 12:45:20 +00:00
Jonathan Coates
58f2c0bd71 Update Cobalt to fix yielding inside __len
Closes #1307
2023-01-26 10:09:09 +00:00
Jonathan Coates
b46ad62424 Send the original rednet message to the current computer
We were incorrectly enquing the modem payload, not the underlying rednet
message.

Closes #1308.
2023-01-21 08:25:13 +00:00
Jonathan Coates
12f2f854a6 Include the licences of our dependencies in the credits
I feel like we should have been doing this from the beginning. Love to
uncompliant for 11 years :/.
2023-01-07 12:04:56 +00:00
Jonathan Coates
4078a2dcba Clamp speaker volume again
Looks like this was removed in b048b6666d.
2023-01-01 13:59:58 +00:00
Jonathan Coates
0ad12eeab6 Fix computer upgrade recipes
Fixes #1272
2022-12-26 09:32:02 +00:00
Jonathan Coates
68a5081740 Bump Cobalt version
See #1248 and #1249
2022-12-21 16:01:54 +00:00
Jonathan Coates
5e701f73d6 Use the correct import path in import.lua
Backported from 1.19.3
2022-12-14 21:52:32 +00:00
Jonathan Coates
1d3ecb551d Improvee changelog 2022-11-02 07:58:31 +00:00
Jonathan Coates
aefda6a381 Fix a couple of issues with the release process
Only way to test these is in prod, alas :D:
2022-11-01 21:53:05 +00:00
700 changed files with 25683 additions and 13255 deletions

View File

@@ -14,7 +14,7 @@ jobs:
- name: Set up Java - name: Set up Java
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
java-version: 17 java-version: 8
distribution: 'temurin' distribution: 'temurin'
- name: Setup Gradle - name: Setup Gradle

View File

@@ -17,7 +17,7 @@ jobs:
- name: Set up Java - name: Set up Java
uses: actions/setup-java@v1 uses: actions/setup-java@v1
with: with:
java-version: 17 java-version: 8
distribution: 'temurin' distribution: 'temurin'
- name: Setup Gradle - name: Setup Gradle

View File

@@ -43,10 +43,6 @@ minecraft {
// configureEach would be better, but we need to eagerly configure configs or otherwise the run task doesn't // configureEach would be better, but we need to eagerly configure configs or otherwise the run task doesn't
// get set up properly. // get set up properly.
all { all {
lazyToken("minecraft_classpath") {
configurations["shade"].copyRecursive().resolve().joinToString(File.pathSeparator) { it.absolutePath }
}
property("forge.logging.markers", "REGISTRIES") property("forge.logging.markers", "REGISTRIES")
property("forge.logging.console.level", "debug") property("forge.logging.console.level", "debug")
@@ -79,24 +75,6 @@ minecraft {
} }
fun RunConfig.configureForGameTest() { fun RunConfig.configureForGameTest() {
val old = lazyTokens.get("minecraft_classpath")
lazyToken("minecraft_classpath") {
// We do some terrible hacks here to basically find all things not already on the runtime classpath
// and add them. /Except/ for our source sets, as those need to load inside the Minecraft classpath.
val testMod = configurations["testModRuntimeClasspath"].resolve()
val implementation = configurations.runtimeClasspath.get().resolve()
val new = (testMod - implementation)
.asSequence()
.filter { it.isFile && !it.name.endsWith("-test-fixtures.jar") }
.map { it.absolutePath }
.joinToString(File.pathSeparator)
if (old == null) new else old.get() + File.pathSeparator + new
}
property("cctest.sources", file("src/testMod/resources/data/cctest").absolutePath)
arg("--mixin.config=computercraft-gametest.mixins.json")
mods.register("cctest") { mods.register("cctest") {
source(sourceSets["testMod"]) source(sourceSets["testMod"])
source(sourceSets["testFixtures"]) source(sourceSets["testFixtures"])
@@ -109,10 +87,12 @@ minecraft {
configureForGameTest() configureForGameTest()
} }
val gameTestServer by registering { val testServer by registering {
workingDirectory(file("run/testServer")) workingDirectory(file("run/testServer"))
parent(server.get())
configureForGameTest() configureForGameTest()
property("cctest.run", "true")
property("forge.logging.console.level", "info") property("forge.logging.console.level", "info")
} }
} }
@@ -120,6 +100,7 @@ minecraft {
mappings("parchment", "${libs.versions.parchmentMc.get()}-${libs.versions.parchment.get()}-$mcVersion") mappings("parchment", "${libs.versions.parchmentMc.get()}-${libs.versions.parchment.get()}-$mcVersion")
accessTransformer(file("src/main/resources/META-INF/accesstransformer.cfg")) accessTransformer(file("src/main/resources/META-INF/accesstransformer.cfg"))
accessTransformer(file("src/testMod/resources/META-INF/accesstransformer.cfg"))
} }
mixin { mixin {
@@ -139,14 +120,16 @@ configurations {
dependencies { dependencies {
minecraft("net.minecraftforge:forge:$mcVersion-${libs.versions.forge.get()}") minecraft("net.minecraftforge:forge:$mcVersion-${libs.versions.forge.get()}")
annotationProcessor("org.spongepowered:mixin:0.8.5:processor") annotationProcessor("org.spongepowered:mixin:0.8.4:processor")
compileOnly(libs.jetbrainsAnnotations) compileOnly(libs.jetbrainsAnnotations)
annotationProcessorEverywhere(libs.autoService) annotationProcessorEverywhere(libs.autoService)
"extraModsCompileOnly"(fg.deobf("mezz.jei:jei-1.18.2:9.4.1.116:api")) "extraModsCompileOnly"(fg.deobf("mezz.jei:jei-1.16.5:7.7.0.104:api"))
"extraModsRuntimeOnly"(fg.deobf("mezz.jei:jei-1.18.2:9.4.1.116")) "extraModsRuntimeOnly"(fg.deobf("mezz.jei:jei-1.16.5:7.7.0.104"))
"extraModsCompileOnly"(fg.deobf("maven.modrinth:oculus:1.18.2-1.2.5"))
"extraModsCompileOnly"(fg.deobf("com.blamejared.crafttweaker:CraftTweaker-1.16.5:7.1.0.313"))
"extraModsCompileOnly"(fg.deobf("commoble.morered:morered-1.16.5:2.1.1.0"))
"shade"(libs.cobalt) "shade"(libs.cobalt)
@@ -168,7 +151,7 @@ illuaminate {
tasks.javadoc { tasks.javadoc {
include("dan200/computercraft/api/**/*.java") include("dan200/computercraft/api/**/*.java")
(options as StandardJavadocDocletOptions).links("https://docs.oracle.com/en/java/javase/17/docs/api/") (options as StandardJavadocDocletOptions).links("https://docs.oracle.com/javase/8/docs/api/")
} }
val apiJar by tasks.registering(Jar::class) { val apiJar by tasks.registering(Jar::class) {
@@ -194,7 +177,7 @@ val luaJavadoc by tasks.registering(Javadoc::class) {
javadocTool.set( javadocTool.set(
javaToolchains.javadocToolFor { javaToolchains.javadocToolFor {
languageVersion.set(cc.tweaked.gradle.CCTweakedPlugin.JAVA_VERSION) languageVersion.set(JavaLanguageVersion.of(11))
}, },
) )
} }
@@ -204,7 +187,7 @@ tasks.processResources {
inputs.property("forgeVersion", libs.versions.forge.get()) inputs.property("forgeVersion", libs.versions.forge.get())
inputs.property("gitHash", cct.gitHash) inputs.property("gitHash", cct.gitHash)
filesMatching("data/computercraft/lua/rom/help/credits.txt") { filesMatching("data/computercraft/lua/rom/help/credits.md") {
expand(mapOf("gitContributors" to cct.gitContributors.get().joinToString("\n"))) expand(mapOf("gitContributors" to cct.gitContributors.get().joinToString("\n")))
} }
@@ -337,14 +320,25 @@ val lintLua by tasks.registering(IlluaminateExec::class) {
doLast { if (System.getenv("GITHUB_ACTIONS") != null) println("::remove-matcher owner=illuaminate::") } doLast { if (System.getenv("GITHUB_ACTIONS") != null) println("::remove-matcher owner=illuaminate::") }
} }
val setupRunGametest by tasks.registering(Copy::class) {
group = LifecycleBasePlugin.VERIFICATION_GROUP
description = "Sets up the environment for the test server."
from("src/testMod/server-files") {
include("eula.txt")
include("server.properties")
}
into("run/testServer")
}
val runGametest by tasks.registering(JavaExec::class) { val runGametest by tasks.registering(JavaExec::class) {
group = LifecycleBasePlugin.VERIFICATION_GROUP group = LifecycleBasePlugin.VERIFICATION_GROUP
description = "Runs tests on a temporary Minecraft instance." description = "Runs tests on a temporary Minecraft instance."
dependsOn("cleanRunGametest") dependsOn(setupRunGametest, "cleanRunGametest")
// Copy from runGameTestServer. We do it in this slightly odd way as runGameTestServer // Copy from runTestServer. We do it in this slightly odd way as runTestServer
// isn't created until the task is configured (which is no good for us). // isn't created until the task is configured (which is no good for us).
val exec = tasks.getByName<JavaExec>("runGameTestServer") val exec = tasks.getByName<JavaExec>("runTestServer")
dependsOn(exec.dependsOn) dependsOn(exec.dependsOn)
exec.copyToFull(this) exec.copyToFull(this)
} }
@@ -370,7 +364,7 @@ val publishCurseForge by tasks.registering(TaskPublishCurseForge::class) {
apiToken = findProperty("curseForgeApiKey") ?: "" apiToken = findProperty("curseForgeApiKey") ?: ""
enabled = apiToken != "" enabled = apiToken != ""
val mainFile = upload("282001", tasks.shadowJar) val mainFile = upload("282001", tasks.shadowJar.get().archiveFile)
dependsOn(tasks.shadowJar) // Ughr. dependsOn(tasks.shadowJar) // Ughr.
mainFile.changelog = "Release notes can be found on the [GitHub repository](https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v$mcVersion-$modVersion)." mainFile.changelog = "Release notes can be found on the [GitHub repository](https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v$mcVersion-$modVersion)."
mainFile.changelogType = "markdown" mainFile.changelogType = "markdown"
@@ -451,6 +445,8 @@ publishing {
repositories { repositories {
maven("https://squiddev.cc/maven") { maven("https://squiddev.cc/maven") {
name = "SquidDev" name = "SquidDev"
credentials(PasswordCredentials::class)
} }
} }
} }

View File

@@ -26,12 +26,12 @@ abstract class CCTweakedExtension(
) { ) {
/** Get the hash of the latest git commit. */ /** Get the hash of the latest git commit. */
val gitHash: Provider<String> = gitProvider(project, "<no git hash>") { val gitHash: Provider<String> = gitProvider(project, "<no git hash>") {
ProcessHelpers.captureOut("git", "-C", project.projectDir.absolutePath, "rev-parse", "HEAD") ProcessHelpers.captureOut("git", "-C", project.projectDir.absolutePath, "rev-parse", "HEAD").trim()
} }
/** Get the current git branch. */ /** Get the current git branch. */
val gitBranch: Provider<String> = gitProvider(project, "<no git branch>") { val gitBranch: Provider<String> = gitProvider(project, "<no git branch>") {
ProcessHelpers.captureOut("git", "-C", project.projectDir.absolutePath, "rev-parse", "--abbrev-ref", "HEAD") ProcessHelpers.captureOut("git", "-C", project.projectDir.absolutePath, "rev-parse", "--abbrev-ref", "HEAD").trim()
} }
/** Get a list of all contributors to the project. */ /** Get a list of all contributors to the project. */

View File

@@ -13,6 +13,6 @@ class CCTweakedPlugin : Plugin<Project> {
} }
companion object { companion object {
val JAVA_VERSION = JavaLanguageVersion.of(17) val JAVA_VERSION = JavaLanguageVersion.of(8)
} }
} }

View File

@@ -58,29 +58,20 @@
<module name="SimplifyBooleanExpression" /> <module name="SimplifyBooleanExpression" />
<module name="SimplifyBooleanReturn" /> <module name="SimplifyBooleanReturn" />
<module name="StringLiteralEquality" /> <module name="StringLiteralEquality" />
<module name="UnnecessaryParentheses"> <module name="UnnecessaryParentheses" />
<!-- Default minus LAND. -->
<property name="tokens" value="EXPR,IDENT,NUM_DOUBLE,NUM_FLOAT,NUM_INT,NUM_LONG,STRING_LITERAL,LITERAL_NULL,LITERAL_FALSE,LITERAL_TRUE,ASSIGN,BAND_ASSIGN,BOR_ASSIGN,BSR_ASSIGN,BXOR_ASSIGN,DIV_ASSIGN,MINUS_ASSIGN,MOD_ASSIGN,PLUS_ASSIGN,SL_ASSIGN,SR_ASSIGN,STAR_ASSIGN,LAMBDA,TEXT_BLOCK_LITERAL_BEGIN,LITERAL_INSTANCEOF,GT,LT,GE,LE,EQUAL,NOT_EQUAL,UNARY_MINUS,UNARY_PLUS,INC,DEC,LNOT,BNOT,POST_INC,POST_DEC" />
</module>
<module name="UnnecessarySemicolonAfterTypeMemberDeclaration" /> <module name="UnnecessarySemicolonAfterTypeMemberDeclaration" />
<module name="UnnecessarySemicolonInTryWithResources" /> <module name="UnnecessarySemicolonInTryWithResources" />
<module name="UnnecessarySemicolonInEnumeration" /> <module name="UnnecessarySemicolonInEnumeration" />
<!-- Imports --> <!-- Imports -->
<module name="CustomImportOrder"> <module name="CustomImportOrder" />
<property name="customImportOrderRules"
value="THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE###STATIC"
/>
</module>
<module name="IllegalImport" /> <module name="IllegalImport" />
<module name="RedundantImport" /> <module name="RedundantImport" />
<module name="UnusedImports" /> <module name="UnusedImports" />
<!-- Javadoc --> <!-- Javadoc -->
<!-- TODO: Missing* checks for the dan200.computercraft.api package? --> <!-- TODO: Missing* checks for the dan200.computercraft.api package? -->
<module name="AtclauseOrder"> <module name="AtclauseOrder" />
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
</module>
<module name="InvalidJavadocPosition" /> <module name="InvalidJavadocPosition" />
<module name="JavadocBlockTagLocation" /> <module name="JavadocBlockTagLocation" />
<module name="JavadocMethod"/> <module name="JavadocMethod"/>
@@ -109,9 +100,7 @@
<module name="LocalFinalVariableName" /> <module name="LocalFinalVariableName" />
<module name="LocalVariableName" /> <module name="LocalVariableName" />
<module name="MemberName" /> <module name="MemberName" />
<module name="MethodName"> <module name="MethodName" />
<property name="format" value="^(computercraft\$)?[a-z][a-zA-Z0-9]*$" />
</module>
<module name="MethodTypeParameterName" /> <module name="MethodTypeParameterName" />
<module name="PackageName"> <module name="PackageName">
<property name="format" value="^dan200\.computercraft(\.[a-z][a-z0-9]*)*" /> <property name="format" value="^dan200\.computercraft(\.[a-z][a-z0-9]*)*" />
@@ -119,6 +108,11 @@
<module name="ParameterName" /> <module name="ParameterName" />
<module name="StaticVariableName"> <module name="StaticVariableName">
<property name="format" value="^[a-z][a-zA-Z0-9]*|CAPABILITY(_[A-Z_]+)?$" /> <property name="format" value="^[a-z][a-zA-Z0-9]*|CAPABILITY(_[A-Z_]+)?$" />
<property name="applyToPrivate" value="false" />
</module>
<module name="StaticVariableName">
<property name="format" value="^(s_)?[a-z][a-zA-Z0-9]*|CAPABILITY(_[A-Z_]+)?$" />
<property name="applyToPrivate" value="true" />
</module> </module>
<module name="TypeName" /> <module name="TypeName" />
@@ -162,7 +156,6 @@
<property name="allowEmptyLambdas" value="true" /> <property name="allowEmptyLambdas" value="true" />
<property name="allowEmptyMethods" value="true" /> <property name="allowEmptyMethods" value="true" />
<property name="allowEmptyConstructors" value="true" /> <property name="allowEmptyConstructors" value="true" />
<property name="allowEmptyTypes" value="true" />
<property name="tokens" value="ASSIGN,BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,COLON,DIV,DIV_ASSIGN,EQUAL,GE,GT,LAMBDA,LAND,LCURLY,LE,LITERAL_RETURN,LOR,LT,MINUS,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS,PLUS_ASSIGN,QUESTION,RCURLY,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,LITERAL_ASSERT,TYPE_EXTENSION_AND" /> <property name="tokens" value="ASSIGN,BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,COLON,DIV,DIV_ASSIGN,EQUAL,GE,GT,LAMBDA,LAND,LCURLY,LE,LITERAL_RETURN,LOR,LT,MINUS,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS,PLUS_ASSIGN,QUESTION,RCURLY,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,LITERAL_ASSERT,TYPE_EXTENSION_AND" />
</module> </module>

View File

@@ -3,6 +3,6 @@ FROM gitpod/workspace-base
USER gitpod USER gitpod
RUN sudo apt-get -q update \ RUN sudo apt-get -q update \
&& sudo apt-get install -yq openjdk-16-jdk python3-pip npm \ && sudo apt-get install -yq openjdk-8-jdk openjdk-16-jdk python3-pip npm \
&& sudo pip3 install pre-commit \ && sudo pip3 install pre-commit \
&& sudo update-java-alternatives --set java-1.16.0-openjdk-amd64 && sudo update-java-alternatives --set java-1.8.0-openjdk-amd64

View File

@@ -1,64 +0,0 @@
--- @module fs
--- Returns true if a path is mounted to the parent filesystem.
--
-- The root filesystem "/" is considered a mount, along with disk folders and
-- the rom folder. Other programs (such as network shares) can exstend this to
-- make other mount types by correctly assigning their return value for getDrive.
--
-- @tparam string path The path to check.
-- @treturn boolean If the path is mounted, rather than a normal file/folder.
-- @throws If the path does not exist.
-- @see getDrive
-- @since 1.87.0
function isDriveRoot(path) end
--[[- Provides completion for a file or directory name, suitable for use with
@{_G.read}.
When a directory is a possible candidate for completion, two entries are
included - one with a trailing slash (indicating that entries within this
directory exist) and one without it (meaning this entry is an immediate
completion candidate). `include_dirs` can be set to @{false} to only include
those with a trailing slash.
@tparam[1] string path The path to complete.
@tparam[1] string location The location where paths are resolved from.
@tparam[1,opt=true] boolean include_files When @{false}, only directories will
be included in the returned list.
@tparam[1,opt=true] boolean include_dirs When @{false}, "raw" directories will
not be included in the returned list.
@tparam[2] string path The path to complete.
@tparam[2] string location The location where paths are resolved from.
@tparam[2] {
include_dirs? = boolean, include_files? = boolean,
include_hidden? = boolean
} options
This table form is an expanded version of the previous syntax. The
`include_files` and `include_dirs` arguments from above are passed in as fields.
This table also accepts the following options:
- `include_hidden`: Whether to include hidden files (those starting with `.`)
by default. They will still be shown when typing a `.`.
@treturn { string... } A list of possible completion candidates.
@since 1.74
@changed 1.101.0
@usage Complete files in the root directory.
read(nil, nil, function(str)
return fs.complete(str, "", true, false)
end)
@usage Complete files in the root directory, hiding hidden files by default.
read(nil, nil, function(str)
return fs.complete(str, "", {
include_files = true,
include_dirs = false,
included_hidden = false,
})
end)
]]
function complete(path, location, include_files, include_dirs) end

View File

@@ -1,177 +0,0 @@
--- Make HTTP requests, sending and receiving data to a remote web server.
--
-- @module http
-- @since 1.1
-- @see local_ips To allow accessing servers running on your local network.
--- Asynchronously make a HTTP request to the given url.
--
-- This returns immediately, a @{http_success} or @{http_failure} will be queued
-- once the request has completed.
--
-- @tparam string url The url to request
-- @tparam[opt] string body An optional string containing the body of the
-- request. If specified, a `POST` request will be made instead.
-- @tparam[opt] { [string] = string } headers Additional headers to send as part
-- of this request.
-- @tparam[opt] boolean binary Whether to make a binary HTTP request. If true,
-- the body will not be UTF-8 encoded, and the received response will not be
-- decoded.
--
-- @tparam[2] {
-- url = string, body? = string, headers? = { [string] = string },
-- binary? = boolean, method? = string, redirect? = boolean,
-- } request Options for the request.
--
-- This table form is an expanded version of the previous syntax. All arguments
-- from above are passed in as fields instead (for instance,
-- `http.request("https://example.com")` becomes `http.request { url =
-- "https://example.com" }`).
--
-- This table also accepts several additional options:
--
-- - `method`: Which HTTP method to use, for instance `"PATCH"` or `"DELETE"`.
-- - `redirect`: Whether to follow HTTP redirects. Defaults to true.
--
-- @see http.get For a synchronous way to make GET requests.
-- @see http.post For a synchronous way to make POST requests.
--
-- @changed 1.63 Added argument for headers.
-- @changed 1.80pr1 Added argument for binary handles.
-- @changed 1.80pr1.6 Added support for table argument.
-- @changed 1.86.0 Added PATCH and TRACE methods.
function request(...) end
--- Make a HTTP GET request to the given url.
--
-- @tparam string url The url to request
-- @tparam[opt] { [string] = string } headers Additional headers to send as part
-- of this request.
-- @tparam[opt] boolean binary Whether to make a binary HTTP request. If true,
-- the body will not be UTF-8 encoded, and the received response will not be
-- decoded.
--
-- @tparam[2] {
-- url = string, headers? = { [string] = string },
-- binary? = boolean, method? = string, redirect? = boolean,
-- } request Options for the request. See @{http.request} for details on how
-- these options behave.
--
-- @treturn Response The resulting http response, which can be read from.
-- @treturn[2] nil When the http request failed, such as in the event of a 404
-- error or connection timeout.
-- @treturn string A message detailing why the request failed.
-- @treturn Response|nil The failing http response, if available.
--
-- @changed 1.63 Added argument for headers.
-- @changed 1.80pr1 Response handles are now returned on error if available.
-- @changed 1.80pr1 Added argument for binary handles.
-- @changed 1.80pr1.6 Added support for table argument.
-- @changed 1.86.0 Added PATCH and TRACE methods.
--
-- @usage Make a request to [example.tweaked.cc](https://example.tweaked.cc),
-- and print the returned page.
-- ```lua
-- local request = http.get("https://example.tweaked.cc")
-- print(request.readAll())
-- -- => HTTP is working!
-- request.close()
-- ```
function get(...) end
--- Make a HTTP POST request to the given url.
--
-- @tparam string url The url to request
-- @tparam string body The body of the POST request.
-- @tparam[opt] { [string] = string } headers Additional headers to send as part
-- of this request.
-- @tparam[opt] boolean binary Whether to make a binary HTTP request. If true,
-- the body will not be UTF-8 encoded, and the received response will not be
-- decoded.
--
-- @tparam[2] {
-- url = string, body? = string, headers? = { [string] = string },
-- binary? = boolean, method? = string, redirect? = boolean,
-- } request Options for the request. See @{http.request} for details on how
-- these options behave.
--
-- @treturn Response The resulting http response, which can be read from.
-- @treturn[2] nil When the http request failed, such as in the event of a 404
-- error or connection timeout.
-- @treturn string A message detailing why the request failed.
-- @treturn Response|nil The failing http response, if available.
--
-- @since 1.31
-- @changed 1.63 Added argument for headers.
-- @changed 1.80pr1 Response handles are now returned on error if available.
-- @changed 1.80pr1 Added argument for binary handles.
-- @changed 1.80pr1.6 Added support for table argument.
-- @changed 1.86.0 Added PATCH and TRACE methods.
function post(...) end
--- Asynchronously determine whether a URL can be requested.
--
-- If this returns `true`, one should also listen for @{http_check} which will
-- container further information about whether the URL is allowed or not.
--
-- @tparam string url The URL to check.
-- @treturn true When this url is not invalid. This does not imply that it is
-- allowed - see the comment above.
-- @treturn[2] false When this url is invalid.
-- @treturn string A reason why this URL is not valid (for instance, if it is
-- malformed, or blocked).
--
-- @see http.checkURL For a synchronous version.
function checkURLAsync(url) end
--- Determine whether a URL can be requested.
--
-- If this returns `true`, one should also listen for @{http_check} which will
-- container further information about whether the URL is allowed or not.
--
-- @tparam string url The URL to check.
-- @treturn true When this url is valid and can be requested via @{http.request}.
-- @treturn[2] false When this url is invalid.
-- @treturn string A reason why this URL is not valid (for instance, if it is
-- malformed, or blocked).
--
-- @see http.checkURLAsync For an asynchronous version.
--
-- @usage
-- ```lua
-- print(http.checkURL("https://example.tweaked.cc/"))
-- -- => true
-- print(http.checkURL("http://localhost/"))
-- -- => false Domain not permitted
-- print(http.checkURL("not a url"))
-- -- => false URL malformed
-- ```
function checkURL(url) end
--- Open a websocket.
--
-- @tparam string url The websocket url to connect to. This should have the
-- `ws://` or `wss://` protocol.
-- @tparam[opt] { [string] = string } headers Additional headers to send as part
-- of the initial websocket connection.
--
-- @treturn Websocket The websocket connection.
-- @treturn[2] false If the websocket connection failed.
-- @treturn string An error message describing why the connection failed.
-- @since 1.80pr1.1
-- @changed 1.80pr1.3 No longer asynchronous.
-- @changed 1.95.3 Added User-Agent to default headers.
function websocket(url, headers) end
--- Asynchronously open a websocket.
--
-- This returns immediately, a @{websocket_success} or @{websocket_failure}
-- will be queued once the request has completed.
--
-- @tparam string url The websocket url to connect to. This should have the
-- `ws://` or `wss://` protocol.
-- @tparam[opt] { [string] = string } headers Additional headers to send as part
-- of the initial websocket connection.
-- @since 1.80pr1.3
-- @changed 1.95.3 Added User-Agent to default headers.
function websocketAsync(url, headers) end

View File

@@ -5,7 +5,7 @@ kotlin.stdlib.default.dependency=false
kotlin.jvm.target.validation.mode=error kotlin.jvm.target.validation.mode=error
# Mod properties # Mod properties
modVersion=1.101.0 modVersion=1.101.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.18.2 mcVersion=1.16.5

View File

@@ -2,12 +2,12 @@
# Minecraft # Minecraft
# MC version is specified in gradle.properties, as we need that in settings.gradle. # MC version is specified in gradle.properties, as we need that in settings.gradle.
forge = "40.1.0" forge = "36.2.34"
parchment = "2022.03.13" parchment = "2021.08.08"
parchmentMc = "1.18.2" parchmentMc = "1.16.5"
autoService = "1.0.1" autoService = "1.0.1"
cobalt = { strictly = "[0.5.8,0.6.0)", prefer = "0.5.8" } cobalt = "0.6.0"
jetbrainsAnnotations = "23.0.0" jetbrainsAnnotations = "23.0.0"
kotlin = "1.7.10" kotlin = "1.7.10"
kotlin-coroutines = "1.6.0" kotlin-coroutines = "1.6.0"
@@ -19,11 +19,11 @@ junit = "5.9.1"
# Build tools # Build tools
cctJavadoc = "1.5.2" cctJavadoc = "1.5.2"
checkstyle = "10.3.4" checkstyle = "8.25" # There's a reason we're pinned on an ancient version, but I can't remember what it is.
curseForgeGradle = "1.0.11" curseForgeGradle = "1.0.11"
forgeGradle = "5.1.+" forgeGradle = "5.1.+"
githubRelease = "2.2.12" githubRelease = "2.2.12"
illuaminate = "0.1.0-7-g2a5a89c" illuaminate = "0.1.0-20-g8c483a4"
librarian = "1.+" librarian = "1.+"
minotaur = "2.+" minotaur = "2.+"
mixinGradle = "0.7.+" mixinGradle = "0.7.+"

View File

@@ -111,6 +111,6 @@
(lint (lint
(globals (globals
:max sleep write :max sleep write
cct_test describe expect howlci fail it pending stub))) cct_test describe expect howlci fail it pending stub before_each)))
(at /src/web/mount/expr_template.lua (lint (globals :max __expr__))) (at /src/web/mount/expr_template.lua (lint (globals :max __expr__)))

View File

@@ -3,8 +3,8 @@
{ {
"when": { "when": {
"OR": [ "OR": [
{"up": "true", "north": "false", "west": "false", "south": "false", "east": "false", "cable": "true"}, {"east": "false", "north": "false", "south": "false", "cable": "true", "up": "true", "west": "false"},
{"north": "false", "west": "false", "south": "false", "east": "false", "down": "true", "cable": "true"} {"down": "true", "east": "false", "north": "false", "south": "false", "cable": "true", "west": "false"}
] ]
}, },
"apply": {"model": "computercraft:block/cable_core_facing", "x": 90} "apply": {"model": "computercraft:block/cable_core_facing", "x": 90}
@@ -13,16 +13,16 @@
"when": { "when": {
"OR": [ "OR": [
{ {
"up": "false",
"north": "false",
"west": "false",
"south": "false",
"east": "false",
"down": "false", "down": "false",
"cable": "true" "east": "false",
"north": "false",
"south": "false",
"cable": "true",
"up": "false",
"west": "false"
}, },
{"up": "false", "west": "false", "north": "true", "east": "false", "down": "false", "cable": "true"}, {"down": "false", "east": "false", "north": "true", "cable": "true", "up": "false", "west": "false"},
{"up": "false", "west": "false", "south": "true", "east": "false", "down": "false", "cable": "true"} {"down": "false", "east": "false", "south": "true", "cable": "true", "up": "false", "west": "false"}
] ]
}, },
"apply": {"model": "computercraft:block/cable_core_facing", "y": 0} "apply": {"model": "computercraft:block/cable_core_facing", "y": 0}
@@ -30,8 +30,8 @@
{ {
"when": { "when": {
"OR": [ "OR": [
{"up": "false", "north": "false", "south": "false", "east": "true", "down": "false", "cable": "true"}, {"down": "false", "east": "true", "north": "false", "south": "false", "cable": "true", "up": "false"},
{"up": "false", "north": "false", "west": "true", "south": "false", "down": "false", "cable": "true"} {"down": "false", "north": "false", "south": "false", "cable": "true", "up": "false", "west": "true"}
] ]
}, },
"apply": {"model": "computercraft:block/cable_core_facing", "y": 90} "apply": {"model": "computercraft:block/cable_core_facing", "y": 90}
@@ -39,18 +39,18 @@
{ {
"when": { "when": {
"OR": [ "OR": [
{"north": "true", "down": "true", "cable": "true"}, {"down": "true", "north": "true", "cable": "true"},
{"south": "true", "down": "true", "cable": "true"}, {"down": "true", "south": "true", "cable": "true"},
{"west": "true", "down": "true", "cable": "true"}, {"down": "true", "cable": "true", "west": "true"},
{"east": "true", "down": "true", "cable": "true"}, {"down": "true", "east": "true", "cable": "true"},
{"up": "true", "north": "true", "cable": "true"}, {"north": "true", "cable": "true", "up": "true"},
{"up": "true", "south": "true", "cable": "true"}, {"south": "true", "cable": "true", "up": "true"},
{"up": "true", "west": "true", "cable": "true"}, {"cable": "true", "up": "true", "west": "true"},
{"up": "true", "east": "true", "cable": "true"}, {"east": "true", "cable": "true", "up": "true"},
{"north": "true", "west": "true", "cable": "true"}, {"north": "true", "cable": "true", "west": "true"},
{"north": "true", "east": "true", "cable": "true"}, {"east": "true", "north": "true", "cable": "true"},
{"west": "true", "south": "true", "cable": "true"}, {"south": "true", "cable": "true", "west": "true"},
{"south": "true", "east": "true", "cable": "true"} {"east": "true", "south": "true", "cable": "true"}
] ]
}, },
"apply": {"model": "computercraft:block/cable_core_any"} "apply": {"model": "computercraft:block/cable_core_any"}

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "minecraft:redstone"
"minecraft:redstone"
]
}, },
{ {
"items": [ "item": "minecraft:gold_ingot"
"minecraft:gold_ingot"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:computer_normal"
"computercraft:computer_normal"
]
}, },
{ {
"tag": "forge:ingots/gold" "tag": "forge:ingots/gold"

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "minecraft:command_block"
"minecraft:command_block"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:disk_drive"
"computercraft:disk_drive"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:disk_drive"
"computercraft:disk_drive"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:disk_drive"
"computercraft:disk_drive"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:disk_drive"
"computercraft:disk_drive"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:disk_drive"
"computercraft:disk_drive"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:disk_drive"
"computercraft:disk_drive"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:disk_drive"
"computercraft:disk_drive"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:disk_drive"
"computercraft:disk_drive"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:disk_drive"
"computercraft:disk_drive"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:disk_drive"
"computercraft:disk_drive"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:disk_drive"
"computercraft:disk_drive"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:disk_drive"
"computercraft:disk_drive"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:disk_drive"
"computercraft:disk_drive"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:disk_drive"
"computercraft:disk_drive"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:disk_drive"
"computercraft:disk_drive"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:disk_drive"
"computercraft:disk_drive"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:pocket_computer_advanced"
"computercraft:pocket_computer_advanced"
]
}, },
{ {
"items": [ "item": "computercraft:speaker"
"computercraft:speaker"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:pocket_computer_advanced"
"computercraft:pocket_computer_advanced"
]
}, },
{ {
"items": [ "item": "computercraft:wireless_modem_advanced"
"computercraft:wireless_modem_advanced"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:pocket_computer_advanced"
"computercraft:pocket_computer_advanced"
]
}, },
{ {
"items": [ "item": "computercraft:wireless_modem_normal"
"computercraft:wireless_modem_normal"
]
} }
] ]
} }

View File

@@ -21,9 +21,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "minecraft:golden_apple"
"minecraft:golden_apple"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:pocket_computer_normal"
"computercraft:pocket_computer_normal"
]
}, },
{ {
"tag": "forge:ingots/gold" "tag": "forge:ingots/gold"

View File

@@ -21,9 +21,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "minecraft:golden_apple"
"minecraft:golden_apple"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:pocket_computer_normal"
"computercraft:pocket_computer_normal"
]
}, },
{ {
"items": [ "item": "computercraft:speaker"
"computercraft:speaker"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:pocket_computer_normal"
"computercraft:pocket_computer_normal"
]
}, },
{ {
"items": [ "item": "computercraft:wireless_modem_advanced"
"computercraft:wireless_modem_advanced"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:pocket_computer_normal"
"computercraft:pocket_computer_normal"
]
}, },
{ {
"items": [ "item": "computercraft:wireless_modem_normal"
"computercraft:wireless_modem_normal"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:printer"
"computercraft:printer"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:printer"
"computercraft:printer"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:computer_normal"
"computercraft:computer_normal"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:turtle_advanced"
"computercraft:turtle_advanced"
]
}, },
{ {
"items": [ "item": "computercraft:speaker"
"computercraft:speaker"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:turtle_advanced"
"computercraft:turtle_advanced"
]
}, },
{ {
"items": [ "item": "computercraft:wireless_modem_advanced"
"computercraft:wireless_modem_advanced"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:turtle_advanced"
"computercraft:turtle_advanced"
]
}, },
{ {
"items": [ "item": "computercraft:wireless_modem_normal"
"computercraft:wireless_modem_normal"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:turtle_advanced"
"computercraft:turtle_advanced"
]
}, },
{ {
"items": [ "item": "minecraft:crafting_table"
"minecraft:crafting_table"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:turtle_advanced"
"computercraft:turtle_advanced"
]
}, },
{ {
"items": [ "item": "minecraft:diamond_axe"
"minecraft:diamond_axe"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:turtle_advanced"
"computercraft:turtle_advanced"
]
}, },
{ {
"items": [ "item": "minecraft:diamond_hoe"
"minecraft:diamond_hoe"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:turtle_advanced"
"computercraft:turtle_advanced"
]
}, },
{ {
"items": [ "item": "minecraft:diamond_pickaxe"
"minecraft:diamond_pickaxe"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:turtle_advanced"
"computercraft:turtle_advanced"
]
}, },
{ {
"items": [ "item": "minecraft:diamond_shovel"
"minecraft:diamond_shovel"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:turtle_advanced"
"computercraft:turtle_advanced"
]
}, },
{ {
"items": [ "item": "minecraft:diamond_sword"
"minecraft:diamond_sword"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:turtle_normal"
"computercraft:turtle_normal"
]
}, },
{ {
"tag": "forge:ingots/gold" "tag": "forge:ingots/gold"

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:computer_normal"
"computercraft:computer_normal"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:turtle_normal"
"computercraft:turtle_normal"
]
}, },
{ {
"items": [ "item": "computercraft:speaker"
"computercraft:speaker"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:turtle_normal"
"computercraft:turtle_normal"
]
}, },
{ {
"items": [ "item": "computercraft:wireless_modem_advanced"
"computercraft:wireless_modem_advanced"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:turtle_normal"
"computercraft:turtle_normal"
]
}, },
{ {
"items": [ "item": "computercraft:wireless_modem_normal"
"computercraft:wireless_modem_normal"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:turtle_normal"
"computercraft:turtle_normal"
]
}, },
{ {
"items": [ "item": "minecraft:crafting_table"
"minecraft:crafting_table"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:turtle_normal"
"computercraft:turtle_normal"
]
}, },
{ {
"items": [ "item": "minecraft:diamond_axe"
"minecraft:diamond_axe"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:turtle_normal"
"computercraft:turtle_normal"
]
}, },
{ {
"items": [ "item": "minecraft:diamond_hoe"
"minecraft:diamond_hoe"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:turtle_normal"
"computercraft:turtle_normal"
]
}, },
{ {
"items": [ "item": "minecraft:diamond_pickaxe"
"minecraft:diamond_pickaxe"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:turtle_normal"
"computercraft:turtle_normal"
]
}, },
{ {
"items": [ "item": "minecraft:diamond_shovel"
"minecraft:diamond_shovel"
]
} }
] ]
} }

View File

@@ -11,14 +11,10 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:turtle_normal"
"computercraft:turtle_normal"
]
}, },
{ {
"items": [ "item": "minecraft:diamond_sword"
"minecraft:diamond_sword"
]
} }
] ]
} }

View File

@@ -21,9 +21,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:cable"
"computercraft:cable"
]
} }
] ]
} }

View File

@@ -21,9 +21,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:wireless_modem_normal"
"computercraft:wireless_modem_normal"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:monitor_normal"
"computercraft:monitor_normal"
]
} }
] ]
} }

View File

@@ -11,9 +11,7 @@
"conditions": { "conditions": {
"items": [ "items": [
{ {
"items": [ "item": "computercraft:computer_advanced"
"computercraft:computer_advanced"
]
} }
] ]
} }

View File

@@ -1,4 +0,0 @@
{
"type": "computercraft:speaker",
"item": "computercraft:speaker"
}

View File

@@ -1,4 +0,0 @@
{
"type": "computercraft:wireless_modem_advanced",
"item": "computercraft:wireless_modem_advanced"
}

View File

@@ -1,4 +0,0 @@
{
"type": "computercraft:wireless_modem_normal",
"item": "computercraft:wireless_modem_normal"
}

View File

@@ -1,4 +0,0 @@
{
"type": "computercraft:speaker",
"item": "computercraft:speaker"
}

View File

@@ -1,4 +0,0 @@
{
"type": "computercraft:wireless_modem_advanced",
"item": "computercraft:wireless_modem_advanced"
}

View File

@@ -1,4 +0,0 @@
{
"type": "computercraft:wireless_modem_normal",
"item": "computercraft:wireless_modem_normal"
}

View File

@@ -2,8 +2,7 @@
"type": "minecraft:block", "type": "minecraft:block",
"pools": [ "pools": [
{ {
"rolls": 1.0, "rolls": 1,
"bonus_rolls": 0.0,
"entries": [ "entries": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
@@ -24,8 +23,7 @@
] ]
}, },
{ {
"rolls": 1.0, "rolls": 1,
"bonus_rolls": 0.0,
"entries": [ "entries": [
{ {
"type": "minecraft:item", "type": "minecraft:item",

View File

@@ -2,8 +2,7 @@
"type": "minecraft:block", "type": "minecraft:block",
"pools": [ "pools": [
{ {
"rolls": 1.0, "rolls": 1,
"bonus_rolls": 0.0,
"entries": [ "entries": [
{ {
"type": "minecraft:dynamic", "type": "minecraft:dynamic",

View File

@@ -2,8 +2,7 @@
"type": "minecraft:block", "type": "minecraft:block",
"pools": [ "pools": [
{ {
"rolls": 1.0, "rolls": 1,
"bonus_rolls": 0.0,
"entries": [ "entries": [
{ {
"type": "minecraft:dynamic", "type": "minecraft:dynamic",

View File

@@ -2,8 +2,7 @@
"type": "minecraft:block", "type": "minecraft:block",
"pools": [ "pools": [
{ {
"rolls": 1.0, "rolls": 1,
"bonus_rolls": 0.0,
"entries": [ "entries": [
{ {
"type": "minecraft:dynamic", "type": "minecraft:dynamic",

View File

@@ -2,8 +2,7 @@
"type": "minecraft:block", "type": "minecraft:block",
"pools": [ "pools": [
{ {
"rolls": 1.0, "rolls": 1,
"bonus_rolls": 0.0,
"entries": [ "entries": [
{ {
"type": "minecraft:item", "type": "minecraft:item",

View File

@@ -2,8 +2,7 @@
"type": "minecraft:block", "type": "minecraft:block",
"pools": [ "pools": [
{ {
"rolls": 1.0, "rolls": 1,
"bonus_rolls": 0.0,
"entries": [ "entries": [
{ {
"type": "minecraft:item", "type": "minecraft:item",

View File

@@ -2,8 +2,7 @@
"type": "minecraft:block", "type": "minecraft:block",
"pools": [ "pools": [
{ {
"rolls": 1.0, "rolls": 1,
"bonus_rolls": 0.0,
"entries": [ "entries": [
{ {
"type": "minecraft:item", "type": "minecraft:item",

View File

@@ -2,8 +2,7 @@
"type": "minecraft:block", "type": "minecraft:block",
"pools": [ "pools": [
{ {
"rolls": 1.0, "rolls": 1,
"bonus_rolls": 0.0,
"entries": [ "entries": [
{ {
"type": "minecraft:item", "type": "minecraft:item",

View File

@@ -2,8 +2,7 @@
"type": "minecraft:block", "type": "minecraft:block",
"pools": [ "pools": [
{ {
"rolls": 1.0, "rolls": 1,
"bonus_rolls": 0.0,
"entries": [ "entries": [
{ {
"type": "minecraft:item", "type": "minecraft:item",

View File

@@ -2,8 +2,7 @@
"type": "minecraft:block", "type": "minecraft:block",
"pools": [ "pools": [
{ {
"rolls": 1.0, "rolls": 1,
"bonus_rolls": 0.0,
"entries": [ "entries": [
{ {
"type": "minecraft:dynamic", "type": "minecraft:dynamic",

View File

@@ -2,8 +2,7 @@
"type": "minecraft:block", "type": "minecraft:block",
"pools": [ "pools": [
{ {
"rolls": 1.0, "rolls": 1,
"bonus_rolls": 0.0,
"entries": [ "entries": [
{ {
"type": "minecraft:dynamic", "type": "minecraft:dynamic",

View File

@@ -2,8 +2,7 @@
"type": "minecraft:block", "type": "minecraft:block",
"pools": [ "pools": [
{ {
"rolls": 1.0, "rolls": 1,
"bonus_rolls": 0.0,
"entries": [ "entries": [
{ {
"type": "minecraft:item", "type": "minecraft:item",

View File

@@ -2,8 +2,7 @@
"type": "minecraft:block", "type": "minecraft:block",
"pools": [ "pools": [
{ {
"rolls": 1.0, "rolls": 1,
"bonus_rolls": 0.0,
"entries": [ "entries": [
{ {
"type": "minecraft:item", "type": "minecraft:item",

View File

@@ -2,8 +2,7 @@
"type": "minecraft:block", "type": "minecraft:block",
"pools": [ "pools": [
{ {
"rolls": 1.0, "rolls": 1,
"bonus_rolls": 0.0,
"entries": [ "entries": [
{ {
"type": "minecraft:item", "type": "minecraft:item",

View File

@@ -10,7 +10,7 @@
"tag": "forge:ingots/gold" "tag": "forge:ingots/gold"
}, },
"C": { "C": {
"item": "computercraft:computer_advanced" "item": "computercraft:computer_normal"
} }
}, },
"result": { "result": {

View File

@@ -10,7 +10,7 @@
"tag": "forge:ingots/gold" "tag": "forge:ingots/gold"
}, },
"C": { "C": {
"item": "computercraft:computer_advanced" "item": "computercraft:turtle_normal"
}, },
"B": { "B": {
"tag": "forge:storage_blocks/gold" "tag": "forge:storage_blocks/gold"

View File

@@ -2,7 +2,6 @@
"replace": false, "replace": false,
"values": [ "values": [
"#minecraft:crops", "#minecraft:crops",
"#minecraft:mineable/hoe",
"minecraft:cactus", "minecraft:cactus",
"minecraft:melon", "minecraft:melon",
"minecraft:pumpkin", "minecraft:pumpkin",

View File

@@ -1,7 +1,6 @@
{ {
"replace": false, "replace": false,
"values": [ "values": [
"#minecraft:mineable/shovel",
"minecraft:melon", "minecraft:melon",
"minecraft:pumpkin", "minecraft:pumpkin",
"minecraft:carved_pumpkin", "minecraft:carved_pumpkin",

View File

@@ -1,4 +0,0 @@
{
"type": "computercraft:workbench",
"item": "minecraft:crafting_table"
}

View File

@@ -1,5 +0,0 @@
{
"type": "computercraft:tool",
"item": "minecraft:diamond_axe",
"damageMultiplier": 6.0
}

View File

@@ -1,5 +0,0 @@
{
"type": "computercraft:tool",
"item": "minecraft:diamond_hoe",
"breakable": "computercraft:turtle_hoe_harvestable"
}

View File

@@ -1,4 +0,0 @@
{
"type": "computercraft:tool",
"item": "minecraft:diamond_pickaxe"
}

View File

@@ -1,5 +0,0 @@
{
"type": "computercraft:tool",
"item": "minecraft:diamond_shovel",
"breakable": "computercraft:turtle_shovel_harvestable"
}

View File

@@ -1,6 +0,0 @@
{
"type": "computercraft:tool",
"item": "minecraft:diamond_sword",
"damageMultiplier": 9.0,
"breakable": "computercraft:turtle_sword_harvestable"
}

View File

@@ -1,18 +0,0 @@
{
"replace": false,
"values": [
"computercraft:computer_normal",
"computercraft:computer_advanced",
"computercraft:turtle_normal",
"computercraft:turtle_advanced",
"computercraft:speaker",
"computercraft:disk_drive",
"computercraft:printer",
"computercraft:monitor_normal",
"computercraft:monitor_advanced",
"computercraft:wireless_modem_normal",
"computercraft:wireless_modem_advanced",
"computercraft:wired_modem_full",
"computercraft:cable"
]
}

View File

@@ -5,17 +5,20 @@
*/ */
package dan200.computercraft; package dan200.computercraft;
import dan200.computercraft.api.turtle.event.TurtleAction;
import dan200.computercraft.core.apis.http.options.Action; import dan200.computercraft.core.apis.http.options.Action;
import dan200.computercraft.core.apis.http.options.AddressRule; import dan200.computercraft.core.apis.http.options.AddressRule;
import dan200.computercraft.shared.Config; import dan200.computercraft.shared.Config;
import dan200.computercraft.shared.Registry; import dan200.computercraft.shared.Registry;
import dan200.computercraft.shared.peripheral.monitor.MonitorRenderer; import dan200.computercraft.shared.peripheral.monitor.MonitorRenderer;
import dan200.computercraft.shared.pocket.peripherals.PocketModem;
import dan200.computercraft.shared.pocket.peripherals.PocketSpeaker;
import dan200.computercraft.shared.turtle.upgrades.*;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import org.slf4j.Logger; import org.apache.logging.log4j.LogManager;
import org.slf4j.LoggerFactory; import org.apache.logging.log4j.Logger;
import java.util.List; import java.util.*;
import java.util.OptionalInt;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@Mod( ComputerCraft.MOD_ID ) @Mod( ComputerCraft.MOD_ID )
@@ -37,10 +40,10 @@ public final class ComputerCraft
public static boolean httpEnabled = true; public static boolean httpEnabled = true;
public static boolean httpWebsocketEnabled = true; public static boolean httpWebsocketEnabled = true;
public static List<AddressRule> httpRules = List.of( public static List<AddressRule> httpRules = Collections.unmodifiableList( Arrays.asList(
AddressRule.parse( "$private", OptionalInt.empty(), Action.DENY.toPartial() ), AddressRule.parse( "$private", OptionalInt.empty(), Action.DENY.toPartial() ),
AddressRule.parse( "*", OptionalInt.empty(), Action.ALLOW.toPartial() ) AddressRule.parse( "*", OptionalInt.empty(), Action.ALLOW.toPartial() )
); ) );
public static int httpMaxRequests = 16; public static int httpMaxRequests = 16;
public static int httpMaxWebsockets = 4; public static int httpMaxWebsockets = 4;
@@ -54,7 +57,7 @@ public final class ComputerCraft
public static int modemHighAltitudeRangeDuringStorm = 384; public static int modemHighAltitudeRangeDuringStorm = 384;
public static int maxNotesPerTick = 8; public static int maxNotesPerTick = 8;
public static MonitorRenderer monitorRenderer = MonitorRenderer.BEST; public static MonitorRenderer monitorRenderer = MonitorRenderer.BEST;
public static int monitorDistance = 65; public static double monitorDistanceSq = 4096;
public static long monitorBandwidth = 1_000_000; public static long monitorBandwidth = 1_000_000;
public static boolean turtlesNeedFuel = true; public static boolean turtlesNeedFuel = true;
@@ -62,6 +65,7 @@ public final class ComputerCraft
public static int advancedTurtleFuelLimit = 100000; public static int advancedTurtleFuelLimit = 100000;
public static boolean turtlesObeyBlockProtection = true; public static boolean turtlesObeyBlockProtection = true;
public static boolean turtlesCanPush = true; public static boolean turtlesCanPush = true;
public static EnumSet<TurtleAction> turtleDisabledActions = EnumSet.noneOf( TurtleAction.class );
public static int computerTermWidth = 51; public static int computerTermWidth = 51;
public static int computerTermHeight = 19; public static int computerTermHeight = 19;
@@ -77,7 +81,28 @@ public final class ComputerCraft
public static int uploadNagDelay = 5; public static int uploadNagDelay = 5;
public static final Logger log = LoggerFactory.getLogger( MOD_ID ); public static final class TurtleUpgrades
{
public static TurtleModem wirelessModemNormal;
public static TurtleModem wirelessModemAdvanced;
public static TurtleSpeaker speaker;
public static TurtleCraftingTable craftingTable;
public static TurtleSword diamondSword;
public static TurtleShovel diamondShovel;
public static TurtleTool diamondPickaxe;
public static TurtleAxe diamondAxe;
public static TurtleHoe diamondHoe;
}
public static final class PocketUpgrades
{
public static PocketModem wirelessModemNormal;
public static PocketModem wirelessModemAdvanced;
public static PocketSpeaker speaker;
}
public static final Logger log = LogManager.getLogger( MOD_ID );
public ComputerCraft() public ComputerCraft()
{ {

Some files were not shown because too many files have changed in this diff Show More