mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-10-16 22:47:38 +00:00
Compare commits
87 Commits
v1.96.0
...
v1.12.2-1.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8b1773dd60 | ||
![]() |
018ecfbaa0 | ||
![]() |
4c8fd4fc35 | ||
![]() |
35c1b10224 | ||
![]() |
c1c01bef7c | ||
![]() |
a48c3d0ba8 | ||
![]() |
93a9ebc4f6 | ||
![]() |
7cc2bd43c6 | ||
![]() |
393e628721 | ||
![]() |
0bcd28e58c | ||
![]() |
42f5389fb8 | ||
![]() |
041cfe91b4 | ||
![]() |
0dde859582 | ||
![]() |
e59c043fb6 | ||
![]() |
ae928c4397 | ||
![]() |
da41c65128 | ||
![]() |
4d18234714 | ||
![]() |
d254c6464b | ||
![]() |
3a5d50e572 | ||
![]() |
03b6d2f1ab | ||
![]() |
b0397ed3c5 | ||
![]() |
fa70ebcac2 | ||
![]() |
86e0330100 | ||
![]() |
0ae70fed13 | ||
![]() |
121802a683 | ||
![]() |
08cf55e55f | ||
![]() |
3c8c0d78ef | ||
![]() |
c4d18aa9ca | ||
![]() |
a8fadabaf1 | ||
![]() |
38f9a015ca | ||
![]() |
c311cdc6f5 | ||
![]() |
a93e0f3284 | ||
![]() |
14b3065ba4 | ||
![]() |
c802290437 | ||
![]() |
418420523a | ||
![]() |
813e91073d | ||
![]() |
7250f22ff6 | ||
![]() |
db31a53bba | ||
![]() |
3023f235a4 | ||
![]() |
79cd8b4da5 | ||
![]() |
8e4d311cd9 | ||
![]() |
9bd8c86a94 | ||
![]() |
cbc0c1d0b6 | ||
![]() |
49c37857d4 | ||
![]() |
a802f25dd6 | ||
![]() |
a80302c513 | ||
![]() |
1c46949da7 | ||
![]() |
46d78af068 | ||
![]() |
eb5cff1045 | ||
![]() |
35c7792aa2 | ||
![]() |
521688d630 | ||
![]() |
75e2845c01 | ||
![]() |
2f96283286 | ||
![]() |
cbe6e9b5f5 | ||
![]() |
2ab79cf474 | ||
![]() |
6ce34aba79 | ||
![]() |
5eeb320b60 | ||
![]() |
93310850d2 | ||
![]() |
a2880b12ca | ||
![]() |
303b57779a | ||
![]() |
6279816ecc | ||
![]() |
4ae77261fa | ||
![]() |
4b7d843b78 | ||
![]() |
1c28df65c3 | ||
![]() |
85b740f484 | ||
![]() |
f9929cb27d | ||
![]() |
bafab1ac07 | ||
![]() |
e05c262468 | ||
![]() |
7a3f7d3bba | ||
![]() |
95aa48c456 | ||
![]() |
904a168d5c | ||
![]() |
724441eddc | ||
![]() |
f68ab3edd1 | ||
![]() |
29dce26bf6 | ||
![]() |
717ab69093 | ||
![]() |
138a2cf08f | ||
![]() |
81daf82647 | ||
![]() |
f3798bfb63 | ||
![]() |
bc07dfad2e | ||
![]() |
309cbdb8be | ||
![]() |
a0e7c4a74c | ||
![]() |
7d428030df | ||
![]() |
00c395f689 | ||
![]() |
d8e1c73d26 | ||
![]() |
ffa4cc241b | ||
![]() |
6f1b740c8f | ||
![]() |
3406ba3ebf |
@@ -11,5 +11,8 @@ insert_final_newline = true
|
|||||||
[*.md]
|
[*.md]
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[*.sexp]
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
[*.properties]
|
[*.properties]
|
||||||
insert_final_newline = false
|
insert_final_newline = false
|
||||||
|
39
.github/workflows/main-ci.yml
vendored
Normal file
39
.github/workflows/main-ci.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
name: Build
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Set up JDK 1.8
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 1.8
|
||||||
|
|
||||||
|
- name: Build with Gradle
|
||||||
|
run: ./gradlew build --no-daemon
|
||||||
|
|
||||||
|
- name: Upload Jar
|
||||||
|
uses: actions/upload-artifact@v1
|
||||||
|
with:
|
||||||
|
name: CC-Tweaked
|
||||||
|
path: build/libs
|
||||||
|
|
||||||
|
lint-lua:
|
||||||
|
name: Lint Lua
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Lint Lua code
|
||||||
|
run: |
|
||||||
|
test -d bin || mkdir bin
|
||||||
|
test -f bin/illuaminate || wget -q -Obin/illuaminate https://squiddev.cc/illuaminate/bin/illuaminate
|
||||||
|
chmod +x bin/illuaminate
|
||||||
|
bin/illuaminate lint
|
6
.gitignore
vendored
6
.gitignore
vendored
@@ -15,3 +15,9 @@
|
|||||||
.idea
|
.idea
|
||||||
.gradle
|
.gradle
|
||||||
*.DS_Store
|
*.DS_Store
|
||||||
|
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
.settings/
|
||||||
|
bin/
|
||||||
|
*.launch
|
||||||
|
34
.luacheckrc
34
.luacheckrc
@@ -1,34 +0,0 @@
|
|||||||
std = "max"
|
|
||||||
|
|
||||||
ignore = {
|
|
||||||
-- Allow access to undefined globals or their fields. In the future we'll
|
|
||||||
-- define all of CC's globals within this file
|
|
||||||
'113', '143',
|
|
||||||
|
|
||||||
-- FIXME: Ignore unused arguments and loop variables
|
|
||||||
'212', '213',
|
|
||||||
|
|
||||||
-- Disable line is too long for now. It would be possible to clean
|
|
||||||
-- this up in the future.
|
|
||||||
'631',
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Only run the linter on ROM and bios for now, as the treasure disks
|
|
||||||
-- are largely unsupported.
|
|
||||||
include_files = {
|
|
||||||
'src/main/resources/assets/computercraft/lua/rom',
|
|
||||||
'src/main/resources/assets/computercraft/lua/bios.lua'
|
|
||||||
}
|
|
||||||
|
|
||||||
files['src/main/resources/assets/computercraft/lua/bios.lua'] = {
|
|
||||||
-- Allow declaring and mutating globals
|
|
||||||
allow_defined_top = true,
|
|
||||||
ignore = { '112', '121', '122', '131', '142' },
|
|
||||||
}
|
|
||||||
|
|
||||||
files['src/main/resources/assets/computercraft/lua/rom/apis'] = {
|
|
||||||
-- APIs may define globals on the top level. We'll ignore unused globals,
|
|
||||||
-- as obviously they may be used outside that API.
|
|
||||||
allow_defined_top = true,
|
|
||||||
ignore = { '131' },
|
|
||||||
}
|
|
14
.travis.yml
14
.travis.yml
@@ -1,14 +0,0 @@
|
|||||||
language: java
|
|
||||||
|
|
||||||
script: ./gradlew build --no-daemon
|
|
||||||
|
|
||||||
before_cache:
|
|
||||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
|
||||||
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $HOME/.gradle/caches/
|
|
||||||
- $HOME/.gradle/wrapper/s
|
|
||||||
|
|
||||||
jdk:
|
|
||||||
- oraclejdk8
|
|
@@ -1,5 +1,5 @@
|
|||||||
# 
|
# 
|
||||||
[](https://travis-ci.org/SquidDev-CC/CC-Tweaked "Current build status") [](https://minecraft.curseforge.com/projects/cc-tweaked "Download CC: Tweaked on CurseForge")
|
[](https://github.com/SquidDev-CC/CC-Tweaked/actions "Current build status") [](https://minecraft.curseforge.com/projects/cc-tweaked "Download CC: Tweaked on CurseForge")
|
||||||
|
|
||||||
CC: Tweaked is a fork of [ComputerCraft](https://github.com/dan200/ComputerCraft), adding programmable computers,
|
CC: Tweaked is a fork of [ComputerCraft](https://github.com/dan200/ComputerCraft), adding programmable computers,
|
||||||
turtles and more to Minecraft.
|
turtles and more to Minecraft.
|
||||||
|
109
build.gradle
109
build.gradle
@@ -5,7 +5,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
maven {
|
maven {
|
||||||
name = "forge"
|
name = "forge"
|
||||||
url = "http://files.minecraftforge.net/maven"
|
url = "https://files.minecraftforge.net/maven"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -17,7 +17,9 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.matthewprenger.cursegradle' version '1.2.0'
|
id "checkstyle"
|
||||||
|
id "com.github.hierynomus.license" version "0.15.0"
|
||||||
|
id "com.matthewprenger.cursegradle" version "1.3.0"
|
||||||
id "com.github.breadmoirai.github-release" version "2.2.4"
|
id "com.github.breadmoirai.github-release" version "2.2.4"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +45,7 @@ minecraft {
|
|||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
name "JEI"
|
name "JEI"
|
||||||
url "http://dvs1.progwml6.com/files/maven"
|
url "https://dvs1.progwml6.com/files/maven"
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
name "SquidDev"
|
name "SquidDev"
|
||||||
@@ -55,7 +57,11 @@ repositories {
|
|||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
name "Amadornes"
|
name "Amadornes"
|
||||||
url "http://maven.amadornes.com/"
|
url "https://maven.amadornes.com/"
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name "CraftTweaker"
|
||||||
|
url "https://maven.blamejared.com/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,20 +72,25 @@ configurations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
checkstyle "com.puppycrawl.tools:checkstyle:8.25"
|
||||||
|
|
||||||
|
deobfProvided "CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-4.1.20.554"
|
||||||
|
deobfProvided "MCMultiPart2:MCMultiPart:2.5.3"
|
||||||
deobfProvided "mezz.jei:jei_1.12.2:4.15.0.269:api"
|
deobfProvided "mezz.jei:jei_1.12.2:4.15.0.269:api"
|
||||||
deobfProvided "pl.asie:Charset-Lib:0.5.4.6"
|
deobfProvided "pl.asie:Charset-Lib:0.5.4.6"
|
||||||
deobfProvided "MCMultiPart2:MCMultiPart:2.5.3"
|
|
||||||
|
|
||||||
runtime "mezz.jei:jei_1.12.2:4.15.0.269"
|
runtime "mezz.jei:jei_1.12.2:4.15.0.269"
|
||||||
|
|
||||||
shade 'org.squiddev:Cobalt:0.5.0-SNAPSHOT'
|
shade 'org.squiddev:Cobalt:0.5.0-SNAPSHOT'
|
||||||
|
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.1.0'
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.2'
|
||||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.1.0'
|
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.2'
|
||||||
|
|
||||||
deployerJars "org.apache.maven.wagon:wagon-ssh:3.0.0"
|
deployerJars "org.apache.maven.wagon:wagon-ssh:3.0.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Compile tasks
|
||||||
|
|
||||||
javadoc {
|
javadoc {
|
||||||
include "dan200/computercraft/api/**/*.java"
|
include "dan200/computercraft/api/**/*.java"
|
||||||
}
|
}
|
||||||
@@ -98,12 +109,22 @@ jar {
|
|||||||
from configurations.shade.collect { it.isDirectory() ? it : zipTree(it) }
|
from configurations.shade.collect { it.isDirectory() ? it : zipTree(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[compileJava, compileTestJava].forEach {
|
||||||
|
it.configure {
|
||||||
|
options.compilerArgs << "-Xlint" << "-Xlint:-processing" << "-Werror"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
import java.nio.file.*
|
import java.nio.file.*
|
||||||
import java.util.zip.*
|
import java.util.zip.*
|
||||||
|
|
||||||
import com.google.gson.GsonBuilder
|
import com.google.gson.GsonBuilder
|
||||||
import com.google.gson.JsonElement
|
import com.google.gson.JsonElement
|
||||||
|
import com.hierynomus.gradle.license.tasks.LicenseCheck
|
||||||
|
import com.hierynomus.gradle.license.tasks.LicenseFormat
|
||||||
import org.ajoberstar.grgit.Grgit
|
import org.ajoberstar.grgit.Grgit
|
||||||
import proguard.gradle.ProGuardTask
|
import proguard.gradle.ProGuardTask
|
||||||
|
|
||||||
@@ -116,6 +137,7 @@ task proguard(type: ProGuardTask, dependsOn: jar) {
|
|||||||
|
|
||||||
// Add the main runtime jar and all non-shadowed dependencies
|
// Add the main runtime jar and all non-shadowed dependencies
|
||||||
libraryjars "${System.getProperty('java.home')}/lib/rt.jar"
|
libraryjars "${System.getProperty('java.home')}/lib/rt.jar"
|
||||||
|
libraryjars "${System.getProperty('java.home')}/lib/jce.jar"
|
||||||
doFirst {
|
doFirst {
|
||||||
sourceSets.main.compileClasspath
|
sourceSets.main.compileClasspath
|
||||||
.filter { !it.name.contains("Cobalt") }
|
.filter { !it.name.contains("Cobalt") }
|
||||||
@@ -130,9 +152,6 @@ task proguard(type: ProGuardTask, dependsOn: jar) {
|
|||||||
|
|
||||||
// Preserve ComputerCraft classes - we only want to strip shadowed files.
|
// Preserve ComputerCraft classes - we only want to strip shadowed files.
|
||||||
keep 'class dan200.computercraft.** { *; }'
|
keep 'class dan200.computercraft.** { *; }'
|
||||||
|
|
||||||
// Preserve the constructors in Cobalt library class, as we init them via reflection
|
|
||||||
keepclassmembers 'class org.squiddev.cobalt.lib.** { <init>(...); }'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task proguardMove(dependsOn: proguard) {
|
task proguardMove(dependsOn: proguard) {
|
||||||
@@ -199,6 +218,7 @@ task compressJson(dependsOn: extractAnnotationsJar) {
|
|||||||
// Copy over all files in the current jar to the new one, running json files from GSON. As pretty printing
|
// Copy over all files in the current jar to the new one, running json files from GSON. As pretty printing
|
||||||
// is turned off, they should be minified.
|
// is turned off, they should be minified.
|
||||||
new ZipFile(jarPath).withCloseable { inJar ->
|
new ZipFile(jarPath).withCloseable { inJar ->
|
||||||
|
tempPath.getParentFile().mkdirs()
|
||||||
new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(tempPath))).withCloseable { outJar ->
|
new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(tempPath))).withCloseable { outJar ->
|
||||||
inJar.entries().each { entry ->
|
inJar.entries().each { entry ->
|
||||||
if(entry.directory) {
|
if(entry.directory) {
|
||||||
@@ -226,6 +246,56 @@ task compressJson(dependsOn: extractAnnotationsJar) {
|
|||||||
|
|
||||||
assemble.dependsOn compressJson
|
assemble.dependsOn compressJson
|
||||||
|
|
||||||
|
// Check tasks
|
||||||
|
|
||||||
|
test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
testLogging {
|
||||||
|
events "skipped", "failed"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
license {
|
||||||
|
mapping("java", "SLASHSTAR_STYLE")
|
||||||
|
strictCheck true
|
||||||
|
|
||||||
|
ext.year = Calendar.getInstance().get(Calendar.YEAR)
|
||||||
|
}
|
||||||
|
|
||||||
|
[licenseMain, licenseFormatMain].forEach {
|
||||||
|
it.configure {
|
||||||
|
include("**/*.java")
|
||||||
|
exclude("dan200/computercraft/api/**")
|
||||||
|
header rootProject.file('config/license/main.txt')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[licenseTest, licenseFormatTest].forEach {
|
||||||
|
it.configure {
|
||||||
|
include("**/*.java")
|
||||||
|
header rootProject.file('config/license/main.txt')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gradle.projectsEvaluated {
|
||||||
|
tasks.withType(LicenseFormat) {
|
||||||
|
outputs.upToDateWhen { false }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
task licenseAPI(type: LicenseCheck);
|
||||||
|
task licenseFormatAPI(type: LicenseFormat);
|
||||||
|
[licenseAPI, licenseFormatAPI].forEach {
|
||||||
|
it.configure {
|
||||||
|
source = sourceSets.main.java
|
||||||
|
include("dan200/computercraft/api/**")
|
||||||
|
header rootProject.file('config/license/api.txt')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Upload tasks
|
||||||
|
|
||||||
task checkRelease {
|
task checkRelease {
|
||||||
group "upload"
|
group "upload"
|
||||||
description "Verifies that everything is ready for a release"
|
description "Verifies that everything is ready for a release"
|
||||||
@@ -264,7 +334,7 @@ task checkRelease {
|
|||||||
if (!ok) throw new IllegalStateException("Could not check release")
|
if (!ok) throw new IllegalStateException("Could not check release")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
check.dependsOn checkRelease
|
||||||
|
|
||||||
curseforge {
|
curseforge {
|
||||||
apiKey = project.hasProperty('curseForgeApiKey') ? project.curseForgeApiKey : ''
|
apiKey = project.hasProperty('curseForgeApiKey') ? project.curseForgeApiKey : ''
|
||||||
@@ -336,7 +406,9 @@ githubRelease {
|
|||||||
token project.hasProperty('githubApiKey') ? project.githubApiKey : ''
|
token project.hasProperty('githubApiKey') ? project.githubApiKey : ''
|
||||||
owner 'SquidDev-CC'
|
owner 'SquidDev-CC'
|
||||||
repo 'CC-Tweaked'
|
repo 'CC-Tweaked'
|
||||||
targetCommitish { Grgit.open(dir: '.').branch.current().name }
|
try {
|
||||||
|
targetCommitish = Grgit.open(dir: '.').branch.current().name
|
||||||
|
} catch(Exception ignored) { }
|
||||||
|
|
||||||
tagName "v${mc_version}-${mod_version}"
|
tagName "v${mc_version}-${mod_version}"
|
||||||
releaseName "[${mc_version}] ${mod_version}"
|
releaseName "[${mc_version}] ${mod_version}"
|
||||||
@@ -357,18 +429,5 @@ task uploadAll(dependsOn: uploadTasks) {
|
|||||||
description "Uploads to all repositories (Maven, Curse, GitHub release)"
|
description "Uploads to all repositories (Maven, Curse, GitHub release)"
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
|
||||||
useJUnitPlatform()
|
|
||||||
testLogging {
|
|
||||||
events "passed", "skipped", "failed"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gradle.projectsEvaluated {
|
|
||||||
tasks.withType(JavaCompile) {
|
|
||||||
options.compilerArgs << "-Xlint" << "-Xlint:-processing" << "-Werror"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
runClient.outputs.upToDateWhen { false }
|
runClient.outputs.upToDateWhen { false }
|
||||||
runServer.outputs.upToDateWhen { false }
|
runServer.outputs.upToDateWhen { false }
|
||||||
|
169
config/checkstyle/checkstyle.xml
Normal file
169
config/checkstyle/checkstyle.xml
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE module PUBLIC
|
||||||
|
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||||
|
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||||
|
<module name="Checker">
|
||||||
|
<property name="tabWidth" value="4"/>
|
||||||
|
<property name="charset" value="UTF-8" />
|
||||||
|
|
||||||
|
<module name="SuppressionFilter">
|
||||||
|
<property name="file" value="config/checkstyle/suppressions.xml" />
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<module name="TreeWalker">
|
||||||
|
<!-- Annotations -->
|
||||||
|
<module name="AnnotationLocation" />
|
||||||
|
<module name="AnnotationUseStyle" />
|
||||||
|
<module name="MissingDeprecated" />
|
||||||
|
<module name="MissingOverride" />
|
||||||
|
|
||||||
|
<!-- Blocks -->
|
||||||
|
<module name="EmptyBlock" />
|
||||||
|
<module name="EmptyCatchBlock">
|
||||||
|
<property name="exceptionVariableName" value="ignored" />
|
||||||
|
</module>
|
||||||
|
<module name="LeftCurly">
|
||||||
|
<property name="option" value="nl" />
|
||||||
|
<!-- The defaults, minus lambdas. -->
|
||||||
|
<property name="tokens" value="ANNOTATION_DEF,CLASS_DEF,CTOR_DEF,ENUM_CONSTANT_DEF,ENUM_DEF,INTERFACE_DEF,LITERAL_CASE,LITERAL_CATCH,LITERAL_DEFAULT,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_SWITCH,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE,METHOD_DEF,OBJBLOCK,STATIC_INIT" />
|
||||||
|
</module>
|
||||||
|
<module name="NeedBraces">
|
||||||
|
<property name="allowSingleLineStatement" value="true"/>
|
||||||
|
</module>
|
||||||
|
<module name="RightCurly">
|
||||||
|
<property name="option" value="alone" />
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<!-- Class design. As if we've ever followed good practice here. -->
|
||||||
|
<module name="FinalClass" />
|
||||||
|
<module name="InterfaceIsType" />
|
||||||
|
<module name="MutableException" />
|
||||||
|
<module name="OneTopLevelClass" />
|
||||||
|
|
||||||
|
<!-- Coding -->
|
||||||
|
<module name="ArrayTrailingComma" />
|
||||||
|
<module name="EqualsHashCode" />
|
||||||
|
<!-- FallThrough does not handle unreachable code well -->
|
||||||
|
<module name="IllegalInstantiation" />
|
||||||
|
<module name="IllegalThrows" />
|
||||||
|
<module name="ModifiedControlVariable" />
|
||||||
|
<module name="NoClone" />
|
||||||
|
<module name="NoFinalizer" />
|
||||||
|
<module name="OneStatementPerLine" />
|
||||||
|
<module name="PackageDeclaration" />
|
||||||
|
<module name="SimplifyBooleanExpression" />
|
||||||
|
<module name="SimplifyBooleanReturn" />
|
||||||
|
<module name="StringLiteralEquality" />
|
||||||
|
<module name="UnnecessaryParentheses" />
|
||||||
|
<module name="UnnecessarySemicolonAfterTypeMemberDeclaration" />
|
||||||
|
<module name="UnnecessarySemicolonInTryWithResources" />
|
||||||
|
<module name="UnnecessarySemicolonInEnumeration" />
|
||||||
|
|
||||||
|
<!-- Imports -->
|
||||||
|
<module name="CustomImportOrder" />
|
||||||
|
<module name="IllegalImport" />
|
||||||
|
<module name="RedundantImport" />
|
||||||
|
<module name="UnusedImports" />
|
||||||
|
|
||||||
|
<!-- Javadoc -->
|
||||||
|
<!-- TODO: Missing* checks for the dan200.computercraft.api package? -->
|
||||||
|
<module name="AtclauseOrder" />
|
||||||
|
<module name="InvalidJavadocPosition" />
|
||||||
|
<module name="JavadocBlockTagLocation" />
|
||||||
|
<module name="JavadocMethod"/>
|
||||||
|
<module name="JavadocType"/>
|
||||||
|
<module name="JavadocStyle" />
|
||||||
|
<module name="NonEmptyAtclauseDescription" />
|
||||||
|
<module name="SingleLineJavadoc" />
|
||||||
|
<module name="SummaryJavadocCheck"/>
|
||||||
|
|
||||||
|
<!-- Misc -->
|
||||||
|
<module name="ArrayTypeStyle" />
|
||||||
|
<module name="CommentsIndentation" />
|
||||||
|
<module name="Indentation" />
|
||||||
|
<module name="OuterTypeFilename" />
|
||||||
|
|
||||||
|
<!-- Modifiers -->
|
||||||
|
<module name="ModifierOrder" />
|
||||||
|
<module name="RedundantModifier" />
|
||||||
|
|
||||||
|
<!-- Naming -->
|
||||||
|
<module name="ClassTypeParameterName" />
|
||||||
|
<module name="InterfaceTypeParameterName" />
|
||||||
|
<module name="LambdaParameterName" />
|
||||||
|
<module name="LocalFinalVariableName" />
|
||||||
|
<module name="LocalVariableName" />
|
||||||
|
<!-- Allow an optional m_ on private members -->
|
||||||
|
<module name="MemberName">
|
||||||
|
<property name="applyToPrivate" value="false" />
|
||||||
|
<property name="applyToPackage" value="false" />
|
||||||
|
</module>
|
||||||
|
<module name="MemberName">
|
||||||
|
<property name="format" value="^(m_)?[a-z][a-zA-Z0-9]*$" />
|
||||||
|
<property name="applyToPrivate" value="true" />
|
||||||
|
<property name="applyToPackage" value="true" />
|
||||||
|
</module>
|
||||||
|
<module name="MethodName" />
|
||||||
|
<module name="MethodTypeParameterName" />
|
||||||
|
<module name="PackageName">
|
||||||
|
<property name="format" value="^dan200\.computercraf(\.[a-z][a-z0-9]*)*" />
|
||||||
|
</module>
|
||||||
|
<module name="ParameterName" />
|
||||||
|
<module name="StaticVariableName">
|
||||||
|
<property name="format" value="^[a-z][a-zA-Z0-9]*|CAPABILITY(_[A-Z]+)?$" />
|
||||||
|
<property name="applyToPrivate" value="false" />
|
||||||
|
</module>
|
||||||
|
<module name="StaticVariableName">
|
||||||
|
<property name="format" value="^(s_)?[a-z][a-zA-Z0-9]*|CAPABILITY(_[A-Z]+)?$" />
|
||||||
|
<property name="applyToPrivate" value="true" />
|
||||||
|
</module>
|
||||||
|
<module name="TypeName" />
|
||||||
|
|
||||||
|
<!-- Whitespace -->
|
||||||
|
<module name="EmptyForInitializerPad"/>
|
||||||
|
<module name="EmptyForIteratorPad">
|
||||||
|
<property name="option" value="space"/>
|
||||||
|
</module>
|
||||||
|
<module name="GenericWhitespace" />
|
||||||
|
<module name="MethodParamPad" />
|
||||||
|
<module name="NoLineWrap" />
|
||||||
|
<module name="NoWhitespaceAfter">
|
||||||
|
<property name="tokens" value="AT,INC,DEC,UNARY_MINUS,UNARY_PLUS,BNOT,LNOT,DOT,ARRAY_DECLARATOR,INDEX_OP" />
|
||||||
|
</module>
|
||||||
|
<module name="NoWhitespaceBefore" />
|
||||||
|
<!-- TODO: Decide on an OperatorWrap style. -->
|
||||||
|
<module name="ParenPad">
|
||||||
|
<property name="option" value="space" />
|
||||||
|
<property name="tokens" value="ANNOTATION,ANNOTATION_FIELD_DEF,CTOR_CALL,CTOR_DEF,ENUM_CONSTANT_DEF,LITERAL_CATCH,LITERAL_DO,LITERAL_FOR,LITERAL_IF,LITERAL_NEW,LITERAL_SWITCH,LITERAL_SYNCHRONIZED,LITERAL_WHILE,METHOD_CALL,METHOD_DEF,RESOURCE_SPECIFICATION,SUPER_CTOR_CALL,LAMBDA" />
|
||||||
|
</module>
|
||||||
|
<module name="ParenPad">
|
||||||
|
<property name="option" value="nospace" />
|
||||||
|
<property name="tokens" value="DOT,EXPR,QUESTION" />
|
||||||
|
</module>
|
||||||
|
<module name="SeparatorWrap">
|
||||||
|
<property name="option" value="eol" />
|
||||||
|
<property name="tokens" value="COMMA,SEMI,ELLIPSIS,ARRAY_DECLARATOR,RBRACK,METHOD_REF" />
|
||||||
|
</module>
|
||||||
|
<module name="SeparatorWrap">
|
||||||
|
<property name="option" value="nl" />
|
||||||
|
<property name="tokens" value="DOT,AT" />
|
||||||
|
</module>
|
||||||
|
<module name="SingleSpaceSeparator" />
|
||||||
|
<module name="TypecastParenPad" />
|
||||||
|
<module name="WhitespaceAfter">
|
||||||
|
<property name="tokens" value="COMMA" />
|
||||||
|
</module>
|
||||||
|
<module name="WhitespaceAround">
|
||||||
|
<property name="allowEmptyConstructors" value="true" />
|
||||||
|
<property name="ignoreEnhancedForColon" value="false" />
|
||||||
|
<property name="tokens" value="ASSIGN,BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,COLON,DIV,DIV_ASSIGN,DO_WHILE,EQUAL,GE,GT,LAMBDA,LAND,LCURLY,LE,LITERAL_RETURN,LOR,LT,MINUS,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS,PLUS_ASSIGN,QUESTION,RCURLY,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,LITERAL_ASSERT,TYPE_EXTENSION_AND" />
|
||||||
|
</module>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<module name="FileTabCharacter" />
|
||||||
|
<module name="NewlineAtEndOfFile" />
|
||||||
|
<module name="RegexpSingleline">
|
||||||
|
<property name="format" value="\s+$"/>
|
||||||
|
<property name="message" value="Trailing whitespace"/>
|
||||||
|
</module>
|
||||||
|
</module>
|
12
config/checkstyle/suppressions.xml
Normal file
12
config/checkstyle/suppressions.xml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE suppressions PUBLIC
|
||||||
|
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
|
||||||
|
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
|
||||||
|
<suppressions>
|
||||||
|
<!-- All the config options and method fields. -->
|
||||||
|
<suppress checks="StaticVariableName" files=".*[\\/]ComputerCraft.java" />
|
||||||
|
<suppress checks="StaticVariableName" files=".*[\\/]ComputerCraftAPI.java" />
|
||||||
|
|
||||||
|
<!-- Do not check for missing package Javadoc. -->
|
||||||
|
<suppress checks="JavadocStyle" files=".*[\\/]package-info.java" />
|
||||||
|
</suppressions>
|
3
config/license/api.txt
Normal file
3
config/license/api.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
|
Copyright Daniel Ratcliffe, 2011-${year}. 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.
|
3
config/license/main.txt
Normal file
3
config/license/main.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
|
Copyright Daniel Ratcliffe, 2011-${year}. Do not distribute without permission.
|
||||||
|
Send enquiries to dratcliffe@gmail.com
|
@@ -1,5 +1,5 @@
|
|||||||
# Mod properties
|
# Mod properties
|
||||||
mod_version=1.83.1
|
mod_version=1.86.2
|
||||||
|
|
||||||
# Minecraft properties
|
# Minecraft properties
|
||||||
mc_version=1.12.2
|
mc_version=1.12.2
|
||||||
|
28
illuaminate.sexp
Normal file
28
illuaminate.sexp
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
; -*- mode: Lisp;-*-
|
||||||
|
|
||||||
|
(sources
|
||||||
|
/src/main/resources/assets/computercraft/lua/bios.lua
|
||||||
|
/src/main/resources/assets/computercraft/lua/rom/
|
||||||
|
/src/test/resources/test-rom)
|
||||||
|
|
||||||
|
(at /
|
||||||
|
(linters
|
||||||
|
;; It'd be nice to avoid this, but right now there's a lot of instances of
|
||||||
|
;; it.
|
||||||
|
-var:set-loop
|
||||||
|
|
||||||
|
;; It's useful to name arguments for documentation, so we allow this. It'd
|
||||||
|
;; be good to find a compromise in the future, but this works for now.
|
||||||
|
-var:unused-arg))
|
||||||
|
|
||||||
|
;; We disable the unused global linter in bios.lua and the APIs. In the future
|
||||||
|
;; hopefully we'll get illuaminate to handle this.
|
||||||
|
(at
|
||||||
|
(/src/main/resources/assets/computercraft/lua/bios.lua
|
||||||
|
/src/main/resources/assets/computercraft/lua/rom/apis/)
|
||||||
|
(linters -var:unused-global)
|
||||||
|
(lint
|
||||||
|
(allow-toplevel-global true)))
|
||||||
|
|
||||||
|
;; These warnings are broken right now
|
||||||
|
(at (bios.lua worm.lua) (linters -control:unreachable))
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft;
|
package dan200.computercraft;
|
||||||
|
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft;
|
package dan200.computercraft;
|
||||||
|
|
||||||
import dan200.computercraft.api.filesystem.IMount;
|
import dan200.computercraft.api.filesystem.IMount;
|
||||||
@@ -72,9 +71,7 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
import net.minecraftforge.fml.common.*;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
|
||||||
import net.minecraftforge.fml.common.SidedProxy;
|
|
||||||
import net.minecraftforge.fml.common.event.*;
|
import net.minecraftforge.fml.common.event.*;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@@ -83,9 +80,7 @@ import java.io.*;
|
|||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipFile;
|
import java.util.zip.ZipFile;
|
||||||
@@ -394,6 +389,27 @@ public class ComputerCraft
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void loadFromFile( List<IMount> mounts, File file, String path, boolean allowMissing )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if( file.isFile() )
|
||||||
|
{
|
||||||
|
mounts.add( new JarMount( file, path ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
File subResource = new File( file, path );
|
||||||
|
if( subResource.exists() ) mounts.add( new FileMount( subResource, 0 ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( IOException | RuntimeException e )
|
||||||
|
{
|
||||||
|
if( allowMissing && e instanceof FileNotFoundException ) return;
|
||||||
|
ComputerCraft.log.error( "Could not load mount '" + path + " 'from '" + file.getName() + "'", e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static IMount createResourceMount( Class<?> modClass, String domain, String subPath )
|
public static IMount createResourceMount( Class<?> modClass, String domain, String subPath )
|
||||||
{
|
{
|
||||||
@@ -413,18 +429,26 @@ public class ComputerCraft
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mount from mod jar
|
// Mount from mod jars, preferring the specified one.
|
||||||
File modJar = getContainingJar( modClass );
|
File modJar = getContainingJar( modClass );
|
||||||
|
Set<File> otherMods = new HashSet<>();
|
||||||
|
for( ModContainer container : Loader.instance().getActiveModList() )
|
||||||
|
{
|
||||||
|
File modFile = container.getSource();
|
||||||
|
if( modFile != null && !modFile.equals( modJar ) && modFile.exists() )
|
||||||
|
{
|
||||||
|
otherMods.add( container.getSource() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for( File file : otherMods )
|
||||||
|
{
|
||||||
|
loadFromFile( mounts, file, subPath, true );
|
||||||
|
}
|
||||||
|
|
||||||
if( modJar != null )
|
if( modJar != null )
|
||||||
{
|
{
|
||||||
try
|
loadFromFile( mounts, modJar, subPath, false );
|
||||||
{
|
|
||||||
mounts.add( new JarMount( modJar, subPath ) );
|
|
||||||
}
|
|
||||||
catch( IOException | RuntimeException e )
|
|
||||||
{
|
|
||||||
ComputerCraft.log.error( "Could not load mount from mod jar", e );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mount from resource packs
|
// Mount from resource packs
|
||||||
@@ -434,28 +458,8 @@ public class ComputerCraft
|
|||||||
String[] resourcePacks = resourcePackDir.list();
|
String[] resourcePacks = resourcePackDir.list();
|
||||||
for( String resourcePackName : resourcePacks )
|
for( String resourcePackName : resourcePacks )
|
||||||
{
|
{
|
||||||
try
|
File resourcePack = new File( resourcePackDir, resourcePackName );
|
||||||
{
|
loadFromFile( mounts, resourcePack, subPath, true );
|
||||||
File resourcePack = new File( resourcePackDir, resourcePackName );
|
|
||||||
if( !resourcePack.isDirectory() )
|
|
||||||
{
|
|
||||||
// Mount a resource pack from a jar
|
|
||||||
mounts.add( new JarMount( resourcePack, subPath ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Mount a resource pack from a folder
|
|
||||||
File subResource = new File( resourcePack, subPath );
|
|
||||||
if( subResource.exists() ) mounts.add( new FileMount( subResource, 0 ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch( FileNotFoundException ignored )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
catch( IOException | RuntimeException e )
|
|
||||||
{
|
|
||||||
ComputerCraft.log.error( "Could not load resource pack '" + resourcePackName + "'", e );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. This API may be redistributed unmodified and in full only.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api;
|
package dan200.computercraft.api;
|
||||||
|
|
||||||
import dan200.computercraft.api.turtle.ITurtleUpgrade;
|
import dan200.computercraft.api.turtle.ITurtleUpgrade;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api;
|
package dan200.computercraft.api;
|
||||||
|
|
||||||
import dan200.computercraft.api.filesystem.IMount;
|
import dan200.computercraft.api.filesystem.IMount;
|
||||||
@@ -32,8 +31,9 @@ import java.lang.reflect.Method;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The static entry point to the ComputerCraft API.
|
* The static entry point to the ComputerCraft API.
|
||||||
* Members in this class must be called after mod_ComputerCraft has been initialised,
|
*
|
||||||
* but may be called before it is fully loaded.
|
* Members in this class must be called after mod_ComputerCraft has been initialised, but may be called before it is
|
||||||
|
* fully loaded.
|
||||||
*/
|
*/
|
||||||
public final class ComputerCraftAPI
|
public final class ComputerCraftAPI
|
||||||
{
|
{
|
||||||
@@ -269,7 +269,7 @@ public final class ComputerCraftAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a media provider to provide {@link IMedia} implementations for Items
|
* Registers a media provider to provide {@link IMedia} implementations for Items.
|
||||||
*
|
*
|
||||||
* @param provider The media provider to register.
|
* @param provider The media provider to register.
|
||||||
* @see IMediaProvider
|
* @see IMediaProvider
|
||||||
@@ -370,7 +370,7 @@ public final class ComputerCraftAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new wired node for a given wired element
|
* Construct a new wired node for a given wired element.
|
||||||
*
|
*
|
||||||
* @param element The element to construct it for
|
* @param element The element to construct it for
|
||||||
* @return The element's node
|
* @return The element's node
|
||||||
@@ -398,7 +398,7 @@ public final class ComputerCraftAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the wired network element for a block in world
|
* Get the wired network element for a block in world.
|
||||||
*
|
*
|
||||||
* @param world The world the block exists in
|
* @param world The world the block exists in
|
||||||
* @param pos The position the block exists in
|
* @param pos The position the block exists in
|
||||||
@@ -438,45 +438,45 @@ public final class ComputerCraftAPI
|
|||||||
computerCraft_getVersion = findCCMethod( "getVersion", new Class<?>[] {
|
computerCraft_getVersion = findCCMethod( "getVersion", new Class<?>[] {
|
||||||
} );
|
} );
|
||||||
computerCraft_createUniqueNumberedSaveDir = findCCMethod( "createUniqueNumberedSaveDir", new Class<?>[] {
|
computerCraft_createUniqueNumberedSaveDir = findCCMethod( "createUniqueNumberedSaveDir", new Class<?>[] {
|
||||||
World.class, String.class
|
World.class, String.class,
|
||||||
} );
|
} );
|
||||||
computerCraft_createSaveDirMount = findCCMethod( "createSaveDirMount", new Class<?>[] {
|
computerCraft_createSaveDirMount = findCCMethod( "createSaveDirMount", new Class<?>[] {
|
||||||
World.class, String.class, Long.TYPE
|
World.class, String.class, Long.TYPE,
|
||||||
} );
|
} );
|
||||||
computerCraft_createResourceMount = findCCMethod( "createResourceMount", new Class<?>[] {
|
computerCraft_createResourceMount = findCCMethod( "createResourceMount", new Class<?>[] {
|
||||||
Class.class, String.class, String.class
|
Class.class, String.class, String.class,
|
||||||
} );
|
} );
|
||||||
computerCraft_registerPeripheralProvider = findCCMethod( "registerPeripheralProvider", new Class<?>[] {
|
computerCraft_registerPeripheralProvider = findCCMethod( "registerPeripheralProvider", new Class<?>[] {
|
||||||
IPeripheralProvider.class
|
IPeripheralProvider.class,
|
||||||
} );
|
} );
|
||||||
computerCraft_registerTurtleUpgrade = findCCMethod( "registerTurtleUpgrade", new Class<?>[] {
|
computerCraft_registerTurtleUpgrade = findCCMethod( "registerTurtleUpgrade", new Class<?>[] {
|
||||||
ITurtleUpgrade.class
|
ITurtleUpgrade.class,
|
||||||
} );
|
} );
|
||||||
computerCraft_registerBundledRedstoneProvider = findCCMethod( "registerBundledRedstoneProvider", new Class<?>[] {
|
computerCraft_registerBundledRedstoneProvider = findCCMethod( "registerBundledRedstoneProvider", new Class<?>[] {
|
||||||
IBundledRedstoneProvider.class
|
IBundledRedstoneProvider.class,
|
||||||
} );
|
} );
|
||||||
computerCraft_getDefaultBundledRedstoneOutput = findCCMethod( "getDefaultBundledRedstoneOutput", new Class<?>[] {
|
computerCraft_getDefaultBundledRedstoneOutput = findCCMethod( "getDefaultBundledRedstoneOutput", new Class<?>[] {
|
||||||
World.class, BlockPos.class, EnumFacing.class
|
World.class, BlockPos.class, EnumFacing.class,
|
||||||
} );
|
} );
|
||||||
computerCraft_registerMediaProvider = findCCMethod( "registerMediaProvider", new Class<?>[] {
|
computerCraft_registerMediaProvider = findCCMethod( "registerMediaProvider", new Class<?>[] {
|
||||||
IMediaProvider.class
|
IMediaProvider.class,
|
||||||
} );
|
} );
|
||||||
computerCraft_registerPermissionProvider = findCCMethod( "registerPermissionProvider", new Class<?>[] {
|
computerCraft_registerPermissionProvider = findCCMethod( "registerPermissionProvider", new Class<?>[] {
|
||||||
ITurtlePermissionProvider.class
|
ITurtlePermissionProvider.class,
|
||||||
} );
|
} );
|
||||||
computerCraft_registerPocketUpgrade = findCCMethod( "registerPocketUpgrade", new Class<?>[] {
|
computerCraft_registerPocketUpgrade = findCCMethod( "registerPocketUpgrade", new Class<?>[] {
|
||||||
IPocketUpgrade.class
|
IPocketUpgrade.class,
|
||||||
} );
|
} );
|
||||||
computerCraft_getWirelessNetwork = findCCMethod( "getWirelessNetwork", new Class<?>[] {
|
computerCraft_getWirelessNetwork = findCCMethod( "getWirelessNetwork", new Class<?>[] {
|
||||||
} );
|
} );
|
||||||
computerCraft_registerAPIFactory = findCCMethod( "registerAPIFactory", new Class<?>[] {
|
computerCraft_registerAPIFactory = findCCMethod( "registerAPIFactory", new Class<?>[] {
|
||||||
ILuaAPIFactory.class
|
ILuaAPIFactory.class,
|
||||||
} );
|
} );
|
||||||
computerCraft_createWiredNodeForElement = findCCMethod( "createWiredNodeForElement", new Class<?>[] {
|
computerCraft_createWiredNodeForElement = findCCMethod( "createWiredNodeForElement", new Class<?>[] {
|
||||||
IWiredElement.class
|
IWiredElement.class,
|
||||||
} );
|
} );
|
||||||
computerCraft_getWiredElementAt = findCCMethod( "getWiredElementAt", new Class<?>[] {
|
computerCraft_getWiredElementAt = findCCMethod( "getWiredElementAt", new Class<?>[] {
|
||||||
IBlockAccess.class, BlockPos.class, EnumFacing.class
|
IBlockAccess.class, BlockPos.class, EnumFacing.class,
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
catch( Exception e )
|
catch( Exception e )
|
||||||
|
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.filesystem;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An {@link IOException} which occurred on a specific file.
|
||||||
|
*
|
||||||
|
* This may be thrown from a {@link IMount} or {@link IWritableMount} to give more information about a failure.
|
||||||
|
*/
|
||||||
|
public class FileOperationException extends IOException
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = -8809108200853029849L;
|
||||||
|
|
||||||
|
private final String filename;
|
||||||
|
|
||||||
|
public FileOperationException( @Nullable String filename, @Nonnull String message )
|
||||||
|
{
|
||||||
|
super( Objects.requireNonNull( message, "message cannot be null" ) );
|
||||||
|
this.filename = filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileOperationException( String message )
|
||||||
|
{
|
||||||
|
super( Objects.requireNonNull( message, "message cannot be null" ) );
|
||||||
|
this.filename = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public String getFilename()
|
||||||
|
{
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
|
}
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.filesystem;
|
package dan200.computercraft.api.filesystem;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.filesystem;
|
package dan200.computercraft.api.filesystem;
|
||||||
|
|
||||||
import dan200.computercraft.api.ComputerCraftAPI;
|
import dan200.computercraft.api.ComputerCraftAPI;
|
||||||
@@ -19,7 +18,7 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a read only part of a virtual filesystem that can be mounted onto a computer using
|
* Represents a read only part of a virtual filesystem that can be mounted onto a computer using
|
||||||
* {@link IComputerAccess#mount(String, IMount)}
|
* {@link IComputerAccess#mount(String, IMount)}.
|
||||||
*
|
*
|
||||||
* Ready made implementations of this interface can be created using
|
* Ready made implementations of this interface can be created using
|
||||||
* {@link ComputerCraftAPI#createSaveDirMount(World, String, long)} or
|
* {@link ComputerCraftAPI#createSaveDirMount(World, String, long)} or
|
||||||
@@ -60,7 +59,7 @@ public interface IMount
|
|||||||
void list( @Nonnull String path, @Nonnull List<String> contents ) throws IOException;
|
void list( @Nonnull String path, @Nonnull List<String> contents ) throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the size of a file with a given path, in bytes
|
* Returns the size of a file with a given path, in bytes.
|
||||||
*
|
*
|
||||||
* @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram".
|
* @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram".
|
||||||
* @return The size of the file, in bytes.
|
* @return The size of the file, in bytes.
|
||||||
@@ -90,7 +89,6 @@ public interface IMount
|
|||||||
* @throws IOException If the file does not exist, or could not be opened.
|
* @throws IOException If the file does not exist, or could not be opened.
|
||||||
*/
|
*/
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@SuppressWarnings( "deprecation" )
|
|
||||||
default ReadableByteChannel openChannelForRead( @Nonnull String path ) throws IOException
|
default ReadableByteChannel openChannelForRead( @Nonnull String path ) throws IOException
|
||||||
{
|
{
|
||||||
return Channels.newChannel( openForRead( path ) );
|
return Channels.newChannel( openForRead( path ) );
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.filesystem;
|
package dan200.computercraft.api.filesystem;
|
||||||
|
|
||||||
import dan200.computercraft.api.ComputerCraftAPI;
|
import dan200.computercraft.api.ComputerCraftAPI;
|
||||||
@@ -67,7 +66,6 @@ public interface IWritableMount extends IMount
|
|||||||
* @throws IOException If the file could not be opened for writing.
|
* @throws IOException If the file could not be opened for writing.
|
||||||
*/
|
*/
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@SuppressWarnings( "deprecation" )
|
|
||||||
default WritableByteChannel openChannelForWrite( @Nonnull String path ) throws IOException
|
default WritableByteChannel openChannelForWrite( @Nonnull String path ) throws IOException
|
||||||
{
|
{
|
||||||
return Channels.newChannel( openForWrite( path ) );
|
return Channels.newChannel( openForWrite( path ) );
|
||||||
@@ -94,7 +92,6 @@ public interface IWritableMount extends IMount
|
|||||||
* @throws IOException If the file could not be opened for writing.
|
* @throws IOException If the file could not be opened for writing.
|
||||||
*/
|
*/
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@SuppressWarnings( "deprecation" )
|
|
||||||
default WritableByteChannel openChannelForAppend( @Nonnull String path ) throws IOException
|
default WritableByteChannel openChannelForAppend( @Nonnull String path ) throws IOException
|
||||||
{
|
{
|
||||||
return Channels.newChannel( openForAppend( path ) );
|
return Channels.newChannel( openForAppend( path ) );
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@API( owner = "ComputerCraft", provides = "ComputerCraft|API|FileSystem", apiVersion = "${version}" )
|
@API( owner = "ComputerCraft", provides = "ComputerCraft|API|FileSystem", apiVersion = "${version}" )
|
||||||
package dan200.computercraft.api.filesystem;
|
package dan200.computercraft.api.filesystem;
|
||||||
|
|
||||||
|
334
src/main/java/dan200/computercraft/api/lua/ArgumentHelper.java
Normal file
334
src/main/java/dan200/computercraft/api/lua/ArgumentHelper.java
Normal file
@@ -0,0 +1,334 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.lua;
|
||||||
|
|
||||||
|
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||||
|
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides methods for extracting values and validating Lua arguments, such as those provided to
|
||||||
|
* {@link ILuaObject#callMethod(ILuaContext, int, Object[])} or
|
||||||
|
* {@link IPeripheral#callMethod(IComputerAccess, ILuaContext, int, Object[])}.
|
||||||
|
*
|
||||||
|
* This provides two sets of functions: the {@code get*} methods, which require an argument to be valid, and
|
||||||
|
* {@code opt*}, which accept a default value and return that if the argument was not present or was {@code null}.
|
||||||
|
* If the argument is of the wrong type, a suitable error message will be thrown, with a similar format to Lua's own
|
||||||
|
* error messages.
|
||||||
|
*
|
||||||
|
* <h2>Example usage:</h2>
|
||||||
|
* <pre>
|
||||||
|
* {@code
|
||||||
|
* int slot = getInt( args, 0 );
|
||||||
|
* int amount = optInt( args, 1, 64 );
|
||||||
|
* }
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public final class ArgumentHelper
|
||||||
|
{
|
||||||
|
private ArgumentHelper()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a string representation of the given value's type.
|
||||||
|
*
|
||||||
|
* @param value The value whose type we are trying to compute.
|
||||||
|
* @return A string representation of the given value's type, in a similar format to that provided by Lua's
|
||||||
|
* {@code type} function.
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
public static String getType( @Nullable Object value )
|
||||||
|
{
|
||||||
|
if( value == null ) return "nil";
|
||||||
|
if( value instanceof String ) return "string";
|
||||||
|
if( value instanceof Boolean ) return "boolean";
|
||||||
|
if( value instanceof Number ) return "number";
|
||||||
|
if( value instanceof Map ) return "table";
|
||||||
|
return "userdata";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a "bad argument" exception, from an expected type and the actual value provided.
|
||||||
|
*
|
||||||
|
* @param index The argument number, starting from 0.
|
||||||
|
* @param expected The expected type for this argument.
|
||||||
|
* @param actual The actual value provided for this argument.
|
||||||
|
* @return The constructed exception, which should be thrown immediately.
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
public static LuaException badArgumentOf( int index, @Nonnull String expected, @Nullable Object actual )
|
||||||
|
{
|
||||||
|
return badArgument( index, expected, getType( actual ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a "bad argument" exception, from an expected and actual type.
|
||||||
|
*
|
||||||
|
* @param index The argument number, starting from 0.
|
||||||
|
* @param expected The expected type for this argument.
|
||||||
|
* @param actual The provided type for this argument.
|
||||||
|
* @return The constructed exception, which should be thrown immediately.
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
public static LuaException badArgument( int index, @Nonnull String expected, @Nonnull String actual )
|
||||||
|
{
|
||||||
|
return new LuaException( "bad argument #" + (index + 1) + " (" + expected + " expected, got " + actual + ")" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an argument as a double.
|
||||||
|
*
|
||||||
|
* @param args The arguments to extract from.
|
||||||
|
* @param index The index into the argument array to read from.
|
||||||
|
* @return The argument's value.
|
||||||
|
* @throws LuaException If the value is not a number.
|
||||||
|
* @see #getFiniteDouble(Object[], int) if you require this to be finite (i.e. not infinite or NaN).
|
||||||
|
*/
|
||||||
|
public static double getDouble( @Nonnull Object[] args, int index ) throws LuaException
|
||||||
|
{
|
||||||
|
if( index >= args.length ) throw badArgument( index, "number", "nil" );
|
||||||
|
Object value = args[index];
|
||||||
|
if( !(value instanceof Number) ) throw badArgumentOf( index, "number", value );
|
||||||
|
return ((Number) value).doubleValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an argument as an integer.
|
||||||
|
*
|
||||||
|
* @param args The arguments to extract from.
|
||||||
|
* @param index The index into the argument array to read from.
|
||||||
|
* @return The argument's value.
|
||||||
|
* @throws LuaException If the value is not an integer.
|
||||||
|
*/
|
||||||
|
public static int getInt( @Nonnull Object[] args, int index ) throws LuaException
|
||||||
|
{
|
||||||
|
return (int) getLong( args, index );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an argument as a long.
|
||||||
|
*
|
||||||
|
* @param args The arguments to extract from.
|
||||||
|
* @param index The index into the argument array to read from.
|
||||||
|
* @return The argument's value.
|
||||||
|
* @throws LuaException If the value is not a long.
|
||||||
|
*/
|
||||||
|
public static long getLong( @Nonnull Object[] args, int index ) throws LuaException
|
||||||
|
{
|
||||||
|
if( index >= args.length ) throw badArgument( index, "number", "nil" );
|
||||||
|
Object value = args[index];
|
||||||
|
if( !(value instanceof Number) ) throw badArgumentOf( index, "number", value );
|
||||||
|
return checkFinite( index, (Number) value ).longValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an argument as a finite number (not infinite or NaN).
|
||||||
|
*
|
||||||
|
* @param args The arguments to extract from.
|
||||||
|
* @param index The index into the argument array to read from.
|
||||||
|
* @return The argument's value.
|
||||||
|
* @throws LuaException If the value is not finite.
|
||||||
|
*/
|
||||||
|
public static double getFiniteDouble( @Nonnull Object[] args, int index ) throws LuaException
|
||||||
|
{
|
||||||
|
return checkFinite( index, getDouble( args, index ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an argument as a boolean.
|
||||||
|
*
|
||||||
|
* @param args The arguments to extract from.
|
||||||
|
* @param index The index into the argument array to read from.
|
||||||
|
* @return The argument's value.
|
||||||
|
* @throws LuaException If the value is not a boolean.
|
||||||
|
*/
|
||||||
|
public static boolean getBoolean( @Nonnull Object[] args, int index ) throws LuaException
|
||||||
|
{
|
||||||
|
if( index >= args.length ) throw badArgument( index, "boolean", "nil" );
|
||||||
|
Object value = args[index];
|
||||||
|
if( !(value instanceof Boolean) ) throw badArgumentOf( index, "boolean", value );
|
||||||
|
return (Boolean) value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an argument as a string.
|
||||||
|
*
|
||||||
|
* @param args The arguments to extract from.
|
||||||
|
* @param index The index into the argument array to read from.
|
||||||
|
* @return The argument's value.
|
||||||
|
* @throws LuaException If the value is not a string.
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
public static String getString( @Nonnull Object[] args, int index ) throws LuaException
|
||||||
|
{
|
||||||
|
if( index >= args.length ) throw badArgument( index, "string", "nil" );
|
||||||
|
Object value = args[index];
|
||||||
|
if( !(value instanceof String) ) throw badArgumentOf( index, "string", value );
|
||||||
|
return (String) value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an argument as a table.
|
||||||
|
*
|
||||||
|
* @param args The arguments to extract from.
|
||||||
|
* @param index The index into the argument array to read from.
|
||||||
|
* @return The argument's value.
|
||||||
|
* @throws LuaException If the value is not a table.
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
public static Map<?, ?> getTable( @Nonnull Object[] args, int index ) throws LuaException
|
||||||
|
{
|
||||||
|
if( index >= args.length ) throw badArgument( index, "table", "nil" );
|
||||||
|
Object value = args[index];
|
||||||
|
if( !(value instanceof Map) ) throw badArgumentOf( index, "table", value );
|
||||||
|
return (Map<?, ?>) value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an argument as a double.
|
||||||
|
*
|
||||||
|
* @param args The arguments to extract from.
|
||||||
|
* @param index The index into the argument array to read from.
|
||||||
|
* @param def The default value, if this argument is not given.
|
||||||
|
* @return The argument's value, or {@code def} if none was provided.
|
||||||
|
* @throws LuaException If the value is not a number.
|
||||||
|
*/
|
||||||
|
public static double optDouble( @Nonnull Object[] args, int index, double def ) throws LuaException
|
||||||
|
{
|
||||||
|
Object value = index < args.length ? args[index] : null;
|
||||||
|
if( value == null ) return def;
|
||||||
|
if( !(value instanceof Number) ) throw badArgumentOf( index, "number", value );
|
||||||
|
return ((Number) value).doubleValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an argument as an int.
|
||||||
|
*
|
||||||
|
* @param args The arguments to extract from.
|
||||||
|
* @param index The index into the argument array to read from.
|
||||||
|
* @param def The default value, if this argument is not given.
|
||||||
|
* @return The argument's value, or {@code def} if none was provided.
|
||||||
|
* @throws LuaException If the value is not a number.
|
||||||
|
*/
|
||||||
|
public static int optInt( @Nonnull Object[] args, int index, int def ) throws LuaException
|
||||||
|
{
|
||||||
|
return (int) optLong( args, index, def );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an argument as a long.
|
||||||
|
*
|
||||||
|
* @param args The arguments to extract from.
|
||||||
|
* @param index The index into the argument array to read from.
|
||||||
|
* @param def The default value, if this argument is not given.
|
||||||
|
* @return The argument's value, or {@code def} if none was provided.
|
||||||
|
* @throws LuaException If the value is not a number.
|
||||||
|
*/
|
||||||
|
public static long optLong( @Nonnull Object[] args, int index, long def ) throws LuaException
|
||||||
|
{
|
||||||
|
Object value = index < args.length ? args[index] : null;
|
||||||
|
if( value == null ) return def;
|
||||||
|
if( !(value instanceof Number) ) throw badArgumentOf( index, "number", value );
|
||||||
|
return checkFinite( index, (Number) value ).longValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an argument as a finite number (not infinite or NaN).
|
||||||
|
*
|
||||||
|
* @param args The arguments to extract from.
|
||||||
|
* @param index The index into the argument array to read from.
|
||||||
|
* @param def The default value, if this argument is not given.
|
||||||
|
* @return The argument's value, or {@code def} if none was provided.
|
||||||
|
* @throws LuaException If the value is not finite.
|
||||||
|
*/
|
||||||
|
public static double optFiniteDouble( @Nonnull Object[] args, int index, double def ) throws LuaException
|
||||||
|
{
|
||||||
|
return checkFinite( index, optDouble( args, index, def ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an argument as a boolean.
|
||||||
|
*
|
||||||
|
* @param args The arguments to extract from.
|
||||||
|
* @param index The index into the argument array to read from.
|
||||||
|
* @param def The default value, if this argument is not given.
|
||||||
|
* @return The argument's value, or {@code def} if none was provided.
|
||||||
|
* @throws LuaException If the value is not a boolean.
|
||||||
|
*/
|
||||||
|
public static boolean optBoolean( @Nonnull Object[] args, int index, boolean def ) throws LuaException
|
||||||
|
{
|
||||||
|
Object value = index < args.length ? args[index] : null;
|
||||||
|
if( value == null ) return def;
|
||||||
|
if( !(value instanceof Boolean) ) throw badArgumentOf( index, "boolean", value );
|
||||||
|
return (Boolean) value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an argument as a string.
|
||||||
|
*
|
||||||
|
* @param args The arguments to extract from.
|
||||||
|
* @param index The index into the argument array to read from.
|
||||||
|
* @param def The default value, if this argument is not given.
|
||||||
|
* @return The argument's value, or {@code def} if none was provided.
|
||||||
|
* @throws LuaException If the value is not a string.
|
||||||
|
*/
|
||||||
|
public static String optString( @Nonnull Object[] args, int index, String def ) throws LuaException
|
||||||
|
{
|
||||||
|
Object value = index < args.length ? args[index] : null;
|
||||||
|
if( value == null ) return def;
|
||||||
|
if( !(value instanceof String) ) throw badArgumentOf( index, "string", value );
|
||||||
|
return (String) value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an argument as a table.
|
||||||
|
*
|
||||||
|
* @param args The arguments to extract from.
|
||||||
|
* @param index The index into the argument array to read from.
|
||||||
|
* @param def The default value, if this argument is not given.
|
||||||
|
* @return The argument's value, or {@code def} if none was provided.
|
||||||
|
* @throws LuaException If the value is not a table.
|
||||||
|
*/
|
||||||
|
public static Map<?, ?> optTable( @Nonnull Object[] args, int index, Map<Object, Object> def ) throws LuaException
|
||||||
|
{
|
||||||
|
Object value = index < args.length ? args[index] : null;
|
||||||
|
if( value == null ) return def;
|
||||||
|
if( !(value instanceof Map) ) throw badArgumentOf( index, "table", value );
|
||||||
|
return (Map<?, ?>) value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Number checkFinite( int index, Number value ) throws LuaException
|
||||||
|
{
|
||||||
|
checkFinite( index, value.doubleValue() );
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double checkFinite( int index, double value ) throws LuaException
|
||||||
|
{
|
||||||
|
if( !Double.isFinite( value ) ) throw badArgument( index, "number", getNumericType( value ) );
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a more detailed representation of this number's type. If this is finite, it will just return "number",
|
||||||
|
* otherwise it returns whether it is infinite or NaN.
|
||||||
|
*
|
||||||
|
* @param value The value to extract the type for.
|
||||||
|
* @return This value's numeric type.
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
public static String getNumericType( double value )
|
||||||
|
{
|
||||||
|
if( Double.isNaN( value ) ) return "nan";
|
||||||
|
if( value == Double.POSITIVE_INFINITY ) return "inf";
|
||||||
|
if( value == Double.NEGATIVE_INFINITY ) return "-inf";
|
||||||
|
return "number";
|
||||||
|
}
|
||||||
|
}
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.lua;
|
package dan200.computercraft.api.lua;
|
||||||
|
|
||||||
import dan200.computercraft.api.filesystem.IFileSystem;
|
import dan200.computercraft.api.filesystem.IFileSystem;
|
||||||
@@ -26,7 +25,7 @@ public interface IComputerSystem extends IComputerAccess
|
|||||||
IFileSystem getFileSystem();
|
IFileSystem getFileSystem();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the label for this computer
|
* Get the label for this computer.
|
||||||
*
|
*
|
||||||
* @return This computer's label, or {@code null} if it is not set.
|
* @return This computer's label, or {@code null} if it is not set.
|
||||||
*/
|
*/
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.lua;
|
package dan200.computercraft.api.lua;
|
||||||
|
|
||||||
import dan200.computercraft.api.ComputerCraftAPI;
|
import dan200.computercraft.api.ComputerCraftAPI;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.lua;
|
package dan200.computercraft.api.lua;
|
||||||
|
|
||||||
import dan200.computercraft.api.ComputerCraftAPI;
|
import dan200.computercraft.api.ComputerCraftAPI;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.lua;
|
package dan200.computercraft.api.lua;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.lua;
|
package dan200.computercraft.api.lua;
|
||||||
|
|
||||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.lua;
|
package dan200.computercraft.api.lua;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.lua;
|
package dan200.computercraft.api.lua;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@API( owner = "ComputerCraft", provides = "ComputerCraft|API|Lua", apiVersion = "${version}" )
|
@API( owner = "ComputerCraft", provides = "ComputerCraft|API|Lua", apiVersion = "${version}" )
|
||||||
package dan200.computercraft.api.lua;
|
package dan200.computercraft.api.lua;
|
||||||
|
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.media;
|
package dan200.computercraft.api.media;
|
||||||
|
|
||||||
import dan200.computercraft.api.filesystem.IMount;
|
import dan200.computercraft.api.filesystem.IMount;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.media;
|
package dan200.computercraft.api.media;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@API( owner = "ComputerCraft", provides = "ComputerCraft|API|Media", apiVersion = "${version}" )
|
@API( owner = "ComputerCraft", provides = "ComputerCraft|API|Media", apiVersion = "${version}" )
|
||||||
package dan200.computercraft.api.media;
|
package dan200.computercraft.api.media;
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
package dan200.computercraft.api.network;
|
package dan200.computercraft.api.network;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
package dan200.computercraft.api.network;
|
package dan200.computercraft.api.network;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
package dan200.computercraft.api.network;
|
package dan200.computercraft.api.network;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
package dan200.computercraft.api.network;
|
package dan200.computercraft.api.network;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@API( owner = "ComputerCraft", provides = "ComputerCraft|API|Network", apiVersion = "${version}" )
|
@API( owner = "ComputerCraft", provides = "ComputerCraft|API|Network", apiVersion = "${version}" )
|
||||||
package dan200.computercraft.api.network;
|
package dan200.computercraft.api.network;
|
||||||
|
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.network.wired;
|
package dan200.computercraft.api.network.wired;
|
||||||
|
|
||||||
import dan200.computercraft.api.ComputerCraftAPI;
|
import dan200.computercraft.api.ComputerCraftAPI;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.network.wired;
|
package dan200.computercraft.api.network.wired;
|
||||||
|
|
||||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.network.wired;
|
package dan200.computercraft.api.network.wired;
|
||||||
|
|
||||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.network.wired;
|
package dan200.computercraft.api.network.wired;
|
||||||
|
|
||||||
import dan200.computercraft.api.network.IPacketNetwork;
|
import dan200.computercraft.api.network.IPacketNetwork;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.network.wired;
|
package dan200.computercraft.api.network.wired;
|
||||||
|
|
||||||
import dan200.computercraft.api.network.IPacketSender;
|
import dan200.computercraft.api.network.IPacketSender;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@API( owner = "ComputerCraft", provides = "ComputerCraft|API|Network|Wired", apiVersion = "${version}" )
|
@API( owner = "ComputerCraft", provides = "ComputerCraft|API|Network|Wired", apiVersion = "${version}" )
|
||||||
package dan200.computercraft.api.network.wired;
|
package dan200.computercraft.api.network.wired;
|
||||||
|
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@API( owner = "ComputerCraft", provides = "ComputerCraft|API", apiVersion = "${version}" )
|
@API( owner = "ComputerCraft", provides = "ComputerCraft|API", apiVersion = "${version}" )
|
||||||
package dan200.computercraft.api;
|
package dan200.computercraft.api;
|
||||||
|
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.peripheral;
|
package dan200.computercraft.api.peripheral;
|
||||||
|
|
||||||
import dan200.computercraft.api.ComputerCraftAPI;
|
import dan200.computercraft.api.ComputerCraftAPI;
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.peripheral;
|
package dan200.computercraft.api.peripheral;
|
||||||
|
|
||||||
|
import dan200.computercraft.api.lua.ArgumentHelper;
|
||||||
import dan200.computercraft.api.lua.ILuaContext;
|
import dan200.computercraft.api.lua.ILuaContext;
|
||||||
import dan200.computercraft.api.lua.LuaException;
|
import dan200.computercraft.api.lua.LuaException;
|
||||||
|
|
||||||
@@ -58,9 +58,11 @@ public interface IPeripheral
|
|||||||
* Lua values of type "table" will be represented by Object type Map.<br>
|
* Lua values of type "table" will be represented by Object type Map.<br>
|
||||||
* Lua values of any other type will be represented by a null object.<br>
|
* Lua values of any other type will be represented by a null object.<br>
|
||||||
* This array will be empty if no arguments are passed.
|
* This array will be empty if no arguments are passed.
|
||||||
|
*
|
||||||
|
* It is recommended you use {@link ArgumentHelper} in order to validate and process arguments.
|
||||||
* @return An array of objects, representing values you wish to return to the lua program. Integers, Doubles, Floats,
|
* @return An array of objects, representing values you wish to return to the lua program. Integers, Doubles, Floats,
|
||||||
* Strings, Booleans, Maps and ILuaObject and null be converted to their corresponding lua type. All other types
|
* Strings, Booleans, Maps, ILuaObject and null be converted to their corresponding lua type. All other types will
|
||||||
* will be converted to nil.
|
* be converted to nil.
|
||||||
*
|
*
|
||||||
* You may return null to indicate no values should be returned.
|
* You may return null to indicate no values should be returned.
|
||||||
* @throws LuaException If you throw any exception from this function, a lua error will be raised with the
|
* @throws LuaException If you throw any exception from this function, a lua error will be raised with the
|
||||||
@@ -70,6 +72,7 @@ public interface IPeripheral
|
|||||||
* InterruptedException will be thrown. This exception must not be caught or
|
* InterruptedException will be thrown. This exception must not be caught or
|
||||||
* intercepted, or the computer will leak memory and end up in a broken state.
|
* intercepted, or the computer will leak memory and end up in a broken state.
|
||||||
* @see #getMethodNames
|
* @see #getMethodNames
|
||||||
|
* @see ArgumentHelper
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
Object[] callMethod( @Nonnull IComputerAccess computer, @Nonnull ILuaContext context, int method, @Nonnull Object[] arguments ) throws LuaException, InterruptedException;
|
Object[] callMethod( @Nonnull IComputerAccess computer, @Nonnull ILuaContext context, int method, @Nonnull Object[] arguments ) throws LuaException, InterruptedException;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.peripheral;
|
package dan200.computercraft.api.peripheral;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
package dan200.computercraft.api.peripheral;
|
package dan200.computercraft.api.peripheral;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. This API may be redistributed unmodified and in full only.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.peripheral;
|
package dan200.computercraft.api.peripheral;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@API( owner = "ComputerCraft", provides = "ComputerCraft|API|Peripheral", apiVersion = "${version}" )
|
@API( owner = "ComputerCraft", provides = "ComputerCraft|API|Peripheral", apiVersion = "${version}" )
|
||||||
package dan200.computercraft.api.peripheral;
|
package dan200.computercraft.api.peripheral;
|
||||||
|
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.permissions;
|
package dan200.computercraft.api.permissions;
|
||||||
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@API( owner = "ComputerCraft", provides = "ComputerCraft|API|Permissions", apiVersion = "${version}" )
|
@API( owner = "ComputerCraft", provides = "ComputerCraft|API|Permissions", apiVersion = "${version}" )
|
||||||
package dan200.computercraft.api.permissions;
|
package dan200.computercraft.api.permissions;
|
||||||
|
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. This API may be redistributed unmodified and in full only.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.pocket;
|
package dan200.computercraft.api.pocket;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.pocket;
|
package dan200.computercraft.api.pocket;
|
||||||
|
|
||||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||||
@@ -16,7 +15,7 @@ import javax.annotation.Nullable;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper class for pocket computers
|
* Wrapper class for pocket computers.
|
||||||
*/
|
*/
|
||||||
public interface IPocketAccess
|
public interface IPocketAccess
|
||||||
{
|
{
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.pocket;
|
package dan200.computercraft.api.pocket;
|
||||||
|
|
||||||
import dan200.computercraft.api.ComputerCraftAPI;
|
import dan200.computercraft.api.ComputerCraftAPI;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.redstone;
|
package dan200.computercraft.api.redstone;
|
||||||
|
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@API( owner = "ComputerCraft", provides = "ComputerCraft|API|Redstone", apiVersion = "${version}" )
|
@API( owner = "ComputerCraft", provides = "ComputerCraft|API|Redstone", apiVersion = "${version}" )
|
||||||
package dan200.computercraft.api.redstone;
|
package dan200.computercraft.api.redstone;
|
||||||
|
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.turtle;
|
package dan200.computercraft.api.turtle;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
@@ -145,7 +144,9 @@ public interface ITurtleAccess
|
|||||||
GameProfile getOwningPlayer();
|
GameProfile getOwningPlayer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the inventory of this turtle
|
* Get the inventory of this turtle.
|
||||||
|
*
|
||||||
|
* Note: this inventory should only be accessed and modified on the server thread.
|
||||||
*
|
*
|
||||||
* @return This turtle's inventory
|
* @return This turtle's inventory
|
||||||
* @see #getItemHandler()
|
* @see #getItemHandler()
|
||||||
@@ -156,6 +157,8 @@ public interface ITurtleAccess
|
|||||||
/**
|
/**
|
||||||
* Get the inventory of this turtle as an {@link IItemHandlerModifiable}.
|
* Get the inventory of this turtle as an {@link IItemHandlerModifiable}.
|
||||||
*
|
*
|
||||||
|
* Note: this inventory should only be accessed and modified on the server thread.
|
||||||
|
*
|
||||||
* @return This turtle's inventory
|
* @return This turtle's inventory
|
||||||
* @see #getInventory()
|
* @see #getInventory()
|
||||||
* @see IItemHandlerModifiable
|
* @see IItemHandlerModifiable
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.turtle;
|
package dan200.computercraft.api.turtle;
|
||||||
|
|
||||||
import dan200.computercraft.api.lua.ILuaContext;
|
import dan200.computercraft.api.lua.ILuaContext;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.turtle;
|
package dan200.computercraft.api.turtle;
|
||||||
|
|
||||||
import dan200.computercraft.api.ComputerCraftAPI;
|
import dan200.computercraft.api.ComputerCraftAPI;
|
||||||
@@ -109,8 +108,8 @@ public interface ITurtleUpgrade
|
|||||||
* Will only be called for Tool turtle. Called when turtle.dig() or turtle.attack() is called
|
* 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.
|
* 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,
|
* Conforming implementations should fire {@link BlockEvent.BreakEvent} and {@link TurtleBlockEvent.Dig} for
|
||||||
* {@link AttackEntityEvent} and {@link TurtleAttackEvent} for attacking.
|
* digging, {@link AttackEntityEvent} and {@link TurtleAttackEvent} for attacking.
|
||||||
*
|
*
|
||||||
* @param turtle Access to the turtle that the tool resides on.
|
* @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.
|
* @param side Which side of the turtle (left or right) the tool resides on.
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.turtle;
|
package dan200.computercraft.api.turtle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.turtle;
|
package dan200.computercraft.api.turtle;
|
||||||
|
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.turtle;
|
package dan200.computercraft.api.turtle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -12,12 +11,12 @@ package dan200.computercraft.api.turtle;
|
|||||||
public enum TurtleSide
|
public enum TurtleSide
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The turtle's left side (where the pickaxe usually is on a Wireless Mining Turtle)
|
* The turtle's left side (where the pickaxe usually is on a Wireless Mining Turtle).
|
||||||
*/
|
*/
|
||||||
Left,
|
Left,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The turtle's right side (where the modem usually is on a Wireless Mining Turtle)
|
* The turtle's right side (where the modem usually is on a Wireless Mining Turtle).
|
||||||
*/
|
*/
|
||||||
Right,
|
Right,
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.turtle;
|
package dan200.computercraft.api.turtle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.turtle;
|
package dan200.computercraft.api.turtle;
|
||||||
|
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
@@ -18,12 +17,12 @@ import net.minecraft.util.EnumFacing;
|
|||||||
public enum TurtleVerb
|
public enum TurtleVerb
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The turtle called {@code turtle.dig()}, {@code turtle.digUp()} or {@code turtle.digDown()}
|
* The turtle called {@code turtle.dig()}, {@code turtle.digUp()} or {@code turtle.digDown()}.
|
||||||
*/
|
*/
|
||||||
Dig,
|
Dig,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The turtle called {@code turtle.attack()}, {@code turtle.attackUp()} or {@code turtle.attackDown()}
|
* The turtle called {@code turtle.attack()}, {@code turtle.attackUp()} or {@code turtle.attackDown()}.
|
||||||
*/
|
*/
|
||||||
Attack,
|
Attack,
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.turtle.event;
|
package dan200.computercraft.api.turtle.event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,7 +70,7 @@ public enum TurtleAction
|
|||||||
EQUIP,
|
EQUIP,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inspect a block in world
|
* Inspect a block in world.
|
||||||
*
|
*
|
||||||
* @see TurtleBlockEvent.Inspect
|
* @see TurtleBlockEvent.Inspect
|
||||||
*/
|
*/
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.turtle.event;
|
package dan200.computercraft.api.turtle.event;
|
||||||
|
|
||||||
import dan200.computercraft.api.turtle.ITurtleAccess;
|
import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.turtle.event;
|
package dan200.computercraft.api.turtle.event;
|
||||||
|
|
||||||
import dan200.computercraft.api.turtle.ITurtleAccess;
|
import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.turtle.event;
|
package dan200.computercraft.api.turtle.event;
|
||||||
|
|
||||||
import dan200.computercraft.api.lua.ILuaContext;
|
import dan200.computercraft.api.lua.ILuaContext;
|
||||||
@@ -112,7 +111,7 @@ public abstract class TurtleBlockEvent extends TurtlePlayerEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the upgrade doing the digging
|
* Get the upgrade doing the digging.
|
||||||
*
|
*
|
||||||
* @return The upgrade doing the digging.
|
* @return The upgrade doing the digging.
|
||||||
*/
|
*/
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.turtle.event;
|
package dan200.computercraft.api.turtle.event;
|
||||||
|
|
||||||
import dan200.computercraft.api.turtle.ITurtleAccess;
|
import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. This API may be redistributed unmodified and in full only.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.turtle.event;
|
package dan200.computercraft.api.turtle.event;
|
||||||
|
|
||||||
import dan200.computercraft.api.lua.ILuaContext;
|
import dan200.computercraft.api.lua.ILuaContext;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.turtle.event;
|
package dan200.computercraft.api.turtle.event;
|
||||||
|
|
||||||
import dan200.computercraft.api.turtle.ITurtleAccess;
|
import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||||
@@ -31,7 +30,7 @@ public abstract class TurtleInventoryEvent extends TurtleBlockEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the inventory being interacted with
|
* 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.
|
* @return The inventory being interacted with, {@code null} if the item will be dropped to/sucked from the world.
|
||||||
*/
|
*/
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.turtle.event;
|
package dan200.computercraft.api.turtle.event;
|
||||||
|
|
||||||
import dan200.computercraft.api.turtle.ITurtleAccess;
|
import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. This API may be redistributed unmodified and in full only.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.api.turtle.event;
|
package dan200.computercraft.api.turtle.event;
|
||||||
|
|
||||||
import dan200.computercraft.api.turtle.ITurtleAccess;
|
import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@API( owner = "ComputerCraft", provides = "ComputerCraft|API|Turtle|Event", apiVersion = "${version}" )
|
@API( owner = "ComputerCraft", provides = "ComputerCraft|API|Turtle|Event", apiVersion = "${version}" )
|
||||||
package dan200.computercraft.api.turtle.event;
|
package dan200.computercraft.api.turtle.event;
|
||||||
|
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only.
|
* Copyright Daniel Ratcliffe, 2011-2020. 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.
|
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@API( owner = "ComputerCraft", provides = "ComputerCraft|API|Turtle", apiVersion = "${version}" )
|
@API( owner = "ComputerCraft", provides = "ComputerCraft|API|Turtle", apiVersion = "${version}" )
|
||||||
package dan200.computercraft.api.turtle;
|
package dan200.computercraft.api.turtle;
|
||||||
|
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.client;
|
package dan200.computercraft.client;
|
||||||
|
|
||||||
import dan200.computercraft.ComputerCraft;
|
import dan200.computercraft.ComputerCraft;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.client;
|
package dan200.computercraft.client;
|
||||||
|
|
||||||
import dan200.computercraft.shared.command.text.ChatHelpers;
|
import dan200.computercraft.shared.command.text.ChatHelpers;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.client;
|
package dan200.computercraft.client;
|
||||||
|
|
||||||
import dan200.computercraft.ComputerCraft;
|
import dan200.computercraft.ComputerCraft;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.client.gui;
|
package dan200.computercraft.client.gui;
|
||||||
|
|
||||||
import dan200.computercraft.core.terminal.TextBuffer;
|
import dan200.computercraft.core.terminal.TextBuffer;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.client.gui;
|
package dan200.computercraft.client.gui;
|
||||||
|
|
||||||
import dan200.computercraft.ComputerCraft;
|
import dan200.computercraft.ComputerCraft;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.client.gui;
|
package dan200.computercraft.client.gui;
|
||||||
|
|
||||||
import dan200.computercraft.ComputerCraft;
|
import dan200.computercraft.ComputerCraft;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.client.gui;
|
package dan200.computercraft.client.gui;
|
||||||
|
|
||||||
import dan200.computercraft.shared.peripheral.diskdrive.ContainerDiskDrive;
|
import dan200.computercraft.shared.peripheral.diskdrive.ContainerDiskDrive;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.client.gui;
|
package dan200.computercraft.client.gui;
|
||||||
|
|
||||||
import dan200.computercraft.ComputerCraft;
|
import dan200.computercraft.ComputerCraft;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.client.gui;
|
package dan200.computercraft.client.gui;
|
||||||
|
|
||||||
import dan200.computercraft.shared.peripheral.printer.ContainerPrinter;
|
import dan200.computercraft.shared.peripheral.printer.ContainerPrinter;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.client.gui;
|
package dan200.computercraft.client.gui;
|
||||||
|
|
||||||
import dan200.computercraft.core.terminal.TextBuffer;
|
import dan200.computercraft.core.terminal.TextBuffer;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.client.gui;
|
package dan200.computercraft.client.gui;
|
||||||
|
|
||||||
import dan200.computercraft.ComputerCraft;
|
import dan200.computercraft.ComputerCraft;
|
||||||
@@ -120,7 +119,7 @@ public class GuiTurtle extends GuiContainer
|
|||||||
int slotX = slot % 4;
|
int slotX = slot % 4;
|
||||||
int slotY = slot / 4;
|
int slotY = slot / 4;
|
||||||
mc.getTextureManager().bindTexture( advanced ? BACKGROUND_ADVANCED : BACKGROUND_NORMAL );
|
mc.getTextureManager().bindTexture( advanced ? BACKGROUND_ADVANCED : BACKGROUND_NORMAL );
|
||||||
drawTexturedModalRect( guiLeft + m_container.m_turtleInvStartX - 2 + slotX * 18, guiTop + m_container.m_playerInvStartY - 2 + slotY * 18, 0, 217, 24, 24 );
|
drawTexturedModalRect( guiLeft + m_container.turtleInvStartX - 2 + slotX * 18, guiTop + m_container.playerInvStartY - 2 + slotY * 18, 0, 217, 24, 24 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.client.gui.widgets;
|
package dan200.computercraft.client.gui.widgets;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.client.gui.widgets;
|
package dan200.computercraft.client.gui.widgets;
|
||||||
|
|
||||||
import dan200.computercraft.client.FrameInfo;
|
import dan200.computercraft.client.FrameInfo;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.client.proxy;
|
package dan200.computercraft.client.proxy;
|
||||||
|
|
||||||
import dan200.computercraft.ComputerCraft;
|
import dan200.computercraft.ComputerCraft;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.client.render;
|
package dan200.computercraft.client.render;
|
||||||
|
|
||||||
import dan200.computercraft.ComputerCraft;
|
import dan200.computercraft.ComputerCraft;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.client.render;
|
package dan200.computercraft.client.render;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@@ -18,7 +17,7 @@ import net.minecraft.util.math.MathHelper;
|
|||||||
public abstract class ItemMapLikeRenderer
|
public abstract class ItemMapLikeRenderer
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The main rendering method for the item
|
* The main rendering method for the item.
|
||||||
*
|
*
|
||||||
* @param stack The stack to render
|
* @param stack The stack to render
|
||||||
* @see ItemRenderer#renderMapFirstPerson(ItemStack)
|
* @see ItemRenderer#renderMapFirstPerson(ItemStack)
|
||||||
@@ -87,7 +86,7 @@ public abstract class ItemMapLikeRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render an item in the middle of the screen
|
* Render an item in the middle of the screen.
|
||||||
*
|
*
|
||||||
* @param pitch The pitch of the player
|
* @param pitch The pitch of the player
|
||||||
* @param equipProgress The equip progress of this item
|
* @param equipProgress The equip progress of this item
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.client.render;
|
package dan200.computercraft.client.render;
|
||||||
|
|
||||||
import dan200.computercraft.ComputerCraft;
|
import dan200.computercraft.ComputerCraft;
|
||||||
@@ -32,7 +31,7 @@ import static dan200.computercraft.client.gui.FixedWidthFontRenderer.*;
|
|||||||
import static dan200.computercraft.client.gui.GuiComputer.*;
|
import static dan200.computercraft.client.gui.GuiComputer.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emulates map rendering for pocket computers
|
* Emulates map rendering for pocket computers.
|
||||||
*/
|
*/
|
||||||
@Mod.EventBusSubscriber( modid = ComputerCraft.MOD_ID, value = Side.CLIENT )
|
@Mod.EventBusSubscriber( modid = ComputerCraft.MOD_ID, value = Side.CLIENT )
|
||||||
public final class ItemPocketRenderer extends ItemMapLikeRenderer
|
public final class ItemPocketRenderer extends ItemMapLikeRenderer
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.client.render;
|
package dan200.computercraft.client.render;
|
||||||
|
|
||||||
import dan200.computercraft.ComputerCraft;
|
import dan200.computercraft.ComputerCraft;
|
||||||
@@ -23,7 +22,7 @@ import static dan200.computercraft.shared.media.items.ItemPrintout.LINES_PER_PAG
|
|||||||
import static dan200.computercraft.shared.media.items.ItemPrintout.LINE_MAX_LENGTH;
|
import static dan200.computercraft.shared.media.items.ItemPrintout.LINE_MAX_LENGTH;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emulates map and item-frame rendering for printouts
|
* Emulates map and item-frame rendering for printouts.
|
||||||
*/
|
*/
|
||||||
@Mod.EventBusSubscriber( modid = ComputerCraft.MOD_ID, value = Side.CLIENT )
|
@Mod.EventBusSubscriber( modid = ComputerCraft.MOD_ID, value = Side.CLIENT )
|
||||||
public final class ItemPrintoutRenderer extends ItemMapLikeRenderer
|
public final class ItemPrintoutRenderer extends ItemMapLikeRenderer
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.client.render;
|
package dan200.computercraft.client.render;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
@@ -94,7 +93,7 @@ public final class ModelTransformer
|
|||||||
private final Point3f[] before = new Point3f[4];
|
private final Point3f[] before = new Point3f[4];
|
||||||
private final Point3f[] after = new Point3f[4];
|
private final Point3f[] after = new Point3f[4];
|
||||||
|
|
||||||
public NormalAwareTransformer( IVertexConsumer parent, Matrix4f positionMatrix, Matrix4f normalMatrix )
|
NormalAwareTransformer( IVertexConsumer parent, Matrix4f positionMatrix, Matrix4f normalMatrix )
|
||||||
{
|
{
|
||||||
super( parent );
|
super( parent );
|
||||||
this.positionMatrix = positionMatrix;
|
this.positionMatrix = positionMatrix;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.client.render;
|
package dan200.computercraft.client.render;
|
||||||
|
|
||||||
import dan200.computercraft.ComputerCraft;
|
import dan200.computercraft.ComputerCraft;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user