mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-10-17 15:07:38 +00:00
Compare commits
11 Commits
v1.16.5-1.
...
v1.17.1-1.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
bbf3e48763 | ||
![]() |
92fe1d4bc2 | ||
![]() |
4d591c600c | ||
![]() |
0a8e427c61 | ||
![]() |
0a537eaeee | ||
![]() |
aa857c1be3 | ||
![]() |
e4ced551eb | ||
![]() |
6eec9ba1a3 | ||
![]() |
a8f675c59d | ||
![]() |
bb1ebaee4f | ||
![]() |
bb1183d274 |
94
build.gradle
94
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.5.21"
|
||||
id "com.modrinth.minotaur" version "1.2.1"
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ version = mod_version
|
||||
group = "org.squiddev"
|
||||
archivesBaseName = "cc-tweaked-${mc_version}"
|
||||
|
||||
def javaVersion = JavaLanguageVersion.of(8)
|
||||
def javaVersion = JavaLanguageVersion.of(16)
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = javaVersion
|
||||
@@ -46,6 +46,9 @@ tasks.withType(JavaExec).configureEach {
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main.java {
|
||||
exclude 'dan200/computercraft/shared/integration/**'
|
||||
}
|
||||
main.resources {
|
||||
srcDir 'src/generated/resources'
|
||||
}
|
||||
@@ -56,6 +59,10 @@ sourceSets {
|
||||
minecraft {
|
||||
runs {
|
||||
all {
|
||||
lazyToken('minecraft_classpath') {
|
||||
configurations.shade.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator)
|
||||
}
|
||||
|
||||
property 'forge.logging.markers', 'REGISTRIES'
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
@@ -89,6 +96,12 @@ minecraft {
|
||||
source sourceSets.testMod
|
||||
}
|
||||
}
|
||||
|
||||
lazyToken('minecraft_classpath') {
|
||||
(configurations.shade.copyRecursive().resolve() + configurations.testModExtra.copyRecursive().resolve())
|
||||
.collect { it.absolutePath }
|
||||
.join(File.pathSeparator)
|
||||
}
|
||||
}
|
||||
|
||||
testServer {
|
||||
@@ -100,6 +113,12 @@ minecraft {
|
||||
source sourceSets.testMod
|
||||
}
|
||||
}
|
||||
|
||||
lazyToken('minecraft_classpath') {
|
||||
(configurations.shade.copyRecursive().resolve() + configurations.testModExtra.copyRecursive().resolve())
|
||||
.collect { it.absolutePath }
|
||||
.join(File.pathSeparator)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +127,6 @@ minecraft {
|
||||
accessTransformer file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
accessTransformer file('src/testMod/resources/META-INF/accesstransformer.cfg')
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
@@ -120,22 +138,24 @@ repositories {
|
||||
configurations {
|
||||
shade
|
||||
implementation.extendsFrom shade
|
||||
|
||||
cctJavadoc
|
||||
|
||||
testModExtra
|
||||
testModImplementation.extendsFrom(testModExtra)
|
||||
testModImplementation.extendsFrom(implementation)
|
||||
testModImplementation.extendsFrom(testImplementation)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
checkstyle "com.puppycrawl.tools:checkstyle:8.25"
|
||||
checkstyle "com.puppycrawl.tools:checkstyle:8.45"
|
||||
|
||||
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"
|
||||
|
||||
compileOnly fg.deobf("mezz.jei:jei-1.16.5:7.7.0.104:api")
|
||||
compileOnly fg.deobf("com.blamejared.crafttweaker:CraftTweaker-1.16.5:7.1.0.313")
|
||||
compileOnly fg.deobf("commoble.morered:morered-1.16.5:2.1.1.0")
|
||||
// compileOnly fg.deobf("com.blamejared.crafttweaker:CraftTweaker-1.16.5:7.1.0.313")
|
||||
// compileOnly fg.deobf("commoble.morered:morered-1.16.5:2.1.1.0")
|
||||
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-1.16.5:7.7.0.104")
|
||||
// runtimeOnly fg.deobf("mezz.jei:jei-1.16.5:7.7.0.104")
|
||||
|
||||
shade 'org.squiddev:Cobalt:0.5.2-SNAPSHOT'
|
||||
|
||||
@@ -143,11 +163,11 @@ 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.5.21'
|
||||
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1'
|
||||
|
||||
testModImplementation sourceSets.main.output
|
||||
testModExtra 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.21'
|
||||
|
||||
cctJavadoc 'cc.tweaked:cct-javadoc:1.4.1'
|
||||
}
|
||||
@@ -175,24 +195,28 @@ task luaJavadoc(type: Javadoc) {
|
||||
options.noTimestamp = false
|
||||
|
||||
javadocTool = javaToolchains.javadocToolFor {
|
||||
languageVersion = JavaLanguageVersion.of(11)
|
||||
languageVersion = javaVersion
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes(["Specification-Title" : "computercraft",
|
||||
"Specification-Vendor" : "SquidDev",
|
||||
"Specification-Version" : "1",
|
||||
"Implementation-Title" : "CC: Tweaked",
|
||||
"Implementation-Version" : "${mod_version}",
|
||||
"Implementation-Vendor" : "SquidDev",
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")])
|
||||
attributes([
|
||||
"Specification-Title" : "computercraft",
|
||||
"Specification-Vendor" : "SquidDev",
|
||||
"Specification-Version" : "1",
|
||||
"Implementation-Title" : "CC: Tweaked",
|
||||
"Implementation-Version" : "${mod_version}",
|
||||
"Implementation-Vendor" : "SquidDev",
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
])
|
||||
}
|
||||
|
||||
from configurations.shade.collect { it.isDirectory() ? it : zipTree(it) }
|
||||
}
|
||||
|
||||
jar.finalizedBy('reobfJar')
|
||||
|
||||
[compileJava, compileTestJava, compileTestModJava].forEach {
|
||||
it.configure {
|
||||
options.compilerArgs << "-Xlint" << "-Xlint:-processing"
|
||||
@@ -222,9 +246,11 @@ processResources {
|
||||
include 'META-INF/mods.toml'
|
||||
include 'data/computercraft/lua/rom/help/credits.txt'
|
||||
|
||||
expand 'version': mod_version,
|
||||
'mcversion': mc_version,
|
||||
'gitcontributors': contributors.sort(false, String.CASE_INSENSITIVE_ORDER).join('\n')
|
||||
expand(
|
||||
'version': mod_version,
|
||||
'mcversion': mc_version,
|
||||
'gitcontributors': contributors.sort(false, String.CASE_INSENSITIVE_ORDER).join('\n')
|
||||
)
|
||||
}
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
@@ -242,6 +268,7 @@ sourcesJar {
|
||||
|
||||
import com.hierynomus.gradle.license.tasks.LicenseCheck
|
||||
import com.hierynomus.gradle.license.tasks.LicenseFormat
|
||||
import com.modrinth.minotaur.TaskModrinthUpload
|
||||
import org.apache.tools.ant.taskdefs.condition.Os
|
||||
|
||||
List<String> mkCommand(String command) {
|
||||
@@ -454,18 +481,19 @@ task checkRelease {
|
||||
}
|
||||
check.dependsOn checkRelease
|
||||
|
||||
def isStable = false
|
||||
|
||||
curseforge {
|
||||
apiKey = project.hasProperty('curseForgeApiKey') ? project.curseForgeApiKey : ''
|
||||
project {
|
||||
id = '282001'
|
||||
releaseType = 'release'
|
||||
releaseType = isStable ? 'release' : 'alpha'
|
||||
changelog = "Release notes can be found on the GitHub repository (https://github.com/SquidDev-CC/CC-Tweaked/releases/tag/v${mc_version}-${mod_version})."
|
||||
|
||||
addGameVersion "${mc_version}"
|
||||
}
|
||||
}
|
||||
|
||||
import com.modrinth.minotaur.TaskModrinthUpload
|
||||
tasks.register('publishModrinth', TaskModrinthUpload.class).configure {
|
||||
dependsOn('assemble', 'reobfJar')
|
||||
onlyIf {
|
||||
@@ -476,6 +504,7 @@ tasks.register('publishModrinth', TaskModrinthUpload.class).configure {
|
||||
projectId = 'gu7yAYhd'
|
||||
versionNumber = "${project.mc_version}-${project.mod_version}"
|
||||
uploadFile = jar
|
||||
versionType = isStable ? 'RELEASE' : 'ALPHA'
|
||||
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})."
|
||||
addLoader('forge')
|
||||
@@ -536,12 +565,17 @@ githubRelease {
|
||||
owner 'SquidDev-CC'
|
||||
repo 'CC-Tweaked'
|
||||
targetCommitish.set(project.provider({
|
||||
try {
|
||||
return ["git", "-C", projectDir, "rev-parse", "--abbrev-ref", "HEAD"].execute().text.trim()
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace()
|
||||
def cmd = ["git", "rev-parse", "--abbrev-ref", "HEAD"]
|
||||
println(cmd)
|
||||
def proc = cmd.execute([], projectDir)
|
||||
if (proc.waitFor() != 0) {
|
||||
println(proc.err.text.trim())
|
||||
throw new IllegalStateException("Executed with a non-0 exit code (${proc.exitValue()}).")
|
||||
}
|
||||
return "master"
|
||||
|
||||
def branch = proc.text.trim()
|
||||
if (branch == "") throw new IllegalStateException("Cannot determine branch")
|
||||
return branch
|
||||
}))
|
||||
|
||||
tagName "v${mc_version}-${mod_version}"
|
||||
@@ -552,7 +586,7 @@ githubRelease {
|
||||
.takeWhile { it != 'Type "help changelog" to see the full version history.' }
|
||||
.join("\n").trim()
|
||||
}))
|
||||
prerelease false
|
||||
prerelease isStable
|
||||
}
|
||||
|
||||
def uploadTasks = ["publish", "curseforge", "publishModrinth", "githubRelease"]
|
||||
|
@@ -58,13 +58,20 @@
|
||||
<module name="SimplifyBooleanExpression" />
|
||||
<module name="SimplifyBooleanReturn" />
|
||||
<module name="StringLiteralEquality" />
|
||||
<module name="UnnecessaryParentheses" />
|
||||
<module name="UnnecessaryParentheses">
|
||||
<!-- Default minus LAND. -->
|
||||
<property name="tokens" value="EXPR,IDENT,NUM_DOUBLE,NUM_FLOAT,NUM_INT,NUM_LONG,STRING_LITERAL,LITERAL_NULL,LITERAL_FALSE,LITERAL_TRUE,ASSIGN,BAND_ASSIGN,BOR_ASSIGN,BSR_ASSIGN,BXOR_ASSIGN,DIV_ASSIGN,MINUS_ASSIGN,MOD_ASSIGN,PLUS_ASSIGN,SL_ASSIGN,SR_ASSIGN,STAR_ASSIGN,LAMBDA,TEXT_BLOCK_LITERAL_BEGIN,LITERAL_INSTANCEOF,GT,LT,GE,LE,EQUAL,NOT_EQUAL,UNARY_MINUS,UNARY_PLUS,INC,DEC,LNOT,BNOT,POST_INC,POST_DEC" />
|
||||
</module>
|
||||
<module name="UnnecessarySemicolonAfterTypeMemberDeclaration" />
|
||||
<module name="UnnecessarySemicolonInTryWithResources" />
|
||||
<module name="UnnecessarySemicolonInEnumeration" />
|
||||
|
||||
<!-- Imports -->
|
||||
<module name="CustomImportOrder" />
|
||||
<module name="CustomImportOrder">
|
||||
<property name="customImportOrderRules"
|
||||
value="THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE###STATIC"
|
||||
/>
|
||||
</module>
|
||||
<module name="IllegalImport" />
|
||||
<module name="RedundantImport" />
|
||||
<module name="UnusedImports" />
|
||||
|
@@ -2,7 +2,7 @@
|
||||
mod_version=1.98.2
|
||||
|
||||
# Minecraft properties (update mods.toml when changing)
|
||||
mc_version=1.16.5
|
||||
mapping_version=2021.08.08
|
||||
forge_version=36.1.0
|
||||
mc_version=1.17.1
|
||||
mapping_version=2021.08.15
|
||||
forge_version=37.0.34
|
||||
# NO SERIOUSLY, UPDATE mods.toml WHEN CHANGING
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "minecraft:redstone"
|
||||
"items": [
|
||||
"minecraft:redstone"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "minecraft:gold_ingot"
|
||||
"items": [
|
||||
"minecraft:gold_ingot"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "minecraft:command_block"
|
||||
"items": [
|
||||
"minecraft:command_block"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:disk_drive"
|
||||
"items": [
|
||||
"computercraft:disk_drive"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:disk_drive"
|
||||
"items": [
|
||||
"computercraft:disk_drive"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:disk_drive"
|
||||
"items": [
|
||||
"computercraft:disk_drive"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:disk_drive"
|
||||
"items": [
|
||||
"computercraft:disk_drive"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:disk_drive"
|
||||
"items": [
|
||||
"computercraft:disk_drive"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:disk_drive"
|
||||
"items": [
|
||||
"computercraft:disk_drive"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:disk_drive"
|
||||
"items": [
|
||||
"computercraft:disk_drive"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:disk_drive"
|
||||
"items": [
|
||||
"computercraft:disk_drive"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:disk_drive"
|
||||
"items": [
|
||||
"computercraft:disk_drive"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:disk_drive"
|
||||
"items": [
|
||||
"computercraft:disk_drive"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:disk_drive"
|
||||
"items": [
|
||||
"computercraft:disk_drive"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:disk_drive"
|
||||
"items": [
|
||||
"computercraft:disk_drive"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:disk_drive"
|
||||
"items": [
|
||||
"computercraft:disk_drive"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:disk_drive"
|
||||
"items": [
|
||||
"computercraft:disk_drive"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:disk_drive"
|
||||
"items": [
|
||||
"computercraft:disk_drive"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:disk_drive"
|
||||
"items": [
|
||||
"computercraft:disk_drive"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:pocket_computer_advanced"
|
||||
"items": [
|
||||
"computercraft:pocket_computer_advanced"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "computercraft:speaker"
|
||||
"items": [
|
||||
"computercraft:speaker"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:pocket_computer_advanced"
|
||||
"items": [
|
||||
"computercraft:pocket_computer_advanced"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "computercraft:wireless_modem_advanced"
|
||||
"items": [
|
||||
"computercraft:wireless_modem_advanced"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:pocket_computer_advanced"
|
||||
"items": [
|
||||
"computercraft:pocket_computer_advanced"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "computercraft:wireless_modem_normal"
|
||||
"items": [
|
||||
"computercraft:wireless_modem_normal"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -21,7 +21,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "minecraft:golden_apple"
|
||||
"items": [
|
||||
"minecraft:golden_apple"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -21,7 +21,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "minecraft:golden_apple"
|
||||
"items": [
|
||||
"minecraft:golden_apple"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:pocket_computer_normal"
|
||||
"items": [
|
||||
"computercraft:pocket_computer_normal"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "computercraft:speaker"
|
||||
"items": [
|
||||
"computercraft:speaker"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:pocket_computer_normal"
|
||||
"items": [
|
||||
"computercraft:pocket_computer_normal"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "computercraft:wireless_modem_advanced"
|
||||
"items": [
|
||||
"computercraft:wireless_modem_advanced"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:pocket_computer_normal"
|
||||
"items": [
|
||||
"computercraft:pocket_computer_normal"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "computercraft:wireless_modem_normal"
|
||||
"items": [
|
||||
"computercraft:wireless_modem_normal"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:printer"
|
||||
"items": [
|
||||
"computercraft:printer"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:printer"
|
||||
"items": [
|
||||
"computercraft:printer"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:turtle_advanced"
|
||||
"items": [
|
||||
"computercraft:turtle_advanced"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "computercraft:speaker"
|
||||
"items": [
|
||||
"computercraft:speaker"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:turtle_advanced"
|
||||
"items": [
|
||||
"computercraft:turtle_advanced"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "computercraft:wireless_modem_advanced"
|
||||
"items": [
|
||||
"computercraft:wireless_modem_advanced"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:turtle_advanced"
|
||||
"items": [
|
||||
"computercraft:turtle_advanced"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "computercraft:wireless_modem_normal"
|
||||
"items": [
|
||||
"computercraft:wireless_modem_normal"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:turtle_advanced"
|
||||
"items": [
|
||||
"computercraft:turtle_advanced"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "minecraft:crafting_table"
|
||||
"items": [
|
||||
"minecraft:crafting_table"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:turtle_advanced"
|
||||
"items": [
|
||||
"computercraft:turtle_advanced"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "minecraft:diamond_axe"
|
||||
"items": [
|
||||
"minecraft:diamond_axe"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:turtle_advanced"
|
||||
"items": [
|
||||
"computercraft:turtle_advanced"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "minecraft:diamond_hoe"
|
||||
"items": [
|
||||
"minecraft:diamond_hoe"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:turtle_advanced"
|
||||
"items": [
|
||||
"computercraft:turtle_advanced"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "minecraft:diamond_pickaxe"
|
||||
"items": [
|
||||
"minecraft:diamond_pickaxe"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:turtle_advanced"
|
||||
"items": [
|
||||
"computercraft:turtle_advanced"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "minecraft:diamond_shovel"
|
||||
"items": [
|
||||
"minecraft:diamond_shovel"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:turtle_advanced"
|
||||
"items": [
|
||||
"computercraft:turtle_advanced"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "minecraft:diamond_sword"
|
||||
"items": [
|
||||
"minecraft:diamond_sword"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:turtle_normal"
|
||||
"items": [
|
||||
"computercraft:turtle_normal"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "computercraft:speaker"
|
||||
"items": [
|
||||
"computercraft:speaker"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:turtle_normal"
|
||||
"items": [
|
||||
"computercraft:turtle_normal"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "computercraft:wireless_modem_advanced"
|
||||
"items": [
|
||||
"computercraft:wireless_modem_advanced"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:turtle_normal"
|
||||
"items": [
|
||||
"computercraft:turtle_normal"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "computercraft:wireless_modem_normal"
|
||||
"items": [
|
||||
"computercraft:wireless_modem_normal"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:turtle_normal"
|
||||
"items": [
|
||||
"computercraft:turtle_normal"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "minecraft:crafting_table"
|
||||
"items": [
|
||||
"minecraft:crafting_table"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:turtle_normal"
|
||||
"items": [
|
||||
"computercraft:turtle_normal"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "minecraft:diamond_axe"
|
||||
"items": [
|
||||
"minecraft:diamond_axe"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:turtle_normal"
|
||||
"items": [
|
||||
"computercraft:turtle_normal"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "minecraft:diamond_hoe"
|
||||
"items": [
|
||||
"minecraft:diamond_hoe"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:turtle_normal"
|
||||
"items": [
|
||||
"computercraft:turtle_normal"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "minecraft:diamond_pickaxe"
|
||||
"items": [
|
||||
"minecraft:diamond_pickaxe"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:turtle_normal"
|
||||
"items": [
|
||||
"computercraft:turtle_normal"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "minecraft:diamond_shovel"
|
||||
"items": [
|
||||
"minecraft:diamond_shovel"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,10 +11,14 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:turtle_normal"
|
||||
"items": [
|
||||
"computercraft:turtle_normal"
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "minecraft:diamond_sword"
|
||||
"items": [
|
||||
"minecraft:diamond_sword"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -21,7 +21,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:cable"
|
||||
"items": [
|
||||
"computercraft:cable"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -21,7 +21,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:wireless_modem_normal"
|
||||
"items": [
|
||||
"computercraft:wireless_modem_normal"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:monitor_normal"
|
||||
"items": [
|
||||
"computercraft:monitor_normal"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "computercraft:computer_advanced"
|
||||
"items": [
|
||||
"computercraft:computer_advanced"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -3,7 +3,8 @@
|
||||
"pools": [
|
||||
{
|
||||
"name": "cable",
|
||||
"rolls": 1,
|
||||
"rolls": 1.0,
|
||||
"bonus_rolls": 0.0,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
@@ -21,11 +22,13 @@
|
||||
"cable": "true"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"functions": []
|
||||
},
|
||||
{
|
||||
"name": "wired_modem",
|
||||
"rolls": 1,
|
||||
"rolls": 1.0,
|
||||
"bonus_rolls": 0.0,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
@@ -46,7 +49,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"functions": []
|
||||
}
|
||||
]
|
||||
}
|
@@ -3,7 +3,8 @@
|
||||
"pools": [
|
||||
{
|
||||
"name": "main",
|
||||
"rolls": 1,
|
||||
"rolls": 1.0,
|
||||
"bonus_rolls": 0.0,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:dynamic",
|
||||
@@ -28,7 +29,8 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"functions": []
|
||||
}
|
||||
]
|
||||
}
|
@@ -3,7 +3,8 @@
|
||||
"pools": [
|
||||
{
|
||||
"name": "main",
|
||||
"rolls": 1,
|
||||
"rolls": 1.0,
|
||||
"bonus_rolls": 0.0,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:dynamic",
|
||||
@@ -28,7 +29,8 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"functions": []
|
||||
}
|
||||
]
|
||||
}
|
@@ -3,7 +3,8 @@
|
||||
"pools": [
|
||||
{
|
||||
"name": "main",
|
||||
"rolls": 1,
|
||||
"rolls": 1.0,
|
||||
"bonus_rolls": 0.0,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:dynamic",
|
||||
@@ -28,7 +29,8 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"functions": []
|
||||
}
|
||||
]
|
||||
}
|
@@ -3,7 +3,8 @@
|
||||
"pools": [
|
||||
{
|
||||
"name": "main",
|
||||
"rolls": 1,
|
||||
"rolls": 1.0,
|
||||
"bonus_rolls": 0.0,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
@@ -14,7 +15,8 @@
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
}
|
||||
]
|
||||
],
|
||||
"functions": []
|
||||
}
|
||||
]
|
||||
}
|
@@ -3,7 +3,8 @@
|
||||
"pools": [
|
||||
{
|
||||
"name": "main",
|
||||
"rolls": 1,
|
||||
"rolls": 1.0,
|
||||
"bonus_rolls": 0.0,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
@@ -14,7 +15,8 @@
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
}
|
||||
]
|
||||
],
|
||||
"functions": []
|
||||
}
|
||||
]
|
||||
}
|
@@ -3,7 +3,8 @@
|
||||
"pools": [
|
||||
{
|
||||
"name": "main",
|
||||
"rolls": 1,
|
||||
"rolls": 1.0,
|
||||
"bonus_rolls": 0.0,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
@@ -14,7 +15,8 @@
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
}
|
||||
]
|
||||
],
|
||||
"functions": []
|
||||
}
|
||||
]
|
||||
}
|
@@ -3,7 +3,8 @@
|
||||
"pools": [
|
||||
{
|
||||
"name": "main",
|
||||
"rolls": 1,
|
||||
"rolls": 1.0,
|
||||
"bonus_rolls": 0.0,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
@@ -14,7 +15,8 @@
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
}
|
||||
]
|
||||
],
|
||||
"functions": []
|
||||
}
|
||||
]
|
||||
}
|
@@ -3,7 +3,8 @@
|
||||
"pools": [
|
||||
{
|
||||
"name": "main",
|
||||
"rolls": 1,
|
||||
"rolls": 1.0,
|
||||
"bonus_rolls": 0.0,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
@@ -14,7 +15,8 @@
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
}
|
||||
]
|
||||
],
|
||||
"functions": []
|
||||
}
|
||||
]
|
||||
}
|
@@ -3,7 +3,8 @@
|
||||
"pools": [
|
||||
{
|
||||
"name": "main",
|
||||
"rolls": 1,
|
||||
"rolls": 1.0,
|
||||
"bonus_rolls": 0.0,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:dynamic",
|
||||
@@ -28,7 +29,8 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"functions": []
|
||||
}
|
||||
]
|
||||
}
|
@@ -3,7 +3,8 @@
|
||||
"pools": [
|
||||
{
|
||||
"name": "main",
|
||||
"rolls": 1,
|
||||
"rolls": 1.0,
|
||||
"bonus_rolls": 0.0,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:dynamic",
|
||||
@@ -28,7 +29,8 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"functions": []
|
||||
}
|
||||
]
|
||||
}
|
@@ -3,7 +3,8 @@
|
||||
"pools": [
|
||||
{
|
||||
"name": "main",
|
||||
"rolls": 1,
|
||||
"rolls": 1.0,
|
||||
"bonus_rolls": 0.0,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
@@ -14,7 +15,8 @@
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
}
|
||||
]
|
||||
],
|
||||
"functions": []
|
||||
}
|
||||
]
|
||||
}
|
@@ -3,7 +3,8 @@
|
||||
"pools": [
|
||||
{
|
||||
"name": "main",
|
||||
"rolls": 1,
|
||||
"rolls": 1.0,
|
||||
"bonus_rolls": 0.0,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
@@ -14,7 +15,8 @@
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
}
|
||||
]
|
||||
],
|
||||
"functions": []
|
||||
}
|
||||
]
|
||||
}
|
@@ -3,7 +3,8 @@
|
||||
"pools": [
|
||||
{
|
||||
"name": "main",
|
||||
"rolls": 1,
|
||||
"rolls": 1.0,
|
||||
"bonus_rolls": 0.0,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
@@ -14,7 +15,8 @@
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
}
|
||||
]
|
||||
],
|
||||
"functions": []
|
||||
}
|
||||
]
|
||||
}
|
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
package dan200.computercraft;
|
||||
|
||||
import dan200.computercraft.api.turtle.event.TurtleAction;
|
||||
import dan200.computercraft.core.apis.http.options.Action;
|
||||
import dan200.computercraft.core.apis.http.options.AddressRule;
|
||||
import dan200.computercraft.shared.Config;
|
||||
@@ -22,7 +21,6 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -62,7 +60,7 @@ public final class ComputerCraft
|
||||
public static int modemHighAltitudeRangeDuringStorm = 384;
|
||||
public static int maxNotesPerTick = 8;
|
||||
public static MonitorRenderer monitorRenderer = MonitorRenderer.BEST;
|
||||
public static double monitorDistanceSq = 4096;
|
||||
public static int monitorDistance = 65;
|
||||
public static long monitorBandwidth = 1_000_000;
|
||||
|
||||
public static boolean turtlesNeedFuel = true;
|
||||
@@ -70,7 +68,6 @@ public final class ComputerCraft
|
||||
public static int advancedTurtleFuelLimit = 100000;
|
||||
public static boolean turtlesObeyBlockProtection = true;
|
||||
public static boolean turtlesCanPush = true;
|
||||
public static EnumSet<TurtleAction> turtleDisabledActions = EnumSet.noneOf( TurtleAction.class );
|
||||
|
||||
public static int computerTermWidth = 51;
|
||||
public static int computerTermHeight = 19;
|
||||
|
@@ -27,17 +27,17 @@ import dan200.computercraft.shared.peripheral.generic.GenericPeripheralProvider;
|
||||
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.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.packs.resources.ReloadableResourceManager;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
||||
import net.minecraftforge.fmllegacy.server.ServerLifecycleHooks;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.File;
|
||||
@@ -58,7 +58,7 @@ public final class ComputerCraftAPIImpl implements IComputerCraftAPI
|
||||
|
||||
public static InputStream getResourceFile( String domain, String subPath )
|
||||
{
|
||||
IReloadableResourceManager manager = (IReloadableResourceManager) ServerLifecycleHooks.getCurrentServer().getDataPackRegistries().getResourceManager();
|
||||
ReloadableResourceManager manager = (ReloadableResourceManager) ServerLifecycleHooks.getCurrentServer().getResourceManager();
|
||||
try
|
||||
{
|
||||
return manager.getResource( new ResourceLocation( domain, subPath ) ).getInputStream();
|
||||
@@ -80,13 +80,13 @@ public final class ComputerCraftAPIImpl implements IComputerCraftAPI
|
||||
}
|
||||
|
||||
@Override
|
||||
public int createUniqueNumberedSaveDir( @Nonnull World world, @Nonnull String parentSubPath )
|
||||
public int createUniqueNumberedSaveDir( @Nonnull Level world, @Nonnull String parentSubPath )
|
||||
{
|
||||
return IDAssigner.getNextId( parentSubPath );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWritableMount createSaveDirMount( @Nonnull World world, @Nonnull String subPath, long capacity )
|
||||
public IWritableMount createSaveDirMount( @Nonnull Level world, @Nonnull String subPath, long capacity )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -101,7 +101,7 @@ public final class ComputerCraftAPIImpl implements IComputerCraftAPI
|
||||
@Override
|
||||
public IMount createResourceMount( @Nonnull String domain, @Nonnull String subPath )
|
||||
{
|
||||
IReloadableResourceManager manager = (IReloadableResourceManager) ServerLifecycleHooks.getCurrentServer().getDataPackRegistries().getResourceManager();
|
||||
ReloadableResourceManager manager = (ReloadableResourceManager) ServerLifecycleHooks.getCurrentServer().getResourceManager();
|
||||
ResourceMount mount = ResourceMount.get( domain, subPath, manager );
|
||||
return mount.exists( "" ) ? mount : null;
|
||||
}
|
||||
@@ -137,7 +137,7 @@ public final class ComputerCraftAPIImpl implements IComputerCraftAPI
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBundledRedstoneOutput( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Direction side )
|
||||
public int getBundledRedstoneOutput( @Nonnull Level world, @Nonnull BlockPos pos, @Nonnull Direction side )
|
||||
{
|
||||
return BundledRedstone.getDefaultOutput( world, pos, side );
|
||||
}
|
||||
@@ -176,9 +176,9 @@ public final class ComputerCraftAPIImpl implements IComputerCraftAPI
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public LazyOptional<IWiredElement> getWiredElementAt( @Nonnull IBlockReader world, @Nonnull BlockPos pos, @Nonnull Direction side )
|
||||
public LazyOptional<IWiredElement> getWiredElementAt( @Nonnull BlockGetter world, @Nonnull BlockPos pos, @Nonnull Direction side )
|
||||
{
|
||||
TileEntity tile = world.getBlockEntity( pos );
|
||||
BlockEntity tile = world.getBlockEntity( pos );
|
||||
return tile == null ? LazyOptional.empty() : tile.getCapability( CAPABILITY_WIRED_ELEMENT, side );
|
||||
}
|
||||
}
|
||||
|
@@ -20,10 +20,10 @@ import dan200.computercraft.api.peripheral.IPeripheralProvider;
|
||||
import dan200.computercraft.api.pocket.IPocketUpgrade;
|
||||
import dan200.computercraft.api.redstone.IBundledRedstoneProvider;
|
||||
import dan200.computercraft.api.turtle.ITurtleUpgrade;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
|
||||
@@ -64,7 +64,7 @@ public final class ComputerCraftAPI
|
||||
* available for writing.
|
||||
* @see #createSaveDirMount(World, String, long)
|
||||
*/
|
||||
public static int createUniqueNumberedSaveDir( @Nonnull World world, @Nonnull String parentSubPath )
|
||||
public static int createUniqueNumberedSaveDir( @Nonnull Level world, @Nonnull String parentSubPath )
|
||||
{
|
||||
return getInstance().createUniqueNumberedSaveDir( world, parentSubPath );
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public final class ComputerCraftAPI
|
||||
* @see IWritableMount
|
||||
*/
|
||||
@Nullable
|
||||
public static IWritableMount createSaveDirMount( @Nonnull World world, @Nonnull String subPath, long capacity )
|
||||
public static IWritableMount createSaveDirMount( @Nonnull Level world, @Nonnull String subPath, long capacity )
|
||||
{
|
||||
return getInstance().createSaveDirMount( world, subPath, capacity );
|
||||
}
|
||||
@@ -185,7 +185,7 @@ public final class ComputerCraftAPI
|
||||
* If there is no block capable of emitting bundled redstone at the location, -1 will be returned.
|
||||
* @see IBundledRedstoneProvider
|
||||
*/
|
||||
public static int getBundledRedstoneOutput( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Direction side )
|
||||
public static int getBundledRedstoneOutput( @Nonnull Level world, @Nonnull BlockPos pos, @Nonnull Direction side )
|
||||
{
|
||||
return getInstance().getBundledRedstoneOutput( world, pos, side );
|
||||
}
|
||||
@@ -244,7 +244,7 @@ public final class ComputerCraftAPI
|
||||
* @see IWiredElement#getNode()
|
||||
*/
|
||||
@Nonnull
|
||||
public static LazyOptional<IWiredElement> getWiredElementAt( @Nonnull IBlockReader world, @Nonnull BlockPos pos, @Nonnull Direction side )
|
||||
public static LazyOptional<IWiredElement> getWiredElementAt( @Nonnull BlockGetter world, @Nonnull BlockPos pos, @Nonnull Direction side )
|
||||
{
|
||||
return getInstance().getWiredElementAt( world, pos, side );
|
||||
}
|
||||
@@ -272,10 +272,10 @@ public final class ComputerCraftAPI
|
||||
@Nonnull
|
||||
String getInstalledVersion();
|
||||
|
||||
int createUniqueNumberedSaveDir( @Nonnull World world, @Nonnull String parentSubPath );
|
||||
int createUniqueNumberedSaveDir( @Nonnull Level world, @Nonnull String parentSubPath );
|
||||
|
||||
@Nullable
|
||||
IWritableMount createSaveDirMount( @Nonnull World world, @Nonnull String subPath, long capacity );
|
||||
IWritableMount createSaveDirMount( @Nonnull Level world, @Nonnull String subPath, long capacity );
|
||||
|
||||
@Nullable
|
||||
IMount createResourceMount( @Nonnull String domain, @Nonnull String subPath );
|
||||
@@ -290,7 +290,7 @@ public final class ComputerCraftAPI
|
||||
|
||||
void registerBundledRedstoneProvider( @Nonnull IBundledRedstoneProvider provider );
|
||||
|
||||
int getBundledRedstoneOutput( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Direction side );
|
||||
int getBundledRedstoneOutput( @Nonnull Level world, @Nonnull BlockPos pos, @Nonnull Direction side );
|
||||
|
||||
void registerMediaProvider( @Nonnull IMediaProvider provider );
|
||||
|
||||
@@ -305,6 +305,6 @@ public final class ComputerCraftAPI
|
||||
IWiredNode createWiredNodeForElement( @Nonnull IWiredElement element );
|
||||
|
||||
@Nonnull
|
||||
LazyOptional<IWiredElement> getWiredElementAt( @Nonnull IBlockReader world, @Nonnull BlockPos pos, @Nonnull Direction side );
|
||||
LazyOptional<IWiredElement> getWiredElementAt( @Nonnull BlockGetter world, @Nonnull BlockPos pos, @Nonnull Direction side );
|
||||
}
|
||||
}
|
||||
|
@@ -7,9 +7,9 @@ package dan200.computercraft.api;
|
||||
|
||||
import dan200.computercraft.api.pocket.IPocketUpgrade;
|
||||
import dan200.computercraft.api.turtle.ITurtleUpgrade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -76,8 +76,8 @@ public interface IUpgradeBase
|
||||
|
||||
// A more expanded form of ItemStack.areShareTagsEqual, but allowing an empty tag to be equal to a
|
||||
// null one.
|
||||
CompoundNBT shareTag = stack.getItem().getShareTag( stack );
|
||||
CompoundNBT craftingShareTag = crafting.getItem().getShareTag( crafting );
|
||||
CompoundTag shareTag = stack.getItem().getShareTag( stack );
|
||||
CompoundTag craftingShareTag = crafting.getItem().getShareTag( crafting );
|
||||
if( shareTag == craftingShareTag ) return true;
|
||||
if( shareTag == null ) return craftingShareTag.isEmpty();
|
||||
if( craftingShareTag == null ) return shareTag.isEmpty();
|
||||
|
@@ -5,12 +5,12 @@
|
||||
*/
|
||||
package dan200.computercraft.api.client;
|
||||
|
||||
import com.mojang.math.Transformation;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.ModelManager;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.vector.TransformationMatrix;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.client.resources.model.ModelManager;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Objects;
|
||||
@@ -20,19 +20,19 @@ import java.util.Objects;
|
||||
*/
|
||||
public final class TransformedModel
|
||||
{
|
||||
private final IBakedModel model;
|
||||
private final TransformationMatrix matrix;
|
||||
private final BakedModel model;
|
||||
private final Transformation matrix;
|
||||
|
||||
public TransformedModel( @Nonnull IBakedModel model, @Nonnull TransformationMatrix matrix )
|
||||
public TransformedModel( @Nonnull BakedModel model, @Nonnull Transformation matrix )
|
||||
{
|
||||
this.model = Objects.requireNonNull( model );
|
||||
this.matrix = Objects.requireNonNull( matrix );
|
||||
}
|
||||
|
||||
public TransformedModel( @Nonnull IBakedModel model )
|
||||
public TransformedModel( @Nonnull BakedModel model )
|
||||
{
|
||||
this.model = Objects.requireNonNull( model );
|
||||
matrix = TransformationMatrix.identity();
|
||||
matrix = Transformation.identity();
|
||||
}
|
||||
|
||||
public static TransformedModel of( @Nonnull ModelResourceLocation location )
|
||||
@@ -41,20 +41,20 @@ public final class TransformedModel
|
||||
return new TransformedModel( modelManager.getModel( location ) );
|
||||
}
|
||||
|
||||
public static TransformedModel of( @Nonnull ItemStack item, @Nonnull TransformationMatrix transform )
|
||||
public static TransformedModel of( @Nonnull ItemStack item, @Nonnull Transformation transform )
|
||||
{
|
||||
IBakedModel model = Minecraft.getInstance().getItemRenderer().getItemModelShaper().getItemModel( item );
|
||||
BakedModel model = Minecraft.getInstance().getItemRenderer().getItemModelShaper().getItemModel( item );
|
||||
return new TransformedModel( model, transform );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public IBakedModel getModel()
|
||||
public BakedModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public TransformationMatrix getMatrix()
|
||||
public Transformation getMatrix()
|
||||
{
|
||||
return matrix;
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ package dan200.computercraft.api.filesystem;
|
||||
|
||||
import dan200.computercraft.api.ComputerCraftAPI;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
@@ -20,10 +20,10 @@ import java.util.List;
|
||||
* {@link IComputerAccess#mount(String, IMount)}.
|
||||
*
|
||||
* Ready made implementations of this interface can be created using
|
||||
* {@link ComputerCraftAPI#createSaveDirMount(World, String, long)} or
|
||||
* {@link ComputerCraftAPI#createSaveDirMount(Level, String, long)} or
|
||||
* {@link ComputerCraftAPI#createResourceMount(String, String)}, or you're free to implement it yourselves!
|
||||
*
|
||||
* @see ComputerCraftAPI#createSaveDirMount(World, String, long)
|
||||
* @see ComputerCraftAPI#createSaveDirMount(Level, String, long)
|
||||
* @see ComputerCraftAPI#createResourceMount(String, String)
|
||||
* @see IComputerAccess#mount(String, IMount)
|
||||
* @see IWritableMount
|
||||
|
@@ -7,7 +7,7 @@ package dan200.computercraft.api.filesystem;
|
||||
|
||||
import dan200.computercraft.api.ComputerCraftAPI;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
@@ -20,9 +20,9 @@ import java.util.OptionalLong;
|
||||
* or {@link IComputerAccess#mountWritable(String, IWritableMount)}, that can also be written to.
|
||||
*
|
||||
* Ready made implementations of this interface can be created using
|
||||
* {@link ComputerCraftAPI#createSaveDirMount(World, String, long)}, or you're free to implement it yourselves!
|
||||
* {@link ComputerCraftAPI#createSaveDirMount(Level, String, long)}, or you're free to implement it yourselves!
|
||||
*
|
||||
* @see ComputerCraftAPI#createSaveDirMount(World, String, long)
|
||||
* @see ComputerCraftAPI#createSaveDirMount(Level, String, long)
|
||||
* @see IComputerAccess#mount(String, IMount)
|
||||
* @see IComputerAccess#mountWritable(String, IWritableMount)
|
||||
* @see IMount
|
||||
|
@@ -9,7 +9,7 @@ import dan200.computercraft.api.ComputerCraftAPI;
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import dan200.computercraft.api.peripheral.IPeripheralProvider;
|
||||
import dan200.computercraft.core.asm.LuaMethod;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
|
@@ -6,10 +6,10 @@
|
||||
package dan200.computercraft.api.media;
|
||||
|
||||
import dan200.computercraft.api.filesystem.IMount;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -78,11 +78,11 @@ public interface IMedia
|
||||
* implements {@link dan200.computercraft.api.filesystem.IWritableMount}, it will mounted using mountWritable()
|
||||
* @see IMount
|
||||
* @see dan200.computercraft.api.filesystem.IWritableMount
|
||||
* @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String, long)
|
||||
* @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(Level, String, long)
|
||||
* @see dan200.computercraft.api.ComputerCraftAPI#createResourceMount(String, String)
|
||||
*/
|
||||
@Nullable
|
||||
default IMount createDataMount( @Nonnull ItemStack stack, @Nonnull World world )
|
||||
default IMount createDataMount( @Nonnull ItemStack stack, @Nonnull Level world )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
package dan200.computercraft.api.media;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
@@ -5,8 +5,8 @@
|
||||
*/
|
||||
package dan200.computercraft.api.network;
|
||||
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -21,7 +21,7 @@ public interface IPacketReceiver
|
||||
* @return The receivers's world.
|
||||
*/
|
||||
@Nonnull
|
||||
World getWorld();
|
||||
Level getLevel();
|
||||
|
||||
/**
|
||||
* Get the position in the world at which this receiver exists.
|
||||
@@ -29,7 +29,7 @@ public interface IPacketReceiver
|
||||
* @return The receiver's position.
|
||||
*/
|
||||
@Nonnull
|
||||
Vector3d getPosition();
|
||||
Vec3 getPosition();
|
||||
|
||||
/**
|
||||
* Get the maximum distance this receiver can send and receive messages.
|
||||
|
@@ -5,8 +5,8 @@
|
||||
*/
|
||||
package dan200.computercraft.api.network;
|
||||
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -21,7 +21,7 @@ public interface IPacketSender
|
||||
* @return The sender's world.
|
||||
*/
|
||||
@Nonnull
|
||||
World getWorld();
|
||||
Level getLevel();
|
||||
|
||||
/**
|
||||
* Get the position in the world at which this sender exists.
|
||||
@@ -29,7 +29,7 @@ public interface IPacketSender
|
||||
* @return The sender's position.
|
||||
*/
|
||||
@Nonnull
|
||||
Vector3d getPosition();
|
||||
Vec3 getPosition();
|
||||
|
||||
/**
|
||||
* Get some sort of identification string for this sender. This does not strictly need to be unique, but you
|
||||
|
@@ -12,7 +12,7 @@ import dan200.computercraft.api.lua.ILuaCallback;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.lua.ILuaTask;
|
||||
import dan200.computercraft.api.lua.MethodResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -33,7 +33,7 @@ public interface IComputerAccess
|
||||
* @return The location on the computer's file system where you the mount mounted, or {@code null} if there was already a
|
||||
* file in the desired location. Store this value if you wish to unmount the mount later.
|
||||
* @throws NotAttachedException If the peripheral has been detached.
|
||||
* @see ComputerCraftAPI#createSaveDirMount(World, String, long)
|
||||
* @see ComputerCraftAPI#createSaveDirMount(Level, String, long)
|
||||
* @see ComputerCraftAPI#createResourceMount(String, String)
|
||||
* @see #mount(String, IMount, String)
|
||||
* @see #mountWritable(String, IWritableMount)
|
||||
@@ -55,7 +55,7 @@ public interface IComputerAccess
|
||||
* @return The location on the computer's file system where you the mount mounted, or {@code null} if there was already a
|
||||
* file in the desired location. Store this value if you wish to unmount the mount later.
|
||||
* @throws NotAttachedException If the peripheral has been detached.
|
||||
* @see ComputerCraftAPI#createSaveDirMount(World, String, long)
|
||||
* @see ComputerCraftAPI#createSaveDirMount(Level, String, long)
|
||||
* @see ComputerCraftAPI#createResourceMount(String, String)
|
||||
* @see #mount(String, IMount)
|
||||
* @see #mountWritable(String, IWritableMount)
|
||||
@@ -73,7 +73,7 @@ public interface IComputerAccess
|
||||
* @return The location on the computer's file system where you the mount mounted, or null if there was already a
|
||||
* file in the desired location. Store this value if you wish to unmount the mount later.
|
||||
* @throws NotAttachedException If the peripheral has been detached.
|
||||
* @see ComputerCraftAPI#createSaveDirMount(World, String, long)
|
||||
* @see ComputerCraftAPI#createSaveDirMount(Level, String, long)
|
||||
* @see ComputerCraftAPI#createResourceMount(String, String)
|
||||
* @see #mount(String, IMount)
|
||||
* @see #unmount(String)
|
||||
@@ -94,7 +94,7 @@ public interface IComputerAccess
|
||||
* @return The location on the computer's file system where you the mount mounted, or null if there was already a
|
||||
* file in the desired location. Store this value if you wish to unmount the mount later.
|
||||
* @throws NotAttachedException If the peripheral has been detached.
|
||||
* @see ComputerCraftAPI#createSaveDirMount(World, String, long)
|
||||
* @see ComputerCraftAPI#createSaveDirMount(Level, String, long)
|
||||
* @see ComputerCraftAPI#createResourceMount(String, String)
|
||||
* @see #mount(String, IMount)
|
||||
* @see #unmount(String)
|
||||
|
@@ -5,10 +5,10 @@
|
||||
*/
|
||||
package dan200.computercraft.api.peripheral;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -16,7 +16,7 @@ import javax.annotation.Nonnull;
|
||||
/**
|
||||
* This interface is used to create peripheral implementations for blocks.
|
||||
*
|
||||
* If you have a {@link TileEntity} which acts as a peripheral, you may alternatively expose the {@link IPeripheral}
|
||||
* If you have a {@link BlockEntity} which acts as a peripheral, you may alternatively expose the {@link IPeripheral}
|
||||
* capability.
|
||||
*
|
||||
* @see dan200.computercraft.api.ComputerCraftAPI#registerPeripheralProvider(IPeripheralProvider)
|
||||
@@ -34,5 +34,5 @@ public interface IPeripheralProvider
|
||||
* @see dan200.computercraft.api.ComputerCraftAPI#registerPeripheralProvider(IPeripheralProvider)
|
||||
*/
|
||||
@Nonnull
|
||||
LazyOptional<IPeripheral> getPeripheral( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Direction side );
|
||||
LazyOptional<IPeripheral> getPeripheral( @Nonnull Level world, @Nonnull BlockPos pos, @Nonnull Direction side );
|
||||
}
|
||||
|
@@ -5,11 +5,11 @@
|
||||
*/
|
||||
package dan200.computercraft.api.pocket;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IItemProvider;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraftforge.common.util.NonNullSupplier;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -48,22 +48,22 @@ public abstract class AbstractPocketUpgrade implements IPocketUpgrade
|
||||
this( id, () -> stack );
|
||||
}
|
||||
|
||||
protected AbstractPocketUpgrade( ResourceLocation id, String adjective, IItemProvider item )
|
||||
protected AbstractPocketUpgrade( ResourceLocation id, String adjective, ItemLike item )
|
||||
{
|
||||
this( id, adjective, new CachedStack( () -> item ) );
|
||||
}
|
||||
|
||||
protected AbstractPocketUpgrade( ResourceLocation id, IItemProvider item )
|
||||
protected AbstractPocketUpgrade( ResourceLocation id, ItemLike item )
|
||||
{
|
||||
this( id, new CachedStack( () -> item ) );
|
||||
}
|
||||
|
||||
protected AbstractPocketUpgrade( ResourceLocation id, String adjective, Supplier<? extends IItemProvider> item )
|
||||
protected AbstractPocketUpgrade( ResourceLocation id, String adjective, Supplier<? extends ItemLike> item )
|
||||
{
|
||||
this( id, adjective, new CachedStack( item ) );
|
||||
}
|
||||
|
||||
protected AbstractPocketUpgrade( ResourceLocation id, Supplier<? extends IItemProvider> item )
|
||||
protected AbstractPocketUpgrade( ResourceLocation id, Supplier<? extends ItemLike> item )
|
||||
{
|
||||
this( id, new CachedStack( item ) );
|
||||
}
|
||||
@@ -96,11 +96,11 @@ public abstract class AbstractPocketUpgrade implements IPocketUpgrade
|
||||
*/
|
||||
private static final class CachedStack implements NonNullSupplier<ItemStack>
|
||||
{
|
||||
private final Supplier<? extends IItemProvider> provider;
|
||||
private final Supplier<? extends ItemLike> provider;
|
||||
private Item item;
|
||||
private ItemStack stack;
|
||||
|
||||
CachedStack( Supplier<? extends IItemProvider> provider )
|
||||
CachedStack( Supplier<? extends ItemLike> provider )
|
||||
{
|
||||
this.provider = provider;
|
||||
}
|
||||
|
@@ -6,9 +6,9 @@
|
||||
package dan200.computercraft.api.pocket;
|
||||
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -74,7 +74,7 @@ public interface IPocketAccess
|
||||
* @see #updateUpgradeNBTData()
|
||||
*/
|
||||
@Nonnull
|
||||
CompoundNBT getUpgradeNBTData();
|
||||
CompoundTag getUpgradeNBTData();
|
||||
|
||||
/**
|
||||
* Mark the upgrade-specific NBT as dirty.
|
||||
|
@@ -8,7 +8,7 @@ package dan200.computercraft.api.pocket;
|
||||
import dan200.computercraft.api.ComputerCraftAPI;
|
||||
import dan200.computercraft.api.IUpgradeBase;
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -56,7 +56,7 @@ public interface IPocketUpgrade extends IUpgradeBase
|
||||
* access the GUI.
|
||||
* @see #createPeripheral(IPocketAccess)
|
||||
*/
|
||||
default boolean onRightClick( @Nonnull World world, @Nonnull IPocketAccess access, @Nullable IPeripheral peripheral )
|
||||
default boolean onRightClick( @Nonnull Level world, @Nonnull IPocketAccess access, @Nullable IPeripheral peripheral )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@@ -5,9 +5,9 @@
|
||||
*/
|
||||
package dan200.computercraft.api.redstone;
|
||||
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -29,5 +29,5 @@ public interface IBundledRedstoneProvider
|
||||
* handle this block.
|
||||
* @see dan200.computercraft.api.ComputerCraftAPI#registerBundledRedstoneProvider(IBundledRedstoneProvider)
|
||||
*/
|
||||
int getBundledRedstoneOutput( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Direction side );
|
||||
int getBundledRedstoneOutput( @Nonnull Level world, @Nonnull BlockPos pos, @Nonnull Direction side );
|
||||
}
|
||||
|
@@ -5,11 +5,11 @@
|
||||
*/
|
||||
package dan200.computercraft.api.turtle;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IItemProvider;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraftforge.common.util.NonNullSupplier;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -50,22 +50,22 @@ public abstract class AbstractTurtleUpgrade implements ITurtleUpgrade
|
||||
this( id, type, () -> stack );
|
||||
}
|
||||
|
||||
protected AbstractTurtleUpgrade( ResourceLocation id, TurtleUpgradeType type, String adjective, IItemProvider item )
|
||||
protected AbstractTurtleUpgrade( ResourceLocation id, TurtleUpgradeType type, String adjective, ItemLike item )
|
||||
{
|
||||
this( id, type, adjective, new CachedStack( () -> item ) );
|
||||
}
|
||||
|
||||
protected AbstractTurtleUpgrade( ResourceLocation id, TurtleUpgradeType type, IItemProvider item )
|
||||
protected AbstractTurtleUpgrade( ResourceLocation id, TurtleUpgradeType type, ItemLike item )
|
||||
{
|
||||
this( id, type, new CachedStack( () -> item ) );
|
||||
}
|
||||
|
||||
protected AbstractTurtleUpgrade( ResourceLocation id, TurtleUpgradeType type, String adjective, Supplier<? extends IItemProvider> item )
|
||||
protected AbstractTurtleUpgrade( ResourceLocation id, TurtleUpgradeType type, String adjective, Supplier<? extends ItemLike> item )
|
||||
{
|
||||
this( id, type, adjective, new CachedStack( item ) );
|
||||
}
|
||||
|
||||
protected AbstractTurtleUpgrade( ResourceLocation id, TurtleUpgradeType type, Supplier<? extends IItemProvider> item )
|
||||
protected AbstractTurtleUpgrade( ResourceLocation id, TurtleUpgradeType type, Supplier<? extends ItemLike> item )
|
||||
{
|
||||
this( id, type, new CachedStack( item ) );
|
||||
}
|
||||
@@ -105,11 +105,11 @@ public abstract class AbstractTurtleUpgrade implements ITurtleUpgrade
|
||||
*/
|
||||
private static final class CachedStack implements NonNullSupplier<ItemStack>
|
||||
{
|
||||
private final Supplier<? extends IItemProvider> provider;
|
||||
private final Supplier<? extends ItemLike> provider;
|
||||
private Item item;
|
||||
private ItemStack stack;
|
||||
|
||||
CachedStack( Supplier<? extends IItemProvider> provider )
|
||||
CachedStack( Supplier<? extends ItemLike> provider )
|
||||
{
|
||||
this.provider = provider;
|
||||
}
|
||||
|
@@ -9,12 +9,12 @@ import com.mojang.authlib.GameProfile;
|
||||
import dan200.computercraft.api.lua.ILuaCallback;
|
||||
import dan200.computercraft.api.lua.MethodResult;
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -34,7 +34,7 @@ public interface ITurtleAccess
|
||||
* @return the world in which the turtle resides.
|
||||
*/
|
||||
@Nonnull
|
||||
World getWorld();
|
||||
Level getLevel();
|
||||
|
||||
/**
|
||||
* Returns a vector containing the integer co-ordinates at which the turtle resides.
|
||||
@@ -56,7 +56,7 @@ public interface ITurtleAccess
|
||||
* was cancelled.
|
||||
* @throws UnsupportedOperationException When attempting to teleport on the client side.
|
||||
*/
|
||||
boolean teleportTo( @Nonnull World world, @Nonnull BlockPos pos );
|
||||
boolean teleportTo( @Nonnull Level world, @Nonnull BlockPos pos );
|
||||
|
||||
/**
|
||||
* Returns a vector containing the floating point co-ordinates at which the turtle is rendered.
|
||||
@@ -67,7 +67,7 @@ public interface ITurtleAccess
|
||||
* @see #getVisualYaw(float)
|
||||
*/
|
||||
@Nonnull
|
||||
Vector3d getVisualPosition( float f );
|
||||
Vec3 getVisualPosition( float f );
|
||||
|
||||
/**
|
||||
* Returns the yaw the turtle is facing when it is rendered.
|
||||
@@ -151,7 +151,7 @@ public interface ITurtleAccess
|
||||
* @see #getItemHandler()
|
||||
*/
|
||||
@Nonnull
|
||||
IInventory getInventory();
|
||||
Container getInventory();
|
||||
|
||||
/**
|
||||
* Get the inventory of this turtle as an {@link IItemHandlerModifiable}.
|
||||
@@ -287,7 +287,7 @@ public interface ITurtleAccess
|
||||
* @see #updateUpgradeNBTData(TurtleSide)
|
||||
*/
|
||||
@Nonnull
|
||||
CompoundNBT getUpgradeNBTData( @Nullable TurtleSide side );
|
||||
CompoundTag getUpgradeNBTData( @Nullable TurtleSide side );
|
||||
|
||||
/**
|
||||
* Mark the upgrade-specific data as dirty on a specific side. This is required for the data to be synced to the
|
||||
|
@@ -9,11 +9,9 @@ import dan200.computercraft.api.ComputerCraftAPI;
|
||||
import dan200.computercraft.api.IUpgradeBase;
|
||||
import dan200.computercraft.api.client.TransformedModel;
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import dan200.computercraft.api.turtle.event.TurtleAttackEvent;
|
||||
import dan200.computercraft.api.turtle.event.TurtleBlockEvent;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.event.entity.player.AttackEntityEvent;
|
||||
@@ -61,8 +59,8 @@ public interface ITurtleUpgrade extends IUpgradeBase
|
||||
* Will only be called for Tool turtle. Called when turtle.dig() or turtle.attack() is called
|
||||
* by the turtle, and the tool is required to do some work.
|
||||
*
|
||||
* Conforming implementations should fire {@link BlockEvent.BreakEvent} and {@link TurtleBlockEvent.Dig} for
|
||||
* digging, {@link AttackEntityEvent} and {@link TurtleAttackEvent} for attacking.
|
||||
* Conforming implementations should fire {@link BlockEvent.BreakEvent} for digging {@link AttackEntityEvent}
|
||||
* for attacking.
|
||||
*
|
||||
* @param turtle Access to the turtle that the tool resides on.
|
||||
* @param side Which side of the turtle (left or right) the tool resides on.
|
||||
@@ -84,8 +82,8 @@ public interface ITurtleUpgrade extends IUpgradeBase
|
||||
/**
|
||||
* Called to obtain the model to be used when rendering a turtle peripheral.
|
||||
*
|
||||
* This can be obtained from {@link net.minecraft.client.renderer.ItemModelMesher#getItemModel(ItemStack)},
|
||||
* {@link net.minecraft.client.renderer.model.ModelManager#getModel(ModelResourceLocation)} or any other
|
||||
* This can be obtained from {@link net.minecraft.client.renderer.ItemModelShaper#getItemModel(ItemStack)},
|
||||
* {@link net.minecraft.client.resources.model.ModelManager#getModel(ModelResourceLocation)} or any other
|
||||
* source.
|
||||
*
|
||||
* @param turtle Access to the turtle that the upgrade resides on. This will be null when getting item models!
|
||||
|
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
package dan200.computercraft.api.turtle;
|
||||
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.core.Direction;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
package dan200.computercraft.api.turtle;
|
||||
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.core.Direction;
|
||||
|
||||
/**
|
||||
* An enum representing the different actions that an {@link ITurtleUpgrade} of type Tool may be called on to perform by
|
||||
|
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* 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.turtle.event;
|
||||
|
||||
/**
|
||||
* A basic action that a turtle may perform, as accessed by the {@code turtle} API.
|
||||
*
|
||||
* @see TurtleActionEvent
|
||||
*/
|
||||
public enum TurtleAction
|
||||
{
|
||||
/**
|
||||
* A turtle moves to a new position.
|
||||
*
|
||||
* @see TurtleBlockEvent.Move
|
||||
*/
|
||||
MOVE,
|
||||
|
||||
/**
|
||||
* A turtle turns in a specific direction.
|
||||
*/
|
||||
TURN,
|
||||
|
||||
/**
|
||||
* A turtle attempts to dig a block.
|
||||
*
|
||||
* @see TurtleBlockEvent.Dig
|
||||
*/
|
||||
DIG,
|
||||
|
||||
/**
|
||||
* A turtle attempts to place a block or item in the world.
|
||||
*
|
||||
* @see TurtleBlockEvent.Place
|
||||
*/
|
||||
PLACE,
|
||||
|
||||
/**
|
||||
* A turtle attempts to attack an entity.
|
||||
*
|
||||
* @see TurtleActionEvent
|
||||
*/
|
||||
ATTACK,
|
||||
|
||||
/**
|
||||
* Drop an item into an inventory/the world.
|
||||
*
|
||||
* @see TurtleInventoryEvent.Drop
|
||||
*/
|
||||
DROP,
|
||||
|
||||
/**
|
||||
* Suck an item from an inventory or the world.
|
||||
*
|
||||
* @see TurtleInventoryEvent.Suck
|
||||
*/
|
||||
SUCK,
|
||||
|
||||
/**
|
||||
* Refuel the turtle's fuel levels.
|
||||
*/
|
||||
REFUEL,
|
||||
|
||||
/**
|
||||
* Equip or unequip an item.
|
||||
*/
|
||||
EQUIP,
|
||||
|
||||
/**
|
||||
* Inspect a block in world.
|
||||
*
|
||||
* @see TurtleBlockEvent.Inspect
|
||||
*/
|
||||
INSPECT,
|
||||
|
||||
/**
|
||||
* Gather metdata about an item in the turtle's inventory.
|
||||
*/
|
||||
INSPECT_ITEM,
|
||||
}
|
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* 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.turtle.event;
|
||||
|
||||
import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||
import dan200.computercraft.api.turtle.TurtleCommandResult;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* An event fired when a turtle is performing a known action.
|
||||
*/
|
||||
@Cancelable
|
||||
public class TurtleActionEvent extends TurtleEvent
|
||||
{
|
||||
private final TurtleAction action;
|
||||
private String failureMessage;
|
||||
|
||||
public TurtleActionEvent( @Nonnull ITurtleAccess turtle, @Nonnull TurtleAction action )
|
||||
{
|
||||
super( turtle );
|
||||
|
||||
Objects.requireNonNull( action, "action cannot be null" );
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public TurtleAction getAction()
|
||||
{
|
||||
return action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancellation state of this action.
|
||||
*
|
||||
* If {@code cancel} is {@code true}, this action will not be carried out.
|
||||
*
|
||||
* @param cancel The new canceled value.
|
||||
* @see TurtleCommandResult#failure()
|
||||
* @deprecated Use {@link #setCanceled(boolean, String)} instead.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setCanceled( boolean cancel )
|
||||
{
|
||||
setCanceled( cancel, null );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the cancellation state of this action, setting a failure message if required.
|
||||
*
|
||||
* If {@code cancel} is {@code true}, this action will not be carried out.
|
||||
*
|
||||
* @param cancel The new canceled value.
|
||||
* @param failureMessage The message to return to the user explaining the failure.
|
||||
* @see TurtleCommandResult#failure(String)
|
||||
*/
|
||||
public void setCanceled( boolean cancel, @Nullable String failureMessage )
|
||||
{
|
||||
super.setCanceled( cancel );
|
||||
this.failureMessage = cancel ? failureMessage : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message with which this will fail.
|
||||
*
|
||||
* @return The failure message.
|
||||
* @see TurtleCommandResult#failure()
|
||||
* @see #setCanceled(boolean, String)
|
||||
*/
|
||||
@Nullable
|
||||
public String getFailureMessage()
|
||||
{
|
||||
return failureMessage;
|
||||
}
|
||||
}
|
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* 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.turtle.event;
|
||||
|
||||
import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||
import dan200.computercraft.api.turtle.ITurtleUpgrade;
|
||||
import dan200.computercraft.api.turtle.TurtleSide;
|
||||
import dan200.computercraft.api.turtle.TurtleVerb;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.event.entity.player.AttackEntityEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Fired when a turtle attempts to attack an entity.
|
||||
*
|
||||
* This must be fired by {@link ITurtleUpgrade#useTool(ITurtleAccess, TurtleSide, TurtleVerb, Direction)},
|
||||
* as the base {@code turtle.attack()} command does not fire it.
|
||||
*
|
||||
* Note that such commands should also fire {@link AttackEntityEvent}, so you do not need to listen to both.
|
||||
*
|
||||
* @see TurtleAction#ATTACK
|
||||
*/
|
||||
public class TurtleAttackEvent extends TurtlePlayerEvent
|
||||
{
|
||||
private final Entity target;
|
||||
private final ITurtleUpgrade upgrade;
|
||||
private final TurtleSide side;
|
||||
|
||||
public TurtleAttackEvent( @Nonnull ITurtleAccess turtle, @Nonnull FakePlayer player, @Nonnull Entity target, @Nonnull ITurtleUpgrade upgrade, @Nonnull TurtleSide side )
|
||||
{
|
||||
super( turtle, TurtleAction.ATTACK, player );
|
||||
Objects.requireNonNull( target, "target cannot be null" );
|
||||
Objects.requireNonNull( upgrade, "upgrade cannot be null" );
|
||||
Objects.requireNonNull( side, "side cannot be null" );
|
||||
this.target = target;
|
||||
this.upgrade = upgrade;
|
||||
this.side = side;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the entity being attacked by this turtle.
|
||||
*
|
||||
* @return The entity being attacked.
|
||||
*/
|
||||
@Nonnull
|
||||
public Entity getTarget()
|
||||
{
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the upgrade responsible for attacking.
|
||||
*
|
||||
* @return The upgrade responsible for attacking.
|
||||
*/
|
||||
@Nonnull
|
||||
public ITurtleUpgrade getUpgrade()
|
||||
{
|
||||
return upgrade;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the side the attacking upgrade is on.
|
||||
*
|
||||
* @return The upgrade's side.
|
||||
*/
|
||||
@Nonnull
|
||||
public TurtleSide getSide()
|
||||
{
|
||||
return side;
|
||||
}
|
||||
}
|
@@ -1,233 +0,0 @@
|
||||
/*
|
||||
* 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.turtle.event;
|
||||
|
||||
import dan200.computercraft.api.lua.MethodResult;
|
||||
import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||
import dan200.computercraft.api.turtle.ITurtleUpgrade;
|
||||
import dan200.computercraft.api.turtle.TurtleSide;
|
||||
import dan200.computercraft.api.turtle.TurtleVerb;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* A general event for when a turtle interacts with a block or region.
|
||||
*
|
||||
* You should generally listen to one of the sub-events instead, cancelling them where
|
||||
* appropriate.
|
||||
*
|
||||
* Note that you are not guaranteed to receive this event, if it has been cancelled by other
|
||||
* mechanisms, such as block protection systems.
|
||||
*
|
||||
* Be aware that some events (such as {@link TurtleInventoryEvent}) do not necessarily interact
|
||||
* with a block, simply objects within that block space.
|
||||
*/
|
||||
public abstract class TurtleBlockEvent extends TurtlePlayerEvent
|
||||
{
|
||||
private final World world;
|
||||
private final BlockPos pos;
|
||||
|
||||
protected TurtleBlockEvent( @Nonnull ITurtleAccess turtle, @Nonnull TurtleAction action, @Nonnull FakePlayer player, @Nonnull World world, @Nonnull BlockPos pos )
|
||||
{
|
||||
super( turtle, action, player );
|
||||
|
||||
Objects.requireNonNull( world, "world cannot be null" );
|
||||
Objects.requireNonNull( pos, "pos cannot be null" );
|
||||
this.world = world;
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the world the turtle is interacting in.
|
||||
*
|
||||
* @return The world the turtle is interacting in.
|
||||
*/
|
||||
public World getWorld()
|
||||
{
|
||||
return world;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the position the turtle is interacting with. Note that this is different
|
||||
* to {@link ITurtleAccess#getPosition()}.
|
||||
*
|
||||
* @return The position the turtle is interacting with.
|
||||
*/
|
||||
public BlockPos getPos()
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a turtle attempts to dig a block.
|
||||
*
|
||||
* This must be fired by {@link ITurtleUpgrade#useTool(ITurtleAccess, TurtleSide, TurtleVerb, Direction)},
|
||||
* as the base {@code turtle.dig()} command does not fire it.
|
||||
*
|
||||
* Note that such commands should also fire {@link BlockEvent.BreakEvent}, so you do not need to listen to both.
|
||||
*
|
||||
* @see TurtleAction#DIG
|
||||
*/
|
||||
public static class Dig extends TurtleBlockEvent
|
||||
{
|
||||
private final BlockState block;
|
||||
private final ITurtleUpgrade upgrade;
|
||||
private final TurtleSide side;
|
||||
|
||||
public Dig( @Nonnull ITurtleAccess turtle, @Nonnull FakePlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState block, @Nonnull ITurtleUpgrade upgrade, @Nonnull TurtleSide side )
|
||||
{
|
||||
super( turtle, TurtleAction.DIG, player, world, pos );
|
||||
|
||||
Objects.requireNonNull( block, "block cannot be null" );
|
||||
Objects.requireNonNull( upgrade, "upgrade cannot be null" );
|
||||
Objects.requireNonNull( side, "side cannot be null" );
|
||||
this.block = block;
|
||||
this.upgrade = upgrade;
|
||||
this.side = side;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the block which is about to be broken.
|
||||
*
|
||||
* @return The block which is going to be broken.
|
||||
*/
|
||||
@Nonnull
|
||||
public BlockState getBlock()
|
||||
{
|
||||
return block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the upgrade doing the digging.
|
||||
*
|
||||
* @return The upgrade doing the digging.
|
||||
*/
|
||||
@Nonnull
|
||||
public ITurtleUpgrade getUpgrade()
|
||||
{
|
||||
return upgrade;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the side the upgrade doing the digging is on.
|
||||
*
|
||||
* @return The upgrade's side.
|
||||
*/
|
||||
@Nonnull
|
||||
public TurtleSide getSide()
|
||||
{
|
||||
return side;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a turtle attempts to move into a block.
|
||||
*
|
||||
* @see TurtleAction#MOVE
|
||||
*/
|
||||
public static class Move extends TurtleBlockEvent
|
||||
{
|
||||
public Move( @Nonnull ITurtleAccess turtle, @Nonnull FakePlayer player, @Nonnull World world, @Nonnull BlockPos pos )
|
||||
{
|
||||
super( turtle, TurtleAction.MOVE, player, world, pos );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a turtle attempts to place a block in the world.
|
||||
*
|
||||
* @see TurtleAction#PLACE
|
||||
*/
|
||||
public static class Place extends TurtleBlockEvent
|
||||
{
|
||||
private final ItemStack stack;
|
||||
|
||||
public Place( @Nonnull ITurtleAccess turtle, @Nonnull FakePlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack )
|
||||
{
|
||||
super( turtle, TurtleAction.PLACE, player, world, pos );
|
||||
|
||||
Objects.requireNonNull( stack, "stack cannot be null" );
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the item stack that will be placed. This should not be modified.
|
||||
*
|
||||
* @return The item stack to be placed.
|
||||
*/
|
||||
@Nonnull
|
||||
public ItemStack getStack()
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a turtle gathers data on a block in world.
|
||||
*
|
||||
* You may prevent blocks being inspected, or add additional information to the result.
|
||||
*
|
||||
* @see TurtleAction#INSPECT
|
||||
*/
|
||||
public static class Inspect extends TurtleBlockEvent
|
||||
{
|
||||
private final BlockState state;
|
||||
private final Map<String, Object> data;
|
||||
|
||||
public Inspect( @Nonnull ITurtleAccess turtle, @Nonnull FakePlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull Map<String, Object> data )
|
||||
{
|
||||
super( turtle, TurtleAction.INSPECT, player, world, pos );
|
||||
|
||||
Objects.requireNonNull( state, "state cannot be null" );
|
||||
Objects.requireNonNull( data, "data cannot be null" );
|
||||
this.data = data;
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the block state which is being inspected.
|
||||
*
|
||||
* @return The inspected block state.
|
||||
*/
|
||||
@Nonnull
|
||||
public BlockState getState()
|
||||
{
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the "inspection data" from this block, which will be returned to the user.
|
||||
*
|
||||
* @return This block's inspection data.
|
||||
*/
|
||||
@Nonnull
|
||||
public Map<String, Object> getData()
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new information to the inspection result. Note this will override fields with the same name.
|
||||
*
|
||||
* @param newData The data to add. Note all values should be convertible to Lua (see
|
||||
* {@link MethodResult#of(Object)}).
|
||||
*/
|
||||
public void addData( @Nonnull Map<String, ?> newData )
|
||||
{
|
||||
Objects.requireNonNull( newData, "newData cannot be null" );
|
||||
data.putAll( newData );
|
||||
}
|
||||
}
|
||||
}
|
@@ -16,8 +16,6 @@ import java.util.Objects;
|
||||
* so sever specific methods on {@link ITurtleAccess} are safe to use.
|
||||
*
|
||||
* You should generally not need to subscribe to this event, preferring one of the more specific classes.
|
||||
*
|
||||
* @see TurtleActionEvent
|
||||
*/
|
||||
public abstract class TurtleEvent extends Event
|
||||
{
|
||||
|
@@ -1,91 +0,0 @@
|
||||
/*
|
||||
* 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.turtle.event;
|
||||
|
||||
import dan200.computercraft.api.lua.MethodResult;
|
||||
import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Fired when a turtle gathers data on an item in its inventory.
|
||||
*
|
||||
* You may prevent items being inspected, or add additional information to the result. Be aware that this may be fired
|
||||
* on the computer thread, and so any operations on it must be thread safe.
|
||||
*
|
||||
* @see TurtleAction#INSPECT_ITEM
|
||||
*/
|
||||
public class TurtleInspectItemEvent extends TurtleActionEvent
|
||||
{
|
||||
private final ItemStack stack;
|
||||
private final Map<String, Object> data;
|
||||
private final boolean mainThread;
|
||||
|
||||
@Deprecated
|
||||
public TurtleInspectItemEvent( @Nonnull ITurtleAccess turtle, @Nonnull ItemStack stack, @Nonnull Map<String, Object> data )
|
||||
{
|
||||
this( turtle, stack, data, false );
|
||||
}
|
||||
|
||||
public TurtleInspectItemEvent( @Nonnull ITurtleAccess turtle, @Nonnull ItemStack stack, @Nonnull Map<String, Object> data, boolean mainThread )
|
||||
{
|
||||
super( turtle, TurtleAction.INSPECT_ITEM );
|
||||
|
||||
Objects.requireNonNull( stack, "stack cannot be null" );
|
||||
Objects.requireNonNull( data, "data cannot be null" );
|
||||
this.stack = stack;
|
||||
this.data = data;
|
||||
this.mainThread = mainThread;
|
||||
}
|
||||
|
||||
/**
|
||||
* The item which is currently being inspected.
|
||||
*
|
||||
* @return The item stack which is being inspected. This should <b>not</b> be modified.
|
||||
*/
|
||||
@Nonnull
|
||||
public ItemStack getStack()
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the "inspection data" from this item, which will be returned to the user.
|
||||
*
|
||||
* @return This items's inspection data.
|
||||
*/
|
||||
@Nonnull
|
||||
public Map<String, Object> getData()
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* If this event is being fired on the server thread. When true, information which relies on server state may be
|
||||
* exposed.
|
||||
*
|
||||
* @return If this is run on the main thread.
|
||||
*/
|
||||
public boolean onMainThread()
|
||||
{
|
||||
return mainThread;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new information to the inspection result. Note this will override fields with the same name.
|
||||
*
|
||||
* @param newData The data to add. Note all values should be convertible to Lua (see
|
||||
* {@link MethodResult#of(Object)}).
|
||||
*/
|
||||
public void addData( @Nonnull Map<String, ?> newData )
|
||||
{
|
||||
Objects.requireNonNull( newData, "newData cannot be null" );
|
||||
data.putAll( newData );
|
||||
}
|
||||
}
|
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* 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.turtle.event;
|
||||
|
||||
import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Fired when a turtle attempts to interact with an inventory.
|
||||
*/
|
||||
public abstract class TurtleInventoryEvent extends TurtleBlockEvent
|
||||
{
|
||||
private final IItemHandler handler;
|
||||
|
||||
protected TurtleInventoryEvent( @Nonnull ITurtleAccess turtle, @Nonnull TurtleAction action, @Nonnull FakePlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nullable IItemHandler handler )
|
||||
{
|
||||
super( turtle, action, player, world, pos );
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the inventory being interacted with.
|
||||
*
|
||||
* @return The inventory being interacted with, {@code null} if the item will be dropped to/sucked from the world.
|
||||
*/
|
||||
@Nullable
|
||||
public IItemHandler getItemHandler()
|
||||
{
|
||||
return handler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a turtle attempts to suck from an inventory.
|
||||
*
|
||||
* @see TurtleAction#SUCK
|
||||
*/
|
||||
public static class Suck extends TurtleInventoryEvent
|
||||
{
|
||||
public Suck( @Nonnull ITurtleAccess turtle, @Nonnull FakePlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nullable IItemHandler handler )
|
||||
{
|
||||
super( turtle, TurtleAction.SUCK, player, world, pos, handler );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a turtle attempts to drop an item into an inventory.
|
||||
*
|
||||
* @see TurtleAction#DROP
|
||||
*/
|
||||
public static class Drop extends TurtleInventoryEvent
|
||||
{
|
||||
private final ItemStack stack;
|
||||
|
||||
public Drop( @Nonnull ITurtleAccess turtle, @Nonnull FakePlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nullable IItemHandler handler, @Nonnull ItemStack stack )
|
||||
{
|
||||
super( turtle, TurtleAction.DROP, player, world, pos, handler );
|
||||
|
||||
Objects.requireNonNull( stack, "stack cannot be null" );
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* The item which will be inserted into the inventory/dropped on the ground.
|
||||
*
|
||||
* @return The item stack which will be dropped. This should <b>not</b> be modified.
|
||||
*/
|
||||
@Nonnull
|
||||
public ItemStack getStack()
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* 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.turtle.event;
|
||||
|
||||
import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* An action done by a turtle which is normally done by a player.
|
||||
*
|
||||
* {@link #getPlayer()} may be used to modify the player's attributes or perform permission checks.
|
||||
*/
|
||||
public abstract class TurtlePlayerEvent extends TurtleActionEvent
|
||||
{
|
||||
private final FakePlayer player;
|
||||
|
||||
protected TurtlePlayerEvent( @Nonnull ITurtleAccess turtle, @Nonnull TurtleAction action, @Nonnull FakePlayer player )
|
||||
{
|
||||
super( turtle, action );
|
||||
|
||||
Objects.requireNonNull( player, "player cannot be null" );
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
/**
|
||||
* A fake player, representing this turtle.
|
||||
*
|
||||
* This may be used for triggering permission checks.
|
||||
*
|
||||
* @return A {@link FakePlayer} representing this turtle.
|
||||
*/
|
||||
@Nonnull
|
||||
public FakePlayer getPlayer()
|
||||
{
|
||||
return player;
|
||||
}
|
||||
}
|
@@ -6,7 +6,7 @@
|
||||
package dan200.computercraft.api.turtle.event;
|
||||
|
||||
import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -15,17 +15,16 @@ import java.util.Objects;
|
||||
/**
|
||||
* Fired when a turtle attempts to refuel from an item.
|
||||
*
|
||||
* One may use {@link #setCanceled(boolean, String)} to prevent refueling from this specific item. Additionally, you
|
||||
* may use {@link #setHandler(Handler)} to register a custom fuel provider.
|
||||
* One may use {@link #setHandler(Handler)} to register a custom fuel provider for a given item.
|
||||
*/
|
||||
public class TurtleRefuelEvent extends TurtleActionEvent
|
||||
public class TurtleRefuelEvent extends TurtleEvent
|
||||
{
|
||||
private final ItemStack stack;
|
||||
private Handler handler;
|
||||
|
||||
public TurtleRefuelEvent( @Nonnull ITurtleAccess turtle, @Nonnull ItemStack stack )
|
||||
{
|
||||
super( turtle, TurtleAction.REFUEL );
|
||||
super( turtle );
|
||||
|
||||
Objects.requireNonNull( turtle, "turtle cannot be null" );
|
||||
this.stack = stack;
|
||||
|
@@ -20,21 +20,22 @@ 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;
|
||||
import net.minecraft.client.gui.screens.MenuScreens;
|
||||
import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemModelsProperties;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
||||
import net.minecraft.client.renderer.item.ItemProperties;
|
||||
import net.minecraft.client.renderer.item.ItemPropertyFunction;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.ColorHandlerEvent;
|
||||
import net.minecraftforge.client.event.EntityRenderersEvent;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
|
||||
@@ -122,44 +123,48 @@ public final class ClientRegistry
|
||||
);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerEntityRenderers( EntityRenderersEvent.RegisterRenderers event )
|
||||
{
|
||||
event.registerEntityRenderer( Registry.ModEntities.TURTLE_PLAYER.get(), TurtlePlayerRenderer::new );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void setupClient( FMLClientSetupEvent event )
|
||||
{
|
||||
registerContainers();
|
||||
|
||||
// While turtles themselves are not transparent, their upgrades may be.
|
||||
RenderTypeLookup.setRenderLayer( Registry.ModBlocks.TURTLE_NORMAL.get(), RenderType.translucent() );
|
||||
RenderTypeLookup.setRenderLayer( Registry.ModBlocks.TURTLE_ADVANCED.get(), RenderType.translucent() );
|
||||
ItemBlockRenderTypes.setRenderLayer( Registry.ModBlocks.TURTLE_NORMAL.get(), RenderType.translucent() );
|
||||
ItemBlockRenderTypes.setRenderLayer( Registry.ModBlocks.TURTLE_ADVANCED.get(), RenderType.translucent() );
|
||||
|
||||
// Monitors' textures have transparent fronts and so count as cutouts.
|
||||
RenderTypeLookup.setRenderLayer( Registry.ModBlocks.MONITOR_NORMAL.get(), RenderType.cutout() );
|
||||
RenderTypeLookup.setRenderLayer( Registry.ModBlocks.MONITOR_ADVANCED.get(), RenderType.cutout() );
|
||||
ItemBlockRenderTypes.setRenderLayer( Registry.ModBlocks.MONITOR_NORMAL.get(), RenderType.cutout() );
|
||||
ItemBlockRenderTypes.setRenderLayer( Registry.ModBlocks.MONITOR_ADVANCED.get(), RenderType.cutout() );
|
||||
|
||||
// Setup TESRs
|
||||
net.minecraftforge.fml.client.registry.ClientRegistry.bindTileEntityRenderer( Registry.ModTiles.MONITOR_NORMAL.get(), TileEntityMonitorRenderer::new );
|
||||
net.minecraftforge.fml.client.registry.ClientRegistry.bindTileEntityRenderer( Registry.ModTiles.MONITOR_ADVANCED.get(), TileEntityMonitorRenderer::new );
|
||||
net.minecraftforge.fml.client.registry.ClientRegistry.bindTileEntityRenderer( Registry.ModTiles.TURTLE_NORMAL.get(), TileEntityTurtleRenderer::new );
|
||||
net.minecraftforge.fml.client.registry.ClientRegistry.bindTileEntityRenderer( Registry.ModTiles.TURTLE_ADVANCED.get(), TileEntityTurtleRenderer::new );
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler( Registry.ModEntities.TURTLE_PLAYER.get(), TurtlePlayerRenderer::new );
|
||||
BlockEntityRenderers.register( Registry.ModBlockEntities.MONITOR_NORMAL.get(), TileEntityMonitorRenderer::new );
|
||||
BlockEntityRenderers.register( Registry.ModBlockEntities.MONITOR_ADVANCED.get(), TileEntityMonitorRenderer::new );
|
||||
BlockEntityRenderers.register( Registry.ModBlockEntities.TURTLE_NORMAL.get(), TileEntityTurtleRenderer::new );
|
||||
BlockEntityRenderers.register( Registry.ModBlockEntities.TURTLE_ADVANCED.get(), TileEntityTurtleRenderer::new );
|
||||
|
||||
registerItemProperty( "state",
|
||||
( stack, world, player ) -> ItemPocketComputer.getState( stack ).ordinal(),
|
||||
( stack, world, player, random ) -> ItemPocketComputer.getState( stack ).ordinal(),
|
||||
Registry.ModItems.POCKET_COMPUTER_NORMAL, Registry.ModItems.POCKET_COMPUTER_ADVANCED
|
||||
);
|
||||
registerItemProperty( "coloured",
|
||||
( stack, world, player ) -> IColouredItem.getColourBasic( stack ) != -1 ? 1 : 0,
|
||||
( stack, world, player, random ) -> IColouredItem.getColourBasic( stack ) != -1 ? 1 : 0,
|
||||
Registry.ModItems.POCKET_COMPUTER_NORMAL, Registry.ModItems.POCKET_COMPUTER_ADVANCED
|
||||
);
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
private static void registerItemProperty( String name, IItemPropertyGetter getter, Supplier<? extends Item>... items )
|
||||
private static void registerItemProperty( String name, ItemPropertyFunction getter, Supplier<? extends Item>... items )
|
||||
{
|
||||
ResourceLocation id = new ResourceLocation( ComputerCraft.MOD_ID, name );
|
||||
for( Supplier<? extends Item> item : items )
|
||||
{
|
||||
ItemModelsProperties.register( item.get(), id, getter );
|
||||
ItemProperties.register( item.get(), id, getter );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,14 +173,14 @@ 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.register( Registry.ModContainers.TURTLE.get(), GuiTurtle::new );
|
||||
MenuScreens.<ContainerComputer, GuiComputer<ContainerComputer>>register( Registry.ModContainers.COMPUTER.get(), GuiComputer::create );
|
||||
MenuScreens.<ContainerPocketComputer, GuiComputer<ContainerPocketComputer>>register( Registry.ModContainers.POCKET_COMPUTER.get(), GuiComputer::createPocket );
|
||||
MenuScreens.register( Registry.ModContainers.TURTLE.get(), GuiTurtle::new );
|
||||
|
||||
ScreenManager.register( Registry.ModContainers.PRINTER.get(), GuiPrinter::new );
|
||||
ScreenManager.register( Registry.ModContainers.DISK_DRIVE.get(), GuiDiskDrive::new );
|
||||
ScreenManager.register( Registry.ModContainers.PRINTOUT.get(), GuiPrintout::new );
|
||||
MenuScreens.register( Registry.ModContainers.PRINTER.get(), GuiPrinter::new );
|
||||
MenuScreens.register( Registry.ModContainers.DISK_DRIVE.get(), GuiDiskDrive::new );
|
||||
MenuScreens.register( Registry.ModContainers.PRINTOUT.get(), GuiPrintout::new );
|
||||
|
||||
ScreenManager.<ContainerViewComputer, GuiComputer<ContainerViewComputer>>register( Registry.ModContainers.VIEW_COMPUTER.get(), GuiComputer::createView );
|
||||
MenuScreens.<ContainerViewComputer, GuiComputer<ContainerViewComputer>>register( Registry.ModContainers.VIEW_COMPUTER.get(), GuiComputer::createView );
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user