mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-10-22 17:37:38 +00:00
Compare commits
59 Commits
v1.16.5-1.
...
v1.16.5-1.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5927e9bb10 | ||
![]() |
53811f8169 | ||
![]() |
298f339376 | ||
![]() |
9d44f1ca66 | ||
![]() |
306e06a79a | ||
![]() |
4f11549112 | ||
![]() |
7f3490591d | ||
![]() |
8ffd45c66e | ||
![]() |
e247bd823e | ||
![]() |
276956eed8 | ||
![]() |
18d66bd727 | ||
![]() |
d3563a3854 | ||
![]() |
c2dc8bf675 | ||
![]() |
603119e1e6 | ||
![]() |
d9b3f17b52 | ||
![]() |
993bccc51f | ||
![]() |
96d3b27064 | ||
![]() |
f33f57ea35 | ||
![]() |
070479d901 | ||
![]() |
2fe40f669d | ||
![]() |
1b39c9f470 | ||
![]() |
814d5cbcd1 | ||
![]() |
4d8862c78e | ||
![]() |
6cc2f035db | ||
![]() |
ea7a218f4a | ||
![]() |
544bcaa599 | ||
![]() |
ab6b861cd6 | ||
![]() |
72e8fc03d3 | ||
![]() |
482ae0d22e | ||
![]() |
6dd33f7099 | ||
![]() |
045472577a | ||
![]() |
9f539dbd59 | ||
![]() |
ca367e7cc7 | ||
![]() |
f6fd0ad172 | ||
![]() |
13779d6ad3 | ||
![]() |
d700f1f500 | ||
![]() |
06bf84f151 | ||
![]() |
8ba20985d7 | ||
![]() |
7bb7b5e638 | ||
![]() |
297426419b | ||
![]() |
eb61c5c5d7 | ||
![]() |
cf2bc667c1 | ||
![]() |
c8449086ee | ||
![]() |
662bead8be | ||
![]() |
acaa61a720 | ||
![]() |
5facbca2b3 | ||
![]() |
6c6b2c2ff3 | ||
![]() |
647902c019 | ||
![]() |
2aa70b49c1 | ||
![]() |
b17ab16e05 | ||
![]() |
94ad106272 | ||
![]() |
dc9edf26ec | ||
![]() |
048c7bda23 | ||
![]() |
c9397460a4 | ||
![]() |
9e82209aab | ||
![]() |
340ade170f | ||
![]() |
7cac8401e8 | ||
![]() |
0f899357c2 | ||
![]() |
3396fe2871 |
2
.github/ISSUE_TEMPLATE/config.yml
vendored
2
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -4,5 +4,5 @@ contact_links:
|
||||
url: https://discord.computercraft.cc
|
||||
about: Get help on the ComputerCraft Discord.
|
||||
- name: GitHub Discussions
|
||||
url: https://github.com/SquidDev-CC/CC-Tweaked/discussions
|
||||
url: https://github.com/cc-tweaked/CC-Tweaked/discussions
|
||||
about: Or ask questions on GitHub Discussions.
|
||||
|
4
.github/workflows/make-doc.sh
vendored
4
.github/workflows/make-doc.sh
vendored
@@ -13,7 +13,7 @@ chmod 600 "$HOME/.ssh/key"
|
||||
# And upload
|
||||
rsync -avc -e "ssh -i $HOME/.ssh/key -o StrictHostKeyChecking=no -p $SSH_PORT" \
|
||||
"$GITHUB_WORKSPACE/build/docs/lua/" \
|
||||
"$SSH_USER@$SSH_HOST:/var/www/tweaked.cc/$DEST"
|
||||
"$SSH_USER@$SSH_HOST:/$DEST"
|
||||
rsync -avc -e "ssh -i $HOME/.ssh/key -o StrictHostKeyChecking=no -p $SSH_PORT" \
|
||||
"$GITHUB_WORKSPACE/build/docs/javadoc/" \
|
||||
"$SSH_USER@$SSH_HOST:/var/www/tweaked.cc/$DEST/javadoc"
|
||||
"$SSH_USER@$SSH_HOST:/$DEST/javadoc"
|
||||
|
@@ -16,11 +16,11 @@ automatically with GitHub, so please don't submit PRs adding/changing translatio
|
||||
In order to develop CC: Tweaked, you'll need to download the source code and then run it. This is a pretty simple
|
||||
process. When building on Windows, Use `gradlew.bat` instead of `./gradlew`.
|
||||
|
||||
- **Clone the repository:** `git clone https://github.com/SquidDev-CC/CC-Tweaked.git && cd CC-Tweaked`
|
||||
- **Clone the repository:** `git clone https://github.com/cc-tweaked/CC-Tweaked.git && cd CC-Tweaked`
|
||||
- **Setup Forge:** `./gradlew build`
|
||||
- **Run Minecraft:** `./gradlew runClient` (or run the `GradleStart` class from your IDE).
|
||||
- **Optionally:** For small PRs (especially those only touching Lua code), it may be easier to use GitPod, which
|
||||
provides a pre-configured environment: [](https://gitpod.io/#https://github.com/SquidDev-CC/CC-Tweaked/)
|
||||
provides a pre-configured environment: [](https://gitpod.io/#https://github.com/cc-tweaked/CC-Tweaked/)
|
||||
|
||||
Do note you will need to download the mod after compiling to test.
|
||||
|
||||
@@ -103,7 +103,7 @@ tests go inside `describe` blocks, and a single test goes inside `it`.
|
||||
Assertions are generally written using `expect` (inspired by Hamcrest and the like). For instance, `expect(foo):eq("bar")`
|
||||
asserts that your variable `foo` is equal to the expected value `"bar"`.
|
||||
|
||||
[new-issue]: https://github.com/SquidDev-CC/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."
|
||||
[checkstyle]: https://checkstyle.org/
|
||||
[illuaminate]: https://github.com/SquidDev/illuaminate/ "Illuaminate on GitHub"
|
||||
|
@@ -1,5 +1,5 @@
|
||||
# 
|
||||
[](https://github.com/SquidDev-CC/CC-Tweaked/actions "Current build status") [][CurseForge]
|
||||
[](https://github.com/cc-tweaked/CC-Tweaked/actions "Current build status") [][CurseForge]
|
||||
|
||||
CC: Tweaked is a mod for Minecraft which adds programmable computers, turtles and more to the game. A fork of the
|
||||
much-beloved [ComputerCraft], it continues its legacy with better performance, stability, and a wealth of new features.
|
||||
@@ -26,7 +26,12 @@ on is present.
|
||||
|
||||
```groovy
|
||||
repositories {
|
||||
maven { url 'https://squiddev.cc/maven/' }
|
||||
maven {
|
||||
url 'https://squiddev.cc/maven/'
|
||||
content {
|
||||
includeGroup 'org.squiddev'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
30
build.gradle
30
build.gradle
@@ -17,7 +17,7 @@ plugins {
|
||||
id "com.github.hierynomus.license" version "0.16.1"
|
||||
id "com.matthewprenger.cursegradle" version "1.4.0"
|
||||
id "com.github.breadmoirai.github-release" version "2.2.12"
|
||||
id "org.jetbrains.kotlin.jvm" version "1.3.72"
|
||||
id "org.jetbrains.kotlin.jvm" version "1.6.0"
|
||||
id "com.modrinth.minotaur" version "1.2.1"
|
||||
}
|
||||
|
||||
@@ -143,13 +143,13 @@ dependencies {
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.7.0'
|
||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
|
||||
testImplementation 'org.hamcrest:hamcrest:2.2'
|
||||
testImplementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72'
|
||||
testImplementation 'org.jetbrains.kotlin:kotlin-reflect:1.3.72'
|
||||
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8'
|
||||
testImplementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0'
|
||||
testImplementation 'org.jetbrains.kotlin:kotlin-reflect:1.6.0'
|
||||
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2'
|
||||
|
||||
testModImplementation sourceSets.main.output
|
||||
|
||||
cctJavadoc 'cc.tweaked:cct-javadoc:1.4.1'
|
||||
cctJavadoc 'cc.tweaked:cct-javadoc:1.4.2'
|
||||
}
|
||||
|
||||
// Compile tasks
|
||||
@@ -408,7 +408,11 @@ task setupServer(type: Copy) {
|
||||
}
|
||||
}
|
||||
|
||||
check.dependsOn("jacocoTest${name}Report")
|
||||
if (name != "Client" || project.findProperty('cc.tweaked.clientTests') == 'true') {
|
||||
// Don't run client tests unless explicitly opted into them. They're a bit of a faff
|
||||
// to run and pretty flakey.
|
||||
check.dependsOn("jacocoTest${name}Report")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -459,7 +463,7 @@ curseforge {
|
||||
project {
|
||||
id = '282001'
|
||||
releaseType = 'release'
|
||||
changelog = "Release notes can be found on the GitHub repository (https://github.com/SquidDev-CC/CC-Tweaked/releases/tag/v${mc_version}-${mod_version})."
|
||||
changelog = "Release notes can be found on the GitHub repository (https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v${mc_version}-${mod_version})."
|
||||
|
||||
addGameVersion "${mc_version}"
|
||||
}
|
||||
@@ -477,7 +481,7 @@ tasks.register('publishModrinth', TaskModrinthUpload.class).configure {
|
||||
versionNumber = "${project.mc_version}-${project.mod_version}"
|
||||
uploadFile = jar
|
||||
addGameVersion(project.mc_version)
|
||||
changelog = "Release notes can be found on the [GitHub repository](https://github.com/SquidDev-CC/CC-Tweaked/releases/tag/v${mc_version}-${mod_version})."
|
||||
changelog = "Release notes can be found on the [GitHub repository](https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v${mc_version}-${mod_version})."
|
||||
addLoader('forge')
|
||||
}
|
||||
|
||||
@@ -494,21 +498,21 @@ publishing {
|
||||
pom {
|
||||
name = 'CC: Tweaked'
|
||||
description = 'CC: Tweaked is a fork of ComputerCraft, adding programmable computers, turtles and more to Minecraft.'
|
||||
url = 'https://github.com/SquidDev-CC/CC-Tweaked'
|
||||
url = 'https://github.com/cc-tweaked/CC-Tweaked'
|
||||
|
||||
scm {
|
||||
url = 'https://github.com/SquidDev-CC/CC-Tweaked.git'
|
||||
url = 'https://github.com/cc-tweaked/CC-Tweaked.git'
|
||||
}
|
||||
|
||||
issueManagement {
|
||||
system = 'github'
|
||||
url = 'https://github.com/SquidDev-CC/CC-Tweaked/issues'
|
||||
url = 'https://github.com/cc-tweaked/CC-Tweaked/issues'
|
||||
}
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name = 'ComputerCraft Public License, Version 1.0'
|
||||
url = 'https://github.com/SquidDev-CC/CC-Tweaked/blob/mc-1.15.x/LICENSE'
|
||||
url = 'https://github.com/cc-tweaked/CC-Tweaked/blob/mc-1.15.x/LICENSE'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -533,7 +537,7 @@ publishing {
|
||||
|
||||
githubRelease {
|
||||
token project.hasProperty('githubApiKey') ? project.githubApiKey : ''
|
||||
owner 'SquidDev-CC'
|
||||
owner 'cc-tweaked'
|
||||
repo 'CC-Tweaked'
|
||||
targetCommitish.set(project.provider({
|
||||
try {
|
||||
|
@@ -149,8 +149,12 @@
|
||||
<property name="tokens" value="COMMA" />
|
||||
</module>
|
||||
<module name="WhitespaceAround">
|
||||
<property name="allowEmptyConstructors" value="true" />
|
||||
<property name="ignoreEnhancedForColon" value="false" />
|
||||
<!-- Allow empty functions -->
|
||||
<property name="allowEmptyLambdas" value="true" />
|
||||
<property name="allowEmptyMethods" value="true" />
|
||||
<property name="allowEmptyConstructors" 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" />
|
||||
</module>
|
||||
</module>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v3.2.0
|
||||
rev: v4.0.1
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
@@ -16,7 +16,7 @@ repos:
|
||||
exclude: "tsconfig\\.json$"
|
||||
|
||||
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
|
||||
rev: 2.3.5
|
||||
rev: 2.3.54
|
||||
hooks:
|
||||
- id: editorconfig-checker
|
||||
args: ['-disable-indentation']
|
||||
|
@@ -2,7 +2,7 @@
|
||||
module: [kind=event] redstone
|
||||
---
|
||||
|
||||
The @{redstone} event is fired whenever any redstone inputs on the computer change.
|
||||
The @{event!redstone} event is fired whenever any redstone inputs on the computer change.
|
||||
|
||||
## Example
|
||||
Prints a message when a redstone input changes:
|
||||
|
@@ -10,6 +10,7 @@ This event is normally handled by @{http.Websocket.receive}, but it can also be
|
||||
1. @{string}: The event name.
|
||||
2. @{string}: The URL of the WebSocket.
|
||||
3. @{string}: The contents of the message.
|
||||
4. @{boolean}: Whether this is a binary message.
|
||||
|
||||
## Example
|
||||
Prints a message sent by a WebSocket:
|
||||
|
@@ -43,8 +43,8 @@ If you get stuck, do pop in to the [Minecraft Computer Mod Discord guild][discor
|
||||
## Get Involved
|
||||
CC: Tweaked lives on [GitHub]. If you've got any ideas, feedback or bugs please do [create an issue][bug].
|
||||
|
||||
[github]: https://github.com/SquidDev-CC/CC-Tweaked/ "CC: Tweaked on GitHub"
|
||||
[bug]: https://github.com/SquidDev-CC/CC-Tweaked/issues/new/choose
|
||||
[github]: https://github.com/cc-tweaked/CC-Tweaked/ "CC: Tweaked on GitHub"
|
||||
[bug]: https://github.com/cc-tweaked/CC-Tweaked/issues/new/choose
|
||||
[computercraft]: https://github.com/dan200/ComputerCraft "ComputerCraft on GitHub"
|
||||
[curseforge]: https://minecraft.curseforge.com/projects/cc-tweaked "Download CC: Tweaked from CurseForge"
|
||||
[modrinth]: https://modrinth.com/mod/gu7yAYhd "Download CC: Tweaked from Modrinth"
|
||||
|
BIN
doc/logo.png
BIN
doc/logo.png
Binary file not shown.
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -12,6 +12,7 @@
|
||||
-- @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
|
||||
@@ -30,5 +31,6 @@ included in the returned list.
|
||||
@tparam[opt] boolean include_dirs When @{false}, "raw" directories will not be
|
||||
included in the returned list.
|
||||
@treturn { string... } A list of possible completion candidates.
|
||||
@since 1.74
|
||||
]]
|
||||
function complete(path, location, include_files, include_dirs) end
|
||||
|
@@ -2,6 +2,7 @@
|
||||
-- receiving data from them.
|
||||
--
|
||||
-- @module http
|
||||
-- @since 1.1
|
||||
|
||||
--- Asynchronously make a HTTP request to the given url.
|
||||
--
|
||||
@@ -35,6 +36,11 @@
|
||||
--
|
||||
-- @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.
|
||||
@@ -58,6 +64,12 @@ function request(...) end
|
||||
-- @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
|
||||
@@ -89,6 +101,13 @@ function get(...) end
|
||||
-- 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.
|
||||
@@ -142,6 +161,9 @@ function checkURL(url) end
|
||||
-- @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.
|
||||
@@ -154,4 +176,6 @@ function websocket(url, headers) end
|
||||
-- `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
|
||||
|
@@ -8,6 +8,7 @@ variables and functions exported by it will by available through the use of
|
||||
|
||||
@tparam string path The path of the API to load.
|
||||
@treturn boolean Whether or not the API was successfully loaded.
|
||||
@since 1.2
|
||||
|
||||
@deprecated When possible it's best to avoid using this function. It pollutes
|
||||
the global table and can mask errors.
|
||||
@@ -21,6 +22,7 @@ function loadAPI(path) end
|
||||
-- This effectively removes the specified table from `_G`.
|
||||
--
|
||||
-- @tparam string name The name of the API to unload.
|
||||
-- @since 1.2
|
||||
-- @deprecated See @{os.loadAPI} for why.
|
||||
function unloadAPI(name) end
|
||||
|
||||
@@ -58,6 +60,7 @@ event, printing the error "Terminated".
|
||||
end
|
||||
|
||||
@see os.pullEventRaw To pull the terminate event.
|
||||
@changed 1.3 Added filter argument.
|
||||
]]
|
||||
function pullEvent(filter) end
|
||||
|
||||
|
@@ -9,5 +9,6 @@ empty, including those outside the crafting "grid".
|
||||
@treturn[1] true If crafting succeeds.
|
||||
@treturn[2] false If crafting fails.
|
||||
@treturn string A string describing why crafting failed.
|
||||
@since 1.4
|
||||
]]
|
||||
function craft(limit) end
|
||||
|
@@ -1,5 +1,5 @@
|
||||
# Mod properties
|
||||
mod_version=1.98.2
|
||||
mod_version=1.99.0
|
||||
|
||||
# Minecraft properties (update mods.toml when changing)
|
||||
mc_version=1.16.5
|
||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
269
gradlew
vendored
269
gradlew
vendored
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -17,67 +17,101 @@
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
@@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
@@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
@@ -106,80 +140,95 @@ location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
@@ -18,7 +18,7 @@
|
||||
(title "CC: Tweaked")
|
||||
(logo src/main/resources/pack.png)
|
||||
(url https://tweaked.cc/)
|
||||
(source-link https://github.com/SquidDev-CC/CC-Tweaked/blob/${commit}/${path}#L${line})
|
||||
(source-link https://github.com/cc-tweaked/CC-Tweaked/blob/${commit}/${path}#L${line})
|
||||
|
||||
(styles src/web/styles.css)
|
||||
(scripts build/rollup/index.js)
|
||||
@@ -61,6 +61,8 @@
|
||||
(table space)
|
||||
(index no-space))
|
||||
|
||||
(allow-clarifying-parens true)
|
||||
|
||||
;; colours imports from colors, and we don't handle that right now.
|
||||
;; keys is entirely dynamic, so we skip it.
|
||||
(dynamic-modules colours keys _G)
|
||||
@@ -69,6 +71,7 @@
|
||||
:max
|
||||
_CC_DEFAULT_SETTINGS
|
||||
_CC_DISABLE_LUA51_FEATURES
|
||||
_HOST
|
||||
;; Ideally we'd pick these up from bios.lua, but illuaminate currently
|
||||
;; isn't smart enough.
|
||||
sleep write printError read rs)))
|
||||
|
474
package-lock.json
generated
474
package-lock.json
generated
@@ -16,14 +16,49 @@
|
||||
"@rollup/plugin-typescript": "^8.2.5",
|
||||
"requirejs": "^2.3.6",
|
||||
"rollup": "^2.33.1",
|
||||
"terser": "^5.3.8",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"typescript": "^4.0.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/code-frame": {
|
||||
"version": "7.16.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.0.tgz",
|
||||
"integrity": "sha512-IF4EOMEV+bfYwOmNxGzSnjR2EmQod7f1UXOpZM3l4i4o4QNwzjtJAu/HxdjHq0aYBvdqMuQEY1eg0nqW9ZPORA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/highlight": "^7.16.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-validator-identifier": {
|
||||
"version": "7.15.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz",
|
||||
"integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/highlight": {
|
||||
"version": "7.16.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.0.tgz",
|
||||
"integrity": "sha512-t8MH41kUQylBtu2+4IQA3atqevA2lRgqA2wyVB/YiWmsDSuylZZuXOUy9ric30hfzauEFfdsuk/eXTRrGrfd0g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-validator-identifier": "^7.15.7",
|
||||
"chalk": "^2.0.0",
|
||||
"js-tokens": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/plugin-typescript": {
|
||||
"version": "8.2.5",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-8.2.5.tgz",
|
||||
"integrity": "sha512-QL/LvDol/PAGB2O0S7/+q2HpSUNodpw7z6nGn9BfoVCPOZ0r4EALrojFU29Bkoi2Hr2jgTocTejJ5GGWZfOxbQ==",
|
||||
"version": "8.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-8.3.0.tgz",
|
||||
"integrity": "sha512-I5FpSvLbtAdwJ+naznv+B4sjXZUcIvLLceYpITAn7wAP8W0wqc5noLdGIp9HGVntNhRWXctwPYrSSFQxtl0FPA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@rollup/pluginutils": "^3.1.0",
|
||||
@@ -61,18 +96,74 @@
|
||||
"integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "16.11.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.10.tgz",
|
||||
"integrity": "sha512-3aRnHa1KlOEEhJ6+CvyHKK5vE9BcLGjtUpwvqYLRvYNQKMfabu3BwfJaA/SLW8dxe28LsNDjtHwePTuzn3gmOA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/ansi-styles": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"color-convert": "^1.9.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer-from": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
||||
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/chalk": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ansi-styles": "^3.2.1",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
"supports-color": "^5.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/color-convert": {
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"color-name": "1.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/color-name": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/commander": {
|
||||
"version": "2.20.3",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/estree-walker": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz",
|
||||
@@ -111,10 +202,19 @@
|
||||
"node": ">= 0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/has-flag": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
||||
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/is-core-module": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.6.0.tgz",
|
||||
"integrity": "sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ==",
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz",
|
||||
"integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"has": "^1.0.3"
|
||||
@@ -123,6 +223,53 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-worker": {
|
||||
"version": "26.6.2",
|
||||
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.6.2.tgz",
|
||||
"integrity": "sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"merge-stream": "^2.0.0",
|
||||
"supports-color": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-worker/node_modules/has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-worker/node_modules/supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"has-flag": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/js-tokens": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/merge-stream": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
|
||||
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/path-parse": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
||||
@@ -142,14 +289,23 @@
|
||||
}
|
||||
},
|
||||
"node_modules/preact": {
|
||||
"version": "10.5.14",
|
||||
"resolved": "https://registry.npmjs.org/preact/-/preact-10.5.14.tgz",
|
||||
"integrity": "sha512-KojoltCrshZ099ksUZ2OQKfbH66uquFoxHSbnwKbTJHeQNvx42EmC7wQVWNuDt6vC5s3nudRHFtKbpY4ijKlaQ==",
|
||||
"version": "10.6.1",
|
||||
"resolved": "https://registry.npmjs.org/preact/-/preact-10.6.1.tgz",
|
||||
"integrity": "sha512-ydCg+ISIq70vqiThvNWStZWLRjR9U2awP/JAmGdWUKm9+Tyuy+MqVdAIyEByeIspAVtD4GWC/SJtxO8XD4knVA==",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/preact"
|
||||
}
|
||||
},
|
||||
"node_modules/randombytes": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
|
||||
"integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"safe-buffer": "^5.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/requirejs": {
|
||||
"version": "2.3.6",
|
||||
"resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.6.tgz",
|
||||
@@ -177,9 +333,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/rollup": {
|
||||
"version": "2.56.2",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.56.2.tgz",
|
||||
"integrity": "sha512-s8H00ZsRi29M2/lGdm1u8DJpJ9ML8SUOpVVBd33XNeEeL3NVaTiUcSBHzBdF3eAyR0l7VSpsuoVUGrRHq7aPwQ==",
|
||||
"version": "2.60.1",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.60.1.tgz",
|
||||
"integrity": "sha512-akwfnpjY0rXEDSn1UTVfKXJhPsEBu+imi1gqBA1ZkHGydUnkV/fWCC90P7rDaLEW8KTwBcS1G3N4893Ndz+jwg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"rollup": "dist/bin/rollup"
|
||||
@@ -191,6 +347,50 @@
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/rollup-plugin-terser": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz",
|
||||
"integrity": "sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.10.4",
|
||||
"jest-worker": "^26.2.1",
|
||||
"serialize-javascript": "^4.0.0",
|
||||
"terser": "^5.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"rollup": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/serialize-javascript": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz",
|
||||
"integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"randombytes": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map": {
|
||||
"version": "0.7.3",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
|
||||
@@ -201,9 +401,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-support": {
|
||||
"version": "0.5.19",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz",
|
||||
"integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==",
|
||||
"version": "0.5.21",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
|
||||
"integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"buffer-from": "^1.0.0",
|
||||
@@ -219,21 +419,41 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/supports-color": {
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
||||
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"has-flag": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/terser": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.7.1.tgz",
|
||||
"integrity": "sha512-b3e+d5JbHAe/JSjwsC3Zn55wsBIM7AsHLjKxT31kGCldgbpFePaFo+PiddtO6uwRZWRw7sPXmAN8dTW61xmnSg==",
|
||||
"version": "5.10.0",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.10.0.tgz",
|
||||
"integrity": "sha512-AMmF99DMfEDiRJfxfY5jj5wNH/bYO09cniSqhfoyxc8sFoYIgkJy86G04UoZU5VjlpnplVu0K6Tx6E9b5+DlHA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"commander": "^2.20.0",
|
||||
"source-map": "~0.7.2",
|
||||
"source-map-support": "~0.5.19"
|
||||
"source-map-support": "~0.5.20"
|
||||
},
|
||||
"bin": {
|
||||
"terser": "bin/terser"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"acorn": "^8.5.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"acorn": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
@@ -242,9 +462,9 @@
|
||||
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.3.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz",
|
||||
"integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==",
|
||||
"version": "4.5.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz",
|
||||
"integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
@@ -256,10 +476,36 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/code-frame": {
|
||||
"version": "7.16.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.0.tgz",
|
||||
"integrity": "sha512-IF4EOMEV+bfYwOmNxGzSnjR2EmQod7f1UXOpZM3l4i4o4QNwzjtJAu/HxdjHq0aYBvdqMuQEY1eg0nqW9ZPORA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/highlight": "^7.16.0"
|
||||
}
|
||||
},
|
||||
"@babel/helper-validator-identifier": {
|
||||
"version": "7.15.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz",
|
||||
"integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==",
|
||||
"dev": true
|
||||
},
|
||||
"@babel/highlight": {
|
||||
"version": "7.16.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.0.tgz",
|
||||
"integrity": "sha512-t8MH41kUQylBtu2+4IQA3atqevA2lRgqA2wyVB/YiWmsDSuylZZuXOUy9ric30hfzauEFfdsuk/eXTRrGrfd0g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-validator-identifier": "^7.15.7",
|
||||
"chalk": "^2.0.0",
|
||||
"js-tokens": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"@rollup/plugin-typescript": {
|
||||
"version": "8.2.5",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-8.2.5.tgz",
|
||||
"integrity": "sha512-QL/LvDol/PAGB2O0S7/+q2HpSUNodpw7z6nGn9BfoVCPOZ0r4EALrojFU29Bkoi2Hr2jgTocTejJ5GGWZfOxbQ==",
|
||||
"version": "8.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-8.3.0.tgz",
|
||||
"integrity": "sha512-I5FpSvLbtAdwJ+naznv+B4sjXZUcIvLLceYpITAn7wAP8W0wqc5noLdGIp9HGVntNhRWXctwPYrSSFQxtl0FPA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@rollup/pluginutils": "^3.1.0",
|
||||
@@ -283,18 +529,65 @@
|
||||
"integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "16.11.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.10.tgz",
|
||||
"integrity": "sha512-3aRnHa1KlOEEhJ6+CvyHKK5vE9BcLGjtUpwvqYLRvYNQKMfabu3BwfJaA/SLW8dxe28LsNDjtHwePTuzn3gmOA==",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-convert": "^1.9.0"
|
||||
}
|
||||
},
|
||||
"buffer-from": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
||||
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
|
||||
"dev": true
|
||||
},
|
||||
"chalk": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-styles": "^3.2.1",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
"supports-color": "^5.3.0"
|
||||
}
|
||||
},
|
||||
"color-convert": {
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-name": "1.1.3"
|
||||
}
|
||||
},
|
||||
"color-name": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
||||
"dev": true
|
||||
},
|
||||
"commander": {
|
||||
"version": "2.20.3",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||
"dev": true
|
||||
},
|
||||
"escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
|
||||
"dev": true
|
||||
},
|
||||
"estree-walker": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz",
|
||||
@@ -323,15 +616,61 @@
|
||||
"function-bind": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
||||
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
|
||||
"dev": true
|
||||
},
|
||||
"is-core-module": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.6.0.tgz",
|
||||
"integrity": "sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ==",
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz",
|
||||
"integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"jest-worker": {
|
||||
"version": "26.6.2",
|
||||
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.6.2.tgz",
|
||||
"integrity": "sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "*",
|
||||
"merge-stream": "^2.0.0",
|
||||
"supports-color": "^7.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||
"dev": true
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-flag": "^4.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"js-tokens": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
|
||||
"dev": true
|
||||
},
|
||||
"merge-stream": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
|
||||
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
|
||||
"dev": true
|
||||
},
|
||||
"path-parse": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
||||
@@ -345,9 +684,18 @@
|
||||
"dev": true
|
||||
},
|
||||
"preact": {
|
||||
"version": "10.5.14",
|
||||
"resolved": "https://registry.npmjs.org/preact/-/preact-10.5.14.tgz",
|
||||
"integrity": "sha512-KojoltCrshZ099ksUZ2OQKfbH66uquFoxHSbnwKbTJHeQNvx42EmC7wQVWNuDt6vC5s3nudRHFtKbpY4ijKlaQ=="
|
||||
"version": "10.6.1",
|
||||
"resolved": "https://registry.npmjs.org/preact/-/preact-10.6.1.tgz",
|
||||
"integrity": "sha512-ydCg+ISIq70vqiThvNWStZWLRjR9U2awP/JAmGdWUKm9+Tyuy+MqVdAIyEByeIspAVtD4GWC/SJtxO8XD4knVA=="
|
||||
},
|
||||
"randombytes": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
|
||||
"integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.0"
|
||||
}
|
||||
},
|
||||
"requirejs": {
|
||||
"version": "2.3.6",
|
||||
@@ -366,14 +714,41 @@
|
||||
}
|
||||
},
|
||||
"rollup": {
|
||||
"version": "2.56.2",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.56.2.tgz",
|
||||
"integrity": "sha512-s8H00ZsRi29M2/lGdm1u8DJpJ9ML8SUOpVVBd33XNeEeL3NVaTiUcSBHzBdF3eAyR0l7VSpsuoVUGrRHq7aPwQ==",
|
||||
"version": "2.60.1",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.60.1.tgz",
|
||||
"integrity": "sha512-akwfnpjY0rXEDSn1UTVfKXJhPsEBu+imi1gqBA1ZkHGydUnkV/fWCC90P7rDaLEW8KTwBcS1G3N4893Ndz+jwg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
"rollup-plugin-terser": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz",
|
||||
"integrity": "sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.10.4",
|
||||
"jest-worker": "^26.2.1",
|
||||
"serialize-javascript": "^4.0.0",
|
||||
"terser": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||
"dev": true
|
||||
},
|
||||
"serialize-javascript": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz",
|
||||
"integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"randombytes": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"source-map": {
|
||||
"version": "0.7.3",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
|
||||
@@ -381,9 +756,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"source-map-support": {
|
||||
"version": "0.5.19",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz",
|
||||
"integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==",
|
||||
"version": "0.5.21",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
|
||||
"integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"buffer-from": "^1.0.0",
|
||||
@@ -398,15 +773,24 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
||||
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-flag": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"terser": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.7.1.tgz",
|
||||
"integrity": "sha512-b3e+d5JbHAe/JSjwsC3Zn55wsBIM7AsHLjKxT31kGCldgbpFePaFo+PiddtO6uwRZWRw7sPXmAN8dTW61xmnSg==",
|
||||
"version": "5.10.0",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.10.0.tgz",
|
||||
"integrity": "sha512-AMmF99DMfEDiRJfxfY5jj5wNH/bYO09cniSqhfoyxc8sFoYIgkJy86G04UoZU5VjlpnplVu0K6Tx6E9b5+DlHA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"commander": "^2.20.0",
|
||||
"source-map": "~0.7.2",
|
||||
"source-map-support": "~0.5.19"
|
||||
"source-map-support": "~0.5.20"
|
||||
}
|
||||
},
|
||||
"tslib": {
|
||||
@@ -415,9 +799,9 @@
|
||||
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.3.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz",
|
||||
"integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==",
|
||||
"version": "4.5.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz",
|
||||
"integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@
|
||||
"@rollup/plugin-typescript": "^8.2.5",
|
||||
"requirejs": "^2.3.6",
|
||||
"rollup": "^2.33.1",
|
||||
"terser": "^5.3.8",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"typescript": "^4.0.5"
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,8 @@
|
||||
import { readFileSync, promises as fs } from "fs";
|
||||
import { readFileSync } from "fs";
|
||||
import path from "path";
|
||||
|
||||
import typescript from "@rollup/plugin-typescript";
|
||||
import { terser } from "rollup-plugin-terser";
|
||||
|
||||
const input = "src/web";
|
||||
const requirejs = readFileSync("node_modules/requirejs/require.js");
|
||||
@@ -12,7 +13,14 @@ export default {
|
||||
file: "build/rollup/index.js",
|
||||
// We bundle requirejs (and config) into the header. It's rather gross
|
||||
// but also works reasonably well.
|
||||
banner: `${requirejs}\nrequire.config({ paths: { copycat: "https://copy-cat.squiddev.cc" } });`,
|
||||
// Also suffix a ?v=${date} onto the end in the event we need to require a specific copy-cat version.
|
||||
banner: `
|
||||
${requirejs}
|
||||
require.config({
|
||||
paths: { copycat: "https://copy-cat.squiddev.cc" },
|
||||
urlArgs: function(id) { return id == "copycat/embed" ? "?v=20211127" : ""; }
|
||||
});
|
||||
`,
|
||||
format: "amd",
|
||||
preferConst: true,
|
||||
amd: {
|
||||
@@ -27,22 +35,6 @@ export default {
|
||||
|
||||
{
|
||||
name: "cc-tweaked",
|
||||
async options(options) {
|
||||
// Generate .d.ts files for all /mount files. This is the worst way to do it,
|
||||
// but we need to run before the TS pass.
|
||||
const template = "declare const contents : string;\nexport default contents;\n";
|
||||
const files = await fs.readdir(`${input}/mount`);
|
||||
|
||||
await Promise.all(files
|
||||
.filter(x => path.extname(x) !== ".ts")
|
||||
.map(async file => {
|
||||
const path = `${input}/mount/${file}.d.ts`;
|
||||
const contents = await fs.readFile(path, { encoding: "utf-8" }).catch(() => "");
|
||||
if (contents !== template) await fs.writeFile(path, template);
|
||||
})
|
||||
);
|
||||
return options;
|
||||
},
|
||||
async transform(code, file) {
|
||||
// Allow loading files in /mount.
|
||||
const ext = path.extname(file);
|
||||
@@ -50,6 +42,8 @@ export default {
|
||||
? `export default ${JSON.stringify(code)};\n`
|
||||
: null;
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
terser(),
|
||||
],
|
||||
};
|
||||
|
@@ -21,7 +21,7 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"tag": "computercraft:computer"
|
||||
"tag": "computercraft:wired_modem"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -6,14 +6,15 @@
|
||||
"P"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"P": {
|
||||
"item": "computercraft:pocket_computer_advanced"
|
||||
},
|
||||
"P": {
|
||||
"#": {
|
||||
"item": "computercraft:speaker"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "computercraft:pocket_computer_advanced"
|
||||
"item": "computercraft:pocket_computer_advanced",
|
||||
"nbt": "{Upgrade:\"computercraft:speaker\"}"
|
||||
}
|
||||
}
|
@@ -6,14 +6,15 @@
|
||||
"P"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"P": {
|
||||
"item": "computercraft:pocket_computer_advanced"
|
||||
},
|
||||
"P": {
|
||||
"#": {
|
||||
"item": "computercraft:wireless_modem_advanced"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "computercraft:pocket_computer_advanced"
|
||||
"item": "computercraft:pocket_computer_advanced",
|
||||
"nbt": "{Upgrade:\"computercraft:wireless_modem_advanced\"}"
|
||||
}
|
||||
}
|
@@ -6,14 +6,15 @@
|
||||
"P"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"P": {
|
||||
"item": "computercraft:pocket_computer_advanced"
|
||||
},
|
||||
"P": {
|
||||
"#": {
|
||||
"item": "computercraft:wireless_modem_normal"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "computercraft:pocket_computer_advanced"
|
||||
"item": "computercraft:pocket_computer_advanced",
|
||||
"nbt": "{Upgrade:\"computercraft:wireless_modem_normal\"}"
|
||||
}
|
||||
}
|
@@ -6,14 +6,15 @@
|
||||
"P"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"P": {
|
||||
"item": "computercraft:pocket_computer_normal"
|
||||
},
|
||||
"P": {
|
||||
"#": {
|
||||
"item": "computercraft:speaker"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "computercraft:pocket_computer_normal"
|
||||
"item": "computercraft:pocket_computer_normal",
|
||||
"nbt": "{Upgrade:\"computercraft:speaker\"}"
|
||||
}
|
||||
}
|
@@ -6,14 +6,15 @@
|
||||
"P"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"P": {
|
||||
"item": "computercraft:pocket_computer_normal"
|
||||
},
|
||||
"P": {
|
||||
"#": {
|
||||
"item": "computercraft:wireless_modem_advanced"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "computercraft:pocket_computer_normal"
|
||||
"item": "computercraft:pocket_computer_normal",
|
||||
"nbt": "{Upgrade:\"computercraft:wireless_modem_advanced\"}"
|
||||
}
|
||||
}
|
@@ -6,14 +6,15 @@
|
||||
"P"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"P": {
|
||||
"item": "computercraft:pocket_computer_normal"
|
||||
},
|
||||
"P": {
|
||||
"#": {
|
||||
"item": "computercraft:wireless_modem_normal"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "computercraft:pocket_computer_normal"
|
||||
"item": "computercraft:pocket_computer_normal",
|
||||
"nbt": "{Upgrade:\"computercraft:wireless_modem_normal\"}"
|
||||
}
|
||||
}
|
@@ -5,10 +5,10 @@
|
||||
"#T"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"T": {
|
||||
"item": "computercraft:turtle_advanced"
|
||||
},
|
||||
"T": {
|
||||
"#": {
|
||||
"item": "computercraft:speaker"
|
||||
}
|
||||
},
|
||||
|
@@ -5,10 +5,10 @@
|
||||
"#T"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"T": {
|
||||
"item": "computercraft:turtle_advanced"
|
||||
},
|
||||
"T": {
|
||||
"#": {
|
||||
"item": "computercraft:wireless_modem_advanced"
|
||||
}
|
||||
},
|
||||
|
@@ -5,10 +5,10 @@
|
||||
"#T"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"T": {
|
||||
"item": "computercraft:turtle_advanced"
|
||||
},
|
||||
"T": {
|
||||
"#": {
|
||||
"item": "computercraft:wireless_modem_normal"
|
||||
}
|
||||
},
|
||||
|
@@ -5,10 +5,10 @@
|
||||
"#T"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"T": {
|
||||
"item": "computercraft:turtle_advanced"
|
||||
},
|
||||
"T": {
|
||||
"#": {
|
||||
"item": "minecraft:crafting_table"
|
||||
}
|
||||
},
|
||||
|
@@ -5,10 +5,10 @@
|
||||
"#T"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"T": {
|
||||
"item": "computercraft:turtle_advanced"
|
||||
},
|
||||
"T": {
|
||||
"#": {
|
||||
"item": "minecraft:diamond_axe"
|
||||
}
|
||||
},
|
||||
|
@@ -5,10 +5,10 @@
|
||||
"#T"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"T": {
|
||||
"item": "computercraft:turtle_advanced"
|
||||
},
|
||||
"T": {
|
||||
"#": {
|
||||
"item": "minecraft:diamond_hoe"
|
||||
}
|
||||
},
|
||||
|
@@ -5,10 +5,10 @@
|
||||
"#T"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"T": {
|
||||
"item": "computercraft:turtle_advanced"
|
||||
},
|
||||
"T": {
|
||||
"#": {
|
||||
"item": "minecraft:diamond_pickaxe"
|
||||
}
|
||||
},
|
||||
|
@@ -5,10 +5,10 @@
|
||||
"#T"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"T": {
|
||||
"item": "computercraft:turtle_advanced"
|
||||
},
|
||||
"T": {
|
||||
"#": {
|
||||
"item": "minecraft:diamond_shovel"
|
||||
}
|
||||
},
|
||||
|
@@ -5,10 +5,10 @@
|
||||
"#T"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"T": {
|
||||
"item": "computercraft:turtle_advanced"
|
||||
},
|
||||
"T": {
|
||||
"#": {
|
||||
"item": "minecraft:diamond_sword"
|
||||
}
|
||||
},
|
||||
|
@@ -5,10 +5,10 @@
|
||||
"#T"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"T": {
|
||||
"item": "computercraft:turtle_normal"
|
||||
},
|
||||
"T": {
|
||||
"#": {
|
||||
"item": "computercraft:speaker"
|
||||
}
|
||||
},
|
||||
|
@@ -5,10 +5,10 @@
|
||||
"#T"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"T": {
|
||||
"item": "computercraft:turtle_normal"
|
||||
},
|
||||
"T": {
|
||||
"#": {
|
||||
"item": "computercraft:wireless_modem_advanced"
|
||||
}
|
||||
},
|
||||
|
@@ -5,10 +5,10 @@
|
||||
"#T"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"T": {
|
||||
"item": "computercraft:turtle_normal"
|
||||
},
|
||||
"T": {
|
||||
"#": {
|
||||
"item": "computercraft:wireless_modem_normal"
|
||||
}
|
||||
},
|
||||
|
@@ -5,10 +5,10 @@
|
||||
"#T"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"T": {
|
||||
"item": "computercraft:turtle_normal"
|
||||
},
|
||||
"T": {
|
||||
"#": {
|
||||
"item": "minecraft:crafting_table"
|
||||
}
|
||||
},
|
||||
|
@@ -5,10 +5,10 @@
|
||||
"#T"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"T": {
|
||||
"item": "computercraft:turtle_normal"
|
||||
},
|
||||
"T": {
|
||||
"#": {
|
||||
"item": "minecraft:diamond_axe"
|
||||
}
|
||||
},
|
||||
|
@@ -5,10 +5,10 @@
|
||||
"#T"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"T": {
|
||||
"item": "computercraft:turtle_normal"
|
||||
},
|
||||
"T": {
|
||||
"#": {
|
||||
"item": "minecraft:diamond_hoe"
|
||||
}
|
||||
},
|
||||
|
@@ -5,10 +5,10 @@
|
||||
"#T"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"T": {
|
||||
"item": "computercraft:turtle_normal"
|
||||
},
|
||||
"T": {
|
||||
"#": {
|
||||
"item": "minecraft:diamond_pickaxe"
|
||||
}
|
||||
},
|
||||
|
@@ -5,10 +5,10 @@
|
||||
"#T"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"T": {
|
||||
"item": "computercraft:turtle_normal"
|
||||
},
|
||||
"T": {
|
||||
"#": {
|
||||
"item": "minecraft:diamond_shovel"
|
||||
}
|
||||
},
|
||||
|
@@ -5,10 +5,10 @@
|
||||
"#T"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"T": {
|
||||
"item": "computercraft:turtle_normal"
|
||||
},
|
||||
"T": {
|
||||
"#": {
|
||||
"item": "minecraft:diamond_sword"
|
||||
}
|
||||
},
|
||||
|
8
src/generated/resources/data/computercraft/tags/blocks/computer.json
generated
Normal file
8
src/generated/resources/data/computercraft/tags/blocks/computer.json
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"computercraft:computer_normal",
|
||||
"computercraft:computer_advanced",
|
||||
"computercraft:computer_command"
|
||||
]
|
||||
}
|
7
src/generated/resources/data/computercraft/tags/blocks/monitor.json
generated
Normal file
7
src/generated/resources/data/computercraft/tags/blocks/monitor.json
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"computercraft:monitor_normal",
|
||||
"computercraft:monitor_advanced"
|
||||
]
|
||||
}
|
7
src/generated/resources/data/computercraft/tags/blocks/turtle.json
generated
Normal file
7
src/generated/resources/data/computercraft/tags/blocks/turtle.json
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"computercraft:turtle_normal",
|
||||
"computercraft:turtle_advanced"
|
||||
]
|
||||
}
|
8
src/generated/resources/data/computercraft/tags/blocks/turtle_always_breakable.json
generated
Normal file
8
src/generated/resources/data/computercraft/tags/blocks/turtle_always_breakable.json
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"#minecraft:leaves",
|
||||
"minecraft:bamboo",
|
||||
"minecraft:bamboo_sapling"
|
||||
]
|
||||
}
|
11
src/generated/resources/data/computercraft/tags/blocks/turtle_hoe_harvestable.json
generated
Normal file
11
src/generated/resources/data/computercraft/tags/blocks/turtle_hoe_harvestable.json
generated
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"#minecraft:crops",
|
||||
"minecraft:cactus",
|
||||
"minecraft:melon",
|
||||
"minecraft:pumpkin",
|
||||
"minecraft:carved_pumpkin",
|
||||
"minecraft:jack_o_lantern"
|
||||
]
|
||||
}
|
9
src/generated/resources/data/computercraft/tags/blocks/turtle_shovel_harvestable.json
generated
Normal file
9
src/generated/resources/data/computercraft/tags/blocks/turtle_shovel_harvestable.json
generated
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:melon",
|
||||
"minecraft:pumpkin",
|
||||
"minecraft:carved_pumpkin",
|
||||
"minecraft:jack_o_lantern"
|
||||
]
|
||||
}
|
7
src/generated/resources/data/computercraft/tags/blocks/turtle_sword_harvestable.json
generated
Normal file
7
src/generated/resources/data/computercraft/tags/blocks/turtle_sword_harvestable.json
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"#minecraft:wool",
|
||||
"minecraft:cobweb"
|
||||
]
|
||||
}
|
7
src/generated/resources/data/computercraft/tags/blocks/wired_modem.json
generated
Normal file
7
src/generated/resources/data/computercraft/tags/blocks/wired_modem.json
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"computercraft:cable",
|
||||
"computercraft:wired_modem_full"
|
||||
]
|
||||
}
|
@@ -28,6 +28,7 @@ import dan200.computercraft.shared.peripheral.modem.wireless.WirelessNetwork;
|
||||
import dan200.computercraft.shared.util.IDAssigner;
|
||||
import dan200.computercraft.shared.wired.WiredNode;
|
||||
import net.minecraft.resources.IReloadableResourceManager;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -101,7 +102,7 @@ public final class ComputerCraftAPIImpl implements IComputerCraftAPI
|
||||
@Override
|
||||
public IMount createResourceMount( @Nonnull String domain, @Nonnull String subPath )
|
||||
{
|
||||
IReloadableResourceManager manager = (IReloadableResourceManager) ServerLifecycleHooks.getCurrentServer().getDataPackRegistries().getResourceManager();
|
||||
IResourceManager manager = ServerLifecycleHooks.getCurrentServer().getDataPackRegistries().getResourceManager();
|
||||
ResourceMount mount = ResourceMount.get( domain, subPath, manager );
|
||||
return mount.exists( "" ) ? mount : null;
|
||||
}
|
||||
|
@@ -40,5 +40,8 @@ public interface ILuaContext
|
||||
* @throws LuaException If the task could not be queued, or if the task threw an exception.
|
||||
*/
|
||||
@Nonnull
|
||||
MethodResult executeMainThreadTask( @Nonnull ILuaTask task ) throws LuaException;
|
||||
default MethodResult executeMainThreadTask( @Nonnull ILuaTask task ) throws LuaException
|
||||
{
|
||||
return TaskCallback.make( this, task );
|
||||
}
|
||||
}
|
||||
|
@@ -1,16 +1,14 @@
|
||||
/*
|
||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission.
|
||||
* Send enquiries to dratcliffe@gmail.com
|
||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2021. This API may be redistributed unmodified and in full only.
|
||||
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||
*/
|
||||
package dan200.computercraft.core.asm;
|
||||
|
||||
import dan200.computercraft.api.lua.*;
|
||||
package dan200.computercraft.api.lua;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Arrays;
|
||||
|
||||
public final class TaskCallback implements ILuaCallback
|
||||
final class TaskCallback implements ILuaCallback
|
||||
{
|
||||
private final MethodResult pull = MethodResult.pullEvent( "task_complete", this );
|
||||
private final long task;
|
||||
@@ -47,19 +45,7 @@ public final class TaskCallback implements ILuaCallback
|
||||
}
|
||||
}
|
||||
|
||||
static Object[] checkUnwrap( MethodResult result )
|
||||
{
|
||||
if( result.getCallback() != null )
|
||||
{
|
||||
// Due to how tasks are implemented, we can't currently return a MethodResult. This is an
|
||||
// entirely artificial limitation - we can remove it if it ever becomes an issue.
|
||||
throw new IllegalStateException( "Cannot return MethodResult for mainThread task." );
|
||||
}
|
||||
|
||||
return result.getResult();
|
||||
}
|
||||
|
||||
public static MethodResult make( ILuaContext context, ILuaTask func ) throws LuaException
|
||||
static MethodResult make( ILuaContext context, ILuaTask func ) throws LuaException
|
||||
{
|
||||
long task = context.issueMainThreadTask( func );
|
||||
return new TaskCallback( task ).pull;
|
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2021. This API may be redistributed unmodified and in full only.
|
||||
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||
*/
|
||||
package dan200.computercraft.api.peripheral;
|
||||
|
||||
import dan200.computercraft.api.lua.GenericSource;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* A {@link GenericSource} which provides methods for a peripheral.
|
||||
*
|
||||
* Unlike a {@link GenericSource}, all methods <strong>should</strong> target the same type, for instance a
|
||||
* {@link TileEntity} subclass or a capability interface. This is not currently enforced.
|
||||
*/
|
||||
public interface GenericPeripheral extends GenericSource
|
||||
{
|
||||
/**
|
||||
* Get the type of the exposed peripheral.
|
||||
*
|
||||
* Unlike normal {@link IPeripheral}s, {@link GenericPeripheral} do not have to have a type. By default, the
|
||||
* resulting peripheral uses the resource name of the wrapped {@link TileEntity} (for instance {@literal minecraft:chest}).
|
||||
*
|
||||
* However, in some cases it may be more appropriate to specify a more readable name. Overriding this method allows
|
||||
* you to do so.
|
||||
*
|
||||
* When multiple {@link GenericPeripheral}s return a non-empty peripheral type for a single tile entity, the
|
||||
* lexicographically smallest will be chosen. In order to avoid this conflict, this method should only be
|
||||
* implemented when your peripheral targets a single tile entity <strong>AND</strong> it's likely that you're the
|
||||
* only mod to do so. Similarly this should <strong>NOT</strong> be implemented when your methods target a
|
||||
* capability or other interface (i.e. {@link IItemHandler}).
|
||||
*
|
||||
* @return The type of this peripheral or {@link PeripheralType#untyped()}.
|
||||
* @see IPeripheral#getType()
|
||||
*/
|
||||
@Nonnull
|
||||
default PeripheralType getType()
|
||||
{
|
||||
return PeripheralType.untyped();
|
||||
}
|
||||
}
|
@@ -10,6 +10,8 @@ import net.minecraftforge.common.capabilities.Capability;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* The interface that defines a peripheral.
|
||||
@@ -31,6 +33,18 @@ public interface IPeripheral
|
||||
@Nonnull
|
||||
String getType();
|
||||
|
||||
/**
|
||||
* Return additional types/traits associated with this object.
|
||||
*
|
||||
* @return A collection of additional object traits.
|
||||
* @see PeripheralType#getAdditionalTypes()
|
||||
*/
|
||||
@Nonnull
|
||||
default Set<String> getAdditionalTypes()
|
||||
{
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is called when when a computer is attaching to the peripheral.
|
||||
*
|
||||
|
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2021. This API may be redistributed unmodified and in full only.
|
||||
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||
*/
|
||||
package dan200.computercraft.api.peripheral;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* The type of a {@link GenericPeripheral}.
|
||||
*
|
||||
* When determining the final type of the resulting peripheral, the union of all types is taken, with the
|
||||
* lexicographically smallest non-empty name being chosen.
|
||||
*/
|
||||
public final class PeripheralType
|
||||
{
|
||||
private static final PeripheralType UNTYPED = new PeripheralType( null, Collections.emptySet() );
|
||||
|
||||
private final String type;
|
||||
private final Set<String> additionalTypes;
|
||||
|
||||
public PeripheralType( String type, Set<String> additionalTypes )
|
||||
{
|
||||
this.type = type;
|
||||
this.additionalTypes = additionalTypes;
|
||||
if( additionalTypes.contains( null ) )
|
||||
{
|
||||
throw new IllegalArgumentException( "All additional types must be non-null" );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An empty peripheral type, used when a {@link GenericPeripheral} does not have an explicit type.
|
||||
*
|
||||
* @return The empty peripheral type.
|
||||
*/
|
||||
public static PeripheralType untyped()
|
||||
{
|
||||
return UNTYPED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new non-empty peripheral type.
|
||||
*
|
||||
* @param type The name of the type.
|
||||
* @return The constructed peripheral type.
|
||||
*/
|
||||
public static PeripheralType ofType( @Nonnull String type )
|
||||
{
|
||||
if( Strings.isNullOrEmpty( type ) ) throw new IllegalArgumentException( "type cannot be null or empty" );
|
||||
return new PeripheralType( type, Collections.emptySet() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new non-empty peripheral type with additional traits.
|
||||
*
|
||||
* @param type The name of the type.
|
||||
* @param additionalTypes Additional types, or "traits" of this peripheral. For instance, {@literal "inventory"}.
|
||||
* @return The constructed peripheral type.
|
||||
*/
|
||||
public static PeripheralType ofType( @Nonnull String type, Collection<String> additionalTypes )
|
||||
{
|
||||
if( Strings.isNullOrEmpty( type ) ) throw new IllegalArgumentException( "type cannot be null or empty" );
|
||||
return new PeripheralType( type, ImmutableSet.copyOf( additionalTypes ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new non-empty peripheral type with additional traits.
|
||||
*
|
||||
* @param type The name of the type.
|
||||
* @param additionalTypes Additional types, or "traits" of this peripheral. For instance, {@literal "inventory"}.
|
||||
* @return The constructed peripheral type.
|
||||
*/
|
||||
public static PeripheralType ofType( @Nonnull String type, @Nonnull String... additionalTypes )
|
||||
{
|
||||
if( Strings.isNullOrEmpty( type ) ) throw new IllegalArgumentException( "type cannot be null or empty" );
|
||||
return new PeripheralType( type, ImmutableSet.copyOf( additionalTypes ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new peripheral type with no primary type but additional traits.
|
||||
*
|
||||
* @param additionalTypes Additional types, or "traits" of this peripheral. For instance, {@literal "inventory"}.
|
||||
* @return The constructed peripheral type.
|
||||
*/
|
||||
public static PeripheralType ofAdditional( Collection<String> additionalTypes )
|
||||
{
|
||||
return new PeripheralType( null, ImmutableSet.copyOf( additionalTypes ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new peripheral type with no primary type but additional traits.
|
||||
*
|
||||
* @param additionalTypes Additional types, or "traits" of this peripheral. For instance, {@literal "inventory"}.
|
||||
* @return The constructed peripheral type.
|
||||
*/
|
||||
public static PeripheralType ofAdditional( @Nonnull String... additionalTypes )
|
||||
{
|
||||
return new PeripheralType( null, ImmutableSet.copyOf( additionalTypes ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of this peripheral type. This may be {@literal null}.
|
||||
*
|
||||
* @return The type of this peripheral.
|
||||
*/
|
||||
@Nullable
|
||||
public String getPrimaryType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get any additional types or "traits" of this peripheral. These effectively act as a standard set of interfaces
|
||||
* a peripheral might have.
|
||||
*
|
||||
* @return All additional types.
|
||||
*/
|
||||
public Set<String> getAdditionalTypes()
|
||||
{
|
||||
return additionalTypes;
|
||||
}
|
||||
}
|
@@ -13,11 +13,10 @@ import dan200.computercraft.client.render.TurtleModelLoader;
|
||||
import dan200.computercraft.client.render.TurtlePlayerRenderer;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.common.IColouredItem;
|
||||
import dan200.computercraft.shared.computer.inventory.ContainerComputer;
|
||||
import dan200.computercraft.shared.computer.inventory.ContainerComputerBase;
|
||||
import dan200.computercraft.shared.computer.inventory.ContainerViewComputer;
|
||||
import dan200.computercraft.shared.media.items.ItemDisk;
|
||||
import dan200.computercraft.shared.media.items.ItemTreasureDisk;
|
||||
import dan200.computercraft.shared.pocket.inventory.ContainerPocketComputer;
|
||||
import dan200.computercraft.shared.pocket.items.ItemPocketComputer;
|
||||
import dan200.computercraft.shared.util.Colour;
|
||||
import net.minecraft.client.gui.ScreenManager;
|
||||
@@ -168,8 +167,9 @@ public final class ClientRegistry
|
||||
{
|
||||
// My IDE doesn't think so, but we do actually need these generics.
|
||||
|
||||
ScreenManager.<ContainerComputer, GuiComputer<ContainerComputer>>register( Registry.ModContainers.COMPUTER.get(), GuiComputer::create );
|
||||
ScreenManager.<ContainerPocketComputer, GuiComputer<ContainerPocketComputer>>register( Registry.ModContainers.POCKET_COMPUTER.get(), GuiComputer::createPocket );
|
||||
ScreenManager.<ContainerComputerBase, GuiComputer<ContainerComputerBase>>register( Registry.ModContainers.COMPUTER.get(), GuiComputer::create );
|
||||
ScreenManager.<ContainerComputerBase, GuiComputer<ContainerComputerBase>>register( Registry.ModContainers.POCKET_COMPUTER.get(), GuiComputer::createPocket );
|
||||
ScreenManager.<ContainerComputerBase, NoTermComputerScreen<ContainerComputerBase>>register( Registry.ModContainers.POCKET_COMPUTER_NO_TERM.get(), NoTermComputerScreen::new );
|
||||
ScreenManager.register( Registry.ModContainers.TURTLE.get(), GuiTurtle::new );
|
||||
|
||||
ScreenManager.register( Registry.ModContainers.PRINTER.get(), GuiPrinter::new );
|
||||
|
@@ -10,8 +10,8 @@ import net.minecraft.client.audio.ISound;
|
||||
import net.minecraft.client.audio.ITickableSound;
|
||||
import net.minecraft.client.audio.LocatableSound;
|
||||
import net.minecraft.client.audio.SoundHandler;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -22,7 +22,7 @@ public class SoundManager
|
||||
{
|
||||
private static final Map<UUID, MoveableSound> sounds = new HashMap<>();
|
||||
|
||||
public static void playSound( UUID source, Vector3d position, SoundEvent event, float volume, float pitch )
|
||||
public static void playSound( UUID source, Vector3d position, ResourceLocation event, float volume, float pitch )
|
||||
{
|
||||
SoundHandler soundManager = Minecraft.getInstance().getSoundManager();
|
||||
|
||||
@@ -55,7 +55,7 @@ public class SoundManager
|
||||
|
||||
private static class MoveableSound extends LocatableSound implements ITickableSound
|
||||
{
|
||||
protected MoveableSound( SoundEvent sound, Vector3d position, float volume, float pitch )
|
||||
protected MoveableSound( ResourceLocation sound, Vector3d position, float volume, float pitch )
|
||||
{
|
||||
super( sound, SoundCategory.RECORDS );
|
||||
setPosition( position );
|
||||
|
@@ -144,22 +144,43 @@ public abstract class ComputerScreenBase<T extends ContainerComputerBase> extend
|
||||
return;
|
||||
}
|
||||
|
||||
String name = file.getFileName().toString();
|
||||
if( name.length() > UploadFileMessage.MAX_FILE_NAME )
|
||||
{
|
||||
alert( UploadResult.FAILED_TITLE, new TranslationTextComponent( "gui.computercraft.upload.failed.name_too_long" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
ByteBuffer buffer = ByteBuffer.allocateDirect( (int) fileSize );
|
||||
sbc.read( buffer );
|
||||
buffer.flip();
|
||||
|
||||
toUpload.add( new FileUpload( file.getFileName().toString(), buffer ) );
|
||||
byte[] digest = FileUpload.getDigest( buffer );
|
||||
if( digest == null )
|
||||
{
|
||||
alert( UploadResult.FAILED_TITLE, new TranslationTextComponent( "gui.computercraft.upload.failed.corrupted" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
buffer.rewind();
|
||||
toUpload.add( new FileUpload( name, buffer, digest ) );
|
||||
}
|
||||
catch( IOException e )
|
||||
{
|
||||
ComputerCraft.log.error( "Failed uploading files", e );
|
||||
alert( UploadResult.FAILED_TITLE, new TranslationTextComponent( "computercraft.gui.upload.failed.generic", e.getMessage() ) );
|
||||
alert( UploadResult.FAILED_TITLE, new TranslationTextComponent( "gui.computercraft.upload.failed.generic", "Cannot compute checksum" ) );
|
||||
}
|
||||
}
|
||||
|
||||
if( toUpload.size() > UploadFileMessage.MAX_FILES )
|
||||
{
|
||||
alert( UploadResult.FAILED_TITLE, new TranslationTextComponent( "gui.computercraft.upload.failed.too_many_files" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if( toUpload.size() > 0 )
|
||||
{
|
||||
NetworkHandler.sendToServer( new UploadFileMessage( computer.getInstanceID(), toUpload ) );
|
||||
UploadFileMessage.send( computer.getInstanceID(), toUpload );
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -11,10 +11,8 @@ import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.client.gui.widgets.ComputerSidebar;
|
||||
import dan200.computercraft.client.gui.widgets.WidgetTerminal;
|
||||
import dan200.computercraft.client.render.ComputerBorderRenderer;
|
||||
import dan200.computercraft.shared.computer.inventory.ContainerComputer;
|
||||
import dan200.computercraft.shared.computer.inventory.ContainerComputerBase;
|
||||
import dan200.computercraft.shared.computer.inventory.ContainerViewComputer;
|
||||
import dan200.computercraft.shared.pocket.inventory.ContainerPocketComputer;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
@@ -39,7 +37,7 @@ public final class GuiComputer<T extends ContainerComputerBase> extends Computer
|
||||
imageHeight = WidgetTerminal.getHeight( termHeight ) + BORDER * 2;
|
||||
}
|
||||
|
||||
public static GuiComputer<ContainerComputer> create( ContainerComputer container, PlayerInventory inventory, ITextComponent component )
|
||||
public static GuiComputer<ContainerComputerBase> create( ContainerComputerBase container, PlayerInventory inventory, ITextComponent component )
|
||||
{
|
||||
return new GuiComputer<>(
|
||||
container, inventory, component,
|
||||
@@ -47,7 +45,7 @@ public final class GuiComputer<T extends ContainerComputerBase> extends Computer
|
||||
);
|
||||
}
|
||||
|
||||
public static GuiComputer<ContainerPocketComputer> createPocket( ContainerPocketComputer container, PlayerInventory inventory, ITextComponent component )
|
||||
public static GuiComputer<ContainerComputerBase> createPocket( ContainerComputerBase container, PlayerInventory inventory, ITextComponent component )
|
||||
{
|
||||
return new GuiComputer<>(
|
||||
container, inventory, component,
|
||||
|
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission.
|
||||
* Send enquiries to dratcliffe@gmail.com
|
||||
*/
|
||||
package dan200.computercraft.client.gui;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.client.gui.widgets.WidgetTerminal;
|
||||
import dan200.computercraft.shared.computer.core.ClientComputer;
|
||||
import dan200.computercraft.shared.computer.inventory.ContainerComputerBase;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.IHasContainer;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.util.IReorderingProcessor;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class NoTermComputerScreen<T extends ContainerComputerBase> extends Screen implements IHasContainer<T>
|
||||
{
|
||||
private final T menu;
|
||||
private WidgetTerminal terminal;
|
||||
|
||||
public NoTermComputerScreen( T menu, PlayerInventory player, ITextComponent title )
|
||||
{
|
||||
super( title );
|
||||
this.menu = menu;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public T getMenu()
|
||||
{
|
||||
return menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init()
|
||||
{
|
||||
this.passEvents = true; // to allow gui click events pass through mouseHelper protection (see MouseHelper.OnPres:105 code string)
|
||||
minecraft.mouseHandler.grabMouse();
|
||||
minecraft.screen = this;
|
||||
|
||||
super.init();
|
||||
minecraft.keyboardHandler.setSendRepeatsToGui( true );
|
||||
|
||||
terminal = addWidget( new WidgetTerminal( (ClientComputer) menu.getComputer(), 0, 0, ComputerCraft.pocketTermWidth, ComputerCraft.pocketTermHeight ) );
|
||||
terminal.visible = false;
|
||||
terminal.active = false;
|
||||
setFocused( terminal );
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void removed()
|
||||
{
|
||||
super.removed();
|
||||
minecraft.keyboardHandler.setSendRepeatsToGui( false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void tick()
|
||||
{
|
||||
super.tick();
|
||||
terminal.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled( double pMouseX, double pMouseY, double pDelta )
|
||||
{
|
||||
minecraft.player.inventory.swapPaint( pDelta );
|
||||
return super.mouseScrolled( pMouseX, pMouseY, pDelta );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose()
|
||||
{
|
||||
minecraft.player.closeContainer();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPauseScreen()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean keyPressed( int key, int scancode, int modifiers )
|
||||
{
|
||||
// Forward the tab key to the terminal, rather than moving between controls.
|
||||
if( key == GLFW.GLFW_KEY_TAB && getFocused() != null && getFocused() == terminal )
|
||||
{
|
||||
return getFocused().keyPressed( key, scancode, modifiers );
|
||||
}
|
||||
|
||||
return super.keyPressed( key, scancode, modifiers );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render( MatrixStack transform, int mouseX, int mouseY, float partialTicks )
|
||||
{
|
||||
super.render( transform, mouseX, mouseY, partialTicks );
|
||||
|
||||
FontRenderer font = minecraft.font;
|
||||
List<IReorderingProcessor> lines = font.split( new TranslationTextComponent( "gui.computercraft.pocket_computer_overlay" ), (int) (width * 0.8) );
|
||||
float y = 10.0f;
|
||||
for( IReorderingProcessor line : lines )
|
||||
{
|
||||
font.drawShadow( transform, line, (float) ((width / 2) - (minecraft.font.width( line ) / 2)), y, 0xFFFFFF );
|
||||
y += 9.0f;
|
||||
}
|
||||
}
|
||||
}
|
@@ -311,6 +311,7 @@ public class WidgetTerminal extends Widget
|
||||
@Override
|
||||
public void render( @Nonnull MatrixStack transform, int mouseX, int mouseY, float partialTicks )
|
||||
{
|
||||
if( !visible ) return;
|
||||
Matrix4f matrix = transform.last().pose();
|
||||
Terminal terminal = computer.getTerminal();
|
||||
if( terminal != null )
|
||||
|
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission.
|
||||
* Send enquiries to dratcliffe@gmail.com
|
||||
*/
|
||||
package dan200.computercraft.client.render;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.api.turtle.ITurtleUpgrade;
|
||||
import dan200.computercraft.api.turtle.TurtleSide;
|
||||
import dan200.computercraft.shared.peripheral.monitor.TileMonitor;
|
||||
import dan200.computercraft.shared.turtle.blocks.TileTurtle;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mod.EventBusSubscriber( modid = ComputerCraft.MOD_ID, value = Dist.CLIENT )
|
||||
public class DebugOverlay
|
||||
{
|
||||
@SubscribeEvent
|
||||
public static void onRenderText( RenderGameOverlayEvent.Text event )
|
||||
{
|
||||
Minecraft minecraft = Minecraft.getInstance();
|
||||
if( !minecraft.options.renderDebug || minecraft.level == null ) return;
|
||||
if( minecraft.hitResult == null || minecraft.hitResult.getType() != RayTraceResult.Type.BLOCK ) return;
|
||||
|
||||
TileEntity tile = minecraft.level.getBlockEntity( ((BlockRayTraceResult) minecraft.hitResult).getBlockPos() );
|
||||
|
||||
if( tile instanceof TileMonitor )
|
||||
{
|
||||
TileMonitor monitor = (TileMonitor) tile;
|
||||
event.getRight().add( "" );
|
||||
event.getRight().add(
|
||||
String.format( "Targeted monitor: (%d, %d), %d x %d", monitor.getXIndex(), monitor.getYIndex(), monitor.getWidth(), monitor.getHeight() )
|
||||
);
|
||||
}
|
||||
else if( tile instanceof TileTurtle )
|
||||
{
|
||||
TileTurtle turtle = (TileTurtle) tile;
|
||||
|
||||
event.getRight().add( "" );
|
||||
event.getRight().add( "Targeted turtle:" );
|
||||
event.getRight().add( String.format( "Id: %d", turtle.getComputerID() ) );
|
||||
addTurtleUpgrade( event.getRight(), turtle, TurtleSide.LEFT );
|
||||
addTurtleUpgrade( event.getRight(), turtle, TurtleSide.RIGHT );
|
||||
}
|
||||
}
|
||||
|
||||
private static void addTurtleUpgrade( List<String> out, TileTurtle turtle, TurtleSide side )
|
||||
{
|
||||
ITurtleUpgrade upgrade = turtle.getUpgrade( side );
|
||||
if( upgrade != null ) out.add( String.format( "Upgrade[%s]: %s", side, upgrade.getUpgradeID() ) );
|
||||
}
|
||||
}
|
@@ -140,8 +140,8 @@ public class TileEntityMonitorRenderer extends TileEntityRenderer<TileMonitor>
|
||||
|
||||
FixedWidthFontRenderer.drawBlocker(
|
||||
transform.last().pose(), renderer,
|
||||
(float) -TileMonitor.RENDER_MARGIN, (float) TileMonitor.RENDER_MARGIN,
|
||||
(float) (xSize + 2 * TileMonitor.RENDER_MARGIN), (float) -(ySize + TileMonitor.RENDER_MARGIN * 2)
|
||||
-MARGIN, MARGIN,
|
||||
(float) (xSize + 2 * MARGIN), (float) -(ySize + MARGIN * 2)
|
||||
);
|
||||
|
||||
// Force a flush of the blocker. WorldRenderer.updateCameraAndRender will "finish" all the built-in
|
||||
|
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
package dan200.computercraft.core.apis;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.api.filesystem.IMount;
|
||||
import dan200.computercraft.api.filesystem.IWritableMount;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
@@ -30,6 +31,11 @@ public abstract class ComputerAccess implements IComputerAccess
|
||||
public void unmountAll()
|
||||
{
|
||||
FileSystem fileSystem = environment.getFileSystem();
|
||||
if( !mounts.isEmpty() )
|
||||
{
|
||||
ComputerCraft.log.warn( "Peripheral or API called mount but did not call unmount for {}", mounts );
|
||||
}
|
||||
|
||||
for( String mount : mounts )
|
||||
{
|
||||
fileSystem.unmount( mount );
|
||||
|
@@ -99,6 +99,7 @@ public class FSAPI implements ILuaAPI
|
||||
* @throws LuaException On argument errors.
|
||||
* @cc.tparam string path The first part of the path. For example, a parent directory path.
|
||||
* @cc.tparam string ... Additional parts of the path to combine.
|
||||
* @cc.changed 1.95.0 Now supports multiple arguments.
|
||||
* @cc.usage Combine several file paths together
|
||||
* <pre>{@code
|
||||
* fs.combine("/rom/programs", "../apis", "parallel.lua")
|
||||
@@ -126,6 +127,7 @@ public class FSAPI implements ILuaAPI
|
||||
*
|
||||
* @param path The path to get the name from.
|
||||
* @return The final part of the path (the file name).
|
||||
* @cc.since 1.2
|
||||
* @cc.usage Get the file name of {@code rom/startup.lua}
|
||||
* <pre>{@code
|
||||
* fs.getName("rom/startup.lua")
|
||||
@@ -143,6 +145,7 @@ public class FSAPI implements ILuaAPI
|
||||
*
|
||||
* @param path The path to get the directory from.
|
||||
* @return The path with the final part removed (the parent directory).
|
||||
* @cc.since 1.63
|
||||
* @cc.usage Get the directory name of {@code rom/startup.lua}
|
||||
* <pre>{@code
|
||||
* fs.getDir("rom/startup.lua")
|
||||
@@ -161,6 +164,7 @@ public class FSAPI implements ILuaAPI
|
||||
* @param path The file to get the file size of.
|
||||
* @return The size of the file, in bytes.
|
||||
* @throws LuaException If the path doesn't exist.
|
||||
* @cc.since 1.3
|
||||
*/
|
||||
@LuaFunction
|
||||
public final long getSize( String path ) throws LuaException
|
||||
@@ -457,8 +461,9 @@ public class FSAPI implements ILuaAPI
|
||||
* @param path The path to check the free space for.
|
||||
* @return The amount of free space available, in bytes.
|
||||
* @throws LuaException If the path doesn't exist.
|
||||
* @see #getCapacity To get the capacity of this drive.
|
||||
* @cc.treturn number|"unlimited" The amount of free space available, in bytes, or "unlimited".
|
||||
* @cc.since 1.4
|
||||
* @see #getCapacity To get the capacity of this drive.
|
||||
*/
|
||||
@LuaFunction
|
||||
public final Object getFreeSpace( String path ) throws LuaException
|
||||
@@ -479,12 +484,13 @@ public class FSAPI implements ILuaAPI
|
||||
*
|
||||
* This string is formatted like a normal path string, but can include any
|
||||
* number of wildcards ({@code *}) to look for files matching anything.
|
||||
* For example, {@code rom/* /command*} will look for any path starting with
|
||||
* For example, <code>rom/*/command*</code> will look for any path starting with
|
||||
* {@code command} inside any subdirectory of {@code /rom}.
|
||||
*
|
||||
* @param path The wildcard-qualified path to search for.
|
||||
* @return A list of paths that match the search string.
|
||||
* @throws LuaException If the path doesn't exist.
|
||||
* @cc.since 1.6
|
||||
*/
|
||||
@LuaFunction
|
||||
public final String[] find( String path ) throws LuaException
|
||||
@@ -506,9 +512,10 @@ public class FSAPI implements ILuaAPI
|
||||
* @param path The path of the drive to get.
|
||||
* @return The drive's capacity.
|
||||
* @throws LuaException If the capacity cannot be determined.
|
||||
* @see #getFreeSpace To get the free space available on this drive.
|
||||
* @cc.treturn number|nil This drive's capacity. This will be nil for "read-only" drives, such as the ROM or
|
||||
* treasure disks.
|
||||
* @cc.since 1.87.0
|
||||
* @see #getFreeSpace To get the free space available on this drive.
|
||||
*/
|
||||
@LuaFunction
|
||||
public final Object getCapacity( String path ) throws LuaException
|
||||
@@ -537,6 +544,9 @@ public class FSAPI implements ILuaAPI
|
||||
* @return The resulting attributes.
|
||||
* @throws LuaException If the path does not exist.
|
||||
* @cc.treturn { size = number, isDir = boolean, isReadOnly = boolean, created = number, modified = number } The resulting attributes.
|
||||
* @cc.since 1.87.0
|
||||
* @cc.changed 1.91.0 Renamed `modification` field to `modified`.
|
||||
* @cc.changed 1.95.2 Added `isReadOnly` to attributes.
|
||||
* @see #getSize If you only care about the file's size.
|
||||
* @see #isDir If you only care whether a path is a directory or not.
|
||||
*/
|
||||
|
@@ -204,14 +204,15 @@ public class OSAPI implements ILuaAPI
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an alarm that will fire at the specified world time. When it fires,
|
||||
* an {@code alarm} event will be added to the event queue with the ID
|
||||
* returned from this function as the first parameter.
|
||||
* Sets an alarm that will fire at the specified in-game time. When it
|
||||
* fires, * an {@code alarm} event will be added to the event queue with the
|
||||
* ID * returned from this function as the first parameter.
|
||||
*
|
||||
* @param time The time at which to fire the alarm, in the range [0.0, 24.0).
|
||||
* @return The ID of the new alarm. This can be used to filter the
|
||||
* {@code alarm} event, or {@link #cancelAlarm cancel the alarm}.
|
||||
* @throws LuaException If the time is out of range.
|
||||
* @cc.since 1.2
|
||||
* @see #cancelAlarm To cancel an alarm.
|
||||
*/
|
||||
@LuaFunction
|
||||
@@ -232,6 +233,7 @@ public class OSAPI implements ILuaAPI
|
||||
* alarm from firing.
|
||||
*
|
||||
* @param token The ID of the alarm to cancel.
|
||||
* @cc.since 1.2
|
||||
* @see #setAlarm To set an alarm.
|
||||
*/
|
||||
@LuaFunction
|
||||
@@ -277,6 +279,7 @@ public class OSAPI implements ILuaAPI
|
||||
*
|
||||
* @return The label of the computer.
|
||||
* @cc.treturn string The label of the computer.
|
||||
* @cc.since 1.3
|
||||
*/
|
||||
@LuaFunction( { "getComputerLabel", "computerLabel" } )
|
||||
public final Object[] getComputerLabel()
|
||||
@@ -289,6 +292,7 @@ public class OSAPI implements ILuaAPI
|
||||
* Set the label of this computer.
|
||||
*
|
||||
* @param label The new label. May be {@code nil} in order to clear it.
|
||||
* @cc.since 1.3
|
||||
*/
|
||||
@LuaFunction
|
||||
public final void setComputerLabel( Optional<String> label )
|
||||
@@ -300,6 +304,7 @@ public class OSAPI implements ILuaAPI
|
||||
* Returns the number of seconds that the computer has been running.
|
||||
*
|
||||
* @return The computer's uptime.
|
||||
* @cc.since 1.2
|
||||
*/
|
||||
@LuaFunction
|
||||
public final double clock()
|
||||
@@ -325,6 +330,15 @@ public class OSAPI implements ILuaAPI
|
||||
* @return The hour of the selected locale, or a UNIX timestamp from the table, depending on the argument passed in.
|
||||
* @throws LuaException If an invalid locale is passed.
|
||||
* @cc.tparam [opt] string|table locale The locale of the time, or a table filled by {@code os.date("*t")} to decode. Defaults to {@code ingame} locale if not specified.
|
||||
* @cc.see textutils.formatTime To convert times into a user-readable string.
|
||||
* @cc.usage Print the current in-game time.
|
||||
* <pre>{@code
|
||||
* textutils.formatTime(os.time())
|
||||
* }</pre>
|
||||
* @cc.since 1.2
|
||||
* @cc.changed 1.80pr1 Add support for getting the local local and UTC time.
|
||||
* @cc.changed 1.82.0 Arguments are now case insensitive.
|
||||
* @cc.changed 1.83.0 {@link #time(IArguments)} now accepts table arguments and converts them to UNIX timestamps.
|
||||
* @see #date To get a date table that can be converted with this function.
|
||||
*/
|
||||
@LuaFunction
|
||||
@@ -360,6 +374,8 @@ public class OSAPI implements ILuaAPI
|
||||
* @param args The locale to get the day for. Defaults to {@code ingame} if not set.
|
||||
* @return The day depending on the selected locale.
|
||||
* @throws LuaException If an invalid locale is passed.
|
||||
* @cc.since 1.48
|
||||
* @cc.changed 1.82.0 Arguments are now case insensitive.
|
||||
*/
|
||||
@LuaFunction
|
||||
public final int day( Optional<String> args ) throws LuaException
|
||||
@@ -390,6 +406,14 @@ public class OSAPI implements ILuaAPI
|
||||
* @param args The locale to get the milliseconds for. Defaults to {@code ingame} if not set.
|
||||
* @return The milliseconds since the epoch depending on the selected locale.
|
||||
* @throws LuaException If an invalid locale is passed.
|
||||
* @cc.since 1.80pr1
|
||||
* @cc.usage Get the current time and use {@link #date} to convert it to a table.
|
||||
* <pre>{@code
|
||||
* -- Dividing by 1000 converts it from milliseconds to seconds.
|
||||
* local time = os.epoch("local") / 1000
|
||||
* local time_table = os.date("*t", time)
|
||||
* print(textutils.serialize(time_table))
|
||||
* }</pre>
|
||||
*/
|
||||
@LuaFunction
|
||||
public final long epoch( Optional<String> args ) throws LuaException
|
||||
@@ -438,6 +462,11 @@ public class OSAPI implements ILuaAPI
|
||||
* @param timeA The time to convert to a string. This defaults to the current time.
|
||||
* @return The resulting format string.
|
||||
* @throws LuaException If an invalid format is passed.
|
||||
* @cc.since 1.83.0
|
||||
* @cc.usage Print the current date in a user-friendly string.
|
||||
* <pre>{@code
|
||||
* os.date("%A %d %B %Y") -- See the reference above!
|
||||
* }</pre>
|
||||
*/
|
||||
@LuaFunction
|
||||
public final Object date( Optional<String> formatA, Optional<Long> timeA ) throws LuaException
|
||||
|
@@ -17,6 +17,7 @@ import dan200.computercraft.core.asm.NamedMethod;
|
||||
import dan200.computercraft.core.asm.PeripheralMethod;
|
||||
import dan200.computercraft.core.computer.ComputerSide;
|
||||
import dan200.computercraft.core.tracking.TrackingField;
|
||||
import dan200.computercraft.shared.util.LuaUtil;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -36,6 +37,7 @@ public class PeripheralAPI implements ILuaAPI, IAPIEnvironment.IPeripheralChange
|
||||
private final IPeripheral peripheral;
|
||||
|
||||
private final String type;
|
||||
private final Set<String> additionalTypes;
|
||||
private final Map<String, PeripheralMethod> methodMap;
|
||||
private boolean attached;
|
||||
|
||||
@@ -47,6 +49,7 @@ public class PeripheralAPI implements ILuaAPI, IAPIEnvironment.IPeripheralChange
|
||||
attached = false;
|
||||
|
||||
type = Objects.requireNonNull( peripheral.getType(), "Peripheral type cannot be null" );
|
||||
additionalTypes = peripheral.getAdditionalTypes();
|
||||
|
||||
methodMap = PeripheralAPI.getMethods( peripheral );
|
||||
}
|
||||
@@ -61,6 +64,11 @@ public class PeripheralAPI implements ILuaAPI, IAPIEnvironment.IPeripheralChange
|
||||
return type;
|
||||
}
|
||||
|
||||
public Set<String> getAdditionalTypes()
|
||||
{
|
||||
return additionalTypes;
|
||||
}
|
||||
|
||||
public Collection<String> getMethods()
|
||||
{
|
||||
return methodMap.keySet();
|
||||
@@ -298,7 +306,23 @@ public class PeripheralAPI implements ILuaAPI, IAPIEnvironment.IPeripheralChange
|
||||
synchronized( peripherals )
|
||||
{
|
||||
PeripheralWrapper p = peripherals[side.ordinal()];
|
||||
if( p != null ) return new Object[] { p.getType() };
|
||||
return p == null ? null : LuaUtil.consArray( p.getType(), p.getAdditionalTypes() );
|
||||
}
|
||||
}
|
||||
|
||||
@LuaFunction
|
||||
public final Object[] hasType( String sideName, String type )
|
||||
{
|
||||
ComputerSide side = ComputerSide.valueOfInsensitive( sideName );
|
||||
if( side == null ) return null;
|
||||
|
||||
synchronized( peripherals )
|
||||
{
|
||||
PeripheralWrapper p = peripherals[side.ordinal()];
|
||||
if( p != null )
|
||||
{
|
||||
return new Object[] { p.getType().equals( type ) || p.getAdditionalTypes().contains( type ) };
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@@ -137,8 +137,8 @@ public class RedstoneAPI implements ILuaAPI
|
||||
*
|
||||
* @param side The side to get.
|
||||
* @return The output signal strength, between 0 and 15.
|
||||
* @see #setAnalogOutput
|
||||
* @cc.since 1.51
|
||||
* @see #setAnalogOutput
|
||||
*/
|
||||
@LuaFunction( { "getAnalogOutput", "getAnalogueOutput" } )
|
||||
public final int getAnalogOutput( ComputerSide side )
|
||||
|
@@ -46,6 +46,7 @@ public class TermAPI extends TermMethods implements ILuaAPI
|
||||
* @cc.treturn number The red channel, will be between 0 and 1.
|
||||
* @cc.treturn number The green channel, will be between 0 and 1.
|
||||
* @cc.treturn number The blue channel, will be between 0 and 1.
|
||||
* @cc.since 1.81.0
|
||||
* @see TermMethods#setPaletteColour(IArguments) To change the palette colour.
|
||||
*/
|
||||
@LuaFunction( { "nativePaletteColour", "nativePaletteColor" } )
|
||||
|
@@ -112,6 +112,7 @@ public abstract class TermMethods
|
||||
*
|
||||
* @return If the cursor is blinking.
|
||||
* @throws LuaException (hidden) If the terminal cannot be found.
|
||||
* @cc.since 1.80pr1.9
|
||||
*/
|
||||
@LuaFunction
|
||||
public final boolean getCursorBlink() throws LuaException
|
||||
@@ -179,6 +180,7 @@ public abstract class TermMethods
|
||||
* @return The current text colour.
|
||||
* @throws LuaException (hidden) If the terminal cannot be found.
|
||||
* @cc.see colors For a list of colour constants, returned by this function.
|
||||
* @cc.since 1.74
|
||||
*/
|
||||
@LuaFunction( { "getTextColour", "getTextColor" } )
|
||||
public final int getTextColour() throws LuaException
|
||||
@@ -192,6 +194,8 @@ public abstract class TermMethods
|
||||
* @param colourArg The new text colour.
|
||||
* @throws LuaException (hidden) If the terminal cannot be found.
|
||||
* @cc.see colors For a list of colour constants.
|
||||
* @cc.since 1.45
|
||||
* @cc.changed 1.80pr1 Standard computers can now use all 16 colors, being changed to grayscale on screen.
|
||||
*/
|
||||
@LuaFunction( { "setTextColour", "setTextColor" } )
|
||||
public final void setTextColour( int colourArg ) throws LuaException
|
||||
@@ -211,6 +215,7 @@ public abstract class TermMethods
|
||||
* @return The current background colour.
|
||||
* @throws LuaException (hidden) If the terminal cannot be found.
|
||||
* @cc.see colors For a list of colour constants, returned by this function.
|
||||
* @cc.since 1.74
|
||||
*/
|
||||
@LuaFunction( { "getBackgroundColour", "getBackgroundColor" } )
|
||||
public final int getBackgroundColour() throws LuaException
|
||||
@@ -225,6 +230,8 @@ public abstract class TermMethods
|
||||
* @param colourArg The new background colour.
|
||||
* @throws LuaException (hidden) If the terminal cannot be found.
|
||||
* @cc.see colors For a list of colour constants.
|
||||
* @cc.since 1.45
|
||||
* @cc.changed 1.80pr1 Standard computers can now use all 16 colors, being changed to grayscale on screen.
|
||||
*/
|
||||
@LuaFunction( { "setBackgroundColour", "setBackgroundColor" } )
|
||||
public final void setBackgroundColour( int colourArg ) throws LuaException
|
||||
@@ -245,6 +252,7 @@ public abstract class TermMethods
|
||||
*
|
||||
* @return Whether this terminal supports colour.
|
||||
* @throws LuaException (hidden) If the terminal cannot be found.
|
||||
* @cc.since 1.45
|
||||
*/
|
||||
@LuaFunction( { "isColour", "isColor" } )
|
||||
public final boolean getIsColour() throws LuaException
|
||||
@@ -267,6 +275,8 @@ public abstract class TermMethods
|
||||
* @param backgroundColour The corresponding background colours.
|
||||
* @throws LuaException If the three inputs are not the same length.
|
||||
* @cc.see colors For a list of colour constants, and their hexadecimal values.
|
||||
* @cc.since 1.74
|
||||
* @cc.changed 1.80pr1 Standard computers can now use all 16 colors, being changed to grayscale on screen.
|
||||
* @cc.usage Prints "Hello, world!" in rainbow text.
|
||||
* <pre>{@code
|
||||
* term.blit("Hello, world!","01234456789ab","0000000000000")
|
||||
@@ -319,6 +329,7 @@ public abstract class TermMethods
|
||||
* }</pre>
|
||||
* @cc.see colors.unpackRGB To convert from the 24-bit format to three separate channels.
|
||||
* @cc.see colors.packRGB To convert from three separate channels to the 24-bit format.
|
||||
* @cc.since 1.80pr1
|
||||
*/
|
||||
@LuaFunction( { "setPaletteColour", "setPaletteColor" } )
|
||||
public final void setPaletteColour( IArguments args ) throws LuaException
|
||||
@@ -348,6 +359,7 @@ public abstract class TermMethods
|
||||
* @cc.treturn number The red channel, will be between 0 and 1.
|
||||
* @cc.treturn number The green channel, will be between 0 and 1.
|
||||
* @cc.treturn number The blue channel, will be between 0 and 1.
|
||||
* @cc.since 1.80pr1
|
||||
*/
|
||||
@LuaFunction( { "getPaletteColour", "getPaletteColor" } )
|
||||
public final Object[] getPaletteColour( int colourArg ) throws LuaException
|
||||
|
@@ -61,6 +61,7 @@ public class BinaryReadableHandle extends HandleGeneric
|
||||
* @cc.treturn [1] nil If we are at the end of the file.
|
||||
* @cc.treturn [2] number The value of the byte read. This is returned when the {@code count} is absent.
|
||||
* @cc.treturn [3] string The bytes read as a string. This is returned when the {@code count} is given.
|
||||
* @cc.changed 1.80pr1 Now accepts an integer argument to read multiple bytes, returning a string instead of a number.
|
||||
*/
|
||||
@LuaFunction
|
||||
public final Object[] read( Optional<Integer> countArg ) throws LuaException
|
||||
@@ -145,6 +146,7 @@ public class BinaryReadableHandle extends HandleGeneric
|
||||
* @return The file, or {@code null} if at the end of it.
|
||||
* @throws LuaException If the file has been closed.
|
||||
* @cc.treturn string|nil The remaining contents of the file, or {@code nil} if we are at the end.
|
||||
* @cc.since 1.80pr1
|
||||
*/
|
||||
@LuaFunction
|
||||
public final Object[] readAll() throws LuaException
|
||||
@@ -182,6 +184,8 @@ public class BinaryReadableHandle extends HandleGeneric
|
||||
* @return The read string.
|
||||
* @throws LuaException If the file has been closed.
|
||||
* @cc.treturn string|nil The read line or {@code nil} if at the end of the file.
|
||||
* @cc.since 1.80pr1.9
|
||||
* @cc.changed 1.81.0 `\r` is now stripped.
|
||||
*/
|
||||
@LuaFunction
|
||||
public final Object[] readLine( Optional<Boolean> withTrailingArg ) throws LuaException
|
||||
@@ -259,6 +263,7 @@ public class BinaryReadableHandle extends HandleGeneric
|
||||
* @cc.treturn [1] number The new position.
|
||||
* @cc.treturn [2] nil If seeking failed.
|
||||
* @cc.treturn string The reason seeking failed.
|
||||
* @cc.since 1.80pr1.9
|
||||
*/
|
||||
@LuaFunction
|
||||
public final Object[] seek( Optional<String> whence, Optional<Long> offset ) throws LuaException
|
||||
|
@@ -55,6 +55,7 @@ public class BinaryWritableHandle extends HandleGeneric
|
||||
* @throws LuaException If the file has been closed.
|
||||
* @cc.tparam [1] number The byte to write.
|
||||
* @cc.tparam [2] string The string to write.
|
||||
* @cc.changed 1.80pr1 Now accepts a string to write multiple bytes.
|
||||
*/
|
||||
@LuaFunction
|
||||
public final void write( IArguments arguments ) throws LuaException
|
||||
@@ -130,6 +131,7 @@ public class BinaryWritableHandle extends HandleGeneric
|
||||
* @cc.treturn [1] number The new position.
|
||||
* @cc.treturn [2] nil If seeking failed.
|
||||
* @cc.treturn string The reason seeking failed.
|
||||
* @cc.since 1.80pr1.9
|
||||
*/
|
||||
@LuaFunction
|
||||
public final Object[] seek( Optional<String> whence, Optional<Long> offset ) throws LuaException
|
||||
|
@@ -50,6 +50,7 @@ public class EncodedReadableHandle extends HandleGeneric
|
||||
* @return The read string.
|
||||
* @throws LuaException If the file has been closed.
|
||||
* @cc.treturn string|nil The read line or {@code nil} if at the end of the file.
|
||||
* @cc.changed 1.81.0 Added option to return trailing newline.
|
||||
*/
|
||||
@LuaFunction
|
||||
public final Object[] readLine( Optional<Boolean> withTrailingArg ) throws LuaException
|
||||
@@ -116,6 +117,7 @@ public class EncodedReadableHandle extends HandleGeneric
|
||||
* @throws LuaException When trying to read a negative number of characters.
|
||||
* @throws LuaException If the file has been closed.
|
||||
* @cc.treturn string|nil The read characters, or {@code nil} if at the of the file.
|
||||
* @cc.since 1.80pr1.4
|
||||
*/
|
||||
@LuaFunction
|
||||
public final Object[] read( Optional<Integer> countA ) throws LuaException
|
||||
|
@@ -46,6 +46,7 @@ public class HttpResponseHandle implements ObjectSource
|
||||
* @return The response code and message.
|
||||
* @cc.treturn number The response code (i.e. 200)
|
||||
* @cc.treturn string The response message (i.e. "OK")
|
||||
* @cc.changed 1.80pr1.13 Added response message return value.
|
||||
*/
|
||||
@LuaFunction
|
||||
public final Object[] getResponseCode()
|
||||
|
@@ -55,6 +55,8 @@ public class WebsocketHandle implements Closeable
|
||||
* @cc.treturn [1] string The received message.
|
||||
* @cc.treturn boolean If this was a binary message.
|
||||
* @cc.treturn [2] nil If the websocket was closed while waiting, or if we timed out.
|
||||
* @cc.changed 1.80pr1.13 Added return value indicating whether the message was binary.
|
||||
* @cc.changed 1.87.0 Added timeout argument.
|
||||
*/
|
||||
@LuaFunction
|
||||
public final MethodResult receive( Optional<Double> timeout ) throws LuaException
|
||||
@@ -74,6 +76,7 @@ public class WebsocketHandle implements Closeable
|
||||
* @param binary Whether this message should be treated as a
|
||||
* @throws LuaException If the message is too large.
|
||||
* @throws LuaException If the websocket has been closed.
|
||||
* @cc.changed 1.81.0 Added argument for binary mode.
|
||||
*/
|
||||
@LuaFunction
|
||||
public final void send( Object message, Optional<Boolean> binary ) throws LuaException
|
||||
|
@@ -15,6 +15,7 @@ import dan200.computercraft.api.lua.IArguments;
|
||||
import dan200.computercraft.api.lua.LuaException;
|
||||
import dan200.computercraft.api.lua.LuaFunction;
|
||||
import dan200.computercraft.api.lua.MethodResult;
|
||||
import dan200.computercraft.api.peripheral.PeripheralType;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Type;
|
||||
@@ -108,7 +109,7 @@ public final class Generator<T>
|
||||
if( instance == null ) continue;
|
||||
|
||||
if( methods == null ) methods = new ArrayList<>();
|
||||
addMethod( methods, method, annotation, instance );
|
||||
addMethod( methods, method, annotation, null, instance );
|
||||
}
|
||||
|
||||
for( GenericMethod method : GenericMethod.all() )
|
||||
@@ -119,7 +120,7 @@ public final class Generator<T>
|
||||
if( instance == null ) continue;
|
||||
|
||||
if( methods == null ) methods = new ArrayList<>();
|
||||
addMethod( methods, method.method, method.annotation, instance );
|
||||
addMethod( methods, method.method, method.annotation, method.peripheralType, instance );
|
||||
}
|
||||
|
||||
if( methods == null ) return Collections.emptyList();
|
||||
@@ -127,7 +128,7 @@ public final class Generator<T>
|
||||
return Collections.unmodifiableList( methods );
|
||||
}
|
||||
|
||||
private void addMethod( List<NamedMethod<T>> methods, Method method, LuaFunction annotation, T instance )
|
||||
private void addMethod( List<NamedMethod<T>> methods, Method method, LuaFunction annotation, PeripheralType genericType, T instance )
|
||||
{
|
||||
if( annotation.mainThread() ) instance = wrap.apply( instance );
|
||||
|
||||
@@ -135,13 +136,13 @@ public final class Generator<T>
|
||||
boolean isSimple = method.getReturnType() != MethodResult.class && !annotation.mainThread();
|
||||
if( names.length == 0 )
|
||||
{
|
||||
methods.add( new NamedMethod<>( method.getName(), instance, isSimple ) );
|
||||
methods.add( new NamedMethod<>( method.getName(), instance, isSimple, genericType ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
for( String name : names )
|
||||
{
|
||||
methods.add( new NamedMethod<>( name, instance, isSimple ) );
|
||||
methods.add( new NamedMethod<>( name, instance, isSimple, genericType ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -8,6 +8,8 @@ package dan200.computercraft.core.asm;
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.api.lua.GenericSource;
|
||||
import dan200.computercraft.api.lua.LuaFunction;
|
||||
import dan200.computercraft.api.peripheral.GenericPeripheral;
|
||||
import dan200.computercraft.api.peripheral.PeripheralType;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -18,6 +20,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* A generic method is a method belonging to a {@link GenericSource} with a known target.
|
||||
@@ -27,15 +30,17 @@ public class GenericMethod
|
||||
final Method method;
|
||||
final LuaFunction annotation;
|
||||
final Class<?> target;
|
||||
final PeripheralType peripheralType;
|
||||
|
||||
private static final List<GenericSource> sources = new ArrayList<>();
|
||||
private static List<GenericMethod> cache;
|
||||
|
||||
GenericMethod( Method method, LuaFunction annotation, Class<?> target )
|
||||
GenericMethod( Method method, LuaFunction annotation, Class<?> target, PeripheralType peripheralType )
|
||||
{
|
||||
this.method = method;
|
||||
this.annotation = annotation;
|
||||
this.target = target;
|
||||
this.peripheralType = peripheralType;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,10 +51,28 @@ public class GenericMethod
|
||||
static List<GenericMethod> all()
|
||||
{
|
||||
if( cache != null ) return cache;
|
||||
return cache = sources.stream()
|
||||
.flatMap( x -> Arrays.stream( x.getClass().getDeclaredMethods() ) )
|
||||
.map( method ->
|
||||
{
|
||||
return cache = sources.stream().flatMap( GenericMethod::getMethods ).collect( Collectors.toList() );
|
||||
}
|
||||
|
||||
public static synchronized void register( @Nonnull GenericSource source )
|
||||
{
|
||||
Objects.requireNonNull( source, "Source cannot be null" );
|
||||
|
||||
if( cache != null )
|
||||
{
|
||||
ComputerCraft.log.warn( "Registering a generic source {} after cache has been built. This source will be ignored.", cache );
|
||||
}
|
||||
|
||||
sources.add( source );
|
||||
}
|
||||
|
||||
private static Stream<GenericMethod> getMethods( GenericSource source )
|
||||
{
|
||||
Class<?> klass = source.getClass();
|
||||
PeripheralType type = source instanceof GenericPeripheral ? ((GenericPeripheral) source).getType() : null;
|
||||
|
||||
return Arrays.stream( klass.getDeclaredMethods() )
|
||||
.map( method -> {
|
||||
LuaFunction annotation = method.getAnnotation( LuaFunction.class );
|
||||
if( annotation == null ) return null;
|
||||
|
||||
@@ -69,22 +92,8 @@ public class GenericMethod
|
||||
Class<?> target = Reflect.getRawType( method, types[0], false );
|
||||
if( target == null ) return null;
|
||||
|
||||
return new GenericMethod( method, annotation, target );
|
||||
return new GenericMethod( method, annotation, target, type );
|
||||
} )
|
||||
.filter( Objects::nonNull )
|
||||
.collect( Collectors.toList() );
|
||||
}
|
||||
|
||||
|
||||
public static synchronized void register( @Nonnull GenericSource source )
|
||||
{
|
||||
Objects.requireNonNull( source, "Source cannot be null" );
|
||||
|
||||
if( cache != null )
|
||||
{
|
||||
ComputerCraft.log.warn( "Registering a generic source {} after cache has been built. This source will be ignored.", cache );
|
||||
}
|
||||
|
||||
sources.add( source );
|
||||
.filter( Objects::nonNull );
|
||||
}
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@ import java.util.Collections;
|
||||
public interface LuaMethod
|
||||
{
|
||||
Generator<LuaMethod> GENERATOR = new Generator<>( LuaMethod.class, Collections.singletonList( ILuaContext.class ),
|
||||
m -> ( target, context, args ) -> TaskCallback.make( context, () -> TaskCallback.checkUnwrap( m.apply( target, context, args ) ) )
|
||||
m -> ( target, context, args ) -> context.executeMainThreadTask( () -> ResultHelpers.checkNormalResult( m.apply( target, context, args ) ) )
|
||||
);
|
||||
|
||||
IntCache<LuaMethod> DYNAMIC = new IntCache<>(
|
||||
|
@@ -5,7 +5,10 @@
|
||||
*/
|
||||
package dan200.computercraft.core.asm;
|
||||
|
||||
import dan200.computercraft.api.peripheral.PeripheralType;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public final class NamedMethod<T>
|
||||
{
|
||||
@@ -13,11 +16,14 @@ public final class NamedMethod<T>
|
||||
private final T method;
|
||||
private final boolean nonYielding;
|
||||
|
||||
NamedMethod( String name, T method, boolean nonYielding )
|
||||
private final PeripheralType genericType;
|
||||
|
||||
NamedMethod( String name, T method, boolean nonYielding, PeripheralType genericType )
|
||||
{
|
||||
this.name = name;
|
||||
this.method = method;
|
||||
this.nonYielding = nonYielding;
|
||||
this.genericType = genericType;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -36,4 +42,10 @@ public final class NamedMethod<T>
|
||||
{
|
||||
return nonYielding;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PeripheralType getGenericType()
|
||||
{
|
||||
return genericType;
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ import java.util.Arrays;
|
||||
public interface PeripheralMethod
|
||||
{
|
||||
Generator<PeripheralMethod> GENERATOR = new Generator<>( PeripheralMethod.class, Arrays.asList( ILuaContext.class, IComputerAccess.class ),
|
||||
m -> ( target, context, computer, args ) -> TaskCallback.make( context, () -> TaskCallback.checkUnwrap( m.apply( target, context, computer, args ) ) )
|
||||
m -> ( target, context, computer, args ) -> context.executeMainThreadTask( () -> ResultHelpers.checkNormalResult( m.apply( target, context, computer, args ) ) )
|
||||
);
|
||||
|
||||
IntCache<PeripheralMethod> DYNAMIC = new IntCache<>(
|
||||
|
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission.
|
||||
* Send enquiries to dratcliffe@gmail.com
|
||||
*/
|
||||
package dan200.computercraft.core.asm;
|
||||
|
||||
import dan200.computercraft.api.lua.MethodResult;
|
||||
|
||||
final class ResultHelpers
|
||||
{
|
||||
private ResultHelpers()
|
||||
{
|
||||
}
|
||||
|
||||
static Object[] checkNormalResult( MethodResult result )
|
||||
{
|
||||
if( result.getCallback() != null )
|
||||
{
|
||||
// Due to how tasks are implemented, we can't currently return a MethodResult. This is an
|
||||
// entirely artificial limitation - we can remove it if it ever becomes an issue.
|
||||
throw new IllegalStateException( "Must return MethodResult.of from mainThread function." );
|
||||
}
|
||||
|
||||
return result.getResult();
|
||||
}
|
||||
}
|
@@ -93,7 +93,7 @@ public final class MainThread
|
||||
executor.updateTime();
|
||||
|
||||
// We're not currently on the queue, so update its current execution time to
|
||||
// ensure its at least as high as the minimum.
|
||||
// ensure it's at least as high as the minimum.
|
||||
long newRuntime = minimumTime;
|
||||
|
||||
// Slow down new computers a little bit.
|
||||
|
@@ -7,19 +7,17 @@ package dan200.computercraft.core.filesystem;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.collect.MapMaker;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.api.filesystem.IMount;
|
||||
import dan200.computercraft.core.apis.handles.ArrayByteChannel;
|
||||
import dan200.computercraft.shared.util.IoUtil;
|
||||
import net.minecraft.resources.IReloadableResourceManager;
|
||||
import net.minecraft.client.resources.ReloadListener;
|
||||
import net.minecraft.profiler.IProfiler;
|
||||
import net.minecraft.resources.IResource;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.ResourceLocationException;
|
||||
import net.minecraftforge.resource.IResourceType;
|
||||
import net.minecraftforge.resource.ISelectiveResourceReloadListener;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -28,9 +26,10 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public final class ResourceMount implements IMount
|
||||
{
|
||||
@@ -58,50 +57,37 @@ public final class ResourceMount implements IMount
|
||||
.<FileEntry, byte[]>weigher( ( k, v ) -> v.length )
|
||||
.build();
|
||||
|
||||
private static final MapMaker CACHE_TEMPLATE = new MapMaker().weakValues().concurrencyLevel( 1 );
|
||||
|
||||
/**
|
||||
* Maintain a cache of currently loaded resource mounts. This cache is invalidated when currentManager changes.
|
||||
*/
|
||||
private static final Map<IReloadableResourceManager, Map<ResourceLocation, ResourceMount>> MOUNT_CACHE = new WeakHashMap<>( 2 );
|
||||
private static final Map<ResourceLocation, ResourceMount> MOUNT_CACHE = new HashMap<>( 2 );
|
||||
|
||||
private final String namespace;
|
||||
private final String subPath;
|
||||
private final IReloadableResourceManager manager;
|
||||
private IResourceManager manager;
|
||||
|
||||
@Nullable
|
||||
private FileEntry root;
|
||||
|
||||
public static ResourceMount get( String namespace, String subPath, IReloadableResourceManager manager )
|
||||
public static ResourceMount get( String namespace, String subPath, IResourceManager manager )
|
||||
{
|
||||
Map<ResourceLocation, ResourceMount> cache;
|
||||
|
||||
ResourceLocation path = new ResourceLocation( namespace, subPath );
|
||||
synchronized( MOUNT_CACHE )
|
||||
{
|
||||
cache = MOUNT_CACHE.get( manager );
|
||||
if( cache == null ) MOUNT_CACHE.put( manager, cache = CACHE_TEMPLATE.makeMap() );
|
||||
}
|
||||
|
||||
ResourceLocation path = new ResourceLocation( namespace, subPath );
|
||||
synchronized( cache )
|
||||
{
|
||||
ResourceMount mount = cache.get( path );
|
||||
if( mount == null ) cache.put( path, mount = new ResourceMount( namespace, subPath, manager ) );
|
||||
ResourceMount mount = MOUNT_CACHE.get( path );
|
||||
if( mount == null ) MOUNT_CACHE.put( path, mount = new ResourceMount( namespace, subPath, manager ) );
|
||||
return mount;
|
||||
}
|
||||
}
|
||||
|
||||
private ResourceMount( String namespace, String subPath, IReloadableResourceManager manager )
|
||||
private ResourceMount( String namespace, String subPath, IResourceManager manager )
|
||||
{
|
||||
this.namespace = namespace;
|
||||
this.subPath = subPath;
|
||||
this.manager = manager;
|
||||
|
||||
Listener.INSTANCE.add( manager, this );
|
||||
if( root == null ) load();
|
||||
load( manager );
|
||||
}
|
||||
|
||||
private void load()
|
||||
private void load( IResourceManager manager )
|
||||
{
|
||||
boolean hasAny = false;
|
||||
String existingNamespace = null;
|
||||
@@ -118,6 +104,7 @@ public final class ResourceMount implements IMount
|
||||
hasAny = true;
|
||||
}
|
||||
|
||||
this.manager = manager;
|
||||
root = hasAny ? newRoot : null;
|
||||
|
||||
if( !hasAny )
|
||||
@@ -293,35 +280,30 @@ public final class ResourceMount implements IMount
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link ISelectiveResourceReloadListener} which reloads any associated mounts.
|
||||
*
|
||||
* While people should really be keeping a permanent reference to this, some people construct it every
|
||||
* method call, so let's make this as small as possible.
|
||||
* A {@link ReloadListener} which reloads any associated mounts and correctly updates the resource manager they
|
||||
* point to.
|
||||
*/
|
||||
static class Listener implements ISelectiveResourceReloadListener
|
||||
public static final ReloadListener<Void> RELOAD_LISTENER = new ReloadListener<Void>()
|
||||
{
|
||||
private static final Listener INSTANCE = new Listener();
|
||||
|
||||
private final Set<ResourceMount> mounts = Collections.newSetFromMap( new WeakHashMap<>() );
|
||||
private final Set<IReloadableResourceManager> managers = Collections.newSetFromMap( new WeakHashMap<>() );
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public void onResourceManagerReload( @Nonnull IResourceManager manager )
|
||||
protected Void prepare( @Nonnull IResourceManager manager, @Nonnull IProfiler profiler )
|
||||
{
|
||||
// FIXME: Remove this. We need this patch in order to prevent trying to load ReloadRequirements.
|
||||
onResourceManagerReload( manager, x -> true );
|
||||
profiler.push( "Reloading ComputerCraft mounts" );
|
||||
try
|
||||
{
|
||||
for( ResourceMount mount : MOUNT_CACHE.values() ) mount.load( manager );
|
||||
}
|
||||
finally
|
||||
{
|
||||
profiler.pop();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void onResourceManagerReload( @Nonnull IResourceManager manager, @Nonnull Predicate<IResourceType> predicate )
|
||||
protected void apply( @Nonnull Void result, @Nonnull IResourceManager manager, @Nonnull IProfiler profiler )
|
||||
{
|
||||
for( ResourceMount mount : mounts ) mount.load();
|
||||
}
|
||||
|
||||
synchronized void add( IReloadableResourceManager manager, ResourceMount mount )
|
||||
{
|
||||
if( managers.add( manager ) ) manager.registerReloadListener( this );
|
||||
mounts.add( mount );
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -9,8 +9,6 @@ import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.lua.ILuaTask;
|
||||
import dan200.computercraft.api.lua.LuaException;
|
||||
import dan200.computercraft.api.lua.MethodResult;
|
||||
import dan200.computercraft.core.asm.TaskCallback;
|
||||
import dan200.computercraft.core.computer.Computer;
|
||||
import dan200.computercraft.core.computer.MainThread;
|
||||
|
||||
@@ -68,11 +66,4 @@ class LuaContext implements ILuaContext
|
||||
throw new LuaException( "Task limit exceeded" );
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public MethodResult executeMainThreadTask( @Nonnull ILuaTask task ) throws LuaException
|
||||
{
|
||||
return TaskCallback.make( this, task );
|
||||
}
|
||||
}
|
||||
|
@@ -419,6 +419,7 @@ public class Terminal
|
||||
{
|
||||
if( c >= '0' && c <= '9' ) return c - '0';
|
||||
if( c >= 'a' && c <= 'f' ) return c - 'a' + 10;
|
||||
if( c >= 'A' && c <= 'F' ) return c - 'A' + 10;
|
||||
return 15 - def.ordinal();
|
||||
}
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ public class BasicCustomLoader<T extends ModelBuilder<T>> extends CustomLoaderBu
|
||||
|
||||
public static <T extends ModelBuilder<T>> BiFunction<T, ExistingFileHelper, CustomLoaderBuilder<T>> makeFactory( ResourceLocation id )
|
||||
{
|
||||
return makeFactory( id, j -> { } );
|
||||
return makeFactory( id, j -> {} );
|
||||
}
|
||||
|
||||
public static <T extends ModelBuilder<T>> BiFunction<T, ExistingFileHelper, CustomLoaderBuilder<T>> makeFactory( ResourceLocation id, Consumer<JsonObject> extra )
|
||||
|
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission.
|
||||
* Send enquiries to dratcliffe@gmail.com
|
||||
*/
|
||||
package dan200.computercraft.data;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.data.BlockTagsProvider;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
|
||||
import static dan200.computercraft.shared.ComputerCraftTags.Blocks.*;
|
||||
|
||||
public class BlockTagsGenerator extends BlockTagsProvider
|
||||
{
|
||||
public BlockTagsGenerator( DataGenerator generator, ExistingFileHelper helper )
|
||||
{
|
||||
super( generator, ComputerCraft.MOD_ID, helper );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings( "unchecked" )
|
||||
protected void addTags()
|
||||
{
|
||||
// Items
|
||||
tag( COMPUTER ).add(
|
||||
Registry.ModBlocks.COMPUTER_NORMAL.get(),
|
||||
Registry.ModBlocks.COMPUTER_ADVANCED.get(),
|
||||
Registry.ModBlocks.COMPUTER_COMMAND.get()
|
||||
);
|
||||
tag( TURTLE ).add( Registry.ModBlocks.TURTLE_NORMAL.get(), Registry.ModBlocks.TURTLE_ADVANCED.get() );
|
||||
tag( WIRED_MODEM ).add( Registry.ModBlocks.CABLE.get(), Registry.ModBlocks.WIRED_MODEM_FULL.get() );
|
||||
tag( MONITOR ).add( Registry.ModBlocks.MONITOR_NORMAL.get(), Registry.ModBlocks.MONITOR_ADVANCED.get() );
|
||||
|
||||
tag( TURTLE_ALWAYS_BREAKABLE ).addTags( BlockTags.LEAVES ).add(
|
||||
Blocks.BAMBOO, Blocks.BAMBOO_SAPLING // Bamboo isn't instabreak for some odd reason.
|
||||
);
|
||||
|
||||
tag( TURTLE_SHOVEL_BREAKABLE ).add(
|
||||
Blocks.MELON,
|
||||
Blocks.PUMPKIN,
|
||||
Blocks.CARVED_PUMPKIN,
|
||||
Blocks.JACK_O_LANTERN
|
||||
);
|
||||
|
||||
tag( TURTLE_HOE_BREAKABLE ).addTags(
|
||||
BlockTags.CROPS
|
||||
).add(
|
||||
Blocks.CACTUS,
|
||||
Blocks.MELON,
|
||||
Blocks.PUMPKIN,
|
||||
Blocks.CARVED_PUMPKIN,
|
||||
Blocks.JACK_O_LANTERN
|
||||
);
|
||||
|
||||
tag( TURTLE_SWORD_BREAKABLE ).addTags( BlockTags.WOOL ).add( Blocks.COBWEB );
|
||||
}
|
||||
}
|
@@ -7,6 +7,7 @@ package dan200.computercraft.data;
|
||||
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.GatherDataEvent;
|
||||
@@ -20,9 +21,14 @@ public class Generators
|
||||
Registry.registerLoot();
|
||||
|
||||
DataGenerator generator = event.getGenerator();
|
||||
generator.addProvider( new Recipes( generator ) );
|
||||
generator.addProvider( new LootTables( generator ) );
|
||||
generator.addProvider( new Tags( generator, event.getExistingFileHelper() ) );
|
||||
generator.addProvider( new BlockModelProvider( generator, event.getExistingFileHelper() ) );
|
||||
ExistingFileHelper existingFiles = event.getExistingFileHelper();
|
||||
|
||||
generator.addProvider( new RecipeGenerator( generator ) );
|
||||
generator.addProvider( new LootTableGenerator( generator ) );
|
||||
generator.addProvider( new BlockModelProvider( generator, existingFiles ) );
|
||||
|
||||
BlockTagsGenerator blockTags = new BlockTagsGenerator( generator, existingFiles );
|
||||
generator.addProvider( blockTags );
|
||||
generator.addProvider( new ItemTagsGenerator( generator, blockTags, existingFiles ) );
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission.
|
||||
* Send enquiries to dratcliffe@gmail.com
|
||||
*/
|
||||
package dan200.computercraft.data;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.shared.ComputerCraftTags.Blocks;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.ItemTagsProvider;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tags.ITag;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
|
||||
import static dan200.computercraft.shared.ComputerCraftTags.Items.*;
|
||||
|
||||
public class ItemTagsGenerator extends ItemTagsProvider
|
||||
{
|
||||
private static final ITag.INamedTag<Item> PIGLIN_LOVED = net.minecraft.tags.ItemTags.PIGLIN_LOVED;
|
||||
|
||||
public ItemTagsGenerator( DataGenerator generator, BlockTagsGenerator blockTags, ExistingFileHelper helper )
|
||||
{
|
||||
super( generator, blockTags, ComputerCraft.MOD_ID, helper );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addTags()
|
||||
{
|
||||
copy( Blocks.COMPUTER, COMPUTER );
|
||||
copy( Blocks.TURTLE, TURTLE );
|
||||
tag( WIRED_MODEM ).add( Registry.ModItems.WIRED_MODEM.get(), Registry.ModItems.WIRED_MODEM_FULL.get() );
|
||||
copy( Blocks.MONITOR, MONITOR );
|
||||
|
||||
tag( PIGLIN_LOVED ).add(
|
||||
Registry.ModItems.COMPUTER_ADVANCED.get(), Registry.ModItems.TURTLE_ADVANCED.get(),
|
||||
Registry.ModItems.WIRELESS_MODEM_ADVANCED.get(), Registry.ModItems.POCKET_COMPUTER_ADVANCED.get(),
|
||||
Registry.ModItems.MONITOR_ADVANCED.get()
|
||||
);
|
||||
}
|
||||
}
|
@@ -25,9 +25,9 @@ import net.minecraftforge.fml.RegistryObject;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
public class LootTables extends LootTableProvider
|
||||
public class LootTableGenerator extends LootTableProvider
|
||||
{
|
||||
public LootTables( DataGenerator generator )
|
||||
public LootTableGenerator( DataGenerator generator )
|
||||
{
|
||||
super( generator );
|
||||
}
|
@@ -6,7 +6,6 @@
|
||||
package dan200.computercraft.data;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.data.Tags.CCTags;
|
||||
import dan200.computercraft.shared.PocketUpgrades;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.TurtleUpgrades;
|
||||
@@ -39,9 +38,12 @@ import javax.annotation.Nonnull;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class Recipes extends RecipeProvider
|
||||
import static dan200.computercraft.shared.ComputerCraftTags.Items.COMPUTER;
|
||||
import static dan200.computercraft.shared.ComputerCraftTags.Items.WIRED_MODEM;
|
||||
|
||||
public class RecipeGenerator extends RecipeProvider
|
||||
{
|
||||
public Recipes( DataGenerator generator )
|
||||
public RecipeGenerator( DataGenerator generator )
|
||||
{
|
||||
super( generator );
|
||||
}
|
||||
@@ -104,8 +106,8 @@ public class Recipes extends RecipeProvider
|
||||
.shaped( result.getItem() )
|
||||
.group( String.format( "%s:turtle_%s", ComputerCraft.MOD_ID, nameId ) )
|
||||
.pattern( "#T" )
|
||||
.define( '#', base.getItem() )
|
||||
.define( 'T', upgrade.getCraftingItem().getItem() )
|
||||
.define( 'T', base.getItem() )
|
||||
.define( '#', upgrade.getCraftingItem().getItem() )
|
||||
.unlockedBy( "has_items",
|
||||
inventoryChange( base.getItem(), upgrade.getCraftingItem().getItem() ) )
|
||||
.save(
|
||||
@@ -133,14 +135,14 @@ public class Recipes extends RecipeProvider
|
||||
String nameId = family.name().toLowerCase( Locale.ROOT );
|
||||
|
||||
PocketUpgrades.getVanillaUpgrades().forEach( upgrade -> {
|
||||
ItemStack result = PocketComputerItemFactory.create( -1, null, -1, family, null );
|
||||
ItemStack result = PocketComputerItemFactory.create( -1, null, -1, family, upgrade );
|
||||
ShapedRecipeBuilder
|
||||
.shaped( result.getItem() )
|
||||
.group( String.format( "%s:pocket_%s", ComputerCraft.MOD_ID, nameId ) )
|
||||
.pattern( "#" )
|
||||
.pattern( "P" )
|
||||
.define( '#', base.getItem() )
|
||||
.define( 'P', upgrade.getCraftingItem().getItem() )
|
||||
.define( 'P', base.getItem() )
|
||||
.define( '#', upgrade.getCraftingItem().getItem() )
|
||||
.unlockedBy( "has_items",
|
||||
inventoryChange( base.getItem(), upgrade.getCraftingItem().getItem() ) )
|
||||
.save(
|
||||
@@ -162,8 +164,8 @@ public class Recipes extends RecipeProvider
|
||||
.pattern( " # " )
|
||||
.define( '#', Tags.Items.STONE )
|
||||
.define( 'R', Tags.Items.DUSTS_REDSTONE )
|
||||
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.unlockedBy( "has_modem", inventoryChange( CCTags.COMPUTER ) )
|
||||
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
|
||||
.unlockedBy( "has_modem", inventoryChange( WIRED_MODEM ) )
|
||||
.save( add );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
@@ -206,7 +208,7 @@ public class Recipes extends RecipeProvider
|
||||
.pattern( "#R#" )
|
||||
.define( '#', Tags.Items.STONE )
|
||||
.define( 'R', Tags.Items.DUSTS_REDSTONE )
|
||||
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
|
||||
.save( add );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
@@ -216,7 +218,7 @@ public class Recipes extends RecipeProvider
|
||||
.pattern( "###" )
|
||||
.define( '#', Tags.Items.STONE )
|
||||
.define( 'G', Tags.Items.GLASS_PANES )
|
||||
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
|
||||
.save( add );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
@@ -226,7 +228,7 @@ public class Recipes extends RecipeProvider
|
||||
.pattern( "###" )
|
||||
.define( '#', Tags.Items.INGOTS_GOLD )
|
||||
.define( 'G', Tags.Items.GLASS_PANES )
|
||||
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
|
||||
.save( add );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
@@ -237,7 +239,7 @@ public class Recipes extends RecipeProvider
|
||||
.define( '#', Tags.Items.STONE )
|
||||
.define( 'A', Items.GOLDEN_APPLE )
|
||||
.define( 'G', Tags.Items.GLASS_PANES )
|
||||
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
|
||||
.unlockedBy( "has_apple", inventoryChange( Items.GOLDEN_APPLE ) )
|
||||
.save( add );
|
||||
|
||||
@@ -249,7 +251,7 @@ public class Recipes extends RecipeProvider
|
||||
.define( '#', Tags.Items.INGOTS_GOLD )
|
||||
.define( 'A', Items.GOLDEN_APPLE )
|
||||
.define( 'G', Tags.Items.GLASS_PANES )
|
||||
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
|
||||
.unlockedBy( "has_apple", inventoryChange( Items.GOLDEN_APPLE ) )
|
||||
.save( add );
|
||||
|
||||
@@ -261,7 +263,7 @@ public class Recipes extends RecipeProvider
|
||||
.define( '#', Tags.Items.STONE )
|
||||
.define( 'R', Tags.Items.DUSTS_REDSTONE )
|
||||
.define( 'D', Tags.Items.DYES )
|
||||
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
|
||||
.save( add );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
@@ -272,7 +274,7 @@ public class Recipes extends RecipeProvider
|
||||
.define( '#', Tags.Items.STONE )
|
||||
.define( 'N', Blocks.NOTE_BLOCK )
|
||||
.define( 'R', Tags.Items.DUSTS_REDSTONE )
|
||||
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
|
||||
.save( add );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
@@ -282,19 +284,19 @@ public class Recipes extends RecipeProvider
|
||||
.pattern( "###" )
|
||||
.define( '#', Tags.Items.STONE )
|
||||
.define( 'R', Tags.Items.DUSTS_REDSTONE )
|
||||
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
|
||||
.unlockedBy( "has_cable", inventoryChange( Registry.ModItems.CABLE.get() ) )
|
||||
.save( add );
|
||||
|
||||
ShapelessRecipeBuilder
|
||||
.shapeless( Registry.ModBlocks.WIRED_MODEM_FULL.get() )
|
||||
.requires( Registry.ModItems.WIRED_MODEM.get() )
|
||||
.unlockedBy( "has_modem", inventoryChange( CCTags.WIRED_MODEM ) )
|
||||
.unlockedBy( "has_modem", inventoryChange( WIRED_MODEM ) )
|
||||
.save( add, new ResourceLocation( ComputerCraft.MOD_ID, "wired_modem_full_from" ) );
|
||||
ShapelessRecipeBuilder
|
||||
.shapeless( Registry.ModItems.WIRED_MODEM.get() )
|
||||
.requires( Registry.ModBlocks.WIRED_MODEM_FULL.get() )
|
||||
.unlockedBy( "has_modem", inventoryChange( CCTags.WIRED_MODEM ) )
|
||||
.unlockedBy( "has_modem", inventoryChange( WIRED_MODEM ) )
|
||||
.save( add, new ResourceLocation( ComputerCraft.MOD_ID, "wired_modem_full_to" ) );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
@@ -304,7 +306,7 @@ public class Recipes extends RecipeProvider
|
||||
.pattern( "###" )
|
||||
.define( '#', Tags.Items.STONE )
|
||||
.define( 'E', Tags.Items.ENDER_PEARLS )
|
||||
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
|
||||
.save( add );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
@@ -314,7 +316,7 @@ public class Recipes extends RecipeProvider
|
||||
.pattern( "###" )
|
||||
.define( '#', Tags.Items.INGOTS_GOLD )
|
||||
.define( 'E', Items.ENDER_EYE )
|
||||
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
|
||||
.unlockedBy( "has_wireless", inventoryChange( Registry.ModBlocks.WIRELESS_MODEM_NORMAL.get() ) )
|
||||
.save( add );
|
||||
|
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission.
|
||||
* Send enquiries to dratcliffe@gmail.com
|
||||
*/
|
||||
package dan200.computercraft.data;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import net.minecraft.data.BlockTagsProvider;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.ItemTagsProvider;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tags.ITag;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
|
||||
import static dan200.computercraft.data.Tags.CCTags.*;
|
||||
|
||||
public class Tags extends ItemTagsProvider
|
||||
{
|
||||
private static final ITag.INamedTag<Item> PIGLIN_LOVED = ItemTags.PIGLIN_LOVED;
|
||||
|
||||
public static class CCTags
|
||||
{
|
||||
public static final ITag.INamedTag<Item> COMPUTER = item( "computer" );
|
||||
public static final ITag.INamedTag<Item> TURTLE = item( "turtle" );
|
||||
public static final ITag.INamedTag<Item> WIRED_MODEM = item( "wired_modem" );
|
||||
public static final ITag.INamedTag<Item> MONITOR = item( "monitor" );
|
||||
}
|
||||
|
||||
public Tags( DataGenerator generator, ExistingFileHelper helper )
|
||||
{
|
||||
super( generator, new BlockTagsProvider( generator, ComputerCraft.MOD_ID, helper ), ComputerCraft.MOD_ID, helper );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addTags()
|
||||
{
|
||||
tag( COMPUTER ).add(
|
||||
Registry.ModItems.COMPUTER_NORMAL.get(),
|
||||
Registry.ModItems.COMPUTER_ADVANCED.get(),
|
||||
Registry.ModItems.COMPUTER_COMMAND.get()
|
||||
);
|
||||
tag( TURTLE ).add( Registry.ModItems.TURTLE_NORMAL.get(), Registry.ModItems.TURTLE_ADVANCED.get() );
|
||||
tag( WIRED_MODEM ).add( Registry.ModItems.WIRED_MODEM.get(), Registry.ModItems.WIRED_MODEM_FULL.get() );
|
||||
tag( MONITOR ).add( Registry.ModItems.MONITOR_NORMAL.get(), Registry.ModItems.MONITOR_ADVANCED.get() );
|
||||
|
||||
tag( PIGLIN_LOVED ).add(
|
||||
Registry.ModItems.COMPUTER_ADVANCED.get(), Registry.ModItems.TURTLE_ADVANCED.get(),
|
||||
Registry.ModItems.WIRELESS_MODEM_ADVANCED.get(), Registry.ModItems.POCKET_COMPUTER_ADVANCED.get(),
|
||||
Registry.ModItems.MONITOR_ADVANCED.get()
|
||||
);
|
||||
}
|
||||
|
||||
private static ITag.INamedTag<Item> item( String name )
|
||||
{
|
||||
return ItemTags.bind( new ResourceLocation( ComputerCraft.MOD_ID, name ).toString() );
|
||||
}
|
||||
}
|
@@ -8,6 +8,7 @@ package dan200.computercraft.shared;
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.core.apis.http.NetworkUtils;
|
||||
import dan200.computercraft.core.computer.MainThread;
|
||||
import dan200.computercraft.core.filesystem.ResourceMount;
|
||||
import dan200.computercraft.core.tracking.ComputerMBean;
|
||||
import dan200.computercraft.core.tracking.Tracking;
|
||||
import dan200.computercraft.shared.command.CommandComputerCraft;
|
||||
@@ -23,6 +24,7 @@ import net.minecraft.loot.TableLootEntry;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.dedicated.DedicatedServer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.event.AddReloadListenerEvent;
|
||||
import net.minecraftforge.event.LootTableLoadEvent;
|
||||
import net.minecraftforge.event.RegisterCommandsEvent;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
@@ -138,4 +140,10 @@ public final class CommonHooks
|
||||
.name( "computercraft_treasure" )
|
||||
.build() );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onAddReloadListeners( AddReloadListenerEvent event )
|
||||
{
|
||||
event.addListener( ResourceMount.RELOAD_LISTENER );
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user