mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-14 17:14:50 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
749ea96c62 | ||
|
|
f4dfa9e6cf | ||
|
|
30958c201a | ||
|
|
8ead31ff76 | ||
|
|
7bebb05573 | ||
|
|
87e5a32b89 | ||
|
|
c232ea8534 | ||
|
|
d27f30951a | ||
|
|
8dcda4e822 | ||
|
|
e337597a3c | ||
|
|
a8197e0026 | ||
|
|
9549d9385c | ||
|
|
d44c6bb7c7 | ||
|
|
a4a40ee726 | ||
|
|
caec163702 | ||
|
|
673f832c2d | ||
|
|
ce11a2dcf2 | ||
|
|
68e209203c | ||
|
|
0715f8b536 | ||
|
|
d356dddedb | ||
|
|
604b47a394 | ||
|
|
42dc1f43aa | ||
|
|
cbeec42e47 | ||
|
|
046ad7441d | ||
|
|
8750005be5 | ||
|
|
b46cfbb351 | ||
|
|
070ef99694 | ||
|
|
fec675ef48 | ||
|
|
503b90a5d0 | ||
|
|
84052a1c42 | ||
|
|
554a08a515 | ||
|
|
55928c5234 | ||
|
|
65c5d3aec5 | ||
|
|
7737598e4f | ||
|
|
eb9845d3a0 | ||
|
|
7a61bb9dee | ||
|
|
ed24e1e1f0 | ||
|
|
76e50f8a32 | ||
|
|
5b8810633b | ||
|
|
48e30828cf | ||
|
|
924b4dbbf2 | ||
|
|
b5a2693d7c | ||
|
|
372c317077 | ||
|
|
44ee860a39 | ||
|
|
181d48ac60 | ||
|
|
267adc0a31 | ||
|
|
503a6e7a76 | ||
|
|
ff0e85142d | ||
|
|
94bd521739 | ||
|
|
e66c50bc24 | ||
|
|
d9df657f35 | ||
|
|
08553f8af2 | ||
|
|
0fe564d007 | ||
|
|
53ba0383fb | ||
|
|
2c5664ce08 | ||
|
|
da70f52b0d | ||
|
|
46644bc889 | ||
|
|
f615df5010 | ||
|
|
73891d20ff | ||
|
|
e21793245f | ||
|
|
ffe4296ef6 | ||
|
|
5083fb2a60 | ||
|
|
05ee12955d | ||
|
|
a7acc7e224 | ||
|
|
a59bb21e59 | ||
|
|
5b6c13ff0a | ||
|
|
6f8b6e2a9c | ||
|
|
479c8328b4 | ||
|
|
0c23f4937d | ||
|
|
cde2e4fa60 | ||
|
|
abbb6dc151 | ||
|
|
b3def82cde | ||
|
|
8b4e7f7ec3 | ||
|
|
d69d77ecae | ||
|
|
a233f6ba30 | ||
|
|
581150178f | ||
|
|
313a243bf5 | ||
|
|
d5f1008b08 | ||
|
|
e1e1f06dc6 | ||
|
|
aad9c092b1 | ||
|
|
f8c56939cd | ||
|
|
e2e22d6103 | ||
|
|
a798d2146d | ||
|
|
e829c4168b | ||
|
|
b1f8d99da9 | ||
|
|
304fdef5ec | ||
|
|
1f05312ded | ||
|
|
eb88b1cfe0 | ||
|
|
d4256bda6e | ||
|
|
bda8902709 | ||
|
|
63971381cc | ||
|
|
09238b09ef | ||
|
|
32556e078e | ||
|
|
ace514f628 | ||
|
|
0102b89c33 | ||
|
|
b65afde754 | ||
|
|
4a0a427186 | ||
|
|
e04e2e3411 | ||
|
|
316db4bd77 | ||
|
|
f43936c29a | ||
|
|
c6471ed6b0 | ||
|
|
654b95da1a | ||
|
|
d70263f3af | ||
|
|
c10f74486b | ||
|
|
c7db2c4840 | ||
|
|
948a021f3e | ||
|
|
346bbf4e53 | ||
|
|
5769ebe3cb | ||
|
|
4558f194be | ||
|
|
e12142890e | ||
|
|
e6ebb5dfec | ||
|
|
1d4f6831dd | ||
|
|
726ce46475 | ||
|
|
d01de95e8e | ||
|
|
b15d357f1a | ||
|
|
0fbf6f05ba | ||
|
|
bf9c2cd2c7 | ||
|
|
51b4c4e74c | ||
|
|
cf6b678dd9 | ||
|
|
6c205150b1 | ||
|
|
e39a1e1eb6 | ||
|
|
4a94c1ba90 | ||
|
|
0fc382dd13 | ||
|
|
04964e15e4 | ||
|
|
085ccc9d21 | ||
|
|
1903589e29 | ||
|
|
46971bbe0e | ||
|
|
4ccecf7bc0 | ||
|
|
92fb58f0c6 | ||
|
|
54c6db0afc | ||
|
|
84d9dcaf00 | ||
|
|
af923d1977 | ||
|
|
efb918fc6d | ||
|
|
6447ffb4d5 | ||
|
|
fb4c9bde59 | ||
|
|
bd47a39c83 | ||
|
|
43d74c9a7a | ||
|
|
6d3a631bb0 | ||
|
|
ccdef03296 | ||
|
|
56e163c234 | ||
|
|
8ecec5b096 | ||
|
|
4e3fbc7667 | ||
|
|
845f277497 | ||
|
|
94fb952cb0 | ||
|
|
29554c6a40 | ||
|
|
fc5cba342c | ||
|
|
05d31b2e70 | ||
|
|
5265340e3c | ||
|
|
37e239ae81 | ||
|
|
a725ebf120 | ||
|
|
6affe75674 | ||
|
|
19f19d348b | ||
|
|
3154d03b4f | ||
|
|
9e84167012 | ||
|
|
d1a1bf1ed5 | ||
|
|
c1309fa37d | ||
|
|
6a0785e1da | ||
|
|
6a4d655c71 | ||
|
|
3639ade571 | ||
|
|
95daa9b035 | ||
|
|
f249fd2973 | ||
|
|
9f3f8243f9 | ||
|
|
23a5484ee8 | ||
|
|
4b5837cac2 | ||
|
|
1251427388 | ||
|
|
3e7d69f460 | ||
|
|
88725a144d | ||
|
|
123f22f20e | ||
|
|
0b0f7a4f1a | ||
|
|
b00c5996f7 | ||
|
|
83f52d15c7 | ||
|
|
287c4498d2 | ||
|
|
2470e81f0e | ||
|
|
1af6fcae0b | ||
|
|
f44111da96 | ||
|
|
4ae9ff2d77 | ||
|
|
71f79536a7 | ||
|
|
0920bf28d6 | ||
|
|
8e4107d11e | ||
|
|
349bcc0926 | ||
|
|
070660efe4 | ||
|
|
0dd56b62ab | ||
|
|
54d61f5251 | ||
|
|
ebcbef851a | ||
|
|
1717d38632 | ||
|
|
5fdd24293a | ||
|
|
2629076937 | ||
|
|
63cbe6e562 | ||
|
|
3194ecf6e8 | ||
|
|
638f04a58e | ||
|
|
e5e6e2fdba | ||
|
|
5b46f376eb | ||
|
|
1a14946abb | ||
|
|
8ca820f71c | ||
|
|
4e40230bf3 | ||
|
|
76708883c0 | ||
|
|
0a1ee81780 | ||
|
|
1fd7ae7567 | ||
|
|
251fcc26b0 | ||
|
|
b22915cc9c | ||
|
|
0bf8d3f568 | ||
|
|
35e6667da5 | ||
|
|
73cb43a761 | ||
|
|
d32a8e88a3 | ||
|
|
447450d541 | ||
|
|
7f6a0a6a4c | ||
|
|
28df6fa938 | ||
|
|
1728809a8a | ||
|
|
0edabd4a9d | ||
|
|
b5752a8338 | ||
|
|
29b0d711f7 | ||
|
|
e41827fb69 | ||
|
|
628af062ba | ||
|
|
09661218a3 | ||
|
|
e9f9412cab | ||
|
|
378b32726b | ||
|
|
4fdfc808ad | ||
|
|
275d137ba8 | ||
|
|
8d02293e71 | ||
|
|
8612980782 | ||
|
|
0902a8956b | ||
|
|
d9b99f6888 | ||
|
|
e03011cd40 | ||
|
|
864e5c03b3 | ||
|
|
727aed1335 | ||
|
|
b607aeb760 | ||
|
|
380518b796 |
No files matched your search
@@ -18,9 +18,5 @@ end_of_line = crlf
|
||||
[*.{dtd,json,info,mcmeta,md,sh,svg,xml,xsd,xsl,yaml,yml}]
|
||||
indent_size = 2
|
||||
|
||||
[*.java]
|
||||
indent_size = 2
|
||||
ij_java_space_before_if_parentheses = false
|
||||
|
||||
[*.lang]
|
||||
trim_trailing_whitespace = false
|
||||
@@ -0,0 +1,2 @@
|
||||
# Ignore spotlessApply reformat
|
||||
275d137ba8573454518c21bdcf4372362302ee82
|
||||
@@ -0,0 +1,44 @@
|
||||
* text eol=lf
|
||||
|
||||
*.[jJ][aA][rR] binary
|
||||
|
||||
*.[pP][nN][gG] binary
|
||||
*.[jJ][pP][gG] binary
|
||||
*.[jJ][pP][eE][gG] binary
|
||||
*.[gG][iI][fF] binary
|
||||
*.[tT][iI][fF] binary
|
||||
*.[tT][iI][fF][fF] binary
|
||||
*.[iI][cC][oO] binary
|
||||
*.[sS][vV][gG] text
|
||||
*.[eE][pP][sS] binary
|
||||
*.[xX][cC][fF] binary
|
||||
|
||||
*.[kK][aA][rR] binary
|
||||
*.[mM]4[aA] binary
|
||||
*.[mM][iI][dD] binary
|
||||
*.[mM][iI][dD][iI] binary
|
||||
*.[mM][pP]3 binary
|
||||
*.[oO][gG][gG] binary
|
||||
*.[rR][aA] binary
|
||||
|
||||
*.7[zZ] binary
|
||||
*.[gG][zZ] binary
|
||||
*.[tT][aA][rR] binary
|
||||
*.[tT][gG][zZ] binary
|
||||
*.[zZ][iI][pP] binary
|
||||
|
||||
*.[tT][cC][nN] binary
|
||||
*.[sS][oO] binary
|
||||
*.[dD][lL][lL] binary
|
||||
*.[dD][yY][lL][iI][bB] binary
|
||||
*.[pP][sS][dD] binary
|
||||
*.[tT][tT][fF] binary
|
||||
*.[oO][tT][fF] binary
|
||||
|
||||
*.[pP][aA][tT][cC][hH] -text
|
||||
|
||||
*.[bB][aA][tT] text eol=crlf
|
||||
*.[cC][mM][dD] text eol=crlf
|
||||
*.[pP][sS]1 text eol=crlf
|
||||
|
||||
*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
RUNDIR="run"
|
||||
CRASH="crash-reports"
|
||||
SERVERLOG="server.log"
|
||||
|
||||
if [[ -d $RUNDIR/$CRASH ]]; then
|
||||
echo "Crash reports detected:"
|
||||
cat $RUNDIR/$CRASH/crash*.txt
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep --quiet "Fatal errors were detected" $SERVERLOG; then
|
||||
echo "Fatal errors detected:"
|
||||
cat server.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" $SERVERLOG; then
|
||||
echo "Server force stopped:"
|
||||
cat server.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! grep --quiet -Po '.+Done \(.+\)\! For help, type "help" or "\?"' $SERVERLOG; then
|
||||
echo "Server didn't finish startup:"
|
||||
cat server.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "No crash reports detected"
|
||||
exit 0
|
||||
|
||||
@@ -3,9 +3,9 @@ name: Build and test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main ]
|
||||
branches: [ master, main, release/** ]
|
||||
push:
|
||||
branches: [ master, main ]
|
||||
branches: [ master, main, release/** ]
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
name: Optimize images
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
push:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
jobs:
|
||||
optimize-images:
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
|
||||
secrets: inherit
|
||||
@@ -27,3 +27,5 @@ whitelist.json
|
||||
*.iws
|
||||
src/main/resources/mixins.*.json
|
||||
*.bat
|
||||
layout.json
|
||||
.DS_Store
|
||||
+2
-920
@@ -1,923 +1,5 @@
|
||||
//version: 1658080040
|
||||
/*
|
||||
DO NOT CHANGE THIS FILE!
|
||||
Also, you may replace this file at any time if there is an update available.
|
||||
Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates.
|
||||
*/
|
||||
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.internal.logging.text.StyledTextOutput.Style
|
||||
import org.gradle.internal.logging.text.StyledTextOutputFactory
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Paths
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipInputStream
|
||||
import java.util.zip.ZipOutputStream
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
maven {
|
||||
name 'forge'
|
||||
url 'https://maven.minecraftforge.net'
|
||||
}
|
||||
maven {
|
||||
name 'sonatype'
|
||||
url 'https://oss.sonatype.org/content/repositories/snapshots/'
|
||||
}
|
||||
maven {
|
||||
name 'Scala CI dependencies'
|
||||
url 'https://repo1.maven.org/maven2/'
|
||||
}
|
||||
maven {
|
||||
name 'jitpack'
|
||||
url 'https://jitpack.io'
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.7'
|
||||
}
|
||||
}
|
||||
//version: 1707058017
|
||||
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'idea'
|
||||
id 'eclipse'
|
||||
id 'scala'
|
||||
id 'maven-publish'
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false
|
||||
id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false
|
||||
id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false
|
||||
id 'org.ajoberstar.grgit' version '4.1.1'
|
||||
id 'com.github.johnrengelman.shadow' version '4.0.4'
|
||||
id 'com.palantir.git-version' version '0.13.0' apply false
|
||||
id 'de.undercouch.download' version '5.0.1'
|
||||
id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false
|
||||
id "com.diffplug.spotless" version "6.7.2"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.diffplug:blowdryer:1.6.0'
|
||||
}
|
||||
|
||||
apply plugin: 'com.diffplug.blowdryer'
|
||||
|
||||
if (project.file('.git/HEAD').isFile()) {
|
||||
apply plugin: 'com.palantir.git-version'
|
||||
}
|
||||
|
||||
def out = services.get(StyledTextOutputFactory).create('an-output')
|
||||
|
||||
apply plugin: 'forge'
|
||||
|
||||
def projectJavaVersion = JavaLanguageVersion.of(8)
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(projectJavaVersion)
|
||||
}
|
||||
}
|
||||
|
||||
idea {
|
||||
module {
|
||||
inheritOutputDirs = true
|
||||
downloadJavadoc = true
|
||||
downloadSources = true
|
||||
}
|
||||
}
|
||||
apply from: Blowdryer.file('spotless.gradle')
|
||||
|
||||
if(JavaVersion.current() != JavaVersion.VERSION_1_8) {
|
||||
throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current())
|
||||
}
|
||||
|
||||
checkPropertyExists("modName")
|
||||
checkPropertyExists("modId")
|
||||
checkPropertyExists("modGroup")
|
||||
checkPropertyExists("autoUpdateBuildScript")
|
||||
checkPropertyExists("minecraftVersion")
|
||||
checkPropertyExists("forgeVersion")
|
||||
checkPropertyExists("replaceGradleTokenInFile")
|
||||
checkPropertyExists("gradleTokenModId")
|
||||
checkPropertyExists("gradleTokenModName")
|
||||
checkPropertyExists("gradleTokenVersion")
|
||||
checkPropertyExists("gradleTokenGroupName")
|
||||
checkPropertyExists("apiPackage")
|
||||
checkPropertyExists("accessTransformersFile")
|
||||
checkPropertyExists("usesMixins")
|
||||
checkPropertyExists("mixinPlugin")
|
||||
checkPropertyExists("mixinsPackage")
|
||||
checkPropertyExists("coreModClass")
|
||||
checkPropertyExists("containsMixinsAndOrCoreModOnly")
|
||||
checkPropertyExists("usesShadowedDependencies")
|
||||
checkPropertyExists("developmentEnvironmentUserName")
|
||||
|
||||
boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
|
||||
boolean usesMixinDebug = project.findProperty('usesMixinDebug') ?: project.usesMixins.toBoolean()
|
||||
boolean forceEnableMixins = project.findProperty('forceEnableMixins') ? project.forceEnableMixins.toBoolean() : false
|
||||
String channel = project.findProperty('channel') ? project.channel : 'stable'
|
||||
String mappingsVersion = project.findProperty('mappingsVersion') ? project.mappingsVersion : '12'
|
||||
String remoteMappings = project.findProperty('remoteMappings') ? project.remoteMappings : 'https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/'
|
||||
|
||||
String javaSourceDir = "src/main/java/"
|
||||
String scalaSourceDir = "src/main/scala/"
|
||||
String kotlinSourceDir = "src/main/kotlin/"
|
||||
|
||||
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||
String targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
||||
}
|
||||
|
||||
if(apiPackage) {
|
||||
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
||||
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
||||
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
||||
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
||||
}
|
||||
}
|
||||
|
||||
if(accessTransformersFile) {
|
||||
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
|
||||
if(!getFile(targetFile).exists()) {
|
||||
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
|
||||
}
|
||||
}
|
||||
|
||||
if(usesMixins.toBoolean()) {
|
||||
if(mixinsPackage.isEmpty() || mixinPlugin.isEmpty()) {
|
||||
throw new GradleException("\"mixinPlugin\" requires \"mixinsPackage\" and \"mixinPlugin\" to be set!")
|
||||
}
|
||||
|
||||
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
||||
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
||||
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
||||
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
||||
}
|
||||
|
||||
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
|
||||
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala"
|
||||
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
|
||||
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".kt"
|
||||
if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
|
||||
}
|
||||
}
|
||||
|
||||
if(coreModClass) {
|
||||
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
|
||||
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala"
|
||||
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
|
||||
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".kt"
|
||||
if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
|
||||
}
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS)
|
||||
|
||||
// Make sure GregTech build won't time out
|
||||
System.setProperty("org.gradle.internal.http.connectionTimeout", 120000 as String)
|
||||
System.setProperty("org.gradle.internal.http.socketTimeout", 120000 as String)
|
||||
}
|
||||
|
||||
// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version
|
||||
try {
|
||||
'git config core.fileMode false'.execute()
|
||||
}
|
||||
catch (Exception ignored) {
|
||||
out.style(Style.Failure).println("git isn't installed at all")
|
||||
}
|
||||
|
||||
// Pulls version first from the VERSION env and then git tag
|
||||
String identifiedVersion
|
||||
String versionOverride = System.getenv("VERSION") ?: null
|
||||
try {
|
||||
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
|
||||
}
|
||||
catch (Exception ignored) {
|
||||
out.style(Style.Failure).text(
|
||||
'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' +
|
||||
'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' +
|
||||
'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)'
|
||||
)
|
||||
versionOverride = 'NO-GIT-TAG-SET'
|
||||
identifiedVersion = versionOverride
|
||||
}
|
||||
version = minecraftVersion + '-' + identifiedVersion
|
||||
ext {
|
||||
modVersion = identifiedVersion
|
||||
}
|
||||
|
||||
if(identifiedVersion == versionOverride) {
|
||||
out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7')
|
||||
}
|
||||
|
||||
group = modGroup
|
||||
if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
|
||||
archivesBaseName = customArchiveBaseName
|
||||
}
|
||||
else {
|
||||
archivesBaseName = modId
|
||||
}
|
||||
|
||||
def arguments = []
|
||||
def jvmArguments = []
|
||||
|
||||
if (usesMixins.toBoolean() || forceEnableMixins) {
|
||||
arguments += [
|
||||
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
|
||||
]
|
||||
if (usesMixinDebug.toBoolean()) {
|
||||
jvmArguments += [
|
||||
"-Dmixin.debug.countInjections=true",
|
||||
"-Dmixin.debug.verbose=true",
|
||||
"-Dmixin.debug.export=true"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = minecraftVersion + '-' + forgeVersion + '-' + minecraftVersion
|
||||
runDir = 'run'
|
||||
|
||||
if (replaceGradleTokenInFile) {
|
||||
replaceIn replaceGradleTokenInFile
|
||||
if(gradleTokenModId) {
|
||||
replace gradleTokenModId, modId
|
||||
}
|
||||
if(gradleTokenModName) {
|
||||
replace gradleTokenModName, modName
|
||||
}
|
||||
if(gradleTokenVersion) {
|
||||
replace gradleTokenVersion, modVersion
|
||||
}
|
||||
if(gradleTokenGroupName) {
|
||||
replace gradleTokenGroupName, modGroup
|
||||
}
|
||||
}
|
||||
|
||||
clientIntellijRun {
|
||||
args(arguments)
|
||||
jvmArgs(jvmArguments)
|
||||
|
||||
if(developmentEnvironmentUserName) {
|
||||
args("--username", developmentEnvironmentUserName)
|
||||
}
|
||||
}
|
||||
|
||||
serverIntellijRun {
|
||||
args(arguments)
|
||||
jvmArgs(jvmArguments)
|
||||
}
|
||||
}
|
||||
|
||||
if(file('addon.gradle').exists()) {
|
||||
apply from: 'addon.gradle'
|
||||
}
|
||||
|
||||
apply from: 'repositories.gradle'
|
||||
|
||||
configurations {
|
||||
implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored
|
||||
implementation.extendsFrom(shadowCompile)
|
||||
implementation.extendsFrom(shadeCompile)
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name 'Overmind forge repo mirror'
|
||||
url 'https://gregtech.overminddl1.com/'
|
||||
}
|
||||
if(usesMixins.toBoolean() || forceEnableMixins) {
|
||||
maven {
|
||||
name 'sponge'
|
||||
url 'https://repo.spongepowered.org/repository/maven-public'
|
||||
}
|
||||
maven {
|
||||
url 'https://jitpack.io'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
if(usesMixins.toBoolean()) {
|
||||
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
|
||||
annotationProcessor('com.google.guava:guava:24.1.1-jre')
|
||||
annotationProcessor('com.google.code.gson:gson:2.8.6')
|
||||
annotationProcessor('org.spongepowered:mixin:0.8-SNAPSHOT')
|
||||
}
|
||||
if(usesMixins.toBoolean() || forceEnableMixins) {
|
||||
// using 0.8 to workaround a issue in 0.7 which fails mixin application
|
||||
compile('com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH') {
|
||||
// Mixin includes a lot of dependencies that are too up-to-date
|
||||
exclude module: 'launchwrapper'
|
||||
exclude module: 'guava'
|
||||
exclude module: 'gson'
|
||||
exclude module: 'commons-io'
|
||||
exclude module: 'log4j-core'
|
||||
}
|
||||
compile('com.github.GTNewHorizons:SpongeMixins:1.5.0')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: 'dependencies.gradle'
|
||||
|
||||
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
|
||||
def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap
|
||||
def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
|
||||
|
||||
task generateAssets {
|
||||
if (usesMixins.toBoolean()) {
|
||||
def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json");
|
||||
if (!mixinConfigFile.exists()) {
|
||||
mixinConfigFile.text = """{
|
||||
"required": true,
|
||||
"minVersion": "0.7.11",
|
||||
"package": "${modGroup}.${mixinsPackage}",
|
||||
"plugin": "${modGroup}.${mixinPlugin}",
|
||||
"refmap": "${mixingConfigRefMap}",
|
||||
"target": "@env(DEFAULT)",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"mixins": [],
|
||||
"client": [],
|
||||
"server": []
|
||||
}
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task relocateShadowJar(type: ConfigureShadowRelocation) {
|
||||
target = tasks.shadowJar
|
||||
prefix = modGroup + ".shadow"
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
project.configurations.shadeCompile.each { dep ->
|
||||
from(project.zipTree(dep)) {
|
||||
exclude 'META-INF', 'META-INF/**'
|
||||
}
|
||||
}
|
||||
|
||||
manifest {
|
||||
attributes(getManifestAttributes())
|
||||
}
|
||||
|
||||
minimize() // This will only allow shading for actually used classes
|
||||
configurations = [
|
||||
project.configurations.shadowImplementation,
|
||||
project.configurations.shadowCompile
|
||||
]
|
||||
dependsOn(relocateShadowJar)
|
||||
}
|
||||
|
||||
jar {
|
||||
project.configurations.shadeCompile.each { dep ->
|
||||
from(project.zipTree(dep)) {
|
||||
exclude 'META-INF', 'META-INF/**'
|
||||
}
|
||||
}
|
||||
|
||||
manifest {
|
||||
attributes(getManifestAttributes())
|
||||
}
|
||||
|
||||
if(usesShadowedDependencies.toBoolean()) {
|
||||
dependsOn(shadowJar)
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
reobf {
|
||||
if(usesMixins.toBoolean()) {
|
||||
addExtraSrgFile mixinSrg
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
if(usesMixins.toBoolean()) {
|
||||
tasks.compileJava {
|
||||
options.compilerArgs += [
|
||||
"-AreobfSrgFile=${tasks.reobf.srg}",
|
||||
"-AoutSrgFile=${mixinSrg}",
|
||||
"-AoutRefMapFile=${refMap}",
|
||||
// Elan: from what I understand they are just some linter configs so you get some warning on how to properly code
|
||||
"-XDenableSunApiLintControl",
|
||||
"-XDignore.symbol.file"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
runClient {
|
||||
if(developmentEnvironmentUserName) {
|
||||
arguments += [
|
||||
"--username",
|
||||
developmentEnvironmentUserName
|
||||
]
|
||||
}
|
||||
|
||||
args(arguments)
|
||||
jvmArgs(jvmArguments)
|
||||
}
|
||||
|
||||
runServer {
|
||||
args(arguments)
|
||||
jvmArgs(jvmArguments)
|
||||
}
|
||||
|
||||
tasks.withType(JavaExec).configureEach {
|
||||
javaLauncher.set(
|
||||
javaToolchains.launcherFor {
|
||||
languageVersion = projectJavaVersion
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
processResources {
|
||||
// this will ensure that this task is redone when the versions change.
|
||||
inputs.property "version", project.version
|
||||
inputs.property "mcversion", project.minecraft.version
|
||||
exclude("spotless.gradle")
|
||||
|
||||
// replace stuff in mcmod.info, nothing else
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'mcmod.info'
|
||||
|
||||
// replace modVersion and minecraftVersion
|
||||
expand "minecraftVersion": project.minecraft.version,
|
||||
"modVersion": modVersion,
|
||||
"modId": modId,
|
||||
"modName": modName
|
||||
}
|
||||
|
||||
if(usesMixins.toBoolean()) {
|
||||
from refMap
|
||||
}
|
||||
|
||||
// copy everything else that's not the mcmod.info
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude 'mcmod.info'
|
||||
exclude 'spotless.gradle'
|
||||
}
|
||||
}
|
||||
|
||||
def getManifestAttributes() {
|
||||
def manifestAttributes = [:]
|
||||
if(!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) {
|
||||
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
|
||||
}
|
||||
|
||||
if(accessTransformersFile) {
|
||||
manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
|
||||
}
|
||||
|
||||
if(coreModClass) {
|
||||
manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
|
||||
}
|
||||
|
||||
if(usesMixins.toBoolean()) {
|
||||
manifestAttributes += [
|
||||
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
|
||||
"MixinConfigs" : "mixins." + modId + ".json",
|
||||
"ForceLoadAsMod" : !containsMixinsAndOrCoreModOnly.toBoolean()
|
||||
]
|
||||
}
|
||||
return manifestAttributes
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from (sourceSets.main.allSource)
|
||||
from (file("$projectDir/LICENSE"))
|
||||
getArchiveClassifier().set('sources')
|
||||
}
|
||||
|
||||
task shadowDevJar(type: ShadowJar) {
|
||||
project.configurations.shadeCompile.each { dep ->
|
||||
from(project.zipTree(dep)) {
|
||||
exclude 'META-INF', 'META-INF/**'
|
||||
}
|
||||
}
|
||||
|
||||
from sourceSets.main.output
|
||||
getArchiveClassifier().set("dev")
|
||||
|
||||
manifest {
|
||||
attributes(getManifestAttributes())
|
||||
}
|
||||
|
||||
minimize() // This will only allow shading for actually used classes
|
||||
configurations = [
|
||||
project.configurations.shadowImplementation,
|
||||
project.configurations.shadowCompile
|
||||
]
|
||||
}
|
||||
|
||||
task relocateShadowDevJar(type: ConfigureShadowRelocation) {
|
||||
target = tasks.shadowDevJar
|
||||
prefix = modGroup + ".shadow"
|
||||
}
|
||||
|
||||
task circularResolverJar(type: Jar) {
|
||||
dependsOn(relocateShadowDevJar)
|
||||
dependsOn(shadowDevJar)
|
||||
enabled = false
|
||||
}
|
||||
|
||||
task devJar(type: Jar) {
|
||||
project.configurations.shadeCompile.each { dep ->
|
||||
from(project.zipTree(dep)) {
|
||||
exclude 'META-INF', 'META-INF/**'
|
||||
}
|
||||
}
|
||||
|
||||
from sourceSets.main.output
|
||||
getArchiveClassifier().set("dev")
|
||||
|
||||
manifest {
|
||||
attributes(getManifestAttributes())
|
||||
}
|
||||
|
||||
if(usesShadowedDependencies.toBoolean()) {
|
||||
dependsOn(circularResolverJar)
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
task apiJar(type: Jar) {
|
||||
from (sourceSets.main.allSource) {
|
||||
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
|
||||
}
|
||||
|
||||
from (sourceSets.main.output) {
|
||||
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
|
||||
}
|
||||
|
||||
from (sourceSets.main.resources.srcDirs) {
|
||||
include("LICENSE")
|
||||
}
|
||||
|
||||
getArchiveClassifier().set('api')
|
||||
}
|
||||
|
||||
artifacts {
|
||||
if(!noPublishedSources) {
|
||||
archives sourcesJar
|
||||
}
|
||||
archives devJar
|
||||
if(apiPackage) {
|
||||
archives apiJar
|
||||
}
|
||||
}
|
||||
|
||||
// The gradle metadata includes all of the additional deps that we disabled from POM generation (including forgeBin with no groupID),
|
||||
// and isn't strictly needed with the POM so just disable it.
|
||||
tasks.withType(GenerateModuleMetadata) {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
// workaround variable hiding in pom processing
|
||||
def projectConfigs = project.configurations
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
from components.java
|
||||
if(usesShadowedDependencies.toBoolean()) {
|
||||
artifact source: shadowJar, classifier: ""
|
||||
}
|
||||
if(!noPublishedSources) {
|
||||
artifact source: sourcesJar, classifier: "sources"
|
||||
}
|
||||
artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev"
|
||||
if (apiPackage) {
|
||||
artifact source: apiJar, classifier: "api"
|
||||
}
|
||||
|
||||
groupId = System.getenv("ARTIFACT_GROUP_ID") ?: "com.github.GTNewHorizons"
|
||||
artifactId = System.getenv("ARTIFACT_ID") ?: project.name
|
||||
// Using the identified version, not project.version as it has the prepended 1.7.10
|
||||
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
|
||||
|
||||
// remove extra garbage from minecraft and minecraftDeps configuration
|
||||
pom.withXml {
|
||||
def badArtifacts = [:].withDefault {[] as Set<String>}
|
||||
for (configuration in [
|
||||
projectConfigs.minecraft,
|
||||
projectConfigs.minecraftDeps
|
||||
]) {
|
||||
for (dependency in configuration.allDependencies) {
|
||||
badArtifacts[dependency.group == null ? "" : dependency.group] += dependency.name
|
||||
}
|
||||
}
|
||||
// example for specifying extra stuff to ignore
|
||||
// badArtifacts["org.example.group"] += "artifactName"
|
||||
|
||||
Node pomNode = asNode()
|
||||
pomNode.dependencies.'*'.findAll() {
|
||||
badArtifacts[it.groupId.text()].contains(it.artifactId.text())
|
||||
}.each() {
|
||||
it.parent().remove(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases"
|
||||
credentials {
|
||||
username = System.getenv("MAVEN_USER") ?: "NONE"
|
||||
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Updating
|
||||
task updateBuildScript {
|
||||
doLast {
|
||||
if (performBuildScriptUpdate(projectDir.toString())) return
|
||||
|
||||
print("Build script already up-to-date!")
|
||||
}
|
||||
}
|
||||
|
||||
if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
|
||||
if (autoUpdateBuildScript.toBoolean()) {
|
||||
performBuildScriptUpdate(projectDir.toString())
|
||||
} else {
|
||||
out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'")
|
||||
}
|
||||
}
|
||||
|
||||
static URL availableBuildScriptUrl() {
|
||||
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle")
|
||||
}
|
||||
|
||||
boolean performBuildScriptUpdate(String projectDir) {
|
||||
if (isNewBuildScriptVersionAvailable(projectDir)) {
|
||||
def buildscriptFile = getFile("build.gradle")
|
||||
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
|
||||
out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
boolean isNewBuildScriptVersionAvailable(String projectDir) {
|
||||
Map parameters = ["connectTimeout": 2000, "readTimeout": 2000]
|
||||
|
||||
String currentBuildScript = getFile("build.gradle").getText()
|
||||
String currentBuildScriptHash = getVersionHash(currentBuildScript)
|
||||
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
|
||||
String availableBuildScriptHash = getVersionHash(availableBuildScript)
|
||||
|
||||
boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash
|
||||
return !isUpToDate
|
||||
}
|
||||
|
||||
static String getVersionHash(String buildScriptContent) {
|
||||
String versionLine = buildScriptContent.find("^//version: [a-z0-9]*")
|
||||
if(versionLine != null) {
|
||||
return versionLine.split(": ").last()
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
configure(updateBuildScript) {
|
||||
group = 'forgegradle'
|
||||
description = 'Updates the build script to the latest version'
|
||||
}
|
||||
|
||||
// Parameter Deobfuscation
|
||||
|
||||
task deobfParams {
|
||||
doLast {
|
||||
|
||||
String mcpDir = "$project.gradle.gradleUserHomeDir/caches/minecraft/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion"
|
||||
String mcpZIP = "$mcpDir/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip"
|
||||
String paramsCSV = "$mcpDir/params.csv"
|
||||
|
||||
download.run {
|
||||
src "https://maven.minecraftforge.net/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion-$minecraftVersion/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip"
|
||||
dest mcpZIP
|
||||
overwrite false
|
||||
}
|
||||
|
||||
if(!file(paramsCSV).exists()) {
|
||||
println("Extracting MCP archive ...")
|
||||
unzip(mcpZIP, mcpDir)
|
||||
}
|
||||
|
||||
println("Parsing params.csv ...")
|
||||
Map<String, String> params = new HashMap<>()
|
||||
Files.lines(Paths.get(paramsCSV)).forEach{line ->
|
||||
String[] cells = line.split(",")
|
||||
if(cells.length > 2 && cells[0].matches("p_i?\\d+_\\d+_")) {
|
||||
params.put(cells[0], cells[1])
|
||||
}
|
||||
}
|
||||
|
||||
out.style(Style.Success).println("Modified ${replaceParams(file("$projectDir/src/main/java"), params)} files!")
|
||||
out.style(Style.Failure).println("Don't forget to verify that the code still works as before!\n It could be broken due to duplicate variables existing now\n or parameters taking priority over other variables.")
|
||||
}
|
||||
}
|
||||
|
||||
static int replaceParams(File file, Map<String, String> params) {
|
||||
int fileCount = 0
|
||||
|
||||
if(file.isDirectory()) {
|
||||
for(File f : file.listFiles()) {
|
||||
fileCount += replaceParams(f, params)
|
||||
}
|
||||
return fileCount
|
||||
}
|
||||
println("Visiting ${file.getName()} ...")
|
||||
try {
|
||||
String content = new String(Files.readAllBytes(file.toPath()))
|
||||
int hash = content.hashCode()
|
||||
params.forEach{key, value ->
|
||||
content = content.replaceAll(key, value)
|
||||
}
|
||||
if(hash != content.hashCode()) {
|
||||
Files.write(file.toPath(), content.getBytes("UTF-8"))
|
||||
return 1
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// Credit: bitsnaps (https://gist.github.com/bitsnaps/00947f2dce66f4bbdabc67d7e7b33681)
|
||||
static unzip(String zipFileName, String outputDir) {
|
||||
byte[] buffer = new byte[16384]
|
||||
ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFileName))
|
||||
ZipEntry zipEntry = zis.getNextEntry()
|
||||
while (zipEntry != null) {
|
||||
File newFile = new File(outputDir + File.separator, zipEntry.name)
|
||||
if (zipEntry.isDirectory()) {
|
||||
if (!newFile.isDirectory() && !newFile.mkdirs()) {
|
||||
throw new IOException("Failed to create directory $newFile")
|
||||
}
|
||||
} else {
|
||||
// fix for Windows-created archives
|
||||
File parent = newFile.parentFile
|
||||
if (!parent.isDirectory() && !parent.mkdirs()) {
|
||||
throw new IOException("Failed to create directory $parent")
|
||||
}
|
||||
// write file content
|
||||
FileOutputStream fos = new FileOutputStream(newFile)
|
||||
int len = 0
|
||||
while ((len = zis.read(buffer)) > 0) {
|
||||
fos.write(buffer, 0, len)
|
||||
}
|
||||
fos.close()
|
||||
}
|
||||
zipEntry = zis.getNextEntry()
|
||||
}
|
||||
zis.closeEntry()
|
||||
zis.close()
|
||||
}
|
||||
|
||||
configure(deobfParams) {
|
||||
group = 'forgegradle'
|
||||
description = 'Rename all obfuscated parameter names inherited from Minecraft classes'
|
||||
}
|
||||
|
||||
// Dependency Deobfuscation
|
||||
|
||||
def deobf(String sourceURL) {
|
||||
try {
|
||||
URL url = new URL(sourceURL)
|
||||
String fileName = url.getFile()
|
||||
|
||||
//get rid of directories:
|
||||
int lastSlash = fileName.lastIndexOf("/")
|
||||
if(lastSlash > 0) {
|
||||
fileName = fileName.substring(lastSlash + 1)
|
||||
}
|
||||
//get rid of extension:
|
||||
if(fileName.endsWith(".jar") || fileName.endsWith(".litemod")) {
|
||||
fileName = fileName.substring(0, fileName.lastIndexOf("."))
|
||||
}
|
||||
|
||||
String hostName = url.getHost()
|
||||
if(hostName.startsWith("www.")) {
|
||||
hostName = hostName.substring(4)
|
||||
}
|
||||
List parts = Arrays.asList(hostName.split("\\."))
|
||||
Collections.reverse(parts)
|
||||
hostName = String.join(".", parts)
|
||||
|
||||
return deobf(sourceURL, "$hostName/$fileName")
|
||||
} catch(Exception e) {
|
||||
return deobf(sourceURL, "deobf/${sourceURL.hashCode()}")
|
||||
}
|
||||
}
|
||||
|
||||
// The method above is to be preferred. Use this method if the filename is not at the end of the URL.
|
||||
def deobf(String sourceURL, String rawFileName) {
|
||||
String bon2Version = "2.5.1"
|
||||
String fileName = URLDecoder.decode(rawFileName, "UTF-8")
|
||||
String cacheDir = "$project.gradle.gradleUserHomeDir/caches"
|
||||
String bon2Dir = "$cacheDir/forge_gradle/deobf"
|
||||
String bon2File = "$bon2Dir/BON2-${bon2Version}.jar"
|
||||
String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar"
|
||||
String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar"
|
||||
|
||||
if(file(deobfFile).exists()) {
|
||||
return files(deobfFile)
|
||||
}
|
||||
|
||||
String mappingsVer
|
||||
if(remoteMappings) {
|
||||
String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion"
|
||||
String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip"
|
||||
|
||||
zipMappings(mappingsZIP, remoteMappings, bon2Dir)
|
||||
|
||||
mappingsVer = "snapshot_$id"
|
||||
} else {
|
||||
mappingsVer = "${channel}_$mappingsVersion"
|
||||
}
|
||||
|
||||
download.run {
|
||||
src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar"
|
||||
dest bon2File
|
||||
quiet true
|
||||
overwrite false
|
||||
}
|
||||
|
||||
download.run {
|
||||
src sourceURL
|
||||
dest obfFile
|
||||
quiet true
|
||||
overwrite false
|
||||
}
|
||||
|
||||
exec {
|
||||
commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch'
|
||||
workingDir bon2Dir
|
||||
standardOutput = new FileOutputStream("${deobfFile}.log")
|
||||
}
|
||||
|
||||
return files(deobfFile)
|
||||
}
|
||||
|
||||
def zipMappings(String zipPath, String url, String bon2Dir) {
|
||||
File zipFile = new File(zipPath)
|
||||
if(zipFile.exists()) {
|
||||
return
|
||||
}
|
||||
|
||||
String fieldsCache = "$bon2Dir/data/fields.csv"
|
||||
String methodsCache = "$bon2Dir/data/methods.csv"
|
||||
|
||||
download.run {
|
||||
src "${url}fields.csv"
|
||||
dest fieldsCache
|
||||
quiet true
|
||||
}
|
||||
download.run {
|
||||
src "${url}methods.csv"
|
||||
dest methodsCache
|
||||
quiet true
|
||||
}
|
||||
|
||||
zipFile.getParentFile().mkdirs()
|
||||
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile))
|
||||
|
||||
zos.putNextEntry(new ZipEntry("fields.csv"))
|
||||
Files.copy(Paths.get(fieldsCache), zos)
|
||||
zos.closeEntry()
|
||||
|
||||
zos.putNextEntry(new ZipEntry("methods.csv"))
|
||||
Files.copy(Paths.get(methodsCache), zos)
|
||||
zos.closeEntry()
|
||||
|
||||
zos.close()
|
||||
}
|
||||
|
||||
// Helper methods
|
||||
|
||||
def checkPropertyExists(String propertyName) {
|
||||
if (!project.hasProperty(propertyName)) {
|
||||
throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties")
|
||||
}
|
||||
}
|
||||
|
||||
def getFile(String relativePath) {
|
||||
return new File(projectDir, relativePath)
|
||||
id 'com.gtnewhorizons.gtnhconvention'
|
||||
}
|
||||
+26
-15
@@ -1,24 +1,35 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
compile('com.github.GTNewHorizons:EnderCore:0.2.9:dev')
|
||||
compile('com.github.GTNewHorizons:ForestryMC:4.4.6:dev')
|
||||
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.15-GTNH:dev')
|
||||
compile('com.github.GTNewHorizons:BuildCraft:7.1.27:dev')
|
||||
compile('curse.maven:cofh-lib-220333:2388748') // https://www.curseforge.com/minecraft/mc-mods/cofh-lib/files/2388748
|
||||
api('com.github.GTNewHorizons:EnderCore:0.5.15:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.37:dev')
|
||||
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.8.130-GTNH:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.11.45:dev")
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.63:dev')
|
||||
api('curse.maven:cofh-lib-220333:2388748') // https://www.curseforge.com/minecraft/mc-mods/cofh-lib/files/2388748
|
||||
shadowImplementation('cglib:cglib-nodep:3.3.0')
|
||||
api("com.github.GTNewHorizons:TinkersConstruct:1.14.107-GTNH:dev")
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.5.19:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-85-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Baubles:1.0.1.14:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.13.6:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.11.13-GTNH:api') {transitive = false}
|
||||
compile('com.github.GTNewHorizons:Chisel:2.10.8-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.7.5.25-GTNH:api') {transitive = false}
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:waila:1.19.34:dev') {transitive = false}
|
||||
compileOnly('ganymedes01.etfuturum:Et-Futurum-Requiem:2.6.48-GTNH:dev') {transitive = false}
|
||||
runtimeOnlyNonPublishable('com.github.GTNewHorizons:WAILAPlugins:0.7.2:dev') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:Backhand:1.8.14:dev") { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-999-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.22-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.54.129:dev') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:ModularUI2:2.3.88-1.7.10:dev") {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.17.31:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.2.29-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Chisel:2.17.32-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.61-GTNH:api') {transitive = false}
|
||||
compileOnly('curse.maven:minefactory-reloaded-66672:2366150') // https://www.curseforge.com/minecraft/mc-mods/minefactory-reloaded/files/2366150
|
||||
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
compileOnly('curse.maven:ee3-65509:2305023') // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
|
||||
compileOnly(deobf('https://media.forgecdn.net/files/2269/339/ComputerCraft1.75.jar')) // https://www.curseforge.com/minecraft/mc-mods/computercraft/files/2269339
|
||||
compileOnly(deobf('https://media.forgecdn.net/files/2426/270/Mekanism-1.7.10-9.1.0.281.jar')) // https://aidancbrady.com/mekanism/download/
|
||||
compileOnly(deobf('https://immibis.com/mcmoddl/files/immibis-microblocks-59.1.2.jar'))
|
||||
compileOnly(rfg.deobf('curse.maven:computercraft-67504:2269339')) // https://www.curseforge.com/minecraft/mc-mods/computercraft/files/2269339
|
||||
compileOnly(rfg.deobf('curse.maven:mekanism-268560:2475797')) // https://www.curseforge.com/minecraft/mc-mods/mekanism/files/2475797
|
||||
compileOnly(rfg.deobf('maven.modrinth:immibis-microblocks:59.1.2')) // https://modrinth.com/mod/immibis-microblocks/version/59.1.2
|
||||
compileOnly('com.github.GTNewHorizons:BetterBuildersWands:0.13.12-GTNH:dev@jar')
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:2.2.10:api') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.196:dev")
|
||||
compileOnly('curse.maven:automagy-222153:2285272')
|
||||
}
|
||||
+200
-29
@@ -1,67 +1,238 @@
|
||||
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
|
||||
# LOCAL to test local config updates.
|
||||
gtnh.settings.blowdryerTag = 0.2.0
|
||||
|
||||
# Human-readable mod name, available for mcmod.info population.
|
||||
modName = Ender IO
|
||||
|
||||
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
||||
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
|
||||
# Conventionally lowercase.
|
||||
modId = EnderIO
|
||||
|
||||
# Root package of the mod, used to find various classes in other properties,
|
||||
# mcmod.info substitution, enabling assertions in run tasks, etc.
|
||||
modGroup = crazypants.enderio
|
||||
|
||||
# WHY is there no version field?
|
||||
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
|
||||
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
|
||||
# Whether to use modGroup as the maven publishing group.
|
||||
# When false, com.github.GTNewHorizons is used.
|
||||
useModGroupForPublishing = false
|
||||
|
||||
# Will update your build.gradle automatically whenever an update is available
|
||||
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
||||
autoUpdateBuildScript = false
|
||||
|
||||
# Version of Minecraft to target
|
||||
minecraftVersion = 1.7.10
|
||||
|
||||
# Version of Minecraft Forge to target
|
||||
forgeVersion = 10.13.4.1614
|
||||
|
||||
# Specify a MCP channel and mappings version for dependency deobfuscation and the deobfParams task.
|
||||
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
|
||||
channel = stable
|
||||
|
||||
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
|
||||
mappingsVersion = 12
|
||||
|
||||
# Define other MCP mappings for dependency deobfuscation
|
||||
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
||||
# Defines other MCP mappings for dependency deobfuscation.
|
||||
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
||||
|
||||
# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you
|
||||
# restart Minecraft in development. Choose this dependent on your mod:
|
||||
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
|
||||
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
|
||||
# Select a default username for testing your mod. You can always override this per-run by running
|
||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||
developmentEnvironmentUserName = Developer
|
||||
|
||||
# Define a source file of your project with:
|
||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's
|
||||
# version in @Mod([...], version = VERSION, [...])
|
||||
# Leave these properties empty to skip individual token replacements
|
||||
replaceGradleTokenInFile = EnderIO.java
|
||||
# Enables modern Java syntax support. Valid values:
|
||||
# - false: No modern syntax, Java 8 only
|
||||
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
|
||||
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
|
||||
# - modern: Native modern Java bytecode, no downgrading
|
||||
enableModernJavaSyntax = jabel
|
||||
|
||||
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
|
||||
# and should *not* be used in most situations. -1 disables this.
|
||||
# forceToolchainVersion = -1
|
||||
|
||||
# Target JVM version for JVM Downgrader bytecode downgrading.
|
||||
# Only used when enableModernJavaSyntax = jvmDowngrader
|
||||
# downgradeTargetVersion = 8
|
||||
|
||||
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
|
||||
# Classes will be available in META-INF/versions/N/ for each version N in this list.
|
||||
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
|
||||
# jvmDowngraderMultiReleaseVersions = 21,25
|
||||
|
||||
# Specifies how JVM Downgrader API stubs are provided. Options:
|
||||
# - shade: Shade minimized stubs into the jar
|
||||
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
|
||||
# - external: Another dependency provides stubs (no constraint, no warning)
|
||||
# - (empty): Warning reminding you to configure stubs
|
||||
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
|
||||
# jvmDowngraderStubsProvider =
|
||||
|
||||
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||
enableGenericInjection = true
|
||||
|
||||
# Generate a class with a String field for the mod version named as defined below.
|
||||
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
|
||||
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
|
||||
generateGradleTokenClass = crazypants.enderio.Tags
|
||||
|
||||
# Name of the token containing the project's current version to generate/replace.
|
||||
gradleTokenVersion = VERSION
|
||||
|
||||
# [DEPRECATED] Mod ID replacement token.
|
||||
gradleTokenModId =
|
||||
|
||||
# [DEPRECATED] Mod name replacement token.
|
||||
gradleTokenModName =
|
||||
gradleTokenVersion = GRADLETOKEN_VERSION
|
||||
|
||||
# [DEPRECATED] Mod Group replacement token.
|
||||
gradleTokenGroupName =
|
||||
|
||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can
|
||||
# [DEPRECATED]
|
||||
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
|
||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
||||
# version in @Mod([...], version = VERSION, [...]).
|
||||
# Leave these properties empty to skip individual token replacements.
|
||||
replaceGradleTokenInFile =
|
||||
|
||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
||||
# leave this property empty.
|
||||
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
|
||||
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
|
||||
apiPackage = api
|
||||
|
||||
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
|
||||
# Example value: mymodid_at.cfg
|
||||
accessTransformersFile =
|
||||
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
|
||||
# There can be multiple files in a space-separated list.
|
||||
# Example value: mymodid_at.cfg nei_at.cfg
|
||||
accessTransformersFile = enderio_at.cfg
|
||||
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins = false
|
||||
|
||||
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
|
||||
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
|
||||
# Mixin classes will have access to "main" classes, but not the other way around.
|
||||
separateMixinSourceSet =
|
||||
|
||||
# Adds some debug arguments like verbose output and class export.
|
||||
usesMixinDebug = false
|
||||
|
||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||
mixinPlugin =
|
||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||
|
||||
# Specify the package that contains all of your Mixins. The package must exist or
|
||||
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
|
||||
# it must match with this or the build will fail.
|
||||
mixinsPackage =
|
||||
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
# This parameter is for legacy compatability only
|
||||
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
|
||||
# This parameter is for legacy compatibility only
|
||||
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
||||
coreModClass =
|
||||
|
||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
||||
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||
containsMixinsAndOrCoreModOnly = false
|
||||
|
||||
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
|
||||
# responsibility check the licence and request permission for distribution, if required.
|
||||
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
||||
forceEnableMixins = false
|
||||
|
||||
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
|
||||
# responsibility to check the license and request permission for distribution if required.
|
||||
usesShadowedDependencies = true
|
||||
|
||||
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
|
||||
# their own classes, making the minimization unreliable.
|
||||
minimizeShadowedDependencies = true
|
||||
|
||||
# If disabled, won't rename the shadowed classes.
|
||||
relocateShadowedDependencies = true
|
||||
|
||||
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
||||
includeWellKnownRepositories = true
|
||||
|
||||
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
|
||||
# list of strings, with the acceptable keys being(case does not matter):
|
||||
# cursemaven
|
||||
# modrinth
|
||||
excludeWellKnownRepositories =
|
||||
|
||||
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
|
||||
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
|
||||
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
|
||||
usesMavenPublishing = true
|
||||
|
||||
# Maven repository to publish the mod to.
|
||||
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
|
||||
|
||||
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
|
||||
#
|
||||
# The project's ID on Modrinth. Can be either the slug or the ID.
|
||||
# Leave this empty if you don't want to publish to Modrinth.
|
||||
modrinthProjectId =
|
||||
|
||||
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
||||
# Syntax: scope1-type1:name1;scope2-type2:name2;...
|
||||
# Where scope can be one of [required, optional, incompatible, embedded],
|
||||
# type can be one of [project, version],
|
||||
# and the name is the Modrinth project or version slug/id of the other mod.
|
||||
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
|
||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||
modrinthRelations =
|
||||
|
||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||
#
|
||||
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
||||
# Leave this empty if you don't want to publish on CurseForge.
|
||||
curseForgeProjectId =
|
||||
|
||||
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||
# Syntax: type1:name1;type2:name2;...
|
||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||
# and the name is the CurseForge project slug of the other mod.
|
||||
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||
curseForgeRelations =
|
||||
|
||||
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
|
||||
# projects. New projects should not use this parameter.
|
||||
# customArchiveBaseName =
|
||||
|
||||
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
|
||||
# runClientWorkingDirectory = run/client
|
||||
|
||||
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
|
||||
# runServerWorkingDirectory = run/server
|
||||
|
||||
# Optional parameter to have the build automatically fail if an illegal version is used.
|
||||
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
|
||||
# The check is ONLY performed if the version is a git tag.
|
||||
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
|
||||
# versionPattern =
|
||||
|
||||
# Uncomment to prevent the source code from being published.
|
||||
# noPublishedSources = true
|
||||
|
||||
# Uncomment this to disable Spotless checks.
|
||||
# This should only be uncommented to keep it easier to sync with upstream/other forks.
|
||||
# That is, if there is no other active fork/upstream, NEVER change this.
|
||||
# disableSpotless = true
|
||||
|
||||
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
|
||||
# disableCheckstyle = true
|
||||
|
||||
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
|
||||
# (force use delegated build).
|
||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
|
||||
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
|
||||
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
|
||||
# ideaOverrideBuildType = idea
|
||||
|
||||
# Whether IDEA should run spotless checks when pressing the Build button.
|
||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||
# ideaCheckSpotlessOnBuild = true
|
||||
|
||||
# Non-GTNH properties
|
||||
org.gradle.configuration-cache = true
|
||||
org.gradle.parallel = true
|
||||
@@ -0,0 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9064f22734b42ac03e85df04b632e167/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/4d0277c49991306ac78048580fe34bcf/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a9fa3b809e484a1e1ac4308a5dda661a/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/aa99913fa6d767d899ffc96082da01ca/redirect
|
||||
toolchainVersion=25
|
||||
Vendored
BIN
Binary file not shown.
+3
-1
@@ -1,5 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -15,80 +15,114 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
@@ -97,92 +131,118 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+27
-34
@@ -13,8 +13,10 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@@ -25,10 +27,14 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@@ -37,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
@@ -51,48 +57,35 @@ goto fail
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
@@ -1,26 +1,4 @@
|
||||
// Add any additional repositories for your dependencies here
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name 'GTNH Maven'
|
||||
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
|
||||
allowInsecureProtocol
|
||||
}
|
||||
maven {
|
||||
name 'ic2'
|
||||
url 'http://maven.ic2.player.to/'
|
||||
metadataSources {
|
||||
mavenPom()
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
maven {
|
||||
url 'https://cursemaven.com'
|
||||
content {
|
||||
includeGroup 'curse.maven'
|
||||
}
|
||||
}
|
||||
maven {
|
||||
url = 'https://jitpack.io'
|
||||
}
|
||||
}
|
||||
+19
-6
@@ -1,10 +1,23 @@
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
maven {
|
||||
// RetroFuturaGradle
|
||||
name "GTNH Maven"
|
||||
url "https://nexus.gtnewhorizons.com/repository/public/"
|
||||
mavenContent {
|
||||
includeGroup("com.gtnewhorizons")
|
||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||
}
|
||||
}
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.diffplug.blowdryerSetup' version '1.6.0'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.29'
|
||||
}
|
||||
|
||||
apply plugin: 'com.diffplug.blowdryerSetup'
|
||||
|
||||
blowdryerSetup {
|
||||
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.4')
|
||||
//devLocal '.' // Use this when testing config updates locally
|
||||
}
|
||||
@@ -1,15 +1,17 @@
|
||||
package crazypants.enderio;
|
||||
|
||||
import com.enderio.core.common.BlockEnder;
|
||||
import crazypants.enderio.api.tool.ITool;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.tool.ToolUtil;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.BlockEnder;
|
||||
|
||||
import crazypants.enderio.api.tool.ITool;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.tool.ToolUtil;
|
||||
|
||||
public abstract class BlockEio extends BlockEnder {
|
||||
|
||||
protected BlockEio(String name, Class<? extends TileEntityEio> teClass) {
|
||||
@@ -23,8 +25,8 @@ public abstract class BlockEio extends BlockEnder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(
|
||||
World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float par7,
|
||||
float par8, float par9) {
|
||||
|
||||
if (shouldWrench(world, x, y, z, entityPlayer, side)
|
||||
&& ToolUtil.breakBlockWithTool(this, world, x, y, z, entityPlayer)) {
|
||||
@@ -33,8 +35,7 @@ public abstract class BlockEio extends BlockEnder {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
ITool tool = ToolUtil.getEquippedTool(entityPlayer);
|
||||
if (tool != null
|
||||
&& !entityPlayer.isSneaking()
|
||||
if (tool != null && !entityPlayer.isSneaking()
|
||||
&& tool.canUse(entityPlayer.getCurrentEquippedItem(), entityPlayer, x, y, z)) {
|
||||
if (te instanceof AbstractMachineEntity) {
|
||||
((AbstractMachineEntity) te).toggleIoModeForFace(ForgeDirection.getOrientation(side));
|
||||
|
||||
@@ -1,7 +1,23 @@
|
||||
package crazypants.enderio;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import com.enderio.core.client.handlers.SpecialTooltipHandler;
|
||||
import com.enderio.core.client.render.IconUtil;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
@@ -11,39 +27,29 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.conduit.BlockConduitBundle;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.TileConduitBundle;
|
||||
import crazypants.enderio.conduit.facade.FacadeRenderer;
|
||||
import crazypants.enderio.conduit.gas.GasConduit;
|
||||
import crazypants.enderio.conduit.gas.GasConduitRenderer;
|
||||
import crazypants.enderio.conduit.gas.GasUtil;
|
||||
import crazypants.enderio.conduit.item.ItemConduit;
|
||||
import crazypants.enderio.conduit.liquid.AbstractEnderLiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.AdvancedLiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.AdvancedLiquidConduitRenderer;
|
||||
import crazypants.enderio.conduit.liquid.CrystallineEnderLiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.CrystallinePinkSlimeEnderLiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.EnderLiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.EnderLiquidConduitRenderer;
|
||||
import crazypants.enderio.conduit.liquid.LiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.LiquidConduitRenderer;
|
||||
import crazypants.enderio.conduit.liquid.MelodicEnderLiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.StellarEnderLiquidConduit;
|
||||
import crazypants.enderio.conduit.me.MEConduit;
|
||||
import crazypants.enderio.conduit.me.MEUtil;
|
||||
import crazypants.enderio.conduit.oc.OCConduit;
|
||||
import crazypants.enderio.conduit.oc.OCConduitRenderer;
|
||||
import crazypants.enderio.conduit.oc.OCUtil;
|
||||
import crazypants.enderio.conduit.power.PowerConduit;
|
||||
import crazypants.enderio.conduit.power.PowerConduitRenderer;
|
||||
import crazypants.enderio.conduit.power.endergy.PowerConduitEndergy;
|
||||
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduitRenderer;
|
||||
import crazypants.enderio.conduit.redstone.RedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.RedstoneSwitch;
|
||||
import crazypants.enderio.conduit.redstone.RedstoneSwitchRenderer;
|
||||
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
|
||||
import crazypants.enderio.conduit.render.ItemConduitRenderer;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.enderface.EnderIoRenderer;
|
||||
@@ -97,11 +103,8 @@ import crazypants.enderio.machine.painter.BlockPaintedFenceGateRenderer;
|
||||
import crazypants.enderio.machine.painter.BlockPaintedGlowstone;
|
||||
import crazypants.enderio.machine.painter.PaintedBlockRenderer;
|
||||
import crazypants.enderio.machine.painter.PaintedItemRenderer;
|
||||
import crazypants.enderio.machine.power.BlockCapacitorBank;
|
||||
import crazypants.enderio.machine.power.CapBankRenderer2;
|
||||
import crazypants.enderio.machine.power.CapacitorBankRenderer;
|
||||
import crazypants.enderio.machine.ranged.RangeEntity;
|
||||
import crazypants.enderio.machine.ranged.RangeRenerer;
|
||||
import crazypants.enderio.machine.ranged.RangeRenderer;
|
||||
import crazypants.enderio.machine.reservoir.ReservoirRenderer;
|
||||
import crazypants.enderio.machine.reservoir.TileReservoir;
|
||||
import crazypants.enderio.machine.solar.BlockSolarPanel;
|
||||
@@ -132,22 +135,6 @@ import crazypants.enderio.teleport.telepad.TelePadRenderer;
|
||||
import crazypants.enderio.teleport.telepad.TelePadSpecialRenderer;
|
||||
import crazypants.enderio.teleport.telepad.TeleportEntityRenderHandler;
|
||||
import crazypants.enderio.teleport.telepad.TileTelePad;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ClientProxy extends CommonProxy {
|
||||
@@ -163,10 +150,6 @@ public class ClientProxy extends CommonProxy {
|
||||
};
|
||||
// @formatter:on
|
||||
|
||||
private final List<ConduitRenderer> conduitRenderers = new ArrayList<ConduitRenderer>();
|
||||
|
||||
private final DefaultConduitRenderer dcr = new DefaultConduitRenderer();
|
||||
|
||||
private ConduitBundleRenderer cbr;
|
||||
|
||||
private boolean checkedNei = false;
|
||||
@@ -255,6 +238,8 @@ public class ClientProxy extends CommonProxy {
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockPainter), machRen);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCrafter), machRen);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockBuffer), machRen);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockPoweredSpawner), machRen);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockSliceAndSplice), machRen);
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemBrokenSpawner, new BrokenSpawnerRenderer());
|
||||
|
||||
@@ -273,14 +258,17 @@ public class ClientProxy extends CommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileFarmStation.class, new FarmingStationSpecialRenderer());
|
||||
|
||||
BlockSoulBinder.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new SoulBinderRenderer());
|
||||
SoulBinderRenderer soulBinderRenderer = new SoulBinderRenderer();
|
||||
RenderingRegistry.registerBlockHandler(soulBinderRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockSoulFuser), soulBinderRenderer);
|
||||
|
||||
ObeliskRenderer defaultObeliskRenderer = new ObeliskRenderer();
|
||||
BlockObeliskAbstract.defaultObeliskRenderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(defaultObeliskRenderer);
|
||||
|
||||
ObeliskSpecialRenderer<TileAttractor> attRen = new ObeliskSpecialRenderer<TileAttractor>(
|
||||
new ItemStack(EnderIO.itemMaterial, 1, Material.ATTRACTOR_CRYSTAL.ordinal()), defaultObeliskRenderer);
|
||||
ObeliskSpecialRenderer<TileAttractor> attRen = new ObeliskSpecialRenderer<>(
|
||||
new ItemStack(EnderIO.itemMaterial, 1, Material.ATTRACTOR_CRYSTAL.ordinal()),
|
||||
defaultObeliskRenderer);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileAttractor.class, attRen);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockAttractor), attRen);
|
||||
|
||||
@@ -288,19 +276,22 @@ public class ClientProxy extends CommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileAversionObelisk.class, sgr);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockSpawnGuard), sgr);
|
||||
|
||||
ObeliskSpecialRenderer<TileExperienceObelisk> eor = new ObeliskSpecialRenderer<TileExperienceObelisk>(
|
||||
new ItemStack(EnderIO.itemXpTransfer), defaultObeliskRenderer);
|
||||
ObeliskSpecialRenderer<TileExperienceObelisk> eor = new ObeliskSpecialRenderer<>(
|
||||
new ItemStack(EnderIO.itemXpTransfer),
|
||||
defaultObeliskRenderer);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileExperienceObelisk.class, eor);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockExperianceOblisk), eor);
|
||||
|
||||
ObeliskSpecialRenderer<TileWeatherObelisk> twr =
|
||||
new WeatherObeliskSpecialRenderer(new ItemStack(Items.fireworks), defaultObeliskRenderer);
|
||||
ObeliskSpecialRenderer<TileWeatherObelisk> twr = new WeatherObeliskSpecialRenderer(
|
||||
new ItemStack(Items.fireworks),
|
||||
defaultObeliskRenderer);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileWeatherObelisk.class, twr);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockWeatherObelisk), twr);
|
||||
|
||||
BlockCombustionGenerator.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
TechneMachineRenderer<TileCombustionGenerator> cr = new TechneMachineRenderer<TileCombustionGenerator>(
|
||||
EnderIO.blockCombustionGenerator, "models/combustionGen");
|
||||
TechneMachineRenderer<TileCombustionGenerator> cr = new TechneMachineRenderer<>(
|
||||
EnderIO.blockCombustionGenerator,
|
||||
"models/combustionGen");
|
||||
RenderingRegistry.registerBlockHandler(cr);
|
||||
|
||||
ZombieGeneratorRenderer zgr = new ZombieGeneratorRenderer();
|
||||
@@ -314,7 +305,7 @@ public class ClientProxy extends CommonProxy {
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockKillerJoe), kjr);
|
||||
|
||||
BlockVat.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
TechneMachineRenderer<TileVat> vr = new TechneMachineRenderer<TileVat>(EnderIO.blockVat, "models/vat");
|
||||
TechneMachineRenderer<TileVat> vr = new TechneMachineRenderer<>(EnderIO.blockVat, "models/vat");
|
||||
RenderingRegistry.registerBlockHandler(vr);
|
||||
|
||||
FusedQuartzFrameRenderer fqfr = new FusedQuartzFrameRenderer();
|
||||
@@ -331,13 +322,6 @@ public class ClientProxy extends CommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCapBank.class, newCbr);
|
||||
}
|
||||
|
||||
CapacitorBankRenderer capr = new CapacitorBankRenderer();
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCapacitorBank), capr);
|
||||
|
||||
BlockCapacitorBank.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
CapBankRenderer2 cbr2 = new CapBankRenderer2();
|
||||
RenderingRegistry.registerBlockHandler(cbr2);
|
||||
|
||||
BlockVacuumChest.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
VacuumChestRenderer vcr = new VacuumChestRenderer();
|
||||
RenderingRegistry.registerBlockHandler(vcr);
|
||||
@@ -369,8 +353,8 @@ public class ClientProxy extends CommonProxy {
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockTravelPlatform), pir);
|
||||
|
||||
BlockPaintedGlowstone.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(
|
||||
new PaintedBlockRenderer(BlockPaintedGlowstone.renderId, Blocks.glowstone));
|
||||
RenderingRegistry
|
||||
.registerBlockHandler(new PaintedBlockRenderer(BlockPaintedGlowstone.renderId, Blocks.glowstone));
|
||||
|
||||
BlockTravelAnchor.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(
|
||||
@@ -380,6 +364,7 @@ public class ClientProxy extends CommonProxy {
|
||||
TelePadRenderer telePadRenderer = new TelePadRenderer();
|
||||
RenderingRegistry.registerBlockHandler(telePadRenderer);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTelePad.class, new TelePadSpecialRenderer(telePadRenderer));
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockTelePad), telePadRenderer);
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemMachinePart, new MachinePartRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemConduitFacade, new FacadeRenderer());
|
||||
@@ -387,7 +372,6 @@ public class ClientProxy extends CommonProxy {
|
||||
cbr = new ConduitBundleRenderer((float) Config.conduitScale);
|
||||
BlockConduitBundle.rendererId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(cbr);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileConduitBundle.class, cbr);
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTravelAnchor.class, new TravelEntitySpecialRenderer());
|
||||
|
||||
@@ -396,26 +380,12 @@ public class ClientProxy extends CommonProxy {
|
||||
RenderingRegistry.registerBlockHandler(esk);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockEndermanSkull), esk);
|
||||
|
||||
conduitRenderers.add(RedstoneSwitchRenderer.getInstance());
|
||||
conduitRenderers.add(new AdvancedLiquidConduitRenderer());
|
||||
conduitRenderers.add(LiquidConduitRenderer.create());
|
||||
conduitRenderers.add(new PowerConduitRenderer());
|
||||
conduitRenderers.add(new InsulatedRedstoneConduitRenderer());
|
||||
conduitRenderers.add(new EnderLiquidConduitRenderer());
|
||||
conduitRenderers.add(new crazypants.enderio.conduit.item.ItemConduitRenderer());
|
||||
if (GasUtil.isGasConduitEnabled()) {
|
||||
conduitRenderers.add(new GasConduitRenderer());
|
||||
}
|
||||
if (OCUtil.isOCEnabled()) {
|
||||
conduitRenderers.add(new OCConduitRenderer());
|
||||
}
|
||||
|
||||
EnderIoRenderer eior = new EnderIoRenderer();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEnderIO.class, eior);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockEnderIo), eior);
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(
|
||||
TileReservoir.class, new ReservoirRenderer(EnderIO.blockReservoir));
|
||||
ClientRegistry
|
||||
.bindTileEntitySpecialRenderer(TileReservoir.class, new ReservoirRenderer(EnderIO.blockReservoir));
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTank.class, new TankFluidRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockTank), new TankItemRenderer());
|
||||
|
||||
@@ -444,7 +414,7 @@ public class ClientProxy extends CommonProxy {
|
||||
FMLCommonHandler.instance().bus().register(KeyTracker.instance);
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(SoundEntity.class, new SoundRenderer());
|
||||
RenderingRegistry.registerEntityRenderingHandler(RangeEntity.class, new RangeRenerer());
|
||||
RenderingRegistry.registerEntityRenderingHandler(RangeEntity.class, new RangeRenderer());
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(SoundDetector.instance);
|
||||
FMLCommonHandler.instance().bus().register(SoundDetector.instance);
|
||||
@@ -473,12 +443,7 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
@Override
|
||||
public ConduitRenderer getRendererForConduit(IConduit conduit) {
|
||||
for (ConduitRenderer renderer : conduitRenderers) {
|
||||
if (renderer.isRendererForConduit(conduit)) {
|
||||
return renderer;
|
||||
}
|
||||
}
|
||||
return dcr;
|
||||
return conduit.getRenderer();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,26 +1,33 @@
|
||||
package crazypants.enderio;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import java.text.DecimalFormat;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class CommonProxy {
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartedEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent;
|
||||
import crazypants.enderio.conduit.ConduitNetworkTickHandler;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.machine.hypercube.HyperCubeRegister;
|
||||
import crazypants.enderio.machine.transceiver.ServerChannelRegister;
|
||||
import crazypants.enderio.machine.wireless.WirelessChargerController;
|
||||
|
||||
private static final DecimalFormat FORMAT = new DecimalFormat("########0.000");
|
||||
public class CommonProxy {
|
||||
|
||||
protected long serverTickCount = 0;
|
||||
protected long clientTickCount = 0;
|
||||
protected final TickTimer tickTimer = new TickTimer();
|
||||
public ConduitNetworkTickHandler conduitNetworkTickHandler = null;
|
||||
public WirelessChargerController wirelessChargerController = null;
|
||||
|
||||
public CommonProxy() {}
|
||||
|
||||
@@ -32,6 +39,7 @@ public class CommonProxy {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ConduitRenderer getRendererForConduit(IConduit conduit) {
|
||||
return null;
|
||||
}
|
||||
@@ -41,7 +49,7 @@ public class CommonProxy {
|
||||
}
|
||||
|
||||
public void loadIcons() {
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
public void load() {
|
||||
@@ -73,6 +81,26 @@ public class CommonProxy {
|
||||
return new ResourceLocation(EnderIO.DOMAIN + TEXTURE_PATH + name + TEXTURE_EXT);
|
||||
}
|
||||
|
||||
public void onServerAboutToStart(FMLServerAboutToStartEvent event) {
|
||||
conduitNetworkTickHandler = new ConduitNetworkTickHandler();
|
||||
FMLCommonHandler.instance().bus().register(conduitNetworkTickHandler);
|
||||
wirelessChargerController = new WirelessChargerController();
|
||||
FMLCommonHandler.instance().bus().register(wirelessChargerController);
|
||||
}
|
||||
|
||||
public void onServerStarted(FMLServerStartedEvent event) {
|
||||
HyperCubeRegister.load();
|
||||
ServerChannelRegister.load();
|
||||
}
|
||||
|
||||
public void onServerStopped(FMLServerStoppedEvent event) {
|
||||
HyperCubeRegister.unload();
|
||||
FMLCommonHandler.instance().bus().unregister(conduitNetworkTickHandler);
|
||||
conduitNetworkTickHandler = null;
|
||||
FMLCommonHandler.instance().bus().unregister(wirelessChargerController);
|
||||
wirelessChargerController = null;
|
||||
}
|
||||
|
||||
public final class TickTimer {
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -4,9 +4,27 @@ import static crazypants.enderio.EnderIO.MODID;
|
||||
import static crazypants.enderio.EnderIO.MOD_NAME;
|
||||
import static crazypants.enderio.EnderIO.VERSION;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import com.enderio.core.common.Lang;
|
||||
import com.enderio.core.common.util.EntityUtil;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
@@ -17,15 +35,19 @@ import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
|
||||
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartedEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import crazypants.enderio.api.IMC;
|
||||
import crazypants.enderio.betterbuilderswands.PaintedCustomMapping;
|
||||
import crazypants.enderio.block.BlockDarkSteelAnvil;
|
||||
import crazypants.enderio.block.BlockDarkSteelLadder;
|
||||
import crazypants.enderio.block.BlockDarkSteelPressurePlate;
|
||||
@@ -42,6 +64,7 @@ import crazypants.enderio.conduit.item.ItemItemConduit;
|
||||
import crazypants.enderio.conduit.item.filter.ItemBasicItemFilter;
|
||||
import crazypants.enderio.conduit.item.filter.ItemBigItemFilter;
|
||||
import crazypants.enderio.conduit.item.filter.ItemExistingItemFilter;
|
||||
import crazypants.enderio.conduit.item.filter.ItemLimitedItemFilter;
|
||||
import crazypants.enderio.conduit.item.filter.ItemModItemFilter;
|
||||
import crazypants.enderio.conduit.item.filter.ItemPowerItemFilter;
|
||||
import crazypants.enderio.conduit.liquid.ItemLiquidConduit;
|
||||
@@ -90,7 +113,6 @@ import crazypants.enderio.machine.generator.zombie.BlockZombieGenerator.BlockEnd
|
||||
import crazypants.enderio.machine.generator.zombie.BlockZombieGenerator.BlockFrankenZombieGenerator;
|
||||
import crazypants.enderio.machine.generator.zombie.PacketNutrientTank;
|
||||
import crazypants.enderio.machine.hypercube.BlockHyperCube;
|
||||
import crazypants.enderio.machine.hypercube.HyperCubeRegister;
|
||||
import crazypants.enderio.machine.invpanel.BlockInventoryPanel;
|
||||
import crazypants.enderio.machine.killera.BlockKillerJoe;
|
||||
import crazypants.enderio.machine.light.BlockElectricLight;
|
||||
@@ -111,7 +133,6 @@ import crazypants.enderio.machine.painter.BlockPaintedStair;
|
||||
import crazypants.enderio.machine.painter.BlockPaintedWall;
|
||||
import crazypants.enderio.machine.painter.BlockPainter;
|
||||
import crazypants.enderio.machine.painter.PaintSourceValidator;
|
||||
import crazypants.enderio.machine.power.BlockCapacitorBank;
|
||||
import crazypants.enderio.machine.ranged.RangeEntity;
|
||||
import crazypants.enderio.machine.reservoir.BlockReservoir;
|
||||
import crazypants.enderio.machine.slicensplice.BlockSliceAndSplice;
|
||||
@@ -150,7 +171,7 @@ import crazypants.enderio.material.endergy.ItemAlloyEndergy;
|
||||
import crazypants.enderio.material.endergy.ItemGrindingBallEndergy;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.rail.BlockEnderRail;
|
||||
import crazypants.enderio.teleport.ItemInfiniteTravelStaff;
|
||||
import crazypants.enderio.teleport.ItemTeleportStaff;
|
||||
import crazypants.enderio.teleport.ItemTravelStaff;
|
||||
import crazypants.enderio.teleport.TeleportRecipes;
|
||||
import crazypants.enderio.teleport.TravelController;
|
||||
@@ -160,35 +181,25 @@ import crazypants.enderio.teleport.telepad.ItemCoordSelector;
|
||||
import crazypants.enderio.thaumcraft.ThaumcraftCompat;
|
||||
import crazypants.enderio.tool.EnderIOCrashCallable;
|
||||
import crazypants.util.EE3Util;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
@Mod(
|
||||
modid = MODID,
|
||||
name = MOD_NAME,
|
||||
version = VERSION,
|
||||
dependencies =
|
||||
"after:endercore;after:MineFactoryReloaded;after:Forestry;after:Waila@[1.5.8,);after:Thaumcraft;after:appliedenergistics2@[rv2-beta-8,);after:chisel",
|
||||
guiFactory = "crazypants.enderio.config.ConfigFactoryEIO")
|
||||
@Mod(modid = MODID, name = MOD_NAME, version = VERSION, dependencies = """
|
||||
required-after:CoFHLib@[1.7.10R1.0.3B3,);\
|
||||
required-after:endercore;\
|
||||
required-after:gtnhlib@[0.9.47,);\
|
||||
after:MineFactoryReloaded;\
|
||||
after:Forestry;\
|
||||
after:Waila@[1.5.8,);\
|
||||
after:Thaumcraft;\
|
||||
after:appliedenergistics2@[rv2-beta-8,);\
|
||||
after:Railcraft@[9.16.7,);\
|
||||
after:betterbuilderswands@[0.13.12,)\
|
||||
""", guiFactory = "crazypants.enderio.config.ConfigFactoryEIO")
|
||||
public class EnderIO {
|
||||
|
||||
public static final String MODID = "EnderIO";
|
||||
public static final String DOMAIN = MODID.toLowerCase(Locale.US);
|
||||
public static final String MOD_NAME = "Ender IO";
|
||||
public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
public static final String VERSION = Tags.VERSION;
|
||||
|
||||
@Instance(MODID)
|
||||
public static EnderIO instance;
|
||||
@@ -202,6 +213,13 @@ public class EnderIO {
|
||||
|
||||
public static final Lang lang = new Lang("enderio");
|
||||
|
||||
public static final boolean hasLwjgl3 = Loader.isModLoaded("lwjgl3ify");
|
||||
public static final boolean hasGT5 = Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi");
|
||||
public static final boolean hasHP = Loader.isModLoaded("hodgepodge");
|
||||
public static final boolean hasEtFuturum = Loader.isModLoaded("etfuturum");
|
||||
public static final boolean hasWailaPlugins = Loader.isModLoaded("wailaplugins");
|
||||
public static final boolean hasAutomagy = Loader.isModLoaded("Automagy");
|
||||
|
||||
// Materials
|
||||
public static ItemCapacitor itemBasicCapacitor;
|
||||
public static ItemAlloy itemAlloy;
|
||||
@@ -229,7 +247,7 @@ public class EnderIO {
|
||||
public static BlockTelePad blockTelePad;
|
||||
public static ItemCoordSelector itemCoordSelector;
|
||||
public static ItemTravelStaff itemTravelStaff;
|
||||
public static ItemInfiniteTravelStaff itemInfiniteTravelStaff;
|
||||
public static ItemTeleportStaff itemTeleportStaff;
|
||||
|
||||
// Painter
|
||||
public static BlockPainter blockPainter;
|
||||
@@ -257,6 +275,7 @@ public class EnderIO {
|
||||
public static ItemBasicItemFilter itemBasicFilterUpgrade;
|
||||
public static ItemBigItemFilter itemBigFilterUpgrade;
|
||||
public static ItemExistingItemFilter itemExistingItemFilter;
|
||||
public static ItemLimitedItemFilter itemLimitedItemFilter;
|
||||
public static ItemModItemFilter itemModItemFilter;
|
||||
public static ItemPowerItemFilter itemPowerItemFilter;
|
||||
public static ItemExtractSpeedUpgrade itemExtractSpeedUpgrade;
|
||||
@@ -271,7 +290,6 @@ public class EnderIO {
|
||||
public static BlockSolarPanel blockSolarPanel;
|
||||
public static BlockReservoir blockReservoir;
|
||||
public static BlockAlloySmelter blockAlloySmelter;
|
||||
public static BlockCapacitorBank blockCapacitorBank;
|
||||
public static BlockCapBank blockCapBank;
|
||||
public static BlockWirelessCharger blockWirelessCharger;
|
||||
public static BlockCrusher blockCrusher;
|
||||
@@ -381,7 +399,6 @@ public class EnderIO {
|
||||
|
||||
blockCrusher = BlockCrusher.create();
|
||||
blockAlloySmelter = BlockAlloySmelter.create();
|
||||
blockCapacitorBank = BlockCapacitorBank.create();
|
||||
blockCapBank = BlockCapBank.create();
|
||||
|
||||
blockPainter = BlockPainter.create();
|
||||
@@ -462,6 +479,7 @@ public class EnderIO {
|
||||
itemBasicFilterUpgrade = ItemBasicItemFilter.create();
|
||||
itemBigFilterUpgrade = ItemBigItemFilter.create();
|
||||
itemExistingItemFilter = ItemExistingItemFilter.create();
|
||||
itemLimitedItemFilter = ItemLimitedItemFilter.create();
|
||||
itemModItemFilter = ItemModItemFilter.create();
|
||||
itemPowerItemFilter = ItemPowerItemFilter.create();
|
||||
itemExtractSpeedUpgrade = ItemExtractSpeedUpgrade.create();
|
||||
@@ -474,14 +492,16 @@ public class EnderIO {
|
||||
itemGrindingBall = ItemGrindingBall.create();
|
||||
itemAlloyEndergy = ItemAlloyEndergy.create();
|
||||
itemGrindingBallEndergy = ItemGrindingBallEndergy.create();
|
||||
itemPowderIngot = ItemPowderIngot.create();
|
||||
if (!hasGT5) {
|
||||
itemPowderIngot = ItemPowderIngot.create();
|
||||
}
|
||||
|
||||
registerFluids();
|
||||
|
||||
itemYetaWench = ItemYetaWrench.create();
|
||||
itemEnderface = ItemEnderface.create();
|
||||
itemTravelStaff = ItemTravelStaff.create();
|
||||
itemInfiniteTravelStaff = ItemInfiniteTravelStaff.create();
|
||||
itemTeleportStaff = ItemTeleportStaff.create();
|
||||
itemConduitProbe = ItemConduitProbe.create();
|
||||
|
||||
itemXpTransfer = ItemXpTransfer.create();
|
||||
@@ -516,11 +536,14 @@ public class EnderIO {
|
||||
Fluid f = new Fluid(Fluids.NUTRIENT_DISTILLATION).setDensity(1500).setViscosity(3000);
|
||||
FluidRegistry.registerFluid(f);
|
||||
fluidNutrientDistillation = FluidRegistry.getFluid(f.getName());
|
||||
blockNutrientDistillation =
|
||||
BlockFluidEio.NutrientDistillation.create(fluidNutrientDistillation, Material.water);
|
||||
blockNutrientDistillation = BlockFluidEio.NutrientDistillation
|
||||
.create(fluidNutrientDistillation, Material.water);
|
||||
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
PacketNutrientTank.class, PacketNutrientTank.class, PacketHandler.nextID(), Side.CLIENT);
|
||||
PacketNutrientTank.class,
|
||||
PacketNutrientTank.class,
|
||||
PacketHandler.nextID(),
|
||||
Side.CLIENT);
|
||||
|
||||
f = new Fluid(Fluids.HOOTCH).setDensity(900).setViscosity(1000);
|
||||
FluidRegistry.registerFluid(f);
|
||||
@@ -543,9 +566,7 @@ public class EnderIO {
|
||||
Fluids.ROCKET_FUEL + "@"
|
||||
+ (Config.rocketFuelPowerPerCycleRF / 10 * Config.rocketFuelPowerTotalBurnTime));
|
||||
|
||||
f = new Fluid(Fluids.FIRE_WATER)
|
||||
.setDensity(900)
|
||||
.setViscosity(1000)
|
||||
f = new Fluid(Fluids.FIRE_WATER).setDensity(900).setViscosity(1000)
|
||||
.setTemperature(FluidRegistry.LAVA.getTemperature() * 2);
|
||||
FluidRegistry.registerFluid(f);
|
||||
fluidFireWater = FluidRegistry.getFluid(f.getName());
|
||||
@@ -569,22 +590,15 @@ public class EnderIO {
|
||||
f = new Fluid(Fluids.CLOUD_SEED_CONCENTRATED).setDensity(1000).setViscosity(1200);
|
||||
FluidRegistry.registerFluid(f);
|
||||
fluidCloudSeedConcentrated = FluidRegistry.getFluid(f.getName());
|
||||
blockCloudSeedConcentrated =
|
||||
BlockFluidEio.CloudSeedConcentrated.create(fluidCloudSeedConcentrated, Material.water);
|
||||
blockCloudSeedConcentrated = BlockFluidEio.CloudSeedConcentrated
|
||||
.create(fluidCloudSeedConcentrated, Material.water);
|
||||
|
||||
f = new Fluid(Fluids.ENDER_DISTILLATION)
|
||||
.setDensity(200)
|
||||
.setViscosity(1000)
|
||||
.setTemperature(175);
|
||||
f = new Fluid(Fluids.ENDER_DISTILLATION).setDensity(200).setViscosity(1000).setTemperature(175);
|
||||
FluidRegistry.registerFluid(f);
|
||||
fluidEnderDistillation = FluidRegistry.getFluid(f.getName());
|
||||
blockEnderDistillation = BlockFluidEio.create(fluidEnderDistillation, Material.water);
|
||||
|
||||
f = new Fluid(Fluids.VAPOR_OF_LEVITY)
|
||||
.setDensity(-10)
|
||||
.setViscosity(100)
|
||||
.setTemperature(5)
|
||||
.setGaseous(true);
|
||||
f = new Fluid(Fluids.VAPOR_OF_LEVITY).setDensity(-10).setViscosity(100).setTemperature(5).setGaseous(true);
|
||||
FluidRegistry.registerFluid(f);
|
||||
fluidVapourOfLevity = FluidRegistry.getFluid(f.getName());
|
||||
blockVapourOfLevity = BlockFluidEio.VapourOfLevity.create(fluidVapourOfLevity, Material.water);
|
||||
@@ -592,10 +606,7 @@ public class EnderIO {
|
||||
|
||||
if (!Loader.isModLoaded("OpenBlocks")) {
|
||||
Log.info("XP Juice registered by Ender IO.");
|
||||
fluidXpJuice = new Fluid(Config.xpJuiceName)
|
||||
.setLuminosity(10)
|
||||
.setDensity(800)
|
||||
.setViscosity(1500)
|
||||
fluidXpJuice = new Fluid(Config.xpJuiceName).setLuminosity(10).setDensity(800).setViscosity(1500)
|
||||
.setUnlocalizedName("eio.xpjuice");
|
||||
FluidRegistry.registerFluid(fluidXpJuice);
|
||||
itemBucketXpJuice = ItemBucketEio.create(fluidXpJuice);
|
||||
@@ -622,16 +633,22 @@ public class EnderIO {
|
||||
instance = this;
|
||||
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
PacketRedstoneMode.class, PacketRedstoneMode.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketRedstoneMode.class,
|
||||
PacketRedstoneMode.class,
|
||||
PacketHandler.nextID(),
|
||||
Side.SERVER);
|
||||
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(this, guiHandler);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
// Register Custom Dungeon Loot here
|
||||
if (Config.lootDarkSteel) {
|
||||
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST)
|
||||
.addItem(new WeightedRandomChestContent(
|
||||
new ItemStack(EnderIO.itemAlloy, 1, Alloy.DARK_STEEL.ordinal()), 1, 3, 15));
|
||||
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(
|
||||
new WeightedRandomChestContent(
|
||||
new ItemStack(EnderIO.itemAlloy, 1, Alloy.DARK_STEEL.ordinal()),
|
||||
1,
|
||||
3,
|
||||
15));
|
||||
}
|
||||
|
||||
if (Config.lootItemConduitProbe) {
|
||||
@@ -655,33 +672,48 @@ public class EnderIO {
|
||||
}
|
||||
|
||||
if (Config.lootElectricSteel) {
|
||||
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH)
|
||||
.addItem(new WeightedRandomChestContent(
|
||||
new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()), 2, 6, 20));
|
||||
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
|
||||
new WeightedRandomChestContent(
|
||||
new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()),
|
||||
2,
|
||||
6,
|
||||
20));
|
||||
}
|
||||
|
||||
if (Config.lootRedstoneAlloy) {
|
||||
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH)
|
||||
.addItem(new WeightedRandomChestContent(
|
||||
new ItemStack(EnderIO.itemAlloy, 1, Alloy.REDSTONE_ALLOY.ordinal()), 3, 6, 35));
|
||||
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
|
||||
new WeightedRandomChestContent(
|
||||
new ItemStack(EnderIO.itemAlloy, 1, Alloy.REDSTONE_ALLOY.ordinal()),
|
||||
3,
|
||||
6,
|
||||
35));
|
||||
}
|
||||
|
||||
if (Config.lootDarkSteel) {
|
||||
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH)
|
||||
.addItem(new WeightedRandomChestContent(
|
||||
new ItemStack(EnderIO.itemAlloy, 1, Alloy.DARK_STEEL.ordinal()), 3, 6, 35));
|
||||
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
|
||||
new WeightedRandomChestContent(
|
||||
new ItemStack(EnderIO.itemAlloy, 1, Alloy.DARK_STEEL.ordinal()),
|
||||
3,
|
||||
6,
|
||||
35));
|
||||
}
|
||||
|
||||
if (Config.lootPhasedIron) {
|
||||
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH)
|
||||
.addItem(new WeightedRandomChestContent(
|
||||
new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_IRON.ordinal()), 1, 2, 10));
|
||||
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
|
||||
new WeightedRandomChestContent(
|
||||
new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_IRON.ordinal()),
|
||||
1,
|
||||
2,
|
||||
10));
|
||||
}
|
||||
|
||||
if (Config.lootPhasedGold) {
|
||||
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH)
|
||||
.addItem(new WeightedRandomChestContent(
|
||||
new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal()), 1, 2, 5));
|
||||
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
|
||||
new WeightedRandomChestContent(
|
||||
new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal()),
|
||||
1,
|
||||
2,
|
||||
5));
|
||||
}
|
||||
|
||||
if (Config.lootTravelStaff) {
|
||||
@@ -702,7 +734,9 @@ public class EnderIO {
|
||||
SkeletonHandler.registerSkeleton(this);
|
||||
}
|
||||
|
||||
MaterialRecipes.registerDependantOresInDictionary();
|
||||
if (!hasGT5) {
|
||||
MaterialRecipes.registerDependantOresInDictionary();
|
||||
}
|
||||
|
||||
EnderfaceRecipes.addRecipes();
|
||||
MaterialRecipes.addRecipes();
|
||||
@@ -768,8 +802,8 @@ public class EnderIO {
|
||||
|
||||
@EventHandler
|
||||
public void loadComplete(FMLLoadCompleteEvent event) {
|
||||
processImc(FMLInterModComms.fetchRuntimeMessages(
|
||||
this)); // Some mods send IMCs during PostInit, so we catch them here.
|
||||
processImc(FMLInterModComms.fetchRuntimeMessages(this)); // Some mods send IMCs during PostInit, so we catch
|
||||
// them here.
|
||||
}
|
||||
|
||||
private static String getXPJuiceName() {
|
||||
@@ -778,8 +812,7 @@ public class EnderIO {
|
||||
try {
|
||||
Field getField = Class.forName("openblocks.Config").getField("xpFluidId");
|
||||
openBlocksXPJuiceName = (String) getField.get(null);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
|
||||
if (openBlocksXPJuiceName != null && !Config.xpJuiceName.equals(openBlocksXPJuiceName)) {
|
||||
Log.info("Overwriting XP Juice name with '" + openBlocksXPJuiceName + "' taken from OpenBlocks' config");
|
||||
@@ -789,7 +822,6 @@ public class EnderIO {
|
||||
return Config.xpJuiceName;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void addModIntegration() {
|
||||
|
||||
if (Loader.isModLoaded("TConstruct")) {
|
||||
@@ -800,6 +832,7 @@ public class EnderIO {
|
||||
|
||||
Class<?> modFluxClass = Class.forName("tconstruct.modifiers.tools.ModFlux");
|
||||
Field batteriesField = modFluxClass.getField("batteries");
|
||||
@SuppressWarnings("unchecked")
|
||||
List<ItemStack> batteries = (List<ItemStack>) batteriesField.get(modFluxInst);
|
||||
batteries.add(new ItemStack(blockCapBank));
|
||||
Log.info("Registered Capacitor Banks as Tinkers Construct Flux Upgrades");
|
||||
@@ -808,6 +841,9 @@ public class EnderIO {
|
||||
Log.info("Failed to registered Capacitor Banks as Tinkers Construct Flux Upgrades");
|
||||
}
|
||||
}
|
||||
if (Loader.isModLoaded("betterbuilderswands")) {
|
||||
PaintedCustomMapping.registerMappings();
|
||||
}
|
||||
|
||||
ThaumcraftCompat.load();
|
||||
}
|
||||
@@ -866,9 +902,28 @@ public class EnderIO {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStarted(FMLServerStartedEvent event) {
|
||||
HyperCubeRegister.load();
|
||||
ServerChannelRegister.load();
|
||||
public void onServerAboutToStart(FMLServerAboutToStartEvent event) {
|
||||
proxy.onServerAboutToStart(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onServerStarted(FMLServerStartedEvent event) {
|
||||
proxy.onServerStarted(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onServerStopped(FMLServerStoppedEvent event) {
|
||||
proxy.onServerStopped(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void remap(FMLMissingMappingsEvent event) {
|
||||
for (FMLMissingMappingsEvent.MissingMapping missingMapping : event.getAll()) {
|
||||
if (missingMapping.type == GameRegistry.Type.ITEM
|
||||
&& missingMapping.name.equals("EnderIO:itemInfiniteTravelStaff")) {
|
||||
missingMapping.remap(itemTeleportStaff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -878,9 +933,4 @@ public class EnderIO {
|
||||
ServerChannelRegister.store();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStopped(FMLServerStoppedEvent event) {
|
||||
HyperCubeRegister.unload();
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,12 @@ package crazypants.enderio;
|
||||
|
||||
import static crazypants.enderio.EnderIO.MODID;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class EnderIOTab extends CreativeTabs {
|
||||
|
||||
public static final CreativeTabs tabEnderIO = new EnderIOTab();
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package crazypants.enderio;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
public class GuiHandler implements IGuiHandler {
|
||||
|
||||
public static final int GUI_ID_ENDERFACE = 1;
|
||||
@@ -58,7 +60,7 @@ public class GuiHandler implements IGuiHandler {
|
||||
|
||||
public static final int GUI_ID_CAP_BANK = 142; // leave room for more machines
|
||||
|
||||
protected final Map<Integer, IGuiHandler> guiHandlers = new HashMap<Integer, IGuiHandler>();
|
||||
protected final Map<Integer, IGuiHandler> guiHandlers = new HashMap<>();
|
||||
|
||||
public void registerGuiHandler(int id, IGuiHandler handler) {
|
||||
guiHandlers.put(id, handler);
|
||||
|
||||
@@ -2,10 +2,13 @@ package crazypants.enderio;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.Marker;
|
||||
import org.apache.logging.log4j.MarkerManager;
|
||||
|
||||
public final class Log {
|
||||
|
||||
public static final Logger LOGGER = LogManager.getLogger(EnderIO.MODID);
|
||||
public static final Marker securityMarker = MarkerManager.getMarker("SuspiciousPackets");
|
||||
|
||||
public static void warn(String msg) {
|
||||
LOGGER.warn(msg);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package crazypants.enderio;
|
||||
|
||||
public enum ModObject {
|
||||
|
||||
// Enderface
|
||||
blockEnderIo,
|
||||
itemEnderface,
|
||||
@@ -17,6 +18,7 @@ public enum ModObject {
|
||||
itemBasicFilterUpgrade,
|
||||
itemBigFilterUpgrade,
|
||||
itemExistingItemFilter,
|
||||
itemLimitedItemFilter,
|
||||
itemModItemFilter,
|
||||
itemPowerItemFilter,
|
||||
itemExtractSpeedUpgrade,
|
||||
@@ -53,7 +55,6 @@ public enum ModObject {
|
||||
blockReservoir,
|
||||
blockAlloySmelter,
|
||||
blockSolarPanel,
|
||||
blockCapacitorBank,
|
||||
blockCapBank,
|
||||
blockSagMill,
|
||||
blockHyperCube,
|
||||
@@ -122,7 +123,7 @@ public enum ModObject {
|
||||
|
||||
itemEnderFood,
|
||||
|
||||
itemInfiniteTravelStaff;
|
||||
itemTeleportStaff;
|
||||
|
||||
public final String unlocalisedName;
|
||||
|
||||
|
||||
@@ -14,119 +14,103 @@ import crazypants.enderio.machine.vat.VatRecipeManager;
|
||||
import crazypants.enderio.teleport.TravelController;
|
||||
|
||||
/**
|
||||
* This class provides the keys for the IMC messages supported by EIO and links
|
||||
* the the details of how the messages are processed. It is preferable not to
|
||||
* refer to these constants directly to avoid a dependence on this class.
|
||||
* This class provides the keys for the IMC messages supported by EIO and links the the details of how the messages are
|
||||
* processed. It is preferable not to refer to these constants directly to avoid a dependence on this class.
|
||||
*/
|
||||
public final class IMC {
|
||||
|
||||
/**
|
||||
* Key for a string message to add Vat recipes. Calls
|
||||
* {@link VatRecipeManager#addCustomRecipes(String)} with the string value of
|
||||
* the message.
|
||||
* Key for a string message to add Vat recipes. Calls {@link VatRecipeManager#addCustomRecipes(String)} with the
|
||||
* string value of the message.
|
||||
*/
|
||||
public static final String VAT_RECIPE = "recipe:vat";
|
||||
|
||||
/**
|
||||
* Key for a string message to add SAGMill recipes. Calls
|
||||
* {@link CrusherRecipeManager#addCustomRecipes(String)} with the string value
|
||||
* of the message.
|
||||
* Key for a string message to add SAGMill recipes. Calls {@link CrusherRecipeManager#addCustomRecipes(String)} with
|
||||
* the string value of the message.
|
||||
*/
|
||||
public static final String SAG_RECIPE = "recipe:sagmill";
|
||||
|
||||
/**
|
||||
* Key for a string message to add Alloy Smelter recipes. Calls
|
||||
* {@link AlloyRecipeManager#addCustomRecipes(String)} with the string value
|
||||
* of the message.
|
||||
* Key for a string message to add Alloy Smelter recipes. Calls {@link AlloyRecipeManager#addCustomRecipes(String)}
|
||||
* with the string value of the message.
|
||||
*/
|
||||
public static final String ALLOY_RECIPE = "recipe:alloysmelter";
|
||||
|
||||
/**
|
||||
* Key for a string message to add Enchanter recipes. Calls
|
||||
* {@link EnchanterRecipeManager#addCustomRecipes(String)} with the string
|
||||
* value of the message. The supplied xml is treated as if it was loaded from
|
||||
* Key for a string message to add Enchanter recipes. Calls {@link EnchanterRecipeManager#addCustomRecipes(String)}
|
||||
* with the string value of the message. The supplied xml is treated as if it was loaded from
|
||||
* EnchanterRecipes_User.xm.
|
||||
*/
|
||||
public static final String ENCHANTER_RECIPE = "recipe:enchanter";
|
||||
|
||||
/**
|
||||
* Key for a string message to add Slice'N'Splice recipes. Calls
|
||||
* {@link SliceAndSpliceRecipeManager#addCustomRecipes(String)} with the
|
||||
* string value of the message.
|
||||
* {@link SliceAndSpliceRecipeManager#addCustomRecipes(String)} with the string value of the message.
|
||||
*/
|
||||
public static final String SLINE_N_SPLICE_RECIPE = "recipe:slicensplice";
|
||||
|
||||
/**
|
||||
* Key for an NBT message to add Soul Binder recipes. Calls
|
||||
* {@link SoulBinderRecipeManager#addRecipeFromNBT(net.minecraft.nbt.NBTTagCompound)}
|
||||
* with the NBT value of the message.
|
||||
* {@link SoulBinderRecipeManager#addRecipeFromNBT(net.minecraft.nbt.NBTTagCompound)} with the NBT value of the
|
||||
* message.
|
||||
*/
|
||||
public static final String SOUL_BINDER_RECIPE = "recipe:soulbinder";
|
||||
|
||||
/**
|
||||
* Key for an ItemStack message to add an item to the Painters paint source
|
||||
* whitelist. Calls
|
||||
* Key for an ItemStack message to add an item to the Painters paint source whitelist. Calls
|
||||
* {@link PaintSourceValidator#addToWhitelist(net.minecraft.item.ItemStack)}
|
||||
*/
|
||||
public static final String PAINTER_WHITELIST_ADD = "painter:whitelist:add";
|
||||
|
||||
/**
|
||||
* Key for an ItemStack message to add an item to the Painters paint source
|
||||
* blacklist. Calls
|
||||
* Key for an ItemStack message to add an item to the Painters paint source blacklist. Calls
|
||||
* {@link PaintSourceValidator#addToBlacklist(net.minecraft.item.ItemStack)}
|
||||
*/
|
||||
public static final String PAINTER_BLACKLIST_ADD = "painter:blacklist:add";
|
||||
|
||||
/**
|
||||
* Key for a string message to add an entity to the Powered Spawner blacklist.
|
||||
* Calls {@link PoweredSpawnerConfig#addToBlacklist(String)} with the string
|
||||
* value of the message.
|
||||
* Key for a string message to add an entity to the Powered Spawner blacklist. Calls
|
||||
* {@link PoweredSpawnerConfig#addToBlacklist(String)} with the string value of the message.
|
||||
*/
|
||||
public static final String POWERED_SPAWNER_BLACKLIST_ADD = "poweredSpawner:blacklist:add";
|
||||
|
||||
/**
|
||||
* Key for an NBT message to specify a cost multiplier for spawning an entity
|
||||
* in the Powered Spawner. Calls
|
||||
* {@link PoweredSpawnerConfig#addEntityCostFromNBT(net.minecraft.nbt.NBTTagCompound)}
|
||||
* with the NBT value of the message.
|
||||
* Key for an NBT message to specify a cost multiplier for spawning an entity in the Powered Spawner. Calls
|
||||
* {@link PoweredSpawnerConfig#addEntityCostFromNBT(net.minecraft.nbt.NBTTagCompound)} with the NBT value of the
|
||||
* message.
|
||||
*/
|
||||
public static final String POWERED_SPAWNER_COST_MULTIPLIER = "poweredSpawner:costMultiplier";
|
||||
|
||||
/**
|
||||
* Key for a string message to add an entity to the Soul Vial blacklist. Calls
|
||||
* {@link ItemSoulVessel#addEntityToBlackList(String)} with the string value
|
||||
* of the message.
|
||||
* {@link ItemSoulVessel#addEntityToBlackList(String)} with the string value of the message.
|
||||
*/
|
||||
public static final String SOUL_VIAL_BLACKLIST = "soulVial:blacklist:add";
|
||||
|
||||
/**
|
||||
* Key for an NBT message to register a fluid fuel. Calls
|
||||
* {@link FluidFuelRegister#addFuel(net.minecraft.nbt.NBTTagCompound)} with
|
||||
* the NBT value of the message.
|
||||
* {@link FluidFuelRegister#addFuel(net.minecraft.nbt.NBTTagCompound)} with the NBT value of the message.
|
||||
*/
|
||||
public static final String FLUID_FUEL_ADD = "fluidFuel:add";
|
||||
|
||||
/**
|
||||
* Key for an NBT message to register a fluid coolant. Calls
|
||||
* {@link FluidFuelRegister#addCoolant(net.minecraft.nbt.NBTTagCompound)} with
|
||||
* the NBT value of the message.
|
||||
* {@link FluidFuelRegister#addCoolant(net.minecraft.nbt.NBTTagCompound)} with the NBT value of the message.
|
||||
*/
|
||||
public static final String FLUID_COOLANT_ADD = "fluidCoolant:add";
|
||||
|
||||
/**
|
||||
* Key for a string message to add a block to the list of blocks that cannot
|
||||
* be teleported through using the Staff of Travel or Dark Steel Travel
|
||||
* Upgrade. Value must be in the form: 'modid:blockName' Calls
|
||||
* {@link TravelController#addBlockToBlinkBlackList(String)} with the string
|
||||
* value of the message.
|
||||
* Key for a string message to add a block to the list of blocks that cannot be teleported through using the Staff
|
||||
* of Travel or Dark Steel Travel Upgrade. Value must be in the form: 'modid:blockName' Calls
|
||||
* {@link TravelController#addBlockToBlinkBlackList(String)} with the string value of the message.
|
||||
*/
|
||||
public static final String TELEPORT_BLACKLIST_ADD = "teleport:blacklist:add";
|
||||
|
||||
/**
|
||||
* Key for an NBT message to register a block or tile entity as connectable to
|
||||
* insulated redstone conduits. Calls
|
||||
* {@link InsulatedRedstoneConduit#addConnectableBlock(net.minecraft.nbt.NBTTagCompound)}
|
||||
* with the NBT value of the message.
|
||||
* Key for an NBT message to register a block or tile entity as connectable to insulated redstone conduits. Calls
|
||||
* {@link InsulatedRedstoneConduit#addConnectableBlock(net.minecraft.nbt.NBTTagCompound)} with the NBT value of the
|
||||
* message.
|
||||
*/
|
||||
public static final String REDSTONE_CONNECTABLE_ADD = "redstone:connectable:add";
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this on your Block or TileEntity to control whether insulated
|
||||
* restone conduits will automatically connect to your block.
|
||||
* Implement this on your Block or TileEntity to control whether insulated restone conduits will automatically connect
|
||||
* to your block.
|
||||
* <p>
|
||||
* Implementing on both is not recommended and will likely not work as expected.
|
||||
*/
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
package crazypants.enderio.api.teleport;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import crazypants.enderio.config.Config;
|
||||
|
||||
public interface IItemOfTravel extends IEnergyContainerItem {
|
||||
|
||||
boolean isActive(EntityPlayer ep, ItemStack equipped);
|
||||
|
||||
void extractInternal(ItemStack equipped, int power);
|
||||
|
||||
/**
|
||||
* @param equipped player who is currently holding this item. caller will ensure the item held has your Item as item
|
||||
* type
|
||||
* @return -1 if method not supported, or max(can extract, power), e.g. 0 if item is empty.
|
||||
*/
|
||||
default int canExtractInternal(ItemStack equipped, int power) {
|
||||
return Config.strictTPItemChecking ? 0 : -1;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,16 @@
|
||||
package crazypants.enderio.api.teleport;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
public interface ITelePad extends ITravelAccessable {
|
||||
|
||||
/**
|
||||
* If this piece of the telepad is the master, meaning it is connected on all
|
||||
* 4 sides. This does <i>not</i> guarantee that it is in a connected state.
|
||||
* If this piece of the telepad is the master, meaning it is connected on all 4 sides. This does <i>not</i>
|
||||
* guarantee that it is in a connected state.
|
||||
*
|
||||
* @return True if this TE is the master TE, false otherwise.
|
||||
*/
|
||||
@@ -17,88 +19,74 @@ public interface ITelePad extends ITravelAccessable {
|
||||
/**
|
||||
* Gets the master telepad that this one is connected to.
|
||||
*
|
||||
* @return The master telepad TE. {@code null} if not in a network. Itself if
|
||||
* it is the master.
|
||||
* @return The master telepad TE. {@code null} if not in a network. Itself if it is the master.
|
||||
*/
|
||||
@Nullable
|
||||
ITelePad getMaster();
|
||||
|
||||
/**
|
||||
* If this telepad piece is in a network, meaning it is connected and in a
|
||||
* valid configuration.
|
||||
* If this telepad piece is in a network, meaning it is connected and in a valid configuration.
|
||||
*
|
||||
* @return True if this TE is in a network, false otherwise.
|
||||
*/
|
||||
boolean inNetwork();
|
||||
|
||||
/**
|
||||
* The X coordinate stored in this telepad network. Always 0 if this is
|
||||
* {@link #inNetwork()} returns false.
|
||||
* The X coordinate stored in this telepad network. Always 0 if this is {@link #inNetwork()} returns false.
|
||||
*
|
||||
* @return The target X coordinate.
|
||||
*/
|
||||
int getX();
|
||||
|
||||
/**
|
||||
* The Y coordinate stored in this telepad network. Always 0 if this is
|
||||
* {@link #inNetwork()} returns false.
|
||||
* The Y coordinate stored in this telepad network. Always 0 if this is {@link #inNetwork()} returns false.
|
||||
*
|
||||
* @return The target Y coordinate.
|
||||
*/
|
||||
int getY();
|
||||
|
||||
/**
|
||||
* The Z coordinate stored in this telepad network. Always 0 if this is
|
||||
* {@link #inNetwork()} returns false.
|
||||
* The Z coordinate stored in this telepad network. Always 0 if this is {@link #inNetwork()} returns false.
|
||||
*
|
||||
* @return The target Z coordinate.
|
||||
*/
|
||||
int getZ();
|
||||
|
||||
/**
|
||||
* The target dimension ID for the telepad. Defaults to the dimension the
|
||||
* block is placed in.
|
||||
* The target dimension ID for the telepad. Defaults to the dimension the block is placed in.
|
||||
*
|
||||
* @return An int dimension ID.
|
||||
*/
|
||||
int getTargetDim();
|
||||
|
||||
/**
|
||||
* Sets the target X coordinate of the network. Has no effect if
|
||||
* {@link #inNetwork()} returns false.
|
||||
* Sets the target X coordinate of the network. Has no effect if {@link #inNetwork()} returns false.
|
||||
*
|
||||
* @param x
|
||||
* The X coord.
|
||||
* @param x The X coord.
|
||||
* @return The master telepad TE. DOES NOT ALWAYS return itself.
|
||||
*/
|
||||
ITelePad setX(int x);
|
||||
|
||||
/**
|
||||
* Sets the target Y coordinate of the network. Has no effect if
|
||||
* {@link #inNetwork()} returns false.
|
||||
* Sets the target Y coordinate of the network. Has no effect if {@link #inNetwork()} returns false.
|
||||
*
|
||||
* @param y
|
||||
* The Y coord.
|
||||
* @param y The Y coord.
|
||||
* @return The master telepad TE. DOES NOT ALWAYS return itself.
|
||||
*/
|
||||
ITelePad setY(int y);
|
||||
|
||||
/**
|
||||
* Sets the target Z coordinate of the network. Has no effect if
|
||||
* {@link #inNetwork()} returns false.
|
||||
* Sets the target Z coordinate of the network. Has no effect if {@link #inNetwork()} returns false.
|
||||
*
|
||||
* @param z
|
||||
* The Z coord.
|
||||
* @param z The Z coord.
|
||||
* @return The master telepad TE. DOES NOT ALWAYS return itself.
|
||||
*/
|
||||
ITelePad setZ(int z);
|
||||
|
||||
/**
|
||||
* Sets the target dimension of the network. Has no effect if
|
||||
* {@link #inNetwork()} returns false.
|
||||
* Sets the target dimension of the network. Has no effect if {@link #inNetwork()} returns false.
|
||||
*
|
||||
* @param dimID
|
||||
* The dimension ID.
|
||||
* @param dimID The dimension ID.
|
||||
* @return The master telepad TE. DOES NOT ALWAYS return itself.
|
||||
*/
|
||||
ITelePad setTargetDim(int dimID);
|
||||
@@ -106,12 +94,10 @@ public interface ITelePad extends ITravelAccessable {
|
||||
/**
|
||||
* Util method to set all coords using a {@link BlockCoord} object.
|
||||
*
|
||||
* @param coords The coords to set this telepad to.
|
||||
* @see #setX(int)
|
||||
* @see #setY(int)
|
||||
* @see #setZ(int)
|
||||
*
|
||||
* @param coords
|
||||
* The coords to set this telepad to.
|
||||
*/
|
||||
void setCoords(BlockCoord coords);
|
||||
|
||||
@@ -122,14 +108,12 @@ public interface ITelePad extends ITravelAccessable {
|
||||
* <li>There is sufficient power to perform the operation</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param entity
|
||||
* The entity to teleport
|
||||
* @param entity The entity to teleport
|
||||
*/
|
||||
void teleportSpecific(Entity entity);
|
||||
|
||||
/**
|
||||
* Teleports all entities in range (in no particular order) until either there
|
||||
* are none left or the power runs out.
|
||||
* Teleports all entities in range (in no particular order) until either there are none left or the power runs out.
|
||||
*/
|
||||
void teleportAll();
|
||||
}
|
||||
@@ -1,12 +1,16 @@
|
||||
package crazypants.enderio.api.teleport;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import crazypants.util.UserIdent;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import crazypants.util.UserIdent;
|
||||
|
||||
public interface ITravelAccessable {
|
||||
|
||||
enum AccessMode {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package crazypants.enderio.api.teleport;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
|
||||
/**
|
||||
* An event that can be used to respond to, edit, and prevent entity teleports.
|
||||
* <p>
|
||||
@@ -13,10 +14,8 @@ import net.minecraftforge.event.entity.EntityEvent;
|
||||
* <li>Staff of travelling</li>
|
||||
* <li>Telepad</li>
|
||||
* </ul>
|
||||
*
|
||||
* As well as any externally added teleports, assuming they fire this event
|
||||
* manually.
|
||||
*
|
||||
* <p>
|
||||
* As well as any externally added teleports, assuming they fire this event manually.
|
||||
*/
|
||||
@Cancelable
|
||||
public class TeleportEntityEvent extends EntityEvent {
|
||||
@@ -31,14 +30,10 @@ public class TeleportEntityEvent extends EntityEvent {
|
||||
/**
|
||||
* Fired before an entity teleports to the given location.
|
||||
*
|
||||
* @param entity
|
||||
* The entity teleporting
|
||||
* @param x
|
||||
* The target X coord
|
||||
* @param y
|
||||
* The target Y coord
|
||||
* @param z
|
||||
* The target Z coord
|
||||
* @param entity The entity teleporting
|
||||
* @param x The target X coord
|
||||
* @param y The target Y coord
|
||||
* @param z The target Z coord
|
||||
*/
|
||||
public TeleportEntityEvent(Entity entity, TravelSource source, int x, int y, int z) {
|
||||
super(entity);
|
||||
|
||||
@@ -1,21 +1,25 @@
|
||||
package crazypants.enderio.api.teleport;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.teleport.TravelController;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public enum TravelSource {
|
||||
|
||||
BLOCK() {
|
||||
|
||||
@Override
|
||||
public int getMaxDistanceTravelled() {
|
||||
return Config.travelAnchorMaxDistance;
|
||||
}
|
||||
},
|
||||
STAFF() {
|
||||
|
||||
@Override
|
||||
public int getMaxDistanceTravelled() {
|
||||
return Config.travelStaffMaxDistance;
|
||||
@@ -27,6 +31,7 @@ public enum TravelSource {
|
||||
}
|
||||
},
|
||||
STAFF_BLINK() {
|
||||
|
||||
@Override
|
||||
public int getMaxDistanceTravelled() {
|
||||
return Config.travelStaffMaxBlinkDistance;
|
||||
@@ -37,6 +42,31 @@ public enum TravelSource {
|
||||
return Config.travelStaffPowerPerBlockRF;
|
||||
}
|
||||
},
|
||||
|
||||
TELEPORT_STAFF() {
|
||||
|
||||
@Override
|
||||
public int getMaxDistanceTravelled() {
|
||||
return Config.teleportStaffMaxDistance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPowerCostPerBlockTraveledRF() {
|
||||
return 0f;
|
||||
}
|
||||
},
|
||||
TELEPORT_STAFF_BLINK() {
|
||||
|
||||
@Override
|
||||
public int getMaxDistanceTravelled() {
|
||||
return Config.teleportStaffMaxBlinkDistance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPowerCostPerBlockTraveledRF() {
|
||||
return 0f;
|
||||
}
|
||||
},
|
||||
TELEPAD(EnderIO.DOMAIN + ":telepad.teleport");
|
||||
|
||||
public static int getMaxDistance() {
|
||||
@@ -51,9 +81,12 @@ public enum TravelSource {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return TravelController.instance.isTravelItemActive(player)
|
||||
? TravelSource.STAFF.getMaxDistanceTravelledSq()
|
||||
: TravelSource.BLOCK.getMaxDistanceTravelledSq();
|
||||
TravelSource source = TravelController.instance.getTravelItemTravelSource(player, false);
|
||||
if (source == null) {
|
||||
return TravelSource.BLOCK.getMaxDistanceTravelledSq();
|
||||
} else {
|
||||
return source.getMaxDistanceTravelledSq();
|
||||
}
|
||||
}
|
||||
|
||||
public final String sound;
|
||||
|
||||
@@ -9,15 +9,11 @@ import net.minecraft.item.ItemStack;
|
||||
public interface IConduitControl extends IHideFacades {
|
||||
|
||||
/**
|
||||
* Controls whether the overlay is shown and the player can change the display
|
||||
* mode.
|
||||
* Controls whether the overlay is shown and the player can change the display mode.
|
||||
*
|
||||
* @param stack
|
||||
* The itemstack
|
||||
* @param player
|
||||
* The player holding the itemstack
|
||||
* @return True if the overlay should be rendered and the player should be
|
||||
* able to change modes. False otherwise.
|
||||
* @param stack The itemstack
|
||||
* @param player The player holding the itemstack
|
||||
* @return True if the overlay should be rendered and the player should be able to change modes. False otherwise.
|
||||
*/
|
||||
boolean showOverlay(ItemStack stack, EntityPlayer player);
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package crazypants.enderio.betterbuilderswands;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.IntFunction;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.github.bsideup.jabel.Desugar;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.machine.painter.BlockPaintedCarpet;
|
||||
import crazypants.enderio.machine.painter.BlockPaintedFence;
|
||||
import crazypants.enderio.machine.painter.BlockPaintedFenceGate;
|
||||
import crazypants.enderio.machine.painter.BlockPaintedGlowstone;
|
||||
import crazypants.enderio.machine.painter.BlockPaintedSlab;
|
||||
import crazypants.enderio.machine.painter.BlockPaintedStair;
|
||||
import crazypants.enderio.machine.painter.BlockPaintedWall;
|
||||
import crazypants.enderio.machine.painter.TileEntityPaintedBlock;
|
||||
import portablejim.bbw.BetterBuildersWandsMod;
|
||||
import portablejim.bbw.basics.Point3d;
|
||||
import portablejim.bbw.core.conversion.ICustomMapping;
|
||||
import portablejim.bbw.shims.IPlayerShim;
|
||||
import portablejim.bbw.shims.IWorldShim;
|
||||
|
||||
@Desugar
|
||||
public record PaintedCustomMapping(Block lookBlock, BiFunction<Block, Integer, ItemStack> itemStackGetter, int meta)
|
||||
implements ICustomMapping {
|
||||
|
||||
@Override
|
||||
public Block getLookBlock() {
|
||||
return lookBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItems(IWorldShim world, IPlayerShim player, Point3d point) {
|
||||
if (world.getTile(point) instanceof TileEntityPaintedBlock painted) {
|
||||
return itemStackGetter.apply(painted.getSourceBlock(), painted.getSourceBlockMetadata());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCopyTileNBT() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void registerMappings() {
|
||||
register(
|
||||
i -> new PaintedCustomMapping(
|
||||
EnderIO.blockPaintedGlowstone,
|
||||
BlockPaintedGlowstone::createItemStackForSourceBlock,
|
||||
i));
|
||||
register(
|
||||
i -> new PaintedCustomMapping(
|
||||
EnderIO.blockPaintedStair,
|
||||
BlockPaintedStair::createItemStackForSourceBlock,
|
||||
i));
|
||||
register(
|
||||
i -> new PaintedCustomMapping(
|
||||
EnderIO.blockPaintedFence,
|
||||
BlockPaintedFence::createItemStackForSourceBlock,
|
||||
i));
|
||||
register(
|
||||
i -> new PaintedCustomMapping(
|
||||
EnderIO.blockPaintedFenceGate,
|
||||
BlockPaintedFenceGate::createItemStackForSourceBlock,
|
||||
i));
|
||||
register(
|
||||
i -> new PaintedCustomMapping(
|
||||
EnderIO.blockPaintedCarpet,
|
||||
BlockPaintedCarpet::createItemStackForSourceBlock,
|
||||
i));
|
||||
register(
|
||||
i -> new PaintedCustomMapping(
|
||||
EnderIO.blockPaintedSlab,
|
||||
BlockPaintedSlab::createItemStackForSourceBlock,
|
||||
i));
|
||||
register(
|
||||
i -> new PaintedCustomMapping(
|
||||
EnderIO.blockPaintedWall,
|
||||
BlockPaintedWall::createItemStackForSourceBlock,
|
||||
i));
|
||||
register(
|
||||
i -> new PaintedCustomMapping(
|
||||
EnderIO.blockPaintedDoubleSlab,
|
||||
BlockPaintedSlab::createItemStackForSourceBlock,
|
||||
i));
|
||||
}
|
||||
|
||||
private static void register(IntFunction<ICustomMapping> mapping) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
BetterBuildersWandsMod.instance.mappingManager.setMapping(mapping.apply(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,5 @@
|
||||
package crazypants.enderio.block;
|
||||
|
||||
import com.enderio.core.api.client.gui.IResourceTooltipProvider;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
import net.minecraft.block.BlockAnvil;
|
||||
import net.minecraft.client.gui.GuiRepair;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -19,9 +10,20 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.enderio.core.api.client.gui.IResourceTooltipProvider;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
|
||||
public class BlockDarkSteelAnvil extends BlockAnvil implements IResourceTooltipProvider {
|
||||
|
||||
private static final String[] anvilIconNames = new String[] {"anvil_0", "anvil_1", "anvil_2"};
|
||||
private static final String[] anvilIconNames = new String[] { "anvil_0", "anvil_1", "anvil_2" };
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] anvilIcons;
|
||||
@@ -65,8 +67,8 @@ public class BlockDarkSteelAnvil extends BlockAnvil implements IResourceTooltipP
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(
|
||||
World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onBlockActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY,
|
||||
float hitZ) {
|
||||
p.openGui(EnderIO.instance, GuiHandler.GUI_ID_ANVIL, w, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
package crazypants.enderio.block;
|
||||
|
||||
import com.enderio.core.api.client.gui.IResourceTooltipProvider;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.config.Config;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLadder;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -14,6 +8,14 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.enderio.core.api.client.gui.IResourceTooltipProvider;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.config.Config;
|
||||
|
||||
public class BlockDarkSteelLadder extends BlockLadder implements IResourceTooltipProvider {
|
||||
|
||||
public static BlockDarkSteelLadder create() {
|
||||
|
||||
@@ -1,23 +1,8 @@
|
||||
package crazypants.enderio.block;
|
||||
|
||||
import com.enderio.core.api.client.gui.IResourceTooltipProvider;
|
||||
import com.enderio.core.common.util.Util;
|
||||
import com.google.common.collect.Lists;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.machine.MachineRecipeInput;
|
||||
import crazypants.enderio.machine.MachineRecipeRegistry;
|
||||
import crazypants.enderio.machine.painter.BasicPainterTemplate;
|
||||
import crazypants.enderio.machine.painter.IPaintedBlock;
|
||||
import crazypants.enderio.machine.painter.PaintSourceValidator;
|
||||
import crazypants.enderio.machine.painter.PainterUtil;
|
||||
import crazypants.enderio.machine.painter.TileEntityPaintedBlock;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockPressurePlate;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
@@ -33,6 +18,24 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.enderio.core.api.client.gui.IResourceTooltipProvider;
|
||||
import com.enderio.core.common.util.Util;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.machine.MachineRecipeInput;
|
||||
import crazypants.enderio.machine.MachineRecipeRegistry;
|
||||
import crazypants.enderio.machine.painter.BasicPainterTemplate;
|
||||
import crazypants.enderio.machine.painter.IPaintedBlock;
|
||||
import crazypants.enderio.machine.painter.PaintSourceValidator;
|
||||
import crazypants.enderio.machine.painter.PainterUtil;
|
||||
import crazypants.enderio.machine.painter.TileEntityPaintedBlock;
|
||||
|
||||
public class BlockDarkSteelPressurePlate extends BlockPressurePlate
|
||||
implements IResourceTooltipProvider, ITileEntityProvider, IPaintedBlock {
|
||||
|
||||
@@ -52,12 +55,14 @@ public class BlockDarkSteelPressurePlate extends BlockPressurePlate
|
||||
|
||||
protected void init() {
|
||||
GameRegistry.registerBlock(
|
||||
this, BlockItemDarkSteelPressurePlate.class, ModObject.blockDarkSteelPressurePlate.unlocalisedName);
|
||||
this,
|
||||
BlockItemDarkSteelPressurePlate.class,
|
||||
ModObject.blockDarkSteelPressurePlate.unlocalisedName);
|
||||
GameRegistry.registerTileEntity(
|
||||
TileEntityDarkSteelPressurePlate.class,
|
||||
ModObject.blockDarkSteelPressurePlate.unlocalisedName + "TileEntity");
|
||||
MachineRecipeRegistry.instance.registerRecipe(
|
||||
ModObject.blockPainter.unlocalisedName, new PainterTemplate(this));
|
||||
MachineRecipeRegistry.instance
|
||||
.registerRecipe(ModObject.blockPainter.unlocalisedName, new PainterTemplate(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -143,10 +148,9 @@ public class BlockDarkSteelPressurePlate extends BlockPressurePlate
|
||||
return super.colorMultiplier(world, x, y, z);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item arg0, CreativeTabs arg1, List items) {
|
||||
public void getSubBlocks(Item arg0, CreativeTabs arg1, List<ItemStack> items) {
|
||||
items.add(new ItemStack(this, 1, 0));
|
||||
items.add(new ItemStack(this, 1, 1));
|
||||
}
|
||||
@@ -210,9 +214,10 @@ public class BlockDarkSteelPressurePlate extends BlockPressurePlate
|
||||
}
|
||||
ItemStack target = MachineRecipeInput.getInputForSlot(0, inputs);
|
||||
ItemStack resultStack = createItemStackForSourceBlock(
|
||||
Block.getBlockFromItem(paintSource.getItem()), paintSource.getItemDamage());
|
||||
Block.getBlockFromItem(paintSource.getItem()),
|
||||
paintSource.getItemDamage());
|
||||
resultStack.setItemDamage(target.getItemDamage());
|
||||
return new ResultStack[] {new ResultStack(resultStack)};
|
||||
return new ResultStack[] { new ResultStack(resultStack) };
|
||||
}
|
||||
|
||||
public static ItemStack createItemStackForSourceBlock(Block block, int damage) {
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
package crazypants.enderio.block;
|
||||
|
||||
import com.enderio.core.api.client.gui.IResourceTooltipProvider;
|
||||
import crazypants.enderio.BlockEio;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.waila.IWailaInfoProvider;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -15,6 +11,13 @@ import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.enderio.core.api.client.gui.IResourceTooltipProvider;
|
||||
|
||||
import crazypants.enderio.BlockEio;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.waila.IWailaInfoProvider;
|
||||
|
||||
public class BlockReinforcedObsidian extends BlockEio implements IResourceTooltipProvider, IWailaInfoProvider {
|
||||
|
||||
public static BlockReinforcedObsidian create() {
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package crazypants.enderio.block;
|
||||
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.config.Config;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ContainerRepair;
|
||||
@@ -12,26 +10,30 @@ import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.config.Config;
|
||||
|
||||
public class ContainerDarkSteelAnvil extends ContainerRepair {
|
||||
|
||||
private int x, y, z;
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
|
||||
private final Field _outputSlot = ReflectionHelper.findField(ContainerRepair.class, "outputSlot", "field_82852_f");
|
||||
private final Field _inputSlots = ReflectionHelper.findField(ContainerRepair.class, "inputSlots", "field_82853_g");
|
||||
private final Field _materialCost = ReflectionHelper.findField(
|
||||
ContainerRepair.class, "materialCost", "stackSizeToBeUsedInRepair", "field_82856_l");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ContainerDarkSteelAnvil(
|
||||
InventoryPlayer playerInv, final World world, final int x, final int y, final int z, EntityPlayer player) {
|
||||
public ContainerDarkSteelAnvil(InventoryPlayer playerInv, final World world, final int x, final int y, final int z,
|
||||
EntityPlayer player) {
|
||||
super(playerInv, world, x, y, z, player);
|
||||
|
||||
final IInventory outputSlot, inputSlots;
|
||||
final int materialCost;
|
||||
|
||||
try {
|
||||
Field _outputSlot = ReflectionHelper.findField(ContainerRepair.class, "outputSlot", "field_82852_f");
|
||||
outputSlot = (IInventory) _outputSlot.get(this);
|
||||
Field _inputSlots = ReflectionHelper.findField(ContainerRepair.class, "inputSlots", "field_82853_g");
|
||||
inputSlots = (IInventory) _inputSlots.get(this);
|
||||
Field _materialCost = ReflectionHelper
|
||||
.findField(ContainerRepair.class, "materialCost", "stackSizeToBeUsedInRepair", "field_82856_l");
|
||||
materialCost = _materialCost.getInt(this);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
@@ -49,7 +51,7 @@ public class ContainerDarkSteelAnvil extends ContainerRepair {
|
||||
|
||||
public boolean canTakeStack(EntityPlayer stack) {
|
||||
return (stack.capabilities.isCreativeMode
|
||||
|| stack.experienceLevel >= ContainerDarkSteelAnvil.this.maximumCost)
|
||||
|| stack.experienceLevel >= ContainerDarkSteelAnvil.this.maximumCost)
|
||||
&& ContainerDarkSteelAnvil.this.maximumCost > 0
|
||||
&& this.getHasStack();
|
||||
}
|
||||
@@ -76,8 +78,7 @@ public class ContainerDarkSteelAnvil extends ContainerRepair {
|
||||
|
||||
ContainerDarkSteelAnvil.this.maximumCost = 0;
|
||||
|
||||
if (!player.capabilities.isCreativeMode
|
||||
&& !world.isRemote
|
||||
if (!player.capabilities.isCreativeMode && !world.isRemote
|
||||
&& world.getBlock(x, y, z) == EnderIO.blockDarkSteelAnvil
|
||||
&& player.getRNG().nextFloat() < Config.darkSteelAnvilDamageChance) {
|
||||
int i1 = world.getBlockMetadata(x, y, z);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package crazypants.enderio.block;
|
||||
|
||||
import crazypants.enderio.machine.painter.TileEntityPaintedBlock;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import crazypants.enderio.machine.painter.TileEntityPaintedBlock;
|
||||
|
||||
public class TileEntityDarkSteelPressurePlate extends TileEntityPaintedBlock {
|
||||
|
||||
private boolean silent;
|
||||
|
||||
@@ -1,6 +1,25 @@
|
||||
package crazypants.enderio.conduit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.gas.GasConduitNetwork;
|
||||
import crazypants.enderio.conduit.gas.IGasConduit;
|
||||
@@ -28,26 +47,11 @@ import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
import crazypants.enderio.conduit.power.PowerConduitNetwork;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.RedstoneConduitNetwork;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import mods.immibis.microblocks.api.EnumPartClass;
|
||||
import mods.immibis.microblocks.api.EnumPosition;
|
||||
import mods.immibis.microblocks.api.IMicroblockCoverSystem;
|
||||
import mods.immibis.microblocks.api.Part;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public abstract class AbstractConduit implements IConduit {
|
||||
|
||||
@@ -69,8 +73,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
|
||||
protected List<CollidableComponent> collidables;
|
||||
|
||||
protected final EnumMap<ForgeDirection, ConnectionMode> conectionModes =
|
||||
new EnumMap<ForgeDirection, ConnectionMode>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, ConnectionMode> conectionModes = new EnumMap<>(ForgeDirection.class);
|
||||
|
||||
protected boolean collidablesDirty = true;
|
||||
|
||||
@@ -80,6 +83,18 @@ public abstract class AbstractConduit implements IConduit {
|
||||
|
||||
protected boolean connectionsDirty = true;
|
||||
|
||||
/**
|
||||
* This shows if the currently running connection update should not finish with settings connectionsDirty to false.
|
||||
* If this is true, it will trigger a reconnection on the next Tick.
|
||||
* <p>
|
||||
* Use the method needUpdateConnections() instead of setting this to true.
|
||||
*
|
||||
* @see needUpdateConnections()
|
||||
*/
|
||||
private boolean needUpdateConnections = false;
|
||||
|
||||
private boolean isUpdatingConnections = false;
|
||||
|
||||
protected AbstractConduit() {}
|
||||
|
||||
@Override
|
||||
@@ -103,7 +118,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
return false;
|
||||
}
|
||||
if (dataRoot.hasKey("connectionMode")) {
|
||||
ConnectionMode mode = ConnectionMode.values()[dataRoot.getShort("connectionMode")];
|
||||
ConnectionMode mode = ConnectionMode.VALUES[dataRoot.getShort("connectionMode")];
|
||||
setConnectionMode(dir, mode);
|
||||
}
|
||||
readTypeSettings(dir, dataRoot);
|
||||
@@ -275,8 +290,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
covers = conduit.getBundle().getCoverSystem();
|
||||
for (Part part : covers.getAllParts()) {
|
||||
if (part.type.getPartClass() == EnumPartClass.Panel) {
|
||||
return part.pos
|
||||
== EnumPosition.getFacePosition(direction.getOpposite().ordinal());
|
||||
return part.pos == EnumPosition.getFacePosition(direction.getOpposite().ordinal());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -368,13 +382,13 @@ public abstract class AbstractConduit implements IConduit {
|
||||
conduitConnections.clear();
|
||||
int[] dirs = nbtRoot.getIntArray("connections");
|
||||
for (int i = 0; i < dirs.length; i++) {
|
||||
conduitConnections.add(ForgeDirection.values()[dirs[i]]);
|
||||
conduitConnections.add(ForgeDirections.DIRECTIONS[dirs[i]]);
|
||||
}
|
||||
|
||||
externalConnections.clear();
|
||||
dirs = nbtRoot.getIntArray("externalConnections");
|
||||
for (int i = 0; i < dirs.length; i++) {
|
||||
externalConnections.add(ForgeDirection.values()[dirs[i]]);
|
||||
externalConnections.add(ForgeDirections.DIRECTIONS[dirs[i]]);
|
||||
}
|
||||
active = nbtRoot.getBoolean("signalActive");
|
||||
|
||||
@@ -383,7 +397,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
if (modes != null && modes.length == 6) {
|
||||
int i = 0;
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
conectionModes.put(dir, ConnectionMode.values()[modes[i]]);
|
||||
conectionModes.put(dir, ConnectionMode.VALUES[modes[i]]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -431,12 +445,15 @@ public abstract class AbstractConduit implements IConduit {
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
if (!connectionsDirty) {
|
||||
if (!connectionsDirty && !needUpdateConnections) {
|
||||
return;
|
||||
}
|
||||
|
||||
isUpdatingConnections = true;
|
||||
needUpdateConnections = false;
|
||||
|
||||
boolean externalConnectionsChanged = false;
|
||||
List<ForgeDirection> copy = new ArrayList<ForgeDirection>(externalConnections);
|
||||
List<ForgeDirection> copy = new ArrayList<>(externalConnections);
|
||||
// remove any no longer valid connections
|
||||
for (ForgeDirection dir : copy) {
|
||||
if (!canConnectToExternal(dir, false)) {
|
||||
@@ -459,6 +476,21 @@ public abstract class AbstractConduit implements IConduit {
|
||||
}
|
||||
|
||||
connectionsDirty = false;
|
||||
isUpdatingConnections = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method prevents connection update from getting completed successfully by not settings connectionsDirty to
|
||||
* false. This will trigger an connection update at the next Tick.
|
||||
* <p>
|
||||
* Only use this while executing updateConnections().
|
||||
* <p>
|
||||
* See this PR for more info: https://github.com/GTNewHorizons/EnderIO/pull/111
|
||||
*/
|
||||
protected void needUpdateConnections() {
|
||||
if (isUpdatingConnections) {
|
||||
needUpdateConnections = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -580,11 +612,13 @@ public abstract class AbstractConduit implements IConduit {
|
||||
|
||||
@Override
|
||||
public Collection<CollidableComponent> createCollidables(CacheKey key) {
|
||||
return Collections.singletonList(new CollidableComponent(
|
||||
getCollidableType(),
|
||||
ConduitGeometryUtil.instance.getBoundingBox(getBaseConduitType(), key.dir, key.isStub, key.offset),
|
||||
key.dir,
|
||||
null));
|
||||
return Collections.singletonList(
|
||||
new CollidableComponent(
|
||||
getCollidableType(),
|
||||
ConduitGeometryUtil.instance
|
||||
.getBoundingBox(getBaseConduitType(), key.dir, key.isStub, key.offset),
|
||||
key.dir,
|
||||
null));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -599,7 +633,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
return collidables;
|
||||
}
|
||||
|
||||
List<CollidableComponent> result = new ArrayList<CollidableComponent>();
|
||||
List<CollidableComponent> result = new ArrayList<>();
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
Collection<CollidableComponent> col = getCollidables(dir);
|
||||
if (col != null) {
|
||||
@@ -623,7 +657,8 @@ public abstract class AbstractConduit implements IConduit {
|
||||
Class<? extends IConduit> type = getCollidableType();
|
||||
if (isConnectedTo(dir) && getConnectionMode(dir) != ConnectionMode.DISABLED) {
|
||||
return cc.getCollidables(
|
||||
cc.createKey(type, getBundle().getOffset(getBaseConduitType(), dir), dir, renderStub(dir)), this);
|
||||
cc.createKey(type, getBundle().getOffset(getBaseConduitType(), dir), dir, renderStub(dir)),
|
||||
this);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -3,13 +3,16 @@ package crazypants.enderio.conduit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
|
||||
// I=base type, I is the base class of the implementations accepted by the network
|
||||
public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
|
||||
|
||||
protected final List<I> conduits = new ArrayList<I>();
|
||||
protected final List<I> conduits = new ArrayList<>();
|
||||
|
||||
protected final Class<I> implClass;
|
||||
protected final Class<T> baseConduitClass;
|
||||
@@ -47,8 +50,8 @@ public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
|
||||
if (conduit != null && implClass.isAssignableFrom(conduit.getClass()) && conduit.setNetwork(this)) {
|
||||
addConduit(implClass.cast(conduit));
|
||||
TileEntity te = tile.getEntity();
|
||||
Collection<T> connections =
|
||||
ConduitUtil.getConnectedConduits(world, te.xCoord, te.yCoord, te.zCoord, getBaseConduitType());
|
||||
Collection<T> connections = ConduitUtil
|
||||
.getConnectedConduits(world, te.xCoord, te.yCoord, te.zCoord, getBaseConduitType());
|
||||
for (T con : connections) {
|
||||
if (con.getNetwork() == null) {
|
||||
setNetwork(world, con.getBundle());
|
||||
@@ -63,7 +66,7 @@ public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
|
||||
public void addConduit(I con) {
|
||||
if (!conduits.contains(con)) {
|
||||
if (conduits.isEmpty()) {
|
||||
ConduitNetworkTickHandler.instance.registerNetwork(this);
|
||||
EnderIO.proxy.conduitNetworkTickHandler.registerNetwork(this);
|
||||
}
|
||||
conduits.add(con);
|
||||
}
|
||||
@@ -74,7 +77,7 @@ public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
|
||||
con.setNetwork(null);
|
||||
}
|
||||
conduits.clear();
|
||||
ConduitNetworkTickHandler.instance.unregisterNetwork(this);
|
||||
EnderIO.proxy.conduitNetworkTickHandler.unregisterNetwork(this);
|
||||
}
|
||||
|
||||
public List<I> getConduits() {
|
||||
|
||||
@@ -1,19 +1,7 @@
|
||||
package crazypants.enderio.conduit;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.enderio.core.common.util.ItemUtil;
|
||||
import com.enderio.core.common.util.Util;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.ModObject;
|
||||
import java.util.List;
|
||||
import mods.immibis.microblocks.api.IMicroblockCoverSystem;
|
||||
import mods.immibis.microblocks.api.IMicroblockSupporterTile;
|
||||
import mods.immibis.microblocks.api.MicroblockAPIUtils;
|
||||
import mods.immibis.microblocks.api.Part;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -26,6 +14,22 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.enderio.core.common.util.ItemUtil;
|
||||
import com.enderio.core.common.util.Util;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import mods.immibis.microblocks.api.IMicroblockCoverSystem;
|
||||
import mods.immibis.microblocks.api.IMicroblockSupporterTile;
|
||||
import mods.immibis.microblocks.api.MicroblockAPIUtils;
|
||||
import mods.immibis.microblocks.api.Part;
|
||||
|
||||
public abstract class AbstractItemConduit extends Item implements IConduitItem {
|
||||
|
||||
protected ModObject modObj;
|
||||
@@ -59,21 +63,11 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
int side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ) {
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||
float hitX, float hitY, float hitZ) {
|
||||
if (MicroblocksUtil.supportMicroblocks() && tryAddToMicroblocks(stack, player, world, x, y, z, side)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
BlockCoord placeAt = Util.canPlaceItem(stack, EnderIO.blockConduitBundle, player, world, x, y, z, side);
|
||||
if (placeAt != null) {
|
||||
if (!world.isRemote) {
|
||||
@@ -90,10 +84,8 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
|
||||
stack.stackSize--;
|
||||
}
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
ForgeDirection dir = ForgeDirection.values()[side];
|
||||
ForgeDirection dir = ForgeDirections.DIRECTIONS[side];
|
||||
int placeX = x + dir.offsetX;
|
||||
int placeY = y + dir.offsetY;
|
||||
int placeZ = z + dir.offsetZ;
|
||||
@@ -122,19 +114,18 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean tryAddToMicroblocks(
|
||||
ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side) {
|
||||
private boolean tryAddToMicroblocks(ItemStack stack, EntityPlayer player, World world, int x, int y, int z,
|
||||
int side) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te != null && te.getClass().getName().equals("mods.immibis.microblocks.TileMicroblockContainer")) {
|
||||
IMicroblockCoverSystem covers = ((IMicroblockSupporterTile) te).getCoverSystem();
|
||||
world.setBlock(x, y, z, EnderIO.blockConduitBundle);
|
||||
EnderIO.blockConduitBundle.onBlockActivated(world, x, y, z, player, side, 0, 0, 0);
|
||||
IMicroblockCoverSystem newCovers = MicroblockAPIUtils.createMicroblockCoverSystem(
|
||||
(IMicroblockSupporterTile) world.getTileEntity(x, y, z));
|
||||
IMicroblockCoverSystem newCovers = MicroblockAPIUtils
|
||||
.createMicroblockCoverSystem((IMicroblockSupporterTile) world.getTileEntity(x, y, z));
|
||||
for (Part p : covers.getAllParts()) {
|
||||
newCovers.addPart(p);
|
||||
}
|
||||
@@ -145,17 +136,8 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
int side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ) {
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||
float hitX, float hitY, float hitZ) {
|
||||
// Conduit replacement
|
||||
if (player.isSneaking()) {
|
||||
return false;
|
||||
@@ -177,8 +159,7 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
|
||||
System.out.println("AbstractItemConduit.onItemUse: Conduit null.");
|
||||
return false;
|
||||
}
|
||||
bundle.removeConduit(existingConduit);
|
||||
bundle.addConduit(newConduit);
|
||||
bundle.replaceConduit(existingConduit, newConduit);
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
stack.stackSize--;
|
||||
for (ItemStack drop : existingConduit.getDrops()) {
|
||||
@@ -210,9 +191,8 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List<ItemStack> par3List) {
|
||||
for (int j = 0; j < subtypes.length; ++j) {
|
||||
par3List.add(new ItemStack(this, 1, j));
|
||||
}
|
||||
|
||||
@@ -1,50 +1,11 @@
|
||||
package crazypants.enderio.conduit;
|
||||
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.enderio.core.common.util.Util;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.BlockEio;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.api.tool.ITool;
|
||||
import crazypants.enderio.conduit.facade.ItemConduitFacade.FacadeType;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.geom.ConduitConnectorType;
|
||||
import crazypants.enderio.conduit.gui.*;
|
||||
import crazypants.enderio.conduit.gui.item.PacketExistingItemFilterSnapshot;
|
||||
import crazypants.enderio.conduit.gui.item.PacketModItemFilter;
|
||||
import crazypants.enderio.conduit.liquid.PacketFluidLevel;
|
||||
import crazypants.enderio.conduit.packet.PacketConnectionMode;
|
||||
import crazypants.enderio.conduit.packet.PacketExtractMode;
|
||||
import crazypants.enderio.conduit.packet.PacketItemConduitFilter;
|
||||
import crazypants.enderio.conduit.packet.PacketOCConduitSignalColor;
|
||||
import crazypants.enderio.conduit.packet.PacketRedstoneConduitOutputStrength;
|
||||
import crazypants.enderio.conduit.packet.PacketRedstoneConduitSignalColor;
|
||||
import crazypants.enderio.conduit.packet.PacketRoundRobinMode;
|
||||
import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit;
|
||||
import crazypants.enderio.item.IRotatableFacade;
|
||||
import crazypants.enderio.item.ItemConduitProbe;
|
||||
import crazypants.enderio.machine.painter.PainterUtil;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.tool.ToolUtil;
|
||||
import crazypants.util.IFacade;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import mods.immibis.core.api.multipart.IMultipartRenderingBlockMarker;
|
||||
import mods.immibis.core.api.multipart.IMultipartSystem;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.ISound;
|
||||
@@ -66,13 +27,64 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.entity.PlaySoundAtEntityEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
|
||||
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.enderio.core.common.util.Util;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.BlockEio;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.api.tool.ITool;
|
||||
import crazypants.enderio.conduit.facade.ItemConduitFacade.FacadeType;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.geom.ConduitConnectorType;
|
||||
import crazypants.enderio.conduit.gui.ExternalConnectionContainer;
|
||||
import crazypants.enderio.conduit.gui.GuiExternalConnection;
|
||||
import crazypants.enderio.conduit.gui.GuiExternalConnectionSelector;
|
||||
import crazypants.enderio.conduit.gui.PacketFluidChannel;
|
||||
import crazypants.enderio.conduit.gui.PacketFluidFilter;
|
||||
import crazypants.enderio.conduit.gui.PacketOpenConduitUI;
|
||||
import crazypants.enderio.conduit.gui.PacketSlotVisibility;
|
||||
import crazypants.enderio.conduit.gui.item.PacketExistingItemFilterSnapshot;
|
||||
import crazypants.enderio.conduit.gui.item.PacketModItemFilter;
|
||||
import crazypants.enderio.conduit.liquid.PacketFluidLevel;
|
||||
import crazypants.enderio.conduit.packet.PacketConnectionMode;
|
||||
import crazypants.enderio.conduit.packet.PacketExtractMode;
|
||||
import crazypants.enderio.conduit.packet.PacketItemConduitFilter;
|
||||
import crazypants.enderio.conduit.packet.PacketOCConduitSignalColor;
|
||||
import crazypants.enderio.conduit.packet.PacketRedstoneConduitOutputStrength;
|
||||
import crazypants.enderio.conduit.packet.PacketRedstoneConduitSignalColor;
|
||||
import crazypants.enderio.conduit.packet.PacketRoundRobinMode;
|
||||
import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit;
|
||||
import crazypants.enderio.item.IRotatableFacade;
|
||||
import crazypants.enderio.item.ItemConduitProbe;
|
||||
import crazypants.enderio.machine.painter.PainterUtil;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.tool.ToolUtil;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import crazypants.util.IFacade;
|
||||
import mods.immibis.core.api.multipart.IMultipartRenderingBlockMarker;
|
||||
import mods.immibis.core.api.multipart.IMultipartSystem;
|
||||
import powercrystals.minefactoryreloaded.api.rednet.IRedNetOmniNode;
|
||||
import powercrystals.minefactoryreloaded.api.rednet.connectivity.RedNetConnectionType;
|
||||
|
||||
@Optional.InterfaceList({
|
||||
@Interface(iface = "powercrystals.minefactoryreloaded.api.rednet.IRedNetOmniNode", modid = "MineFactoryReloaded"),
|
||||
@Interface(iface = "mods.immibis.core.api.multipart.IMultipartRenderingBlockMarker", modid = "ImmibisMicroblocks")
|
||||
})
|
||||
@Interface(
|
||||
iface = "powercrystals.minefactoryreloaded.api.rednet.IRedNetOmniNode",
|
||||
modid = "MineFactoryReloaded"),
|
||||
@Interface(
|
||||
iface = "mods.immibis.core.api.multipart.IMultipartRenderingBlockMarker",
|
||||
modid = "ImmibisMicroblocks") })
|
||||
public class BlockConduitBundle extends BlockEio
|
||||
implements IGuiHandler, IFacade, IRotatableFacade, IRedNetOmniNode, IMultipartRenderingBlockMarker {
|
||||
|
||||
@@ -81,28 +93,37 @@ public class BlockConduitBundle extends BlockEio
|
||||
|
||||
public static BlockConduitBundle create() {
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(ConduitNetworkTickHandler.instance);
|
||||
FMLCommonHandler.instance().bus().register(ConduitNetworkTickHandler.instance);
|
||||
|
||||
PacketHandler.INSTANCE
|
||||
.registerMessage(PacketFluidLevel.class, PacketFluidLevel.class, PacketHandler.nextID(), Side.CLIENT);
|
||||
PacketHandler.INSTANCE
|
||||
.registerMessage(PacketExtractMode.class, PacketExtractMode.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
PacketFluidLevel.class, PacketFluidLevel.class, PacketHandler.nextID(), Side.CLIENT);
|
||||
PacketConnectionMode.class,
|
||||
PacketConnectionMode.class,
|
||||
PacketHandler.nextID(),
|
||||
Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
PacketExtractMode.class, PacketExtractMode.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
PacketConnectionMode.class, PacketConnectionMode.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
PacketItemConduitFilter.class, PacketItemConduitFilter.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketItemConduitFilter.class,
|
||||
PacketItemConduitFilter.class,
|
||||
PacketHandler.nextID(),
|
||||
Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
PacketExistingItemFilterSnapshot.class,
|
||||
PacketExistingItemFilterSnapshot.class,
|
||||
PacketHandler.nextID(),
|
||||
Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
PacketModItemFilter.class, PacketModItemFilter.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketModItemFilter.class,
|
||||
PacketModItemFilter.class,
|
||||
PacketHandler.nextID(),
|
||||
Side.SERVER);
|
||||
PacketHandler.INSTANCE
|
||||
.registerMessage(PacketFluidFilter.class, PacketFluidFilter.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
PacketFluidFilter.class, PacketFluidFilter.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
PacketFluidChannel.class, PacketFluidChannel.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketFluidChannel.class,
|
||||
PacketFluidChannel.class,
|
||||
PacketHandler.nextID(),
|
||||
Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
PacketRedstoneConduitSignalColor.class,
|
||||
PacketRedstoneConduitSignalColor.class,
|
||||
@@ -114,20 +135,28 @@ public class BlockConduitBundle extends BlockEio
|
||||
PacketHandler.nextID(),
|
||||
Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
PacketOpenConduitUI.class, PacketOpenConduitUI.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketOpenConduitUI.class,
|
||||
PacketOpenConduitUI.class,
|
||||
PacketHandler.nextID(),
|
||||
Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
PacketSlotVisibility.class, PacketSlotVisibility.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketSlotVisibility.class,
|
||||
PacketSlotVisibility.class,
|
||||
PacketHandler.nextID(),
|
||||
Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
PacketOCConduitSignalColor.class,
|
||||
PacketOCConduitSignalColor.class,
|
||||
PacketHandler.nextID(),
|
||||
Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
PacketRoundRobinMode.class, PacketRoundRobinMode.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketRoundRobinMode.class,
|
||||
PacketRoundRobinMode.class,
|
||||
PacketHandler.nextID(),
|
||||
Side.SERVER);
|
||||
|
||||
BlockConduitBundle result = new BlockConduitBundle();
|
||||
result.init();
|
||||
MinecraftForge.EVENT_BUS.register(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -146,6 +175,7 @@ public class BlockConduitBundle extends BlockEio
|
||||
setResistance(10.0f);
|
||||
setCreativeTab(null);
|
||||
this.stepSound = new SoundType("silence", 0, 0) {
|
||||
|
||||
@Override
|
||||
public String getBreakSound() {
|
||||
return "EnderIO:" + soundName + ".dig";
|
||||
@@ -167,7 +197,11 @@ public class BlockConduitBundle extends BlockEio
|
||||
|
||||
IIcon tex = null;
|
||||
|
||||
TileConduitBundle cb = (TileConduitBundle) world.getTileEntity(target.blockX, target.blockY, target.blockZ);
|
||||
TileEntity cbe = world.getTileEntity(target.blockX, target.blockY, target.blockZ);
|
||||
if (!(cbe instanceof TileConduitBundle)) {
|
||||
return false;
|
||||
}
|
||||
TileConduitBundle cb = (TileConduitBundle) cbe;
|
||||
if (ConduitUtil.isSolidFacadeRendered(cb, Minecraft.getMinecraft().thePlayer)) {
|
||||
if (cb.getFacadeId() != null) {
|
||||
tex = cb.getFacadeId().getIcon(target.sideHit, cb.getFacadeMetadata());
|
||||
@@ -204,8 +238,16 @@ public class BlockConduitBundle extends BlockEio
|
||||
double d2 = z + (l1 + 0.5D) / b0;
|
||||
int i2 = rand.nextInt(6);
|
||||
EntityDiggingFX fx = new EntityDiggingFX(
|
||||
world, d0, d1, d2, d0 - x - 0.5D, d1 - y - 0.5D, d2 - z - 0.5D, this, i2, 0)
|
||||
.applyColourMultiplier(x, y, z);
|
||||
world,
|
||||
d0,
|
||||
d1,
|
||||
d2,
|
||||
d0 - x - 0.5D,
|
||||
d1 - y - 0.5D,
|
||||
d2 - z - 0.5D,
|
||||
this,
|
||||
i2,
|
||||
0).applyColourMultiplier(x, y, z);
|
||||
fx.setParticleIcon(tex);
|
||||
effectRenderer.addEffect(fx);
|
||||
}
|
||||
@@ -215,19 +257,16 @@ public class BlockConduitBundle extends BlockEio
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void addBlockHitEffects(
|
||||
World world, EffectRenderer effectRenderer, int x, int y, int z, int side, IIcon tex) {
|
||||
private void addBlockHitEffects(World world, EffectRenderer effectRenderer, int x, int y, int z, int side,
|
||||
IIcon tex) {
|
||||
float f = 0.1F;
|
||||
double d0 = x
|
||||
+ rand.nextDouble() * (getBlockBoundsMaxX() - getBlockBoundsMinX() - f * 2.0F)
|
||||
double d0 = x + rand.nextDouble() * (getBlockBoundsMaxX() - getBlockBoundsMinX() - f * 2.0F)
|
||||
+ f
|
||||
+ getBlockBoundsMinX();
|
||||
double d1 = y
|
||||
+ rand.nextDouble() * (getBlockBoundsMaxY() - getBlockBoundsMinY() - f * 2.0F)
|
||||
double d1 = y + rand.nextDouble() * (getBlockBoundsMaxY() - getBlockBoundsMinY() - f * 2.0F)
|
||||
+ f
|
||||
+ getBlockBoundsMinY();
|
||||
double d2 = z
|
||||
+ rand.nextDouble() * (getBlockBoundsMaxZ() - getBlockBoundsMinZ() - f * 2.0F)
|
||||
double d2 = z + rand.nextDouble() * (getBlockBoundsMaxZ() - getBlockBoundsMinZ() - f * 2.0F)
|
||||
+ f
|
||||
+ getBlockBoundsMinZ();
|
||||
if (side == 0) {
|
||||
@@ -249,41 +288,6 @@ public class BlockConduitBundle extends BlockEio
|
||||
effectRenderer.addEffect(digFX);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onPlaySound(PlaySoundSourceEvent event) {
|
||||
String path = event.sound.getPositionedSoundLocation().getResourcePath();
|
||||
if ("silence.step".equals(path)) {
|
||||
ISound snd = event.sound;
|
||||
World world = EnderIO.proxy.getClientWorld();
|
||||
BlockCoord bc = new BlockCoord(snd.getXPosF(), snd.getYPosF(), snd.getZPosF());
|
||||
TileEntity te = bc.getTileEntity(world);
|
||||
if (te != null && te instanceof TileConduitBundle && ((TileConduitBundle) te).hasFacade()) {
|
||||
Block facade = getFacade(world, bc.x, bc.y, bc.z, -1);
|
||||
ConduitUtil.playHitSound(facade.stepSound, world, bc.x, bc.y, bc.z);
|
||||
} else {
|
||||
ConduitUtil.playHitSound(Block.soundTypeMetal, world, bc.x, bc.y, bc.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onPlaySoundAtEntity(PlaySoundAtEntityEvent event) {
|
||||
String path = event.name;
|
||||
World world = event.entity.worldObj;
|
||||
if ("EnderIO:silence.step".equals(path) && world.isRemote) {
|
||||
BlockCoord bc = new BlockCoord(event.entity.posX, event.entity.posY - 2, event.entity.posZ);
|
||||
TileEntity te = bc.getTileEntity(world);
|
||||
if (te != null && te instanceof TileConduitBundle && ((TileConduitBundle) te).hasFacade()) {
|
||||
Block facade = getFacade(world, bc.x, bc.y, bc.z, -1);
|
||||
ConduitUtil.playStepSound(facade.stepSound, world, bc.x, bc.y, bc.z);
|
||||
} else {
|
||||
ConduitUtil.playStepSound(Block.soundTypeMetal, world, bc.x, bc.y, bc.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
@@ -291,6 +295,7 @@ public class BlockConduitBundle extends BlockEio
|
||||
EnderIO.guiHandler.registerGuiHandler(GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE + dir.ordinal(), this);
|
||||
}
|
||||
EnderIO.guiHandler.registerGuiHandler(GuiHandler.GUI_ID_EXTERNAL_CONNECTION_SELECTOR, this);
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -306,7 +311,11 @@ public class BlockConduitBundle extends BlockEio
|
||||
}
|
||||
if (ret == null && target != null && target.hitInfo instanceof CollidableComponent) {
|
||||
CollidableComponent cc = (CollidableComponent) target.hitInfo;
|
||||
TileConduitBundle bundle = (TileConduitBundle) world.getTileEntity(x, y, z);
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (!(te instanceof TileConduitBundle)) {
|
||||
return null;
|
||||
}
|
||||
TileConduitBundle bundle = (TileConduitBundle) te;
|
||||
IConduit conduit = bundle.getConduit(cc.conduitType);
|
||||
if (conduit != null) {
|
||||
ret = conduit.createItem();
|
||||
@@ -410,41 +419,20 @@ public class BlockConduitBundle extends BlockEio
|
||||
|
||||
@Override
|
||||
public float getBlockHardness(World world, int x, int y, int z) {
|
||||
IConduitBundle te = (IConduitBundle) world.getTileEntity(x, y, z);
|
||||
return te != null && te.getFacadeType() == FacadeType.HARDENED ? blockHardness * 10 : blockHardness;
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
return te instanceof IConduitBundle && ((IConduitBundle) te).getFacadeType() == FacadeType.HARDENED
|
||||
? blockHardness * 10
|
||||
: blockHardness;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExplosionResistance(
|
||||
Entity par1Entity,
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
double explosionX,
|
||||
double explosionY,
|
||||
double explosionZ) {
|
||||
public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX,
|
||||
double explosionY, double explosionZ) {
|
||||
float resist = getExplosionResistance(par1Entity);
|
||||
IConduitBundle te = (IConduitBundle) world.getTileEntity(x, y, z);
|
||||
return te != null && te.getFacadeType() == FacadeType.HARDENED ? resist * 10 : resist;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBreakSpeed(BreakSpeed event) {
|
||||
if (event.block == this) {
|
||||
ItemStack held = event.entityPlayer.getCurrentEquippedItem();
|
||||
if (held == null || held.getItem().getHarvestLevel(held, "pickaxe") == -1) {
|
||||
event.newSpeed += 2;
|
||||
}
|
||||
IConduitBundle te = (IConduitBundle) event.entity.worldObj.getTileEntity(event.x, event.y, event.z);
|
||||
if (te != null && te.getFacadeType() == FacadeType.HARDENED) {
|
||||
if (!ConduitUtil.isSolidFacadeRendered(te, event.entityPlayer)) {
|
||||
event.newSpeed *= 6;
|
||||
} else {
|
||||
event.newSpeed *= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
return te instanceof IConduitBundle && ((IConduitBundle) te).getFacadeType() == FacadeType.HARDENED
|
||||
? resist * 10
|
||||
: resist;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -485,17 +473,17 @@ public class BlockConduitBundle extends BlockEio
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
IConduitBundle te = (IConduitBundle) world.getTileEntity(x, y, z);
|
||||
if (te == null) {
|
||||
TileEntity rte = world.getTileEntity(x, y, z);
|
||||
if (!(rte instanceof IConduitBundle)) {
|
||||
return true;
|
||||
}
|
||||
IConduitBundle te = (IConduitBundle) rte;
|
||||
|
||||
boolean breakBlock = true;
|
||||
List<ItemStack> drop = new ArrayList<ItemStack>();
|
||||
List<ItemStack> drop = new ArrayList<>();
|
||||
if (ConduitUtil.isSolidFacadeRendered(te, player)) {
|
||||
breakBlock = false;
|
||||
ItemStack fac = new ItemStack(
|
||||
EnderIO.itemConduitFacade, 1, te.getFacadeType().ordinal());
|
||||
ItemStack fac = new ItemStack(EnderIO.itemConduitFacade, 1, te.getFacadeType().ordinal());
|
||||
PainterUtil.setSourceBlock(fac, te.getFacadeId(), te.getFacadeMetadata());
|
||||
drop.add(fac);
|
||||
ConduitUtil.playBreakSound(te.getFacadeId().stepSound, world, x, y, z);
|
||||
@@ -550,11 +538,10 @@ public class BlockConduitBundle extends BlockEio
|
||||
if (type == null) {
|
||||
// broke a conector so drop any conduits with no connections as there
|
||||
// is no other way to remove these
|
||||
List<IConduit> cons = new ArrayList<IConduit>(te.getConduits());
|
||||
List<IConduit> cons = new ArrayList<>(te.getConduits());
|
||||
boolean droppedUnconected = false;
|
||||
for (IConduit con : cons) {
|
||||
if (con.getConduitConnections().isEmpty()
|
||||
&& con.getExternalConnections().isEmpty()
|
||||
if (con.getConduitConnections().isEmpty() && con.getExternalConnections().isEmpty()
|
||||
&& ConduitUtil.renderConduit(player, con)) {
|
||||
te.removeConduit(con);
|
||||
drop.addAll(con.getDrops());
|
||||
@@ -598,21 +585,22 @@ public class BlockConduitBundle extends BlockEio
|
||||
|
||||
@Override
|
||||
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
|
||||
ItemStack equipped = player.getCurrentEquippedItem();
|
||||
if (!player.isSneaking() || equipped == null || equipped.getItem() != EnderIO.itemYetaWench) {
|
||||
ITool tool = ToolUtil.getEquippedTool(player);
|
||||
if (!player.isSneaking() || tool == null || !tool.canUse(player.getCurrentEquippedItem(), player, x, y, z)) {
|
||||
return;
|
||||
}
|
||||
ConduitUtil.openConduitGui(world, x, y, z, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(
|
||||
World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) {
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7,
|
||||
float par8, float par9) {
|
||||
|
||||
IConduitBundle bundle = (IConduitBundle) world.getTileEntity(x, y, z);
|
||||
if (bundle == null) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (!(te instanceof IConduitBundle)) {
|
||||
return false;
|
||||
}
|
||||
IConduitBundle bundle = (IConduitBundle) te;
|
||||
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack != null && stack.getItem() == EnderIO.itemConduitFacade) {
|
||||
@@ -698,8 +686,7 @@ public class BlockConduitBundle extends BlockEio
|
||||
}
|
||||
} else {
|
||||
IConduit closestConduit = bundle.getConduit(closest.component.conduitType);
|
||||
if (closestConduit != null
|
||||
&& ConduitUtil.renderConduit(player, closestConduit)
|
||||
if (closestConduit != null && ConduitUtil.renderConduit(player, closestConduit)
|
||||
&& closestConduit.onBlockActivated(player, closest, all)) {
|
||||
bundle.getEntity().markDirty();
|
||||
return true;
|
||||
@@ -722,8 +709,8 @@ public class BlockConduitBundle extends BlockEio
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean handleConduitProbeClick(
|
||||
World world, int x, int y, int z, EntityPlayer player, IConduitBundle bundle, ItemStack stack) {
|
||||
private boolean handleConduitProbeClick(World world, int x, int y, int z, EntityPlayer player,
|
||||
IConduitBundle bundle, ItemStack stack) {
|
||||
if (stack.getItemDamage() != 1) {
|
||||
return false; // not in copy paste mode
|
||||
}
|
||||
@@ -734,8 +721,8 @@ public class BlockConduitBundle extends BlockEio
|
||||
return ItemConduitProbe.copyPasteSettings(player, stack, bundle, rr.component.dir);
|
||||
}
|
||||
|
||||
private boolean handleConduitClick(
|
||||
World world, int x, int y, int z, EntityPlayer player, IConduitBundle bundle, ItemStack stack) {
|
||||
private boolean handleConduitClick(World world, int x, int y, int z, EntityPlayer player, IConduitBundle bundle,
|
||||
ItemStack stack) {
|
||||
IConduitItem equipped = (IConduitItem) stack.getItem();
|
||||
if (!bundle.hasType(equipped.getBaseConduitType())) {
|
||||
if (!world.isRemote) {
|
||||
@@ -750,8 +737,8 @@ public class BlockConduitBundle extends BlockEio
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean handleFacadeClick(
|
||||
World world, int x, int y, int z, EntityPlayer player, int side, IConduitBundle bundle, ItemStack stack) {
|
||||
public boolean handleFacadeClick(World world, int x, int y, int z, EntityPlayer player, int side,
|
||||
IConduitBundle bundle, ItemStack stack) {
|
||||
if (MicroblocksUtil.supportMicroblocks() && hasMicroblocks(bundle)) {
|
||||
return false;
|
||||
}
|
||||
@@ -776,8 +763,7 @@ public class BlockConduitBundle extends BlockEio
|
||||
return false;
|
||||
}
|
||||
if (!world.isRemote && !player.capabilities.isCreativeMode) {
|
||||
ItemStack fac = new ItemStack(
|
||||
EnderIO.itemConduitFacade, 1, bundle.getFacadeType().ordinal());
|
||||
ItemStack fac = new ItemStack(EnderIO.itemConduitFacade, 1, bundle.getFacadeType().ordinal());
|
||||
PainterUtil.setSourceBlock(fac, bundle.getFacadeId(), bundle.getFacadeMetadata());
|
||||
Util.dropItems(world, fac, x, y, z, false);
|
||||
}
|
||||
@@ -785,7 +771,7 @@ public class BlockConduitBundle extends BlockEio
|
||||
|
||||
bundle.setFacadeId(facadeID);
|
||||
bundle.setFacadeMetadata(facadeMeta);
|
||||
bundle.setFacadeType(FacadeType.values()[facadeType]);
|
||||
bundle.setFacadeType(FacadeType.VALUES[facadeType]);
|
||||
if (!world.isRemote) {
|
||||
ConduitUtil.playPlaceSound(facadeID.stepSound, world, x, y, z);
|
||||
}
|
||||
@@ -798,17 +784,17 @@ public class BlockConduitBundle extends BlockEio
|
||||
}
|
||||
|
||||
private boolean facadeEquals(IConduitBundle bundle, Block facadeID, int facadeMeta, int facadeType) {
|
||||
return bundle.getFacadeId().equals(facadeID)
|
||||
&& bundle.getFacadeMetadata() == facadeMeta
|
||||
return bundle.getFacadeId().equals(facadeID) && bundle.getFacadeMetadata() == facadeMeta
|
||||
&& bundle.getFacadeType().ordinal() == facadeType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tryRotateFacade(World world, int x, int y, int z, ForgeDirection axis) {
|
||||
IConduitBundle bundle = (IConduitBundle) world.getTileEntity(x, y, z);
|
||||
if (bundle == null) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (!(te instanceof IConduitBundle)) {
|
||||
return false;
|
||||
}
|
||||
IConduitBundle bundle = (IConduitBundle) te;
|
||||
|
||||
int oldMeta = bundle.getFacadeMetadata();
|
||||
int newMeta = PainterUtil.rotateFacadeMetadata(bundle.getFacadeId(), oldMeta, axis);
|
||||
@@ -834,7 +820,7 @@ public class BlockConduitBundle extends BlockEio
|
||||
return new ExternalConnectionContainer(
|
||||
player.inventory,
|
||||
(IConduitBundle) te,
|
||||
ForgeDirection.values()[id - GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE]);
|
||||
ForgeDirections.DIRECTIONS[id - GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -849,7 +835,7 @@ public class BlockConduitBundle extends BlockEio
|
||||
return new GuiExternalConnection(
|
||||
player.inventory,
|
||||
(IConduitBundle) te,
|
||||
ForgeDirection.values()[id - GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE]);
|
||||
ForgeDirections.DIRECTIONS[id - GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -880,14 +866,8 @@ public class BlockConduitBundle extends BlockEio
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
AxisAlignedBB axisalignedbb,
|
||||
@SuppressWarnings("rawtypes") List arraylist,
|
||||
Entity par7Entity) {
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axisalignedbb,
|
||||
List<AxisAlignedBB> arraylist, Entity par7Entity) {
|
||||
|
||||
if (MicroblocksUtil.supportMicroblocks()) {
|
||||
IM__addCollisionBoxesToList(world, x, y, z, axisalignedbb, arraylist, par7Entity);
|
||||
@@ -906,7 +886,12 @@ public class BlockConduitBundle extends BlockEio
|
||||
Collection<CollidableComponent> bounds = con.getCollidableComponents();
|
||||
for (CollidableComponent bnd : bounds) {
|
||||
setBlockBounds(
|
||||
bnd.bound.minX, bnd.bound.minY, bnd.bound.minZ, bnd.bound.maxX, bnd.bound.maxY, bnd.bound.maxZ);
|
||||
bnd.bound.minX,
|
||||
bnd.bound.minY,
|
||||
bnd.bound.minZ,
|
||||
bnd.bound.maxX,
|
||||
bnd.bound.maxY,
|
||||
bnd.bound.maxZ);
|
||||
super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, arraylist, par7Entity);
|
||||
}
|
||||
|
||||
@@ -947,8 +932,7 @@ public class BlockConduitBundle extends BlockEio
|
||||
// This is an ugly special case, TODO fix this
|
||||
for (RaytraceResult hit : results) {
|
||||
IInsulatedRedstoneConduit cond = con.getConduit(IInsulatedRedstoneConduit.class);
|
||||
if (cond != null
|
||||
&& hit.component != null
|
||||
if (cond != null && hit.component != null
|
||||
&& cond.getExternalConnections().contains(hit.component.dir)
|
||||
&& !cond.isSpecialConnection(hit.component.dir)
|
||||
&& hit.component.data == InsulatedRedstoneConduit.COLOR_CONTROLLER_ID) {
|
||||
@@ -983,7 +967,12 @@ public class BlockConduitBundle extends BlockEio
|
||||
}
|
||||
|
||||
return AxisAlignedBB.getBoundingBox(
|
||||
x + minBB.minX, y + minBB.minY, z + minBB.minZ, x + minBB.maxX, y + minBB.maxY, z + minBB.maxZ);
|
||||
x + minBB.minX,
|
||||
y + minBB.minY,
|
||||
z + minBB.minZ,
|
||||
x + minBB.maxX,
|
||||
y + minBB.maxY,
|
||||
z + minBB.maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1029,8 +1018,8 @@ public class BlockConduitBundle extends BlockEio
|
||||
return doRayTraceAll(world, x, y, z, origin, direction, entityPlayer);
|
||||
}
|
||||
|
||||
private RaytraceResult doRayTrace(
|
||||
World world, int x, int y, int z, Vec3 origin, Vec3 direction, EntityPlayer entityPlayer) {
|
||||
private RaytraceResult doRayTrace(World world, int x, int y, int z, Vec3 origin, Vec3 direction,
|
||||
EntityPlayer entityPlayer) {
|
||||
List<RaytraceResult> allHits = doRayTraceAll(world, x, y, z, origin, direction, entityPlayer);
|
||||
if (allHits == null) {
|
||||
return null;
|
||||
@@ -1038,15 +1027,15 @@ public class BlockConduitBundle extends BlockEio
|
||||
return RaytraceResult.getClosestHit(origin, allHits);
|
||||
}
|
||||
|
||||
protected List<RaytraceResult> doRayTraceAll(
|
||||
World world, int x, int y, int z, Vec3 origin, Vec3 direction, EntityPlayer player) {
|
||||
protected List<RaytraceResult> doRayTraceAll(World world, int x, int y, int z, Vec3 origin, Vec3 direction,
|
||||
EntityPlayer player) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (!(te instanceof IConduitBundle)) {
|
||||
return null;
|
||||
}
|
||||
IConduitBundle bundle = (IConduitBundle) te;
|
||||
List<RaytraceResult> hits = new ArrayList<RaytraceResult>();
|
||||
List<RaytraceResult> hits = new ArrayList<>();
|
||||
|
||||
if (player == null) {
|
||||
player = EnderIO.proxy.getClientPlayer();
|
||||
@@ -1056,13 +1045,14 @@ public class BlockConduitBundle extends BlockEio
|
||||
setBlockBounds(0, 0, 0, 1, 1, 1);
|
||||
MovingObjectPosition hitPos = super.collisionRayTrace(world, x, y, z, origin, direction);
|
||||
if (hitPos != null) {
|
||||
hits.add(new RaytraceResult(
|
||||
new CollidableComponent(null, BoundingBox.UNIT_CUBE, ForgeDirection.UNKNOWN, null), hitPos));
|
||||
hits.add(
|
||||
new RaytraceResult(
|
||||
new CollidableComponent(null, BoundingBox.UNIT_CUBE, ForgeDirection.UNKNOWN, null),
|
||||
hitPos));
|
||||
}
|
||||
} else {
|
||||
ConduitDisplayMode mode = ConduitUtil.getDisplayMode(player);
|
||||
Collection<CollidableComponent> components =
|
||||
new ArrayList<CollidableComponent>(bundle.getCollidableComponents());
|
||||
Collection<CollidableComponent> components = new ArrayList<>(bundle.getCollidableComponents());
|
||||
for (CollidableComponent component : components) {
|
||||
if ((component.conduitType != null || mode == ConduitDisplayMode.ALL)
|
||||
&& ConduitUtil.renderConduit(player, component.conduitType)) {
|
||||
@@ -1188,8 +1178,8 @@ public class BlockConduitBundle extends BlockEio
|
||||
return bundle.getConduit(IRedstoneConduit.class);
|
||||
}
|
||||
|
||||
public ItemStack getMicroblockPickBlock(
|
||||
MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
public ItemStack getMicroblockPickBlock(MovingObjectPosition target, World world, int x, int y, int z,
|
||||
EntityPlayer player) {
|
||||
return IMultipartSystem.instance.hook_getPickBlock(target, world, x, y, z, player);
|
||||
}
|
||||
|
||||
@@ -1209,23 +1199,79 @@ public class BlockConduitBundle extends BlockEio
|
||||
return IMultipartSystem.instance.hook_addHitEffects(worldObj, target, effectRenderer);
|
||||
}
|
||||
|
||||
private MovingObjectPosition IM__collisionRayTrace(
|
||||
MovingObjectPosition cur, World world, int x, int y, int z, Vec3 src, Vec3 dst) {
|
||||
private MovingObjectPosition IM__collisionRayTrace(MovingObjectPosition cur, World world, int x, int y, int z,
|
||||
Vec3 src, Vec3 dst) {
|
||||
return IMultipartSystem.instance.hook_collisionRayTrace(cur, world, x, y, z, src, dst);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
private void IM__addCollisionBoxesToList(
|
||||
World world, int x, int y, int z, AxisAlignedBB mask, List list, Entity entity) {
|
||||
private void IM__addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB mask,
|
||||
List<AxisAlignedBB> list, Entity entity) {
|
||||
IMultipartSystem.instance.hook_addCollisionBoxesToList(world, x, y, z, mask, list, entity);
|
||||
}
|
||||
|
||||
private ArrayList<ItemStack> IM__getDrops(
|
||||
List<ItemStack> cur, World world, int x, int y, int z, int metadata, int fortune) {
|
||||
private ArrayList<ItemStack> IM__getDrops(List<ItemStack> cur, World world, int x, int y, int z, int metadata,
|
||||
int fortune) {
|
||||
return IMultipartSystem.instance.hook_getDrops(cur, world, x, y, z, metadata, fortune);
|
||||
}
|
||||
|
||||
private boolean hasMicroblocks(IConduitBundle bundle) {
|
||||
return !bundle.getCoverSystem().getAllParts().isEmpty();
|
||||
}
|
||||
|
||||
public class EventHandler {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onPlaySound(PlaySoundSourceEvent event) {
|
||||
String path = event.sound.getPositionedSoundLocation().getResourcePath();
|
||||
if ("silence.step".equals(path)) {
|
||||
ISound snd = event.sound;
|
||||
World world = EnderIO.proxy.getClientWorld();
|
||||
if (world == null) return;
|
||||
BlockCoord bc = new BlockCoord(snd.getXPosF(), snd.getYPosF(), snd.getZPosF());
|
||||
TileEntity te = bc.getTileEntity(world);
|
||||
if (te instanceof TileConduitBundle && ((TileConduitBundle) te).hasFacade()) {
|
||||
Block facade = getFacade(world, bc.x, bc.y, bc.z, -1);
|
||||
ConduitUtil.playHitSound(facade.stepSound, world, bc.x, bc.y, bc.z);
|
||||
} else {
|
||||
ConduitUtil.playHitSound(Block.soundTypeMetal, world, bc.x, bc.y, bc.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onPlaySoundAtEntity(PlaySoundAtEntityEvent event) {
|
||||
String path = event.name;
|
||||
World world = event.entity.worldObj;
|
||||
if ("EnderIO:silence.step".equals(path) && world.isRemote) {
|
||||
BlockCoord bc = new BlockCoord(event.entity.posX, event.entity.posY - 2, event.entity.posZ);
|
||||
TileEntity te = bc.getTileEntity(world);
|
||||
if (te instanceof TileConduitBundle && ((TileConduitBundle) te).hasFacade()) {
|
||||
Block facade = getFacade(world, bc.x, bc.y, bc.z, -1);
|
||||
ConduitUtil.playStepSound(facade.stepSound, world, bc.x, bc.y, bc.z);
|
||||
} else {
|
||||
ConduitUtil.playStepSound(Block.soundTypeMetal, world, bc.x, bc.y, bc.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBreakSpeed(BreakSpeed event) {
|
||||
if (event.block == BlockConduitBundle.this) {
|
||||
ItemStack held = event.entityPlayer.getCurrentEquippedItem();
|
||||
if (held == null || held.getItem().getHarvestLevel(held, "pickaxe") == -1) {
|
||||
event.newSpeed += 2;
|
||||
}
|
||||
IConduitBundle te = (IConduitBundle) event.entity.worldObj.getTileEntity(event.x, event.y, event.z);
|
||||
if (te != null && te.getFacadeType() == FacadeType.HARDENED) {
|
||||
if (!ConduitUtil.isSolidFacadeRendered(te, event.entityPlayer)) {
|
||||
event.newSpeed *= 6;
|
||||
} else {
|
||||
event.newSpeed *= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,34 @@
|
||||
package crazypants.enderio.conduit;
|
||||
|
||||
import static crazypants.enderio.gui.IconEIO.*;
|
||||
import static crazypants.enderio.gui.IconEIO.CROSS;
|
||||
import static crazypants.enderio.gui.IconEIO.TICK;
|
||||
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_FLUID;
|
||||
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_FLUID_OFF;
|
||||
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_ITEM;
|
||||
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_ITEM_OFF;
|
||||
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_POWER;
|
||||
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_POWER_OFF;
|
||||
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_REDSTONE;
|
||||
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_REDSTONE_OFF;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.enderio.core.api.client.render.IWidgetIcon;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import crazypants.enderio.api.tool.IConduitControl;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ConduitDisplayMode {
|
||||
|
||||
@@ -48,18 +61,13 @@ public class ConduitDisplayMode {
|
||||
private String overrideName = null;
|
||||
|
||||
/**
|
||||
* Use this constructor if you have custom display logic, it will use
|
||||
* {@code IConduit.class} as the conduitType, and the passed name as the
|
||||
* override name.
|
||||
* Use this constructor if you have custom display logic, it will use {@code IConduit.class} as the conduitType, and
|
||||
* the passed name as the override name.
|
||||
*
|
||||
* @param name The override name.
|
||||
* @param widgetSelected The widget to render when this type is selected.
|
||||
* @param widgetUnselected The widget to render when this type is unselected.
|
||||
* @see #ConduitDisplayMode(Class, IWidgetIcon, IWidgetIcon)
|
||||
*
|
||||
* @param name
|
||||
* The override name.
|
||||
* @param widgetSelected
|
||||
* The widget to render when this type is selected.
|
||||
* @param widgetUnselected
|
||||
* The widget to render when this type is unselected.
|
||||
*/
|
||||
public ConduitDisplayMode(String name, IWidgetIcon widgetSelected, IWidgetIcon widgetUnselected) {
|
||||
this(IConduit.class, widgetSelected, widgetUnselected);
|
||||
@@ -67,20 +75,16 @@ public class ConduitDisplayMode {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new display mode for any {@link IConduitControl} wrench. Contains
|
||||
* data about which conduit type this is for, and the icons to render while
|
||||
* holding the wrench. wrench.
|
||||
* Creates a new display mode for any {@link IConduitControl} wrench. Contains data about which conduit type this is
|
||||
* for, and the icons to render while holding the wrench. wrench.
|
||||
*
|
||||
* @param conduitType
|
||||
* The base class for your conduit type, typically an interface (e.g.
|
||||
* {@code IPowerConduit}).
|
||||
* @param widgetSelected
|
||||
* The widget to render when this type is selected.
|
||||
* @param widgetUnselected
|
||||
* The widget to render when this type is unselected.
|
||||
* @param conduitType The base class for your conduit type, typically an interface (e.g.
|
||||
* {@code IPowerConduit}).
|
||||
* @param widgetSelected The widget to render when this type is selected.
|
||||
* @param widgetUnselected The widget to render when this type is unselected.
|
||||
*/
|
||||
public ConduitDisplayMode(
|
||||
@Nonnull Class<? extends IConduit> conduitType, IWidgetIcon widgetSelected, IWidgetIcon widgetUnselected) {
|
||||
public ConduitDisplayMode(@Nonnull Class<? extends IConduit> conduitType, IWidgetIcon widgetSelected,
|
||||
IWidgetIcon widgetUnselected) {
|
||||
this.conduitType = conduitType;
|
||||
this.widgetSelected = widgetSelected;
|
||||
this.widgetUnselected = widgetUnselected;
|
||||
@@ -107,11 +111,9 @@ public class ConduitDisplayMode {
|
||||
}
|
||||
|
||||
/**
|
||||
* The name is null by default, and will use the simple class name of the
|
||||
* conduit type.
|
||||
* The name is null by default, and will use the simple class name of the conduit type.
|
||||
*
|
||||
* @param name
|
||||
* The override name to set.
|
||||
* @param name The override name to set.
|
||||
*/
|
||||
public void setName(@Nullable String name) {
|
||||
this.overrideName = name;
|
||||
@@ -194,7 +196,8 @@ public class ConduitDisplayMode {
|
||||
}
|
||||
|
||||
public static Iterable<ConduitDisplayMode> getRenderableModes() {
|
||||
return FluentIterable.from(registrar).filter(new Predicate<ConduitDisplayMode>() {
|
||||
return FluentIterable.from(registrar).filter(new Predicate<>() {
|
||||
|
||||
@Override
|
||||
public boolean apply(ConduitDisplayMode input) {
|
||||
return input != ALL && input != NONE;
|
||||
|
||||
@@ -1,26 +1,24 @@
|
||||
package crazypants.enderio.conduit;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import java.util.ArrayList;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
|
||||
public class ConduitNetworkTickHandler {
|
||||
|
||||
public static final ConduitNetworkTickHandler instance = new ConduitNetworkTickHandler();
|
||||
public interface TickListener {
|
||||
|
||||
public static interface TickListener {
|
||||
public void tickStart(TickEvent.ServerTickEvent evt);
|
||||
void tickStart(TickEvent.ServerTickEvent evt);
|
||||
|
||||
public void tickEnd(TickEvent.ServerTickEvent evt);
|
||||
void tickEnd(TickEvent.ServerTickEvent evt);
|
||||
}
|
||||
|
||||
private final List<TickListener> listeners = new ArrayList<TickListener>();
|
||||
|
||||
private final IdentityHashMap<AbstractConduitNetwork<?, ?>, Boolean> networks =
|
||||
new IdentityHashMap<AbstractConduitNetwork<?, ?>, Boolean>();
|
||||
private final List<TickListener> listeners = new ArrayList<>();
|
||||
private final IdentityHashMap<AbstractConduitNetwork<?, ?>, Boolean> networks = new IdentityHashMap<>();
|
||||
|
||||
public void addListener(TickListener listener) {
|
||||
listeners.add(listener);
|
||||
|
||||
@@ -1,11 +1,29 @@
|
||||
package crazypants.enderio.conduit;
|
||||
|
||||
import static crazypants.enderio.ModObject.blockPainter;
|
||||
import static crazypants.enderio.material.Alloy.*;
|
||||
import static crazypants.enderio.material.Material.*;
|
||||
import static crazypants.enderio.material.endergy.AlloyEndergy.*;
|
||||
import static crazypants.enderio.material.Alloy.CONDUCTIVE_IRON;
|
||||
import static crazypants.enderio.material.Alloy.ELECTRICAL_STEEL;
|
||||
import static crazypants.enderio.material.Alloy.END_STEEL;
|
||||
import static crazypants.enderio.material.Alloy.ENERGETIC_ALLOY;
|
||||
import static crazypants.enderio.material.Alloy.PHASED_GOLD;
|
||||
import static crazypants.enderio.material.Alloy.REDSTONE_ALLOY;
|
||||
import static crazypants.enderio.material.Material.CONDUIT_BINDER;
|
||||
import static crazypants.enderio.material.Material.PHASED_IRON_NUGGET;
|
||||
import static crazypants.enderio.material.endergy.AlloyEndergy.CRUDE_STEEL;
|
||||
import static crazypants.enderio.material.endergy.AlloyEndergy.CRYSTALLINE_ALLOY;
|
||||
import static crazypants.enderio.material.endergy.AlloyEndergy.CRYSTALLINE_PINK_SLIME;
|
||||
import static crazypants.enderio.material.endergy.AlloyEndergy.ENERGETIC_SILVER;
|
||||
import static crazypants.enderio.material.endergy.AlloyEndergy.MELODIC_ALLOY;
|
||||
import static crazypants.enderio.material.endergy.AlloyEndergy.STELLAR_ALLOY;
|
||||
import static crazypants.util.RecipeUtil.addShaped;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
@@ -26,12 +44,6 @@ import crazypants.enderio.machine.MachineRecipeRegistry;
|
||||
import crazypants.enderio.material.BlockFusedQuartz;
|
||||
import crazypants.enderio.material.FrankenSkull;
|
||||
import crazypants.enderio.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
public class ConduitRecipes {
|
||||
|
||||
@@ -59,10 +71,14 @@ public class ConduitRecipes {
|
||||
|
||||
String binder = CONDUIT_BINDER.oreDict;
|
||||
|
||||
ItemStack zombieController =
|
||||
new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.ZOMBIE_CONTROLLER.ordinal());
|
||||
ItemStack skeletalContractor =
|
||||
new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.SKELETAL_CONTRACTOR.ordinal());
|
||||
ItemStack zombieController = new ItemStack(
|
||||
EnderIO.itemFrankenSkull,
|
||||
1,
|
||||
FrankenSkull.ZOMBIE_CONTROLLER.ordinal());
|
||||
ItemStack skeletalContractor = new ItemStack(
|
||||
EnderIO.itemFrankenSkull,
|
||||
1,
|
||||
FrankenSkull.SKELETAL_CONTRACTOR.ordinal());
|
||||
|
||||
// Recipes
|
||||
addShaped(
|
||||
@@ -72,15 +88,16 @@ public class ConduitRecipes {
|
||||
"bbb",
|
||||
'b',
|
||||
binder);
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
new ItemStack(EnderIO.itemConduitFacade, 1, FacadeType.HARDENED.ordinal()),
|
||||
" o ",
|
||||
"oFo",
|
||||
" o ",
|
||||
'F',
|
||||
EnderIO.itemConduitFacade,
|
||||
'o',
|
||||
"dustObsidian"));
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
new ItemStack(EnderIO.itemConduitFacade, 1, FacadeType.HARDENED.ordinal()),
|
||||
" o ",
|
||||
"oFo",
|
||||
" o ",
|
||||
'F',
|
||||
EnderIO.itemConduitFacade,
|
||||
'o',
|
||||
"dustObsidian"));
|
||||
|
||||
int numConduits = Config.numConduitsPerRecipe;
|
||||
addShaped(
|
||||
@@ -245,8 +262,7 @@ public class ConduitRecipes {
|
||||
"ingotGold");
|
||||
lastTier = new ItemStack(EnderIO.itemPowerConduitEndergy, 1, 3);
|
||||
|
||||
if (OreDictionary.doesOreNameExist("ingotCopper")
|
||||
&& OreDictionary.getOres("ingotCopper").size() > 0) {
|
||||
if (OreDictionary.doesOreNameExist("ingotCopper") && OreDictionary.getOres("ingotCopper").size() > 0) {
|
||||
addShaped(
|
||||
new ItemStack(EnderIO.itemPowerConduitEndergy, numConduits, 4),
|
||||
"b#b",
|
||||
@@ -553,8 +569,8 @@ public class ConduitRecipes {
|
||||
ItemStack itemConduit = new ItemStack(EnderIO.itemItemConduit, numConduits, 0);
|
||||
addShaped(itemConduit, "bbb", "###", "bbb", 'b', binder, '#', phasedIronNugget);
|
||||
|
||||
MachineRecipeRegistry.instance.registerRecipe(
|
||||
blockPainter.unlocalisedName, EnderIO.itemConduitFacade.new FacadePainterRecipe());
|
||||
MachineRecipeRegistry.instance
|
||||
.registerRecipe(blockPainter.unlocalisedName, EnderIO.itemConduitFacade.new FacadePainterRecipe());
|
||||
|
||||
// Filter Recipes
|
||||
ItemStack basicFilter = new ItemStack(EnderIO.itemBasicFilterUpgrade, 1, 0);
|
||||
@@ -585,6 +601,9 @@ public class ConduitRecipes {
|
||||
'f',
|
||||
advFilter);
|
||||
|
||||
ItemStack limitedFilter = new ItemStack(EnderIO.itemLimitedItemFilter, 1, 0);
|
||||
addShaped(limitedFilter, " ", "cfc", " ", 'c', new ItemStack(Items.comparator, 1, 0), 'f', advFilter);
|
||||
|
||||
ItemStack powerFilt = new ItemStack(EnderIO.itemPowerItemFilter);
|
||||
addShaped(powerFilt, " p ", "pcp", " p ", 'p', Items.paper, 'c', EnderIO.itemConduitProbe);
|
||||
|
||||
@@ -669,8 +688,7 @@ public class ConduitRecipes {
|
||||
String fluix = "crystalFluix";
|
||||
String pureFluix = "crystalPureFluix";
|
||||
|
||||
ItemStack quartzFiber =
|
||||
AEApi.instance().parts().partQuartzFiber.stack(1).copy();
|
||||
ItemStack quartzFiber = AEApi.instance().definitions().parts().quartzFiber().maybeStack(1).get().copy();
|
||||
ItemStack conduitBinder = new ItemStack(EnderIO.itemMaterial, 1, Material.CONDUIT_BINDER.ordinal());
|
||||
ItemStack res = new ItemStack(EnderIO.itemMEConduit, Config.numConduitsPerRecipe / 2);
|
||||
|
||||
@@ -678,6 +696,7 @@ public class ConduitRecipes {
|
||||
addShaped(res.copy(), "bbb", "fqf", "bbb", 'b', conduitBinder, 'f', pureFluix, 'q', quartzFiber);
|
||||
|
||||
res.stackSize = 1;
|
||||
addShaped(new ItemStack(EnderIO.itemMEConduit, 1, 1), "bCb", "CbC", "bCb", 'b', conduitBinder, 'C', res);
|
||||
ItemStack resDense = new ItemStack(EnderIO.itemMEConduit, 1, 1);
|
||||
addShaped(resDense, "bCb", "CbC", "bCb", 'b', conduitBinder, 'C', res);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,27 @@
|
||||
package crazypants.enderio.conduit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block.SoundType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -18,46 +38,31 @@ import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.Signal;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.tool.ToolUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import net.minecraft.block.Block.SoundType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class ConduitUtil {
|
||||
|
||||
public static final Random RANDOM = new Random();
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void ensureValidNetwork(IConduit conduit) {
|
||||
TileEntity te = conduit.getBundle().getEntity();
|
||||
World world = te.getWorldObj();
|
||||
Collection<? extends IConduit> connections =
|
||||
ConduitUtil.getConnectedConduits(world, te.xCoord, te.yCoord, te.zCoord, conduit.getBaseConduitType());
|
||||
Collection<? extends IConduit> connections = ConduitUtil
|
||||
.getConnectedConduits(world, te.xCoord, te.yCoord, te.zCoord, conduit.getBaseConduitType());
|
||||
|
||||
if (reuseNetwork(conduit, connections, world)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
AbstractConduitNetwork res = conduit.createNetworkForType();
|
||||
res.init(conduit.getBundle(), connections, world);
|
||||
return;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings("unchecked")
|
||||
private static boolean reuseNetwork(IConduit con, Collection<? extends IConduit> connections, World world) {
|
||||
@SuppressWarnings("rawtypes")
|
||||
AbstractConduitNetwork network = null;
|
||||
for (IConduit conduit : connections) {
|
||||
if (network == null) {
|
||||
@@ -80,16 +85,16 @@ public class ConduitUtil {
|
||||
public static <T extends IConduit> void disconectConduits(T con, ForgeDirection connDir) {
|
||||
con.conduitConnectionRemoved(connDir);
|
||||
BlockCoord loc = con.getLocation().getLocation(connDir);
|
||||
IConduit neighbour = ConduitUtil.getConduit(
|
||||
con.getBundle().getEntity().getWorldObj(), loc.x, loc.y, loc.z, con.getBaseConduitType());
|
||||
IConduit neighbour = ConduitUtil
|
||||
.getConduit(con.getBundle().getEntity().getWorldObj(), loc.x, loc.y, loc.z, con.getBaseConduitType());
|
||||
if (neighbour != null) {
|
||||
neighbour.conduitConnectionRemoved(connDir.getOpposite());
|
||||
if (neighbour.getNetwork() != null) {
|
||||
neighbour.getNetwork().destroyNetwork();
|
||||
}
|
||||
}
|
||||
if (con.getNetwork()
|
||||
!= null) { // this should have been destroyed when destroying the neighbours network but lets just make
|
||||
if (con.getNetwork() != null) { // this should have been destroyed when destroying the neighbours network but
|
||||
// lets just make
|
||||
// sure
|
||||
con.getNetwork().destroyNetwork();
|
||||
}
|
||||
@@ -101,10 +106,9 @@ public class ConduitUtil {
|
||||
|
||||
public static <T extends IConduit> boolean joinConduits(T con, ForgeDirection faceHit) {
|
||||
BlockCoord loc = con.getLocation().getLocation(faceHit);
|
||||
IConduit neighbour = ConduitUtil.getConduit(
|
||||
con.getBundle().getEntity().getWorldObj(), loc.x, loc.y, loc.z, con.getBaseConduitType());
|
||||
if (neighbour != null
|
||||
&& con.canConnectToConduit(faceHit, neighbour)
|
||||
IConduit neighbour = ConduitUtil
|
||||
.getConduit(con.getBundle().getEntity().getWorldObj(), loc.x, loc.y, loc.z, con.getBaseConduitType());
|
||||
if (neighbour != null && con.canConnectToConduit(faceHit, neighbour)
|
||||
&& neighbour.canConnectToConduit(faceHit.getOpposite(), con)) {
|
||||
con.conduitConnectionAdded(faceHit);
|
||||
neighbour.conduitConnectionAdded(faceHit.getOpposite());
|
||||
@@ -156,7 +160,7 @@ public class ConduitUtil {
|
||||
}
|
||||
|
||||
public static boolean isFacadeHidden(IConduitBundle bundle, EntityPlayer player) {
|
||||
return bundle.getFacadeId() != null && shouldHeldItemHideFacades(player);
|
||||
return bundle != null && bundle.getFacadeId() != null && shouldHeldItemHideFacades(player);
|
||||
}
|
||||
|
||||
public static ConduitDisplayMode getDisplayMode(EntityPlayer player) {
|
||||
@@ -240,17 +244,17 @@ public class ConduitUtil {
|
||||
}
|
||||
|
||||
public static <T extends IConduit> T getConduit(World world, TileEntity te, ForgeDirection dir, Class<T> type) {
|
||||
return ConduitUtil.getConduit(
|
||||
world, te.xCoord + dir.offsetX, te.yCoord + dir.offsetY, te.zCoord + dir.offsetZ, type);
|
||||
return ConduitUtil
|
||||
.getConduit(world, te.xCoord + dir.offsetX, te.yCoord + dir.offsetY, te.zCoord + dir.offsetZ, type);
|
||||
}
|
||||
|
||||
public static <T extends IConduit> Collection<T> getConnectedConduits(
|
||||
World world, int x, int y, int z, Class<T> type) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
public static <T extends IConduit> Collection<T> getConnectedConduits(World world, int x, int y, int z,
|
||||
Class<T> type) {
|
||||
TileEntity te = world.blockExists(x, y, z) ? world.getTileEntity(x, y, z) : null;
|
||||
if (!(te instanceof IConduitBundle)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<T> result = new ArrayList<T>();
|
||||
List<T> result = new ArrayList<>();
|
||||
IConduitBundle root = (IConduitBundle) te;
|
||||
T con = root.getConduit(type);
|
||||
if (con != null) {
|
||||
@@ -316,10 +320,10 @@ public class ConduitUtil {
|
||||
}
|
||||
|
||||
int signalStrength = getInternalSignalForColor(bundle, col);
|
||||
if (signalStrength < 15 && DyeColor.RED == col && bundle != null && bundle.getEntity() != null) {
|
||||
if (signalStrength < 15 && bundle != null && bundle.getEntity() != null) {
|
||||
TileEntity te = bundle.getEntity();
|
||||
signalStrength = Math.max(
|
||||
signalStrength, te.getWorldObj().getStrongestIndirectPower(te.xCoord, te.yCoord, te.zCoord));
|
||||
signalStrength = Math
|
||||
.max(signalStrength, te.getWorldObj().getStrongestIndirectPower(te.xCoord, te.yCoord, te.zCoord));
|
||||
}
|
||||
return RedstoneControlMode.isConditionMet(mode, signalStrength);
|
||||
}
|
||||
@@ -359,7 +363,7 @@ public class ConduitUtil {
|
||||
return;
|
||||
}
|
||||
IConduitBundle cb = (IConduitBundle) te;
|
||||
Set<ForgeDirection> cons = new HashSet<ForgeDirection>();
|
||||
Set<ForgeDirection> cons = new HashSet<>();
|
||||
boolean hasInsulated = false;
|
||||
for (IConduit con : cb.getConduits()) {
|
||||
cons.addAll(con.getExternalConnections());
|
||||
@@ -373,8 +377,7 @@ public class ConduitUtil {
|
||||
if (cons.size() == 1) {
|
||||
player.openGui(
|
||||
EnderIO.instance,
|
||||
GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE
|
||||
+ cons.iterator().next().ordinal(),
|
||||
GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE + cons.iterator().next().ordinal(),
|
||||
world,
|
||||
x,
|
||||
y,
|
||||
@@ -399,8 +402,7 @@ public class ConduitUtil {
|
||||
}
|
||||
|
||||
private static void playClientBreakSound(SoundType snd) {
|
||||
FMLClientHandler.instance()
|
||||
.getClientPlayerEntity()
|
||||
FMLClientHandler.instance().getClientPlayerEntity()
|
||||
.playSound(snd.getBreakSound(), (snd.getVolume() + 1.0F) / 2.0F, snd.getPitch() * 0.8F);
|
||||
}
|
||||
|
||||
@@ -419,8 +421,7 @@ public class ConduitUtil {
|
||||
}
|
||||
|
||||
private static void playClientHitSound(SoundType snd) {
|
||||
FMLClientHandler.instance()
|
||||
.getClientPlayerEntity()
|
||||
FMLClientHandler.instance().getClientPlayerEntity()
|
||||
.playSound(snd.getStepResourcePath(), (snd.getVolume() + 1.0F) / 8.0F, snd.getPitch() * 0.5F);
|
||||
}
|
||||
|
||||
@@ -439,8 +440,7 @@ public class ConduitUtil {
|
||||
}
|
||||
|
||||
private static void playClientStepSound(SoundType snd) {
|
||||
FMLClientHandler.instance()
|
||||
.getClientPlayerEntity()
|
||||
FMLClientHandler.instance().getClientPlayerEntity()
|
||||
.playSound(snd.getStepResourcePath(), (snd.getVolume() + 1.0F) / 8.0F, snd.getPitch());
|
||||
}
|
||||
|
||||
@@ -459,8 +459,7 @@ public class ConduitUtil {
|
||||
}
|
||||
|
||||
private static void playClientPlaceSound(SoundType snd) {
|
||||
FMLClientHandler.instance()
|
||||
.getClientPlayerEntity()
|
||||
FMLClientHandler.instance().getClientPlayerEntity()
|
||||
.playSound(snd.func_150496_b(), (snd.getVolume() + 1.0F) / 8.0F, snd.getPitch());
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,17 @@ package crazypants.enderio.conduit;
|
||||
import crazypants.enderio.EnderIO;
|
||||
|
||||
public enum ConnectionMode {
|
||||
|
||||
IN_OUT("gui.conduit.ioMode.inOut"),
|
||||
INPUT("gui.conduit.ioMode.input"),
|
||||
OUTPUT("gui.conduit.ioMode.output"),
|
||||
DISABLED("gui.conduit.ioMode.disabled"),
|
||||
NOT_SET("gui.conduit.ioMode.notSet");
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final ConnectionMode[] VALUES = values();
|
||||
private final String unlocalisedName;
|
||||
|
||||
ConnectionMode(String unlocalisedName) {
|
||||
@@ -21,19 +26,19 @@ public enum ConnectionMode {
|
||||
|
||||
public static ConnectionMode getNext(ConnectionMode mode) {
|
||||
int ord = mode.ordinal() + 1;
|
||||
if (ord >= ConnectionMode.values().length) {
|
||||
if (ord >= ConnectionMode.VALUES.length) {
|
||||
ord = 0;
|
||||
}
|
||||
return ConnectionMode.values()[ord];
|
||||
return ConnectionMode.VALUES[ord];
|
||||
}
|
||||
|
||||
public static ConnectionMode getPrevious(ConnectionMode mode) {
|
||||
|
||||
int ord = mode.ordinal() - 1;
|
||||
if (ord < 0) {
|
||||
ord = ConnectionMode.values().length - 1;
|
||||
ord = ConnectionMode.VALUES.length - 1;
|
||||
}
|
||||
return ConnectionMode.values()[ord];
|
||||
return ConnectionMode.VALUES[ord];
|
||||
}
|
||||
|
||||
public boolean acceptsInput() {
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package crazypants.enderio.conduit;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import crazypants.enderio.conduit.geom.CollidableCache.CacheKey;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -15,6 +13,12 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import crazypants.enderio.conduit.geom.CollidableCache.CacheKey;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
|
||||
public interface IConduit {
|
||||
|
||||
// Base functionality
|
||||
@@ -135,8 +139,9 @@ public interface IConduit {
|
||||
public AbstractConduitNetwork<?, ?> createNetworkForType();
|
||||
|
||||
/**
|
||||
* Should the texture of the conduit connectors be mirrored around the conduit
|
||||
* node?
|
||||
* Should the texture of the conduit connectors be mirrored around the conduit node?
|
||||
*/
|
||||
boolean shouldMirrorTexture();
|
||||
|
||||
ConduitRenderer getRenderer();
|
||||
}
|
||||
@@ -1,8 +1,20 @@
|
||||
package crazypants.enderio.conduit;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import appeng.api.networking.IGridHost;
|
||||
import cofh.api.transport.IItemDuct;
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
import cpw.mods.fml.common.Optional.InterfaceList;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -11,36 +23,18 @@ import crazypants.enderio.conduit.facade.ItemConduitFacade.FacadeType;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.geom.Offset;
|
||||
import crazypants.enderio.power.IInternalPowerHandler;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import li.cil.oc.api.network.Environment;
|
||||
import li.cil.oc.api.network.SidedEnvironment;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import mods.immibis.microblocks.api.IMicroblockSupporterTile;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
@InterfaceList({
|
||||
@Interface(iface = "appeng.api.networking.IGridHost", modid = "appliedenergistics2"),
|
||||
@Interface(iface = "mekanism.api.gas.IGasHandler", modid = "MekanismAPI|gas"),
|
||||
@Interface(iface = "mods.immibis.microblocks.api.IMicroblockSupporterTile", modid = "ImmibisMicroblocks"),
|
||||
@Interface(iface = "li.cil.oc.api.network.Environment", modid = "OpenComputersAPI|Network"),
|
||||
@Interface(iface = "li.cil.oc.api.network.SidedEnvironment", modid = "OpenComputersAPI|Network")
|
||||
})
|
||||
public interface IConduitBundle
|
||||
extends IInternalPowerHandler,
|
||||
IFluidHandler,
|
||||
IItemDuct,
|
||||
IGasHandler,
|
||||
IGridHost,
|
||||
IMicroblockSupporterTile,
|
||||
Environment,
|
||||
SidedEnvironment {
|
||||
@InterfaceList({ @Interface(iface = "appeng.api.networking.IGridHost", modid = "appliedenergistics2"),
|
||||
@Interface(iface = "mekanism.api.gas.IGasHandler", modid = "MekanismAPI|gas"),
|
||||
@Interface(iface = "mods.immibis.microblocks.api.IMicroblockSupporterTile", modid = "ImmibisMicroblocks"),
|
||||
@Interface(iface = "li.cil.oc.api.network.Environment", modid = "OpenComputersAPI|Network"),
|
||||
@Interface(iface = "li.cil.oc.api.network.SidedEnvironment", modid = "OpenComputersAPI|Network") })
|
||||
public interface IConduitBundle extends IInternalPowerHandler, IFluidHandler, IItemDuct, IGasHandler, IGridHost,
|
||||
IMicroblockSupporterTile, Environment, SidedEnvironment {
|
||||
|
||||
TileEntity getEntity();
|
||||
|
||||
@@ -55,6 +49,8 @@ public interface IConduitBundle
|
||||
|
||||
void addConduit(IConduit conduit);
|
||||
|
||||
void replaceConduit(IConduit original, IConduit replacement);
|
||||
|
||||
void removeConduit(IConduit conduit);
|
||||
|
||||
Collection<IConduit> getConduits();
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package crazypants.enderio.conduit;
|
||||
|
||||
import crazypants.enderio.api.tool.IHideFacades;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import crazypants.enderio.api.tool.IHideFacades;
|
||||
|
||||
public interface IConduitItem extends IHideFacades {
|
||||
|
||||
Class<? extends IConduit> getBaseConduitType();
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package crazypants.enderio.conduit;
|
||||
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
|
||||
public interface IExtractor extends IConduit {
|
||||
|
||||
void setExtractionRedstoneMode(RedstoneControlMode mode, ForgeDirection dir);
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package crazypants.enderio.conduit;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import mods.immibis.microblocks.api.EnumPosition;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class MicroblocksUtil {
|
||||
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
package crazypants.enderio.conduit;
|
||||
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
|
||||
public class RaytraceResult {
|
||||
|
||||
public static RaytraceResult getClosestHit(Vec3 origin, Collection<RaytraceResult> candidates) {
|
||||
@@ -31,7 +33,8 @@ public class RaytraceResult {
|
||||
if (origin == null || toSort == null) {
|
||||
return;
|
||||
}
|
||||
Collections.sort(toSort, new Comparator<RaytraceResult>() {
|
||||
Collections.sort(toSort, new Comparator<>() {
|
||||
|
||||
@Override
|
||||
public int compare(RaytraceResult o1, RaytraceResult o2) {
|
||||
return Double.compare(o1.getDistanceTo(origin), o2.getDistanceTo(origin));
|
||||
|
||||
@@ -1,8 +1,34 @@
|
||||
package crazypants.enderio.conduit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import com.gtnewhorizon.gtnhlib.concurrent.cas.CasList;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.util.AECableType;
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -25,13 +51,7 @@ import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit;
|
||||
import crazypants.enderio.config.Config;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import li.cil.oc.api.network.*;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import li.cil.oc.api.network.Message;
|
||||
import li.cil.oc.api.network.Node;
|
||||
import mekanism.api.gas.Gas;
|
||||
@@ -43,28 +63,12 @@ import mods.immibis.microblocks.api.IMicroblockSystem;
|
||||
import mods.immibis.microblocks.api.MicroblockAPIUtils;
|
||||
import mods.immibis.microblocks.api.Part;
|
||||
import mods.immibis.microblocks.api.PartType;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
|
||||
public static final short NBT_VERSION = 1;
|
||||
|
||||
private final List<IConduit> conduits = new ArrayList<IConduit>();
|
||||
private final List<IConduit> conduits = new CasList<>();
|
||||
|
||||
private Block facadeId = null;
|
||||
private int facadeMeta = 0;
|
||||
@@ -72,9 +76,9 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
|
||||
private boolean facadeChanged;
|
||||
|
||||
private final List<CollidableComponent> cachedCollidables = new ArrayList<CollidableComponent>();
|
||||
private final List<CollidableComponent> cachedCollidables = new ArrayList<>();
|
||||
|
||||
private final List<CollidableComponent> cachedConnectors = new ArrayList<CollidableComponent>();
|
||||
private final List<CollidableComponent> cachedConnectors = new ArrayList<>();
|
||||
|
||||
private boolean conduitsDirty = true;
|
||||
private boolean collidablesDirty = true;
|
||||
@@ -104,8 +108,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
|
||||
@Override
|
||||
public boolean shouldRenderInPass(int arg0) {
|
||||
if (facadeId != null
|
||||
&& facadeId.isOpaqueCube()
|
||||
if (facadeId != null && facadeId.isOpaqueCube()
|
||||
&& !ConduitUtil.isFacadeHidden(this, EnderIO.proxy.getClientPlayer())) {
|
||||
return false;
|
||||
}
|
||||
@@ -334,8 +337,8 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
markForUpdate = true;
|
||||
}
|
||||
} else { // can do the else as only need to update once
|
||||
ConduitDisplayMode curMode = ConduitDisplayMode.getDisplayMode(
|
||||
EnderIO.proxy.getClientPlayer().getCurrentEquippedItem());
|
||||
ConduitDisplayMode curMode = ConduitDisplayMode
|
||||
.getDisplayMode(EnderIO.proxy.getClientPlayer().getCurrentEquippedItem());
|
||||
if (curMode != lastMode) {
|
||||
markForUpdate = true;
|
||||
lastMode = curMode;
|
||||
@@ -403,6 +406,29 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
dirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replaceConduit(IConduit original, IConduit replacement) {
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
// If you're wondering why I am not using conduit.writeToNBT, it is because there is some data that should not
|
||||
// persist, some of which causes crashes with energy conduits.
|
||||
NBTTagCompound[] originalData = new NBTTagCompound[ForgeDirections.DIRECTIONS.length];
|
||||
for (ForgeDirection conduitConnection : original.getExternalConnections()) {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
original.writeConnectionSettingsToNBT(conduitConnection, tag);
|
||||
originalData[conduitConnection.ordinal()] = tag;
|
||||
}
|
||||
removeConduit(original);
|
||||
addConduit(replacement);
|
||||
for (int i = 0; i < originalData.length; i++) {
|
||||
NBTTagCompound nbt = originalData[i];
|
||||
if (nbt != null) {
|
||||
replacement.readConduitSettingsFromNBT(ForgeDirections.DIRECTIONS[i], nbt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeConduit(IConduit conduit) {
|
||||
if (conduit != null) {
|
||||
@@ -427,7 +453,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
List<IConduit> copy = new ArrayList<IConduit>(conduits);
|
||||
List<IConduit> copy = new ArrayList<>(conduits);
|
||||
for (IConduit con : copy) {
|
||||
removeConduit(con, false);
|
||||
}
|
||||
@@ -512,11 +538,12 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
|
||||
@Override
|
||||
public List<CollidableComponent> getConnectors() {
|
||||
List<CollidableComponent> result = new ArrayList<CollidableComponent>();
|
||||
List<CollidableComponent> result = new ArrayList<>();
|
||||
addConnectors(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void addConnectors(List<CollidableComponent> result) {
|
||||
|
||||
if (conduits.isEmpty()) {
|
||||
@@ -537,7 +564,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
cachedConnectors.clear();
|
||||
|
||||
// TODO: What an unholly mess! (and it doesn't even work correctly...)
|
||||
List<CollidableComponent> coreBounds = new ArrayList<CollidableComponent>();
|
||||
List<CollidableComponent> coreBounds = new ArrayList<>();
|
||||
for (IConduit con : conduits) {
|
||||
addConduitCores(coreBounds, con);
|
||||
}
|
||||
@@ -545,13 +572,13 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
result.addAll(coreBounds);
|
||||
|
||||
// 1st algorithm
|
||||
List<CollidableComponent> conduitsBounds = new ArrayList<CollidableComponent>();
|
||||
List<CollidableComponent> conduitsBounds = new ArrayList<>();
|
||||
for (IConduit con : conduits) {
|
||||
conduitsBounds.addAll(con.getCollidableComponents());
|
||||
addConduitCores(conduitsBounds, con);
|
||||
}
|
||||
|
||||
Set<Class<IConduit>> collidingTypes = new HashSet<Class<IConduit>>();
|
||||
Set<Class<IConduit>> collidingTypes = new HashSet<>();
|
||||
for (CollidableComponent conCC : conduitsBounds) {
|
||||
for (CollidableComponent innerCC : conduitsBounds) {
|
||||
if (!InsulatedRedstoneConduit.COLOR_CONTROLLER_ID.equals(innerCC.data)
|
||||
@@ -565,7 +592,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
|
||||
// TODO: Remove the core geometries covered up by this as no point in rendering these
|
||||
if (!collidingTypes.isEmpty()) {
|
||||
List<CollidableComponent> colCores = new ArrayList<CollidableComponent>();
|
||||
List<CollidableComponent> colCores = new ArrayList<>();
|
||||
for (Class<IConduit> c : collidingTypes) {
|
||||
IConduit con = getConduit(c);
|
||||
if (con != null) {
|
||||
@@ -583,8 +610,11 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
}
|
||||
if (bb != null) {
|
||||
bb = bb.scale(1.05, 1.05, 1.05);
|
||||
CollidableComponent cc =
|
||||
new CollidableComponent(null, bb, ForgeDirection.UNKNOWN, ConduitConnectorType.INTERNAL);
|
||||
CollidableComponent cc = new CollidableComponent(
|
||||
null,
|
||||
bb,
|
||||
ForgeDirection.UNKNOWN,
|
||||
ConduitConnectorType.INTERNAL);
|
||||
result.add(cc);
|
||||
cachedConnectors.add(cc);
|
||||
}
|
||||
@@ -594,7 +624,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
for (IConduit con : conduits) {
|
||||
|
||||
if (con.hasConnections()) {
|
||||
List<CollidableComponent> cores = new ArrayList<CollidableComponent>();
|
||||
List<CollidableComponent> cores = new ArrayList<>();
|
||||
addConduitCores(cores, con);
|
||||
if (cores.size() > 1) {
|
||||
BoundingBox bb = cores.get(0).bound;
|
||||
@@ -605,7 +635,10 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
if (bb.getArea() > area * 1.5f) {
|
||||
bb = bb.scale(1.05, 1.05, 1.05);
|
||||
CollidableComponent cc = new CollidableComponent(
|
||||
null, bb, ForgeDirection.UNKNOWN, ConduitConnectorType.INTERNAL);
|
||||
null,
|
||||
bb,
|
||||
ForgeDirection.UNKNOWN,
|
||||
ConduitConnectorType.INTERNAL);
|
||||
result.add(cc);
|
||||
cachedConnectors.add(cc);
|
||||
}
|
||||
@@ -626,8 +659,11 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
}
|
||||
|
||||
if (conBB != null) {
|
||||
CollidableComponent cc =
|
||||
new CollidableComponent(null, conBB, ForgeDirection.UNKNOWN, ConduitConnectorType.INTERNAL);
|
||||
CollidableComponent cc = new CollidableComponent(
|
||||
null,
|
||||
conBB,
|
||||
ForgeDirection.UNKNOWN,
|
||||
ConduitConnectorType.INTERNAL);
|
||||
result.add(cc);
|
||||
cachedConnectors.add(cc);
|
||||
}
|
||||
@@ -659,23 +695,34 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
Class<? extends IConduit> type = con.getCollidableType();
|
||||
if (con.hasConnections()) {
|
||||
for (ForgeDirection dir : con.getExternalConnections()) {
|
||||
result.addAll(cc.getCollidables(
|
||||
cc.createKey(type, getOffset(con.getBaseConduitType(), dir), ForgeDirection.UNKNOWN, false),
|
||||
con));
|
||||
result.addAll(
|
||||
cc.getCollidables(
|
||||
cc.createKey(
|
||||
type,
|
||||
getOffset(con.getBaseConduitType(), dir),
|
||||
ForgeDirection.UNKNOWN,
|
||||
false),
|
||||
con));
|
||||
}
|
||||
for (ForgeDirection dir : con.getConduitConnections()) {
|
||||
result.addAll(cc.getCollidables(
|
||||
cc.createKey(type, getOffset(con.getBaseConduitType(), dir), ForgeDirection.UNKNOWN, false),
|
||||
con));
|
||||
result.addAll(
|
||||
cc.getCollidables(
|
||||
cc.createKey(
|
||||
type,
|
||||
getOffset(con.getBaseConduitType(), dir),
|
||||
ForgeDirection.UNKNOWN,
|
||||
false),
|
||||
con));
|
||||
}
|
||||
} else {
|
||||
result.addAll(cc.getCollidables(
|
||||
cc.createKey(
|
||||
type,
|
||||
getOffset(con.getBaseConduitType(), ForgeDirection.UNKNOWN),
|
||||
ForgeDirection.UNKNOWN,
|
||||
false),
|
||||
con));
|
||||
result.addAll(
|
||||
cc.getCollidables(
|
||||
cc.createKey(
|
||||
type,
|
||||
getOffset(con.getBaseConduitType(), ForgeDirection.UNKNOWN),
|
||||
ForgeDirection.UNKNOWN,
|
||||
false),
|
||||
con));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -920,7 +967,6 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
return (IGridNode) node;
|
||||
}
|
||||
|
||||
@SuppressWarnings("cast")
|
||||
@Override
|
||||
@Method(modid = "appliedenergistics2")
|
||||
public void setGridNode(Object node) {
|
||||
@@ -1029,8 +1075,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
super.onDataPacket(net, pkt);
|
||||
if (covers != null) {
|
||||
((IMicroblockCoverSystem) covers)
|
||||
.readDescriptionBytes(pkt.func_148857_g().getByteArray("C"), 0);
|
||||
((IMicroblockCoverSystem) covers).readDescriptionBytes(pkt.func_148857_g().getByteArray("C"), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
package crazypants.enderio.conduit.facade;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.BlockEio;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.machine.painter.IPaintedBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -15,7 +9,14 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockConduitFacade extends BlockEio implements IPaintedBlock {
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.BlockEio;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.machine.painter.IPaintedBlock;
|
||||
|
||||
public class BlockConduitFacade extends BlockEio implements IPaintedBlock, Cloneable {
|
||||
|
||||
public static BlockConduitFacade create() {
|
||||
BlockConduitFacade result = new BlockConduitFacade();
|
||||
@@ -23,6 +24,10 @@ public class BlockConduitFacade extends BlockEio implements IPaintedBlock {
|
||||
return result;
|
||||
}
|
||||
|
||||
public BlockConduitFacade clone() throws CloneNotSupportedException {
|
||||
return (BlockConduitFacade) super.clone();
|
||||
}
|
||||
|
||||
private Block blockOverride;
|
||||
|
||||
private BlockConduitFacade() {
|
||||
@@ -78,8 +83,7 @@ public class BlockConduitFacade extends BlockEio implements IPaintedBlock {
|
||||
if (blockOverride != null) {
|
||||
try { // work around for Issue #589
|
||||
return blockOverride.colorMultiplier(par1IBlockAccess, par2, par3, par4);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
return super.colorMultiplier(par1IBlockAccess, par2, par3, par4);
|
||||
}
|
||||
@@ -105,7 +109,6 @@ public class BlockConduitFacade extends BlockEio implements IPaintedBlock {
|
||||
}
|
||||
|
||||
Block block = cb.getFacadeId();
|
||||
int meta = cb.getFacadeMetadata();
|
||||
if (block == null || block == this) {
|
||||
return;
|
||||
}
|
||||
@@ -137,7 +140,7 @@ public class BlockConduitFacade extends BlockEio implements IPaintedBlock {
|
||||
return new Mimic(id, meta);
|
||||
}
|
||||
|
||||
class Mimic {
|
||||
static class Mimic {
|
||||
|
||||
int meta;
|
||||
Block block;
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
package crazypants.enderio.conduit.facade;
|
||||
|
||||
import com.enderio.core.client.render.RenderUtil;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.machine.painter.PainterUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.enderio.core.client.render.RenderUtil;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.machine.painter.PainterUtil;
|
||||
|
||||
public class FacadeRenderer implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type == ItemRenderType.ENTITY
|
||||
|| type == ItemRenderType.EQUIPPED
|
||||
return type == ItemRenderType.ENTITY || type == ItemRenderType.EQUIPPED
|
||||
|| type == ItemRenderType.INVENTORY
|
||||
|| type == ItemRenderType.EQUIPPED_FIRST_PERSON;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
package crazypants.enderio.conduit.facade;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.api.client.gui.IAdvancedTooltipProvider;
|
||||
import com.enderio.core.api.client.gui.IResourceTooltipProvider;
|
||||
import com.enderio.core.client.handlers.SpecialTooltipHandler;
|
||||
import com.enderio.core.common.util.Util;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -19,23 +32,17 @@ import crazypants.enderio.machine.painter.BasicPainterTemplate;
|
||||
import crazypants.enderio.machine.painter.IPaintedBlock;
|
||||
import crazypants.enderio.machine.painter.PaintSourceValidator;
|
||||
import crazypants.enderio.machine.painter.PainterUtil;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import crazypants.util.ForgeDirections;
|
||||
|
||||
public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider, IResourceTooltipProvider {
|
||||
|
||||
public static enum FacadeType {
|
||||
public enum FacadeType {
|
||||
|
||||
BASIC,
|
||||
HARDENED;
|
||||
|
||||
public static final FacadeType[] VALUES = values();
|
||||
|
||||
public String getUnlocName(Item me) {
|
||||
return this == BASIC ? me.getUnlocalizedName() : me.getUnlocalizedName() + ".hardened";
|
||||
}
|
||||
@@ -61,18 +68,17 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
|
||||
GameRegistry.registerItem(this, ModObject.itemConduitFacade.unlocalisedName);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs p_150895_2_, List list) {
|
||||
for (FacadeType t : FacadeType.values()) {
|
||||
public void getSubItems(Item item, CreativeTabs p_150895_2_, List<ItemStack> list) {
|
||||
for (FacadeType t : FacadeType.VALUES) {
|
||||
list.add(new ItemStack(item, 1, t.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return FacadeType.values()[stack.getItemDamage()].getUnlocName(this);
|
||||
return FacadeType.VALUES[stack.getItemDamage()].getUnlocName(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -83,7 +89,7 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister IIconRegister) {
|
||||
icons = new IIcon[FacadeType.values().length];
|
||||
icons = new IIcon[FacadeType.VALUES.length];
|
||||
icons[0] = itemIcon = IIconRegister.registerIcon("enderio:conduitFacade");
|
||||
icons[1] = IIconRegister.registerIcon("enderio:conduitFacadeHardened");
|
||||
overlayIcon = IIconRegister.registerIcon("enderio:conduitFacadeOverlay");
|
||||
@@ -105,23 +111,14 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(
|
||||
ItemStack itemStack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
int side,
|
||||
float par8,
|
||||
float par9,
|
||||
float par10) {
|
||||
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||
float par8, float par9, float par10) {
|
||||
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
|
||||
ForgeDirection dir = ForgeDirection.values()[side];
|
||||
ForgeDirection dir = ForgeDirections.DIRECTIONS[side];
|
||||
int placeX = x + dir.offsetX;
|
||||
int placeY = y + dir.offsetY;
|
||||
int placeZ = z + dir.offsetZ;
|
||||
@@ -136,7 +133,7 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
|
||||
facadeMeta = PainterUtil.adjustFacadeMetadata(facadeID, facadeMeta, side);
|
||||
bundle.setFacadeId(facadeID);
|
||||
bundle.setFacadeMetadata(facadeMeta);
|
||||
bundle.setFacadeType(FacadeType.values()[itemStack.getItemDamage()]);
|
||||
bundle.setFacadeType(FacadeType.VALUES[itemStack.getItemDamage()]);
|
||||
ConduitUtil.playPlaceSound(facadeID.stepSound, world, x, y, z);
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
itemStack.stackSize--;
|
||||
@@ -145,16 +142,15 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
|
||||
} else {
|
||||
Block block = world.getBlock(placeX, placeY, placeZ);
|
||||
if (block == EnderIO.blockConduitBundle) {
|
||||
((BlockConduitBundle) block)
|
||||
.handleFacadeClick(
|
||||
world,
|
||||
placeX,
|
||||
placeY,
|
||||
placeZ,
|
||||
player,
|
||||
dir.getOpposite().ordinal(),
|
||||
(IConduitBundle) world.getTileEntity(placeX, placeY, placeZ),
|
||||
itemStack);
|
||||
((BlockConduitBundle) block).handleFacadeClick(
|
||||
world,
|
||||
placeX,
|
||||
placeY,
|
||||
placeZ,
|
||||
player,
|
||||
dir.getOpposite().ordinal(),
|
||||
(IConduitBundle) world.getTileEntity(placeX, placeY, placeZ),
|
||||
itemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -177,10 +173,9 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
|
||||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack item, EntityPlayer par2EntityPlayer, List list, boolean par4) {
|
||||
public void addInformation(ItemStack item, EntityPlayer par2EntityPlayer, List<String> list, boolean par4) {
|
||||
super.addInformation(item, par2EntityPlayer, list, par4);
|
||||
}
|
||||
|
||||
@@ -189,15 +184,13 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addCommonEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {}
|
||||
public void addCommonEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) {}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addBasicEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {
|
||||
public void addBasicEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) {
|
||||
if (PainterUtil.getSourceBlock(itemstack) == null) {
|
||||
list.add(EnderIO.lang.localize("item.itemConduitFacade.tooltip.notpainted"));
|
||||
} else {
|
||||
@@ -205,10 +198,9 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addDetailedEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {
|
||||
public void addDetailedEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) {
|
||||
SpecialTooltipHandler.addDetailedTooltipFromResources(list, itemstack);
|
||||
if (itemstack.getItemDamage() == FacadeType.HARDENED.ordinal()) {
|
||||
list.add("");
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import crazypants.enderio.conduit.AbstractConduit;
|
||||
import crazypants.enderio.conduit.ConduitUtil;
|
||||
@@ -10,30 +21,19 @@ import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.machine.reservoir.TileReservoir;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public abstract class AbstractGasConduit extends AbstractConduit implements IGasConduit {
|
||||
|
||||
protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes =
|
||||
new EnumMap<ForgeDirection, RedstoneControlMode>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> extractionColors =
|
||||
new EnumMap<ForgeDirection, DyeColor>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<>(ForgeDirection.class);
|
||||
|
||||
protected final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<ForgeDirection, Integer>();
|
||||
protected final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<>();
|
||||
protected boolean redstoneStateDirty = true;
|
||||
|
||||
@Method(modid = GasUtil.API_NAME)
|
||||
public IGasHandler getExternalHandler(ForgeDirection direction) {
|
||||
IGasHandler con = GasUtil.getExternalGasHandler(
|
||||
getBundle().getWorld(), getLocation().getLocation(direction));
|
||||
IGasHandler con = GasUtil.getExternalGasHandler(getBundle().getWorld(), getLocation().getLocation(direction));
|
||||
return (con != null && !(con instanceof IConduitBundle)) ? con : null;
|
||||
}
|
||||
|
||||
@@ -184,15 +184,15 @@ public abstract class AbstractGasConduit extends AbstractConduit implements IGas
|
||||
String key = "extRM." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < RedstoneControlMode.values().length) {
|
||||
extractionModes.put(dir, RedstoneControlMode.values()[ord]);
|
||||
if (ord >= 0 && ord < RedstoneControlMode.VALUES.length) {
|
||||
extractionModes.put(dir, RedstoneControlMode.VALUES[ord]);
|
||||
}
|
||||
}
|
||||
key = "extSC." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < DyeColor.values().length) {
|
||||
extractionColors.put(dir, DyeColor.values()[ord]);
|
||||
if (ord >= 0 && ord < DyeColor.VALUES.length) {
|
||||
extractionColors.put(dir, DyeColor.VALUES[ord]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
import crazypants.enderio.conduit.ConduitUtil;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.RaytraceResult;
|
||||
import crazypants.enderio.tool.ToolUtil;
|
||||
import java.util.List;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public abstract class AbstractGasTankConduit extends AbstractGasConduit {
|
||||
|
||||
@@ -44,7 +47,11 @@ public abstract class AbstractGasTankConduit extends AbstractGasConduit {
|
||||
|
||||
BlockCoord loc = getLocation().getLocation(faceHit);
|
||||
IGasConduit n = ConduitUtil.getConduit(
|
||||
getBundle().getEntity().getWorldObj(), loc.x, loc.y, loc.z, IGasConduit.class);
|
||||
getBundle().getEntity().getWorldObj(),
|
||||
loc.x,
|
||||
loc.y,
|
||||
loc.z,
|
||||
IGasConduit.class);
|
||||
if (n == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.GasTank;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ConduitGasTank extends GasTank {
|
||||
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.client.render.IconUtil;
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -10,16 +19,10 @@ import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.config.Config;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class GasConduit extends AbstractGasTankConduit {
|
||||
|
||||
@@ -31,7 +34,12 @@ public class GasConduit extends AbstractGasTankConduit {
|
||||
public static final String ICON_INSERT_KEY = "enderio:gasConduitOutput";
|
||||
public static final String ICON_EMPTY_EDGE = "enderio:gasConduitEdge";
|
||||
|
||||
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
|
||||
static final Map<String, IIcon> ICONS = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public ConduitRenderer getRenderer() {
|
||||
return GasConduitRenderer.instance.get();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void initIcons() {
|
||||
@@ -79,7 +87,6 @@ public class GasConduit extends AbstractGasTankConduit {
|
||||
}
|
||||
|
||||
private void doExtract() {
|
||||
BlockCoord loc = getLocation();
|
||||
if (!hasConnectionMode(ConnectionMode.INPUT)) {
|
||||
return;
|
||||
}
|
||||
@@ -94,7 +101,6 @@ public class GasConduit extends AbstractGasTankConduit {
|
||||
return;
|
||||
}
|
||||
|
||||
Gas f = tank.getGas() == null ? null : tank.getGas().getGas();
|
||||
for (ForgeDirection dir : externalConnections) {
|
||||
if (autoExtractForDir(dir)) {
|
||||
if (network.extractFrom(this, dir, MAX_EXTRACT_PER_TICK)) {
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
|
||||
public class GasConduitNetwork extends AbstractGasTankConduitNetwork<GasConduit> {
|
||||
|
||||
private final ConduitGasTank tank = new ConduitGasTank(0);
|
||||
|
||||
private final Set<GasOutput> outputs = new HashSet<GasOutput>();
|
||||
private final Set<GasOutput> outputs = new HashSet<>();
|
||||
|
||||
private Iterator<GasOutput> outputIterator;
|
||||
|
||||
@@ -77,11 +80,8 @@ public class GasConduitNetwork extends AbstractGasTankConduitNetwork<GasConduit>
|
||||
}
|
||||
con.getTank().setGas(f);
|
||||
BlockCoord bc = con.getLocation();
|
||||
con.getBundle()
|
||||
.getEntity()
|
||||
.getWorldObj()
|
||||
.markTileEntityChunkModified(
|
||||
bc.x, bc.y, bc.z, con.getBundle().getEntity());
|
||||
con.getBundle().getEntity().getWorldObj()
|
||||
.markTileEntityChunkModified(bc.x, bc.y, bc.z, con.getBundle().getEntity());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -154,8 +154,7 @@ public class GasConduitNetwork extends AbstractGasTankConduitNetwork<GasConduit>
|
||||
}
|
||||
|
||||
public GasStack drain(ForgeDirection from, GasStack resource, boolean doDrain) {
|
||||
if (resource == null
|
||||
|| tank.isEmpty()
|
||||
if (resource == null || tank.isEmpty()
|
||||
|| !tank.containsValidGas()
|
||||
|| !GasConduitNetwork.areGassCompatable(getGasType(), resource)) {
|
||||
return null;
|
||||
@@ -206,11 +205,11 @@ public class GasConduitNetwork extends AbstractGasTankConduitNetwork<GasConduit>
|
||||
GasStack couldDrain = gasType.copy();
|
||||
couldDrain.amount = maxExtract;
|
||||
|
||||
// GasStack drained = extTank.drain(dir.getOpposite(), couldDrain, true);
|
||||
// if(drained == null || drained.amount <= 0) {
|
||||
// return false;
|
||||
// }
|
||||
// tank.addAmount(drained.amount);
|
||||
// GasStack drained = extTank.drain(dir.getOpposite(), couldDrain, true);
|
||||
// if(drained == null || drained.amount <= 0) {
|
||||
// return false;
|
||||
// }
|
||||
// tank.addAmount(drained.amount);
|
||||
|
||||
// Have to use this 'double handle' approach to work around an issue with TiC
|
||||
GasStack drained = extTank.drawGas(dir.getOpposite(), maxExtract);
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import static com.enderio.core.client.render.CubeRenderer.addVecWithUV;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import com.enderio.core.client.render.CubeRenderer;
|
||||
import com.enderio.core.client.render.RenderUtil;
|
||||
import com.enderio.core.common.vecmath.Vector3d;
|
||||
import com.enderio.core.common.vecmath.Vertex;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
@@ -14,32 +20,17 @@ import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.geom.ConnectionModeGeometry;
|
||||
import crazypants.enderio.conduit.geom.Offset;
|
||||
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
|
||||
import java.util.List;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class GasConduitRenderer extends DefaultConduitRenderer {
|
||||
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
return conduit instanceof GasConduit;
|
||||
}
|
||||
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(GasConduitRenderer::new);
|
||||
|
||||
@Override
|
||||
public void renderEntity(
|
||||
ConduitBundleRenderer conduitBundleRenderer,
|
||||
IConduitBundle te,
|
||||
IConduit conduit,
|
||||
double x,
|
||||
double y,
|
||||
double z,
|
||||
float partialTick,
|
||||
float worldLight,
|
||||
RenderBlocks rb) {
|
||||
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
|
||||
double y, double z, float partialTick, float worldLight, RenderBlocks rb) {
|
||||
super.renderEntity(conduitBundleRenderer, te, conduit, x, y, z, partialTick, worldLight, rb);
|
||||
|
||||
if (!conduit.hasConnectionMode(ConnectionMode.INPUT) && !conduit.hasConnectionMode(ConnectionMode.OUTPUT)) {
|
||||
@@ -63,6 +54,8 @@ public class GasConduitRenderer extends DefaultConduitRenderer {
|
||||
@Override
|
||||
protected void renderConduit(IIcon tex, IConduit conduit, CollidableComponent component, float brightness) {
|
||||
super.renderConduit(tex, conduit, component, brightness);
|
||||
final CubeRenderer cr = CubeRenderer.get();
|
||||
int i;
|
||||
|
||||
if (isNSEWUD(component.dir)) {
|
||||
GasConduit lc = (GasConduit) conduit;
|
||||
@@ -93,8 +86,8 @@ public class GasConduitRenderer extends DefaultConduitRenderer {
|
||||
vDir = RenderUtil.getUDirForFace(d);
|
||||
} else if ((component.dir == ForgeDirection.NORTH || component.dir == ForgeDirection.SOUTH)
|
||||
&& d.offsetY != 0) {
|
||||
vDir = RenderUtil.getUDirForFace(d);
|
||||
}
|
||||
vDir = RenderUtil.getUDirForFace(d);
|
||||
}
|
||||
|
||||
float minU = texture.getMinU();
|
||||
float maxU = texture.getMaxU();
|
||||
@@ -108,15 +101,17 @@ public class GasConduitRenderer extends DefaultConduitRenderer {
|
||||
List<Vertex> corners = bb.getCornersWithUvForFace(d, minU, maxU, minV, maxV);
|
||||
moveEdgeCorners(corners, vDir, width);
|
||||
moveEdgeCorners(corners, component.dir.getOpposite(), sideScale);
|
||||
for (Vertex c : corners) {
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
for (i = 0; i < corners.size(); i++) {
|
||||
final Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
|
||||
corners = bb.getCornersWithUvForFace(d, minU, maxU, minV, maxV);
|
||||
moveEdgeCorners(corners, vDir.getOpposite(), width);
|
||||
moveEdgeCorners(corners, component.dir.getOpposite(), sideScale);
|
||||
for (Vertex c : corners) {
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
for (i = 0; i < corners.size(); i++) {
|
||||
final Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,15 +119,20 @@ public class GasConduitRenderer extends DefaultConduitRenderer {
|
||||
if (conduit.getConnectionMode(component.dir) == ConnectionMode.DISABLED) {
|
||||
tex = EnderIO.blockConduitBundle.getConnectorIcon(component.data);
|
||||
List<Vertex> corners = component.bound.getCornersWithUvForFace(
|
||||
component.dir, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV());
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
for (Vertex c : corners) {
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
component.dir,
|
||||
tex.getMinU(),
|
||||
tex.getMaxU(),
|
||||
tex.getMinV(),
|
||||
tex.getMaxV());
|
||||
|
||||
for (i = 0; i < corners.size(); i++) {
|
||||
final Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
// back face
|
||||
for (int i = corners.size() - 1; i >= 0; i--) {
|
||||
Vertex c = corners.get(i);
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
for (i = corners.size() - 1; i >= 0; i--) {
|
||||
final Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -154,7 +154,7 @@ public class GasConduitRenderer extends DefaultConduitRenderer {
|
||||
}
|
||||
|
||||
private int[] getClosest(ForgeDirection edge, List<Vertex> vertices) {
|
||||
int[] res = new int[] {-1, -1};
|
||||
int[] res = new int[] { -1, -1 };
|
||||
boolean highest = edge.offsetX > 0 || edge.offsetY > 0 || edge.offsetZ > 0;
|
||||
double minMax = highest ? -Double.MAX_VALUE : Double.MAX_VALUE;
|
||||
int index = 0;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
public class GasOutput {
|
||||
|
||||
final ForgeDirection dir;
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import cpw.mods.fml.common.ModAPIManager;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.config.Config;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public final class GasUtil {
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IExtractor;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Interface(iface = "mekanism.api.gas.IGasHandler", modid = GasUtil.API_NAME)
|
||||
public interface IGasConduit extends IConduit, IGasHandler, IExtractor {
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.enderio.core.api.client.gui.IAdvancedTooltipProvider;
|
||||
import com.enderio.core.client.handlers.SpecialTooltipHandler;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
@@ -12,22 +18,21 @@ import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.ItemConduitSubtype;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemGasConduit extends AbstractItemConduit implements IAdvancedTooltipProvider {
|
||||
|
||||
private static ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
|
||||
new ItemConduitSubtype(ModObject.itemGasConduit.name(), "enderio:itemGasConduit"),
|
||||
};
|
||||
private static final ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
|
||||
new ItemConduitSubtype(ModObject.itemGasConduit.name(), "enderio:itemGasConduit"), };
|
||||
|
||||
public static ItemGasConduit create() {
|
||||
ItemGasConduit result = new ItemGasConduit();
|
||||
if (GasUtil.isGasConduitEnabled()) {
|
||||
result.init();
|
||||
ConduitDisplayMode.registerDisplayMode(new ConduitDisplayMode(
|
||||
IGasConduit.class, IconEIO.WRENCH_OVERLAY_GAS, IconEIO.WRENCH_OVERLAY_GAS_OFF));
|
||||
ConduitDisplayMode.registerDisplayMode(
|
||||
new ConduitDisplayMode(
|
||||
IGasConduit.class,
|
||||
IconEIO.WRENCH_OVERLAY_GAS,
|
||||
IconEIO.WRENCH_OVERLAY_GAS_OFF));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -51,15 +56,15 @@ public class ItemGasConduit extends AbstractItemConduit implements IAdvancedTool
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addCommonEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {}
|
||||
public void addCommonEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) {}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addBasicEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {}
|
||||
public void addBasicEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) {}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addDetailedEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {
|
||||
public void addDetailedEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) {
|
||||
String gpt = " " + EnderIO.lang.localize("gas.gasTick");
|
||||
int extractRate = Config.gasConduitExtractRate;
|
||||
int maxIo = Config.gasConduitMaxIoRate;
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import com.enderio.core.common.network.MessageTileEntity;
|
||||
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.util.ClientUtil;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class PacketGasLevel extends MessageTileEntity<TileEntity> implements IMessageHandler<PacketGasLevel, IMessage> {
|
||||
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
package crazypants.enderio.conduit.geom;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
|
||||
public class CollidableCache {
|
||||
|
||||
public static final CollidableCache instance = new CollidableCache();
|
||||
|
||||
private final Map<CacheKey, Collection<CollidableComponent>> cache =
|
||||
new HashMap<CollidableCache.CacheKey, Collection<CollidableComponent>>();
|
||||
private final Map<CacheKey, Collection<CollidableComponent>> cache = new HashMap<>();
|
||||
|
||||
public CacheKey createKey(Class<? extends IConduit> baseType, Offset offset, ForgeDirection dir, boolean isStub) {
|
||||
return new CacheKey(baseType, offset, dir, isStub);
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package crazypants.enderio.conduit.geom;
|
||||
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
|
||||
public class CollidableComponent {
|
||||
|
||||
public final Class<? extends IConduit> conduitType;
|
||||
@@ -11,8 +13,8 @@ public class CollidableComponent {
|
||||
public final ForgeDirection dir;
|
||||
public final Object data;
|
||||
|
||||
public CollidableComponent(
|
||||
Class<? extends IConduit> conduitType, BoundingBox bound, ForgeDirection id, Object data) {
|
||||
public CollidableComponent(Class<? extends IConduit> conduitType, BoundingBox bound, ForgeDirection id,
|
||||
Object data) {
|
||||
this.conduitType = conduitType;
|
||||
this.bound = bound;
|
||||
this.dir = id;
|
||||
@@ -28,8 +30,7 @@ public class CollidableComponent {
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof CollidableComponent) {
|
||||
CollidableComponent other = (CollidableComponent) obj;
|
||||
return conduitType == other.conduitType
|
||||
&& bound.equals(((CollidableComponent) obj).bound)
|
||||
return conduitType == other.conduitType && bound.equals(((CollidableComponent) obj).bound)
|
||||
&& dir == other.dir;
|
||||
}
|
||||
return false;
|
||||
@@ -40,8 +41,7 @@ public class CollidableComponent {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((bound == null) ? 0 : bound.hashCode());
|
||||
result = prime * result
|
||||
+ ((conduitType == null) ? 0 : conduitType.getName().hashCode());
|
||||
result = prime * result + ((conduitType == null) ? 0 : conduitType.getName().hashCode());
|
||||
result = prime * result + ((dir == null) ? 0 : dir.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package crazypants.enderio.conduit.geom;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import com.enderio.core.common.util.ForgeDirectionOffsets;
|
||||
import com.enderio.core.common.vecmath.VecmathUtil;
|
||||
import com.enderio.core.common.vecmath.Vector3d;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class ConduitGeometryUtil {
|
||||
|
||||
@@ -30,8 +33,7 @@ public class ConduitGeometryUtil {
|
||||
|
||||
public static final float CONNECTOR_DEPTH = 0.05f;
|
||||
|
||||
private static Map<ForgeDirection, BoundingBox[]> EXTERNAL_CONNECTOR_BOUNDS =
|
||||
new HashMap<ForgeDirection, BoundingBox[]>();
|
||||
private static final Map<ForgeDirection, BoundingBox[]> EXTERNAL_CONNECTOR_BOUNDS = new HashMap<>();
|
||||
|
||||
static {
|
||||
setupBounds(0.5f);
|
||||
@@ -55,8 +57,8 @@ public class ConduitGeometryUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private static BoundingBox[] createExternalConnector(
|
||||
ForgeDirection dir, float connectorDepth, float connectorWidth) {
|
||||
private static BoundingBox[] createExternalConnector(ForgeDirection dir, float connectorDepth,
|
||||
float connectorWidth) {
|
||||
|
||||
BoundingBox[] res = new BoundingBox[2];
|
||||
|
||||
@@ -77,8 +79,8 @@ public class ConduitGeometryUtil {
|
||||
return res;
|
||||
}
|
||||
|
||||
private static BoundingBox createConnectorComponent(
|
||||
ForgeDirection dir, float cornerMin, float cornerMax, float depthMin, float depthMax) {
|
||||
private static BoundingBox createConnectorComponent(ForgeDirection dir, float cornerMin, float cornerMax,
|
||||
float depthMin, float depthMax) {
|
||||
float minX = (1 - Math.abs(dir.offsetX)) * cornerMin + dir.offsetX * depthMin;
|
||||
float minY = (1 - Math.abs(dir.offsetY)) * cornerMin + dir.offsetY * depthMin;
|
||||
float minZ = (1 - Math.abs(dir.offsetZ)) * cornerMin + dir.offsetZ * depthMin;
|
||||
@@ -104,10 +106,10 @@ public class ConduitGeometryUtil {
|
||||
return val < 0 ? 1 + val : val;
|
||||
}
|
||||
|
||||
private Map<GeometryKey, BoundingBox> boundsCache = new HashMap<GeometryKey, BoundingBox>();
|
||||
private final Map<GeometryKey, BoundingBox> boundsCache = new HashMap<>();
|
||||
|
||||
private EnumMap<ConduitConnectorType, BoundingBox> connectorBounds =
|
||||
new EnumMap<ConduitConnectorType, BoundingBox>(ConduitConnectorType.class);
|
||||
private final EnumMap<ConduitConnectorType, BoundingBox> connectorBounds = new EnumMap<>(
|
||||
ConduitConnectorType.class);
|
||||
|
||||
private ConduitGeometryUtil() {}
|
||||
|
||||
@@ -119,8 +121,8 @@ public class ConduitGeometryUtil {
|
||||
return EXTERNAL_CONNECTOR_BOUNDS.get(dir);
|
||||
}
|
||||
|
||||
public BoundingBox getBoundingBox(
|
||||
Class<? extends IConduit> type, ForgeDirection dir, boolean isStub, Offset offset) {
|
||||
public BoundingBox getBoundingBox(Class<? extends IConduit> type, ForgeDirection dir, boolean isStub,
|
||||
Offset offset) {
|
||||
GeometryKey key = new GeometryKey(dir, isStub, offset, type);
|
||||
BoundingBox result = boundsCache.get(key);
|
||||
if (result == null) {
|
||||
@@ -164,8 +166,8 @@ public class ConduitGeometryUtil {
|
||||
return createConduitBounds(type, key.dir, key.isStub, key.offset);
|
||||
}
|
||||
|
||||
private BoundingBox createConduitBounds(
|
||||
Class<? extends IConduit> type, ForgeDirection dir, boolean isStub, Offset offset) {
|
||||
private BoundingBox createConduitBounds(Class<? extends IConduit> type, ForgeDirection dir, boolean isStub,
|
||||
Offset offset) {
|
||||
BoundingBox bb = CORE_BOUNDS;
|
||||
|
||||
Vector3d min = bb.getMin();
|
||||
|
||||
@@ -2,6 +2,14 @@ package crazypants.enderio.conduit.geom;
|
||||
|
||||
import static com.enderio.core.common.util.ForgeDirectionOffsets.offsetScaled;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.api.client.render.VertexTransform;
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import com.enderio.core.client.render.RenderUtil;
|
||||
@@ -10,17 +18,10 @@ import com.enderio.core.client.render.VertexTransformComposite;
|
||||
import com.enderio.core.client.render.VertexTranslation;
|
||||
import com.enderio.core.common.vecmath.Vector3d;
|
||||
import com.enderio.core.common.vecmath.Vertex;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class ConnectionModeGeometry {
|
||||
|
||||
private static final EnumMap<ForgeDirection, List<Vertex>> VERTS =
|
||||
new EnumMap<ForgeDirection, List<Vertex>>(ForgeDirection.class);
|
||||
private static final EnumMap<ForgeDirection, List<Vertex>> VERTS = new EnumMap<>(ForgeDirection.class);
|
||||
|
||||
static {
|
||||
float scale = 0.9f;
|
||||
@@ -82,7 +83,7 @@ public class ConnectionModeGeometry {
|
||||
}
|
||||
|
||||
private static List<Vertex> createVerticesForDir(BoundingBox refBB, VertexTransform xform) {
|
||||
List<Vertex> result = new ArrayList<Vertex>(24);
|
||||
List<Vertex> result = new ArrayList<>(24);
|
||||
for (ForgeDirection face : ForgeDirection.VALID_DIRECTIONS) {
|
||||
result.addAll(refBB.getCornersWithUvForFace(face));
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package crazypants.enderio.conduit.geom;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
|
||||
public final class GeometryKey {
|
||||
|
||||
public final ForgeDirection dir;
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
* @author brad
|
||||
*/
|
||||
public enum Offset {
|
||||
|
||||
NONE(0, 0, 0),
|
||||
UP(ForgeDirection.UP),
|
||||
DOWN(ForgeDirection.DOWN),
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package crazypants.enderio.conduit.geom;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.gas.IGasConduit;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
@@ -8,13 +13,10 @@ import crazypants.enderio.conduit.me.IMEConduit;
|
||||
import crazypants.enderio.conduit.oc.IOCConduit;
|
||||
import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class Offsets {
|
||||
|
||||
private static Map<OffsetKey, Offset> OFFSETS = new HashMap<OffsetKey, Offset>();
|
||||
private static final Map<OffsetKey, Offset> OFFSETS = new HashMap<>();
|
||||
|
||||
static {
|
||||
OFFSETS.put(key(IRedstoneConduit.class, Axis.NONE), Offset.UP);
|
||||
|
||||
@@ -1,24 +1,29 @@
|
||||
package crazypants.enderio.conduit.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import com.enderio.core.api.client.gui.ITabPanel;
|
||||
import com.enderio.core.api.client.render.IWidgetIcon;
|
||||
import com.enderio.core.client.gui.button.CheckBox;
|
||||
import com.enderio.core.client.gui.widget.GuiToolTip;
|
||||
import com.enderio.core.client.handlers.SpecialTooltipHandler;
|
||||
import com.enderio.core.client.render.ColorUtil;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.item.FunctionUpgrade;
|
||||
import crazypants.enderio.conduit.packet.PacketConnectionMode;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class BaseSettingsPanel implements ITabPanel {
|
||||
|
||||
@@ -26,7 +31,7 @@ public class BaseSettingsPanel implements ITabPanel {
|
||||
static final int ID_EXTRACT_ENABLED = 328;
|
||||
protected static final int ID_INSERT_FILTER_OPTIONS = 329;
|
||||
protected static final int ID_EXTRACT_FILTER_OPTIONS = 330;
|
||||
protected final int ID_ENABLED = 331;
|
||||
protected static final int ID_ENABLED = 331;
|
||||
|
||||
protected final @Nonnull IWidgetIcon icon;
|
||||
protected final @Nonnull GuiExternalConnection gui;
|
||||
@@ -36,8 +41,8 @@ public class BaseSettingsPanel implements ITabPanel {
|
||||
|
||||
protected ConnectionMode oldConnectionMode;
|
||||
|
||||
private @Nonnull String inputHeading;
|
||||
private @Nonnull String outputHeading;
|
||||
private final @Nonnull String inputHeading;
|
||||
private final @Nonnull String outputHeading;
|
||||
|
||||
private boolean insertEnabled = false;
|
||||
private boolean extractEnabled = false;
|
||||
@@ -67,20 +72,13 @@ public class BaseSettingsPanel implements ITabPanel {
|
||||
protected @Nonnull GuiToolTip filterExtractUpgradeTooltip;
|
||||
protected @Nonnull GuiToolTip filterInsertUpgradeTooltip;
|
||||
|
||||
protected BaseSettingsPanel(
|
||||
@Nonnull IWidgetIcon icon,
|
||||
@Nonnull String typeName,
|
||||
@Nonnull GuiExternalConnection gui,
|
||||
protected BaseSettingsPanel(@Nonnull IWidgetIcon icon, @Nonnull String typeName, @Nonnull GuiExternalConnection gui,
|
||||
@Nonnull IConduit con) {
|
||||
this(icon, typeName, gui, con, "externalConduitConnection");
|
||||
}
|
||||
|
||||
protected BaseSettingsPanel(
|
||||
@Nonnull IWidgetIcon icon,
|
||||
@Nonnull String typeName,
|
||||
@Nonnull GuiExternalConnection gui,
|
||||
@Nonnull IConduit con,
|
||||
@Nonnull String texture) {
|
||||
protected BaseSettingsPanel(@Nonnull IWidgetIcon icon, @Nonnull String typeName, @Nonnull GuiExternalConnection gui,
|
||||
@Nonnull IConduit con, @Nonnull String texture) {
|
||||
this.icon = icon;
|
||||
this.typeName = typeName;
|
||||
this.gui = gui;
|
||||
@@ -113,51 +111,51 @@ public class BaseSettingsPanel implements ITabPanel {
|
||||
|
||||
x = rightColumn + 18 + 1;
|
||||
|
||||
filterExtractUpgradeTooltip =
|
||||
new GuiToolTip(
|
||||
new Rectangle(rightColumn, 70, 18, 18),
|
||||
EnderIO.lang.localize("gui.conduit.item.filterupgrade")) {
|
||||
@Override
|
||||
public boolean shouldDraw() {
|
||||
return !gui.getContainer().hasFilterUpgrades(true) && super.shouldDraw();
|
||||
}
|
||||
};
|
||||
filterExtractUpgradeTooltip = new GuiToolTip(
|
||||
new Rectangle(rightColumn, 70, 18, 18),
|
||||
EnderIO.lang.localize("gui.conduit.item.filterupgrade")) {
|
||||
|
||||
filterInsertUpgradeTooltip =
|
||||
new GuiToolTip(
|
||||
new Rectangle(leftColumn, 70, 18, 18),
|
||||
EnderIO.lang.localize("gui.conduit.item.filterupgrade")) {
|
||||
@Override
|
||||
public boolean shouldDraw() {
|
||||
return !gui.getContainer().hasFilterUpgrades(false) && super.shouldDraw();
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public boolean shouldDraw() {
|
||||
return !gui.getContainer().hasFilterUpgrades(true) && super.shouldDraw();
|
||||
}
|
||||
};
|
||||
|
||||
speedUpgradeTooltip =
|
||||
new GuiToolTip(
|
||||
new Rectangle(rightColumn + 18, customTop + 43, 18, 18),
|
||||
EnderIO.lang.localize("gui.conduit.item.speedupgrade"),
|
||||
EnderIO.lang.localize("gui.conduit.item.speedupgrade2")) {
|
||||
@Override
|
||||
public boolean shouldDraw() {
|
||||
return !gui.getContainer().hasSpeedUpgrades() && super.shouldDraw();
|
||||
}
|
||||
};
|
||||
filterInsertUpgradeTooltip = new GuiToolTip(
|
||||
new Rectangle(leftColumn, 70, 18, 18),
|
||||
EnderIO.lang.localize("gui.conduit.item.filterupgrade")) {
|
||||
|
||||
ArrayList<String> funcUpgradeTips = new ArrayList<String>();
|
||||
@Override
|
||||
public boolean shouldDraw() {
|
||||
return !gui.getContainer().hasFilterUpgrades(false) && super.shouldDraw();
|
||||
}
|
||||
};
|
||||
|
||||
speedUpgradeTooltip = new GuiToolTip(
|
||||
new Rectangle(rightColumn + 18, customTop + 43, 18, 18),
|
||||
EnderIO.lang.localize("gui.conduit.item.speedupgrade"),
|
||||
EnderIO.lang.localize("gui.conduit.item.speedupgrade2")) {
|
||||
|
||||
@Override
|
||||
public boolean shouldDraw() {
|
||||
return !gui.getContainer().hasSpeedUpgrades() && super.shouldDraw();
|
||||
}
|
||||
};
|
||||
|
||||
ArrayList<String> funcUpgradeTips = new ArrayList<>();
|
||||
SpecialTooltipHandler.addTooltipFromResources(funcUpgradeTips, "enderio.gui.conduit.item.functionupgrade.line");
|
||||
for (FunctionUpgrade upgrade : FunctionUpgrade.values()) {
|
||||
funcUpgradeTips.add(EnderIO.lang.localizeExact(upgrade.unlocName.concat(".name")));
|
||||
}
|
||||
functionUpgradeTooltip =
|
||||
new GuiToolTip(
|
||||
new Rectangle(rightColumn + 36, customTop + 43, 18, 18),
|
||||
funcUpgradeTips.toArray(new String[0])) {
|
||||
@Override
|
||||
public boolean shouldDraw() {
|
||||
return !gui.getContainer().hasFunctionUpgrades() && super.shouldDraw();
|
||||
}
|
||||
};
|
||||
functionUpgradeTooltip = new GuiToolTip(
|
||||
new Rectangle(rightColumn + 36, customTop + 43, 18, 18),
|
||||
funcUpgradeTips.toArray(new String[0])) {
|
||||
|
||||
@Override
|
||||
public boolean shouldDraw() {
|
||||
return !gui.getContainer().hasFunctionUpgrades() && super.shouldDraw();
|
||||
}
|
||||
};
|
||||
|
||||
gui.getContainer().setInoutSlotsVisible(false, false);
|
||||
}
|
||||
|
||||
@@ -1,32 +1,38 @@
|
||||
package crazypants.enderio.conduit.gui;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.client.gui.widget.GhostBackgroundItemSlot;
|
||||
import com.enderio.core.client.gui.widget.GhostSlot;
|
||||
import com.enderio.core.common.ContainerEnder;
|
||||
import com.enderio.core.common.util.ItemUtil;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.conduit.gui.item.InventoryUpgrades;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.item.SpeedUpgrade;
|
||||
import crazypants.enderio.conduit.item.filter.IItemFilter;
|
||||
import crazypants.enderio.machine.gui.IContainerWithTileEntity;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class ExternalConnectionContainer extends ContainerEnder<InventoryUpgrades> {
|
||||
public class ExternalConnectionContainer extends ContainerEnder<InventoryUpgrades> implements IContainerWithTileEntity {
|
||||
|
||||
private final IItemConduit itemConduit;
|
||||
private final ForgeDirection direction;
|
||||
private final TileEntity te;
|
||||
|
||||
private int speedUpgradeSlotLimit = 15;
|
||||
|
||||
@@ -49,6 +55,7 @@ public class ExternalConnectionContainer extends ContainerEnder<InventoryUpgrade
|
||||
super(playerInv, new InventoryUpgrades(bundle.getConduit(IItemConduit.class), dir));
|
||||
this.direction = dir;
|
||||
this.itemConduit = bundle.getConduit(IItemConduit.class);
|
||||
this.te = (TileEntity) bundle;
|
||||
slotLocations.addAll(playerSlotLocations.values());
|
||||
|
||||
int x;
|
||||
@@ -70,6 +77,7 @@ public class ExternalConnectionContainer extends ContainerEnder<InventoryUpgrade
|
||||
x = 131;
|
||||
y = 71;
|
||||
slotSpeedUpgrades = addSlotToContainer(new Slot(getInv(), 0, x, y) {
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
return getInv().isItemValidForSlot(0, par1ItemStack);
|
||||
@@ -86,6 +94,7 @@ public class ExternalConnectionContainer extends ContainerEnder<InventoryUpgrade
|
||||
x = 149;
|
||||
y = 71;
|
||||
slotFunctionUpgrades = addSlotToContainer(new Slot(getInv(), 1, x, y) {
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
return getInv().isItemValidForSlot(1, par1ItemStack);
|
||||
@@ -241,9 +250,8 @@ public class ExternalConnectionContainer extends ContainerEnder<InventoryUpgrade
|
||||
|
||||
boolean merged = false;
|
||||
if (slotIndex < outputFilterUpgradeSlot) {
|
||||
for (int targetSlotIdx = outputFilterUpgradeSlot;
|
||||
targetSlotIdx <= functionUpgradeSlot;
|
||||
targetSlotIdx++) {
|
||||
for (int targetSlotIdx = outputFilterUpgradeSlot; targetSlotIdx
|
||||
<= functionUpgradeSlot; targetSlotIdx++) {
|
||||
Slot targetSlot = (Slot) inventorySlots.get(targetSlotIdx);
|
||||
if (targetSlot.xDisplayPosition >= 0 && mergeItemStackSpecial(origStack, targetSlot)) {
|
||||
merged = true;
|
||||
@@ -276,7 +284,13 @@ public class ExternalConnectionContainer extends ContainerEnder<InventoryUpgrade
|
||||
return copystack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity() {
|
||||
return te;
|
||||
}
|
||||
|
||||
private class FilterSlot extends Slot {
|
||||
|
||||
public FilterSlot(IInventory par1iInventory, int par2, int par3, int par4) {
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package crazypants.enderio.conduit.gui;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.enderio.core.api.client.gui.IGuiScreen;
|
||||
import com.enderio.core.api.client.render.IWidgetIcon;
|
||||
import com.enderio.core.client.gui.button.TooltipButton;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class FakeButton extends TooltipButton {
|
||||
|
||||
@@ -61,15 +64,14 @@ public class FakeButton extends TooltipButton {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
icon.getMap()
|
||||
.render(
|
||||
icon,
|
||||
xPosition + marginX,
|
||||
yPosition + marginY,
|
||||
width - 2 * marginX,
|
||||
height - 2 * marginY,
|
||||
0,
|
||||
true);
|
||||
icon.getMap().render(
|
||||
icon,
|
||||
xPosition + marginX,
|
||||
yPosition + marginY,
|
||||
width - 2 * marginX,
|
||||
height - 2 * marginY,
|
||||
0,
|
||||
true);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
package crazypants.enderio.conduit.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import com.enderio.core.client.gui.button.ColorButton;
|
||||
import com.enderio.core.client.render.ColorUtil;
|
||||
import com.enderio.core.client.render.RenderUtil;
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
@@ -14,10 +20,7 @@ import crazypants.enderio.gui.RedstoneModeButton;
|
||||
import crazypants.enderio.machine.IRedstoneModeControlable;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import java.awt.Color;
|
||||
import mekanism.api.gas.Gas;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class GasSettings extends BaseSettingsPanel {
|
||||
|
||||
@@ -25,13 +28,13 @@ public class GasSettings extends BaseSettingsPanel {
|
||||
|
||||
private static final int ID_COLOR_BUTTON = GuiExternalConnection.nextButtonId();
|
||||
|
||||
private RedstoneModeButton rsB;
|
||||
private final RedstoneModeButton rsB;
|
||||
|
||||
private ColorButton colorB;
|
||||
private final ColorButton colorB;
|
||||
|
||||
private String autoExtractStr = EnderIO.lang.localize("gui.conduit.gas.autoExtract");
|
||||
private final String autoExtractStr = EnderIO.lang.localize("gui.conduit.gas.autoExtract");
|
||||
|
||||
private IGasConduit conduit;
|
||||
private final IGasConduit conduit;
|
||||
|
||||
protected GasSettings(final GuiExternalConnection gui, IConduit con) {
|
||||
super(IconEIO.WRENCH_OVERLAY_GAS, EnderIO.lang.localize("itemGasConduit.name"), gui, con);
|
||||
@@ -69,7 +72,7 @@ public class GasSettings extends BaseSettingsPanel {
|
||||
public void actionPerformed(GuiButton guiButton) {
|
||||
super.actionPerformed(guiButton);
|
||||
if (guiButton.id == ID_COLOR_BUTTON) {
|
||||
conduit.setExtractionSignalColor(gui.getDir(), DyeColor.values()[colorB.getColorIndex()]);
|
||||
conduit.setExtractionSignalColor(gui.getDir(), DyeColor.VALUES[colorB.getColorIndex()]);
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketExtractMode(conduit, gui.getDir()));
|
||||
}
|
||||
}
|
||||
@@ -100,8 +103,6 @@ public class GasSettings extends BaseSettingsPanel {
|
||||
protected void renderCustomOptions(int top, float par1, int par2, int par3) {
|
||||
boolean isInput = isInput();
|
||||
if (isInput) {
|
||||
int x = gui.getGuiLeft() + gap + gui.getFontRenderer().getStringWidth(autoExtractStr) + gap + 2;
|
||||
int y = customTop;
|
||||
gui.getFontRenderer().drawString(autoExtractStr, left, top, ColorUtil.getRGB(Color.DARK_GRAY));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,26 @@
|
||||
package crazypants.enderio.conduit.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.enderio.core.api.client.gui.ITabPanel;
|
||||
import com.enderio.core.api.client.render.IWidgetIcon;
|
||||
import com.enderio.core.client.gui.widget.GhostSlot;
|
||||
import com.enderio.core.client.render.RenderUtil;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
@@ -16,19 +33,6 @@ import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
import crazypants.enderio.gui.GuiContainerBaseEIO;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiExternalConnection extends GuiContainerBaseEIO {
|
||||
|
||||
@@ -46,8 +50,7 @@ public class GuiExternalConnection extends GuiContainerBaseEIO {
|
||||
return id;
|
||||
}
|
||||
|
||||
private static final Map<Class<? extends IConduit>, Integer> TAB_ORDER =
|
||||
new HashMap<Class<? extends IConduit>, Integer>();
|
||||
private static final Map<Class<? extends IConduit>, Integer> TAB_ORDER = new HashMap<>();
|
||||
|
||||
static {
|
||||
TAB_ORDER.put(IItemConduit.class, 0);
|
||||
@@ -63,11 +66,11 @@ public class GuiExternalConnection extends GuiContainerBaseEIO {
|
||||
final IConduitBundle bundle;
|
||||
private final ForgeDirection dir;
|
||||
|
||||
private final List<IConduit> conduits = new ArrayList<IConduit>();
|
||||
private final List<ITabPanel> tabs = new ArrayList<ITabPanel>();
|
||||
private final List<IConduit> conduits = new ArrayList<>();
|
||||
private final List<ITabPanel> tabs = new ArrayList<>();
|
||||
private int activeTab = 0;
|
||||
|
||||
private int tabYOffset = 4;
|
||||
private static final int tabYOffset = 4;
|
||||
|
||||
private final ExternalConnectionContainer container;
|
||||
|
||||
@@ -83,8 +86,8 @@ public class GuiExternalConnection extends GuiContainerBaseEIO {
|
||||
|
||||
container.setInoutSlotsVisible(false, false);
|
||||
|
||||
List<IConduit> cons = new ArrayList<IConduit>(bundle.getConduits());
|
||||
Collections.sort(cons, new Comparator<IConduit>() {
|
||||
List<IConduit> cons = new ArrayList<>(bundle.getConduits());
|
||||
Collections.sort(cons, new Comparator<>() {
|
||||
|
||||
@Override
|
||||
public int compare(IConduit o1, IConduit o2) {
|
||||
@@ -135,8 +138,8 @@ public class GuiExternalConnection extends GuiContainerBaseEIO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true when slots outside of standard gui bounds are clicked to prevent
|
||||
* setting ghost filters dropping items on the ground.
|
||||
* Returns true when slots outside of standard gui bounds are clicked to prevent setting ghost filters dropping
|
||||
* items on the ground.
|
||||
*/
|
||||
private boolean handleOobClick(int x, int y, int button) {
|
||||
boolean outOfBounds = x < guiLeft || y < guiTop || x >= guiLeft + xSize || y >= guiTop + ySize;
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
package crazypants.enderio.conduit.gui;
|
||||
|
||||
import com.enderio.core.client.render.ColorUtil;
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import java.awt.Color;
|
||||
import java.awt.Point;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
@@ -21,6 +14,17 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.client.render.ColorUtil;
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.util.ForgeDirections;
|
||||
|
||||
public class GuiExternalConnectionSelector extends GuiScreen {
|
||||
|
||||
Set<ForgeDirection> cons;
|
||||
@@ -30,7 +34,7 @@ public class GuiExternalConnectionSelector extends GuiScreen {
|
||||
|
||||
public GuiExternalConnectionSelector(IConduitBundle cb) {
|
||||
this.cb = cb;
|
||||
cons = new HashSet<ForgeDirection>();
|
||||
cons = new HashSet<>();
|
||||
for (IConduit con : cb.getConduits()) {
|
||||
if (con instanceof IInsulatedRedstoneConduit) {
|
||||
Set<ForgeDirection> conCons = con.getConduitConnections();
|
||||
@@ -48,7 +52,7 @@ public class GuiExternalConnectionSelector extends GuiScreen {
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton b) {
|
||||
ForgeDirection dir = ForgeDirection.values()[b.id];
|
||||
ForgeDirection dir = ForgeDirections.DIRECTIONS[b.id];
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
BlockCoord loc = cb.getLocation();
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketOpenConduitUI(cb.getEntity(), dir));
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
package crazypants.enderio.conduit.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.enderio.core.client.gui.button.ColorButton;
|
||||
import com.enderio.core.client.gui.button.IconButton;
|
||||
import com.enderio.core.client.gui.button.ToggleButton;
|
||||
@@ -7,6 +21,7 @@ import com.enderio.core.client.gui.widget.GuiToolTip;
|
||||
import com.enderio.core.client.render.ColorUtil;
|
||||
import com.enderio.core.client.render.RenderUtil;
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
@@ -20,17 +35,6 @@ import crazypants.enderio.gui.RedstoneModeButton;
|
||||
import crazypants.enderio.machine.IRedstoneModeControlable;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import java.awt.Color;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class LiquidSettings extends BaseSettingsPanel {
|
||||
|
||||
@@ -58,7 +62,7 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
private final ILiquidConduit conduit;
|
||||
|
||||
private AbstractEnderLiquidConduit eConduit;
|
||||
private boolean isEnder;
|
||||
private final boolean isEnder;
|
||||
private static final int filterIX = 4;
|
||||
private static final int filterEX = 104;
|
||||
private static final int filterY = 63;
|
||||
@@ -66,7 +70,7 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
private static final Rectangle extractFilterBounds = new Rectangle(filterEX, filterY, 90, 18);
|
||||
private GuiToolTip[] filterToolTips;
|
||||
|
||||
private boolean inOutShowIn = true;
|
||||
private static final boolean inOutShowIn = true;
|
||||
private IconButton insertWhiteListB;
|
||||
private IconButton extractWhiteListB;
|
||||
|
||||
@@ -135,8 +139,13 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
|
||||
if (isEnder) {
|
||||
x += rsB.getWidth();
|
||||
roundRobinB =
|
||||
new ToggleButton(gui, ID_ROUND_ROBIN_BUTTON, x, y, IconEIO.ROUND_ROBIN_OFF, IconEIO.ROUND_ROBIN);
|
||||
roundRobinB = new ToggleButton(
|
||||
gui,
|
||||
ID_ROUND_ROBIN_BUTTON,
|
||||
x,
|
||||
y,
|
||||
IconEIO.ROUND_ROBIN_OFF,
|
||||
IconEIO.ROUND_ROBIN);
|
||||
roundRobinB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.roundRobinEnabled"));
|
||||
roundRobinB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.roundRobinDisabled"));
|
||||
roundRobinB.setPaintSelectedBorder(false);
|
||||
@@ -163,7 +172,7 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
public void actionPerformed(GuiButton guiButton) {
|
||||
super.actionPerformed(guiButton);
|
||||
if (guiButton.id == ID_COLOR_BUTTON) {
|
||||
conduit.setExtractionSignalColor(gui.getDir(), DyeColor.values()[colorB.getColorIndex()]);
|
||||
conduit.setExtractionSignalColor(gui.getDir(), DyeColor.VALUES[colorB.getColorIndex()]);
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketExtractMode(conduit, gui.getDir()));
|
||||
} else if (guiButton.id == ID_INSERT_WHITELIST || guiButton.id == ID_EXTRACT_WHITELIST) {
|
||||
toggleBlacklist(guiButton.id == ID_EXTRACT_WHITELIST);
|
||||
@@ -171,7 +180,7 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
ColorButton btn = (ColorButton) guiButton;
|
||||
if (isEnder) {
|
||||
|
||||
DyeColor col = DyeColor.values()[btn.getColorIndex()];
|
||||
DyeColor col = DyeColor.VALUES[btn.getColorIndex()];
|
||||
boolean isInput = guiButton.id == ID_EXTRACT_CHANNEL;
|
||||
|
||||
if (isInput) {
|
||||
@@ -275,6 +284,8 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
rsB.onGuiInit();
|
||||
colorB.onGuiInit();
|
||||
|
||||
gui.getContainer().setInventorySlotsVisible(true);
|
||||
|
||||
if (!isEnder) {
|
||||
return;
|
||||
}
|
||||
@@ -286,7 +297,6 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
roundRobinB.onGuiInit();
|
||||
roundRobinB.setSelected(eConduit.isRoundRobin(gui.getDir()));
|
||||
|
||||
gui.getContainer().setInventorySlotsVisible(true);
|
||||
if (isFilterVisible()) {
|
||||
addFilterTooltips();
|
||||
|
||||
|
||||
@@ -1,23 +1,26 @@
|
||||
package crazypants.enderio.conduit.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
import com.enderio.core.client.gui.button.ColorButton;
|
||||
import com.enderio.core.client.render.ColorUtil;
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.oc.IOCConduit;
|
||||
import crazypants.enderio.conduit.packet.PacketOCConduitSignalColor;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import java.awt.Color;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
public class OCSettings extends BaseSettingsPanel {
|
||||
|
||||
private static final int ID_COLOR_BUTTON = GuiExternalConnection.nextButtonId();
|
||||
private ColorButton cb;
|
||||
private final ColorButton cb;
|
||||
|
||||
private String signalColorStr = EnderIO.lang.localize("gui.conduit.redstone.color");
|
||||
private final String signalColorStr = EnderIO.lang.localize("gui.conduit.redstone.color");
|
||||
private final IOCConduit occon;
|
||||
|
||||
public OCSettings(GuiExternalConnection gui, IConduit con) {
|
||||
@@ -39,7 +42,7 @@ public class OCSettings extends BaseSettingsPanel {
|
||||
public void actionPerformed(GuiButton guiButton) {
|
||||
super.actionPerformed(guiButton);
|
||||
if (guiButton.id == ID_COLOR_BUTTON && cb != null) {
|
||||
occon.setSignalColor(gui.getDir(), DyeColor.values()[cb.getColorIndex()]);
|
||||
occon.setSignalColor(gui.getDir(), DyeColor.VALUES[cb.getColorIndex()]);
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketOCConduitSignalColor(occon, gui.getDir()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package crazypants.enderio.conduit.gui;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
@@ -8,8 +11,8 @@ import crazypants.enderio.conduit.liquid.AbstractEnderLiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.packet.AbstractConduitPacket;
|
||||
import crazypants.enderio.conduit.packet.ConTypeEnum;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class PacketFluidChannel extends AbstractConduitPacket<ILiquidConduit>
|
||||
implements IMessageHandler<PacketFluidChannel, IMessage> {
|
||||
@@ -21,8 +24,8 @@ public class PacketFluidChannel extends AbstractConduitPacket<ILiquidConduit>
|
||||
|
||||
public PacketFluidChannel() {}
|
||||
|
||||
public PacketFluidChannel(
|
||||
AbstractEnderLiquidConduit eConduit, ForgeDirection dir, boolean isInput, DyeColor channel) {
|
||||
public PacketFluidChannel(AbstractEnderLiquidConduit eConduit, ForgeDirection dir, boolean isInput,
|
||||
DyeColor channel) {
|
||||
super(eConduit.getBundle().getEntity(), ConTypeEnum.FLUID);
|
||||
this.dir = dir;
|
||||
this.isInput = isInput;
|
||||
@@ -40,13 +43,14 @@ public class PacketFluidChannel extends AbstractConduitPacket<ILiquidConduit>
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
dir = ForgeDirection.values()[buf.readShort()];
|
||||
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
|
||||
isInput = buf.readBoolean();
|
||||
channel = DyeColor.values()[buf.readShort()];
|
||||
channel = DyeColor.VALUES[buf.readShort()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketFluidChannel message, MessageContext ctx) {
|
||||
if (isInvalidPacketForGui(message, ctx)) return null;
|
||||
ILiquidConduit conduit = message.getTileCasted(ctx);
|
||||
if (!(conduit instanceof AbstractEnderLiquidConduit)) {
|
||||
return null;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package crazypants.enderio.conduit.gui;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
@@ -9,9 +12,8 @@ import crazypants.enderio.conduit.liquid.FluidFilter;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.packet.AbstractConduitPacket;
|
||||
import crazypants.enderio.conduit.packet.ConTypeEnum;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class PacketFluidFilter extends AbstractConduitPacket<ILiquidConduit>
|
||||
implements IMessageHandler<PacketFluidFilter, IMessage> {
|
||||
@@ -22,8 +24,8 @@ public class PacketFluidFilter extends AbstractConduitPacket<ILiquidConduit>
|
||||
|
||||
public PacketFluidFilter() {}
|
||||
|
||||
public PacketFluidFilter(
|
||||
AbstractEnderLiquidConduit eConduit, ForgeDirection dir, FluidFilter filter, boolean isInput) {
|
||||
public PacketFluidFilter(AbstractEnderLiquidConduit eConduit, ForgeDirection dir, FluidFilter filter,
|
||||
boolean isInput) {
|
||||
super(eConduit.getBundle().getEntity(), ConTypeEnum.FLUID);
|
||||
this.dir = dir;
|
||||
this.filter = filter;
|
||||
@@ -43,7 +45,7 @@ public class PacketFluidFilter extends AbstractConduitPacket<ILiquidConduit>
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
dir = ForgeDirection.values()[buf.readShort()];
|
||||
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
|
||||
isInput = buf.readBoolean();
|
||||
NBTTagCompound tag = ByteBufUtils.readTag(buf);
|
||||
filter = new FluidFilter();
|
||||
@@ -52,6 +54,7 @@ public class PacketFluidFilter extends AbstractConduitPacket<ILiquidConduit>
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketFluidFilter message, MessageContext ctx) {
|
||||
if (isInvalidPacketForGui(message, ctx)) return null;
|
||||
ILiquidConduit conduit = message.getTileCasted(ctx);
|
||||
if (!(conduit instanceof AbstractEnderLiquidConduit)) {
|
||||
return null;
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
package crazypants.enderio.conduit.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.network.MessageTileEntity;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class PacketOpenConduitUI extends MessageTileEntity<TileEntity>
|
||||
implements IMessageHandler<PacketOpenConduitUI, IMessage> {
|
||||
@@ -32,7 +35,7 @@ public class PacketOpenConduitUI extends MessageTileEntity<TileEntity>
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
dir = ForgeDirection.values()[buf.readShort()];
|
||||
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
|
||||
}
|
||||
|
||||
public IMessage onMessage(PacketOpenConduitUI message, MessageContext ctx) {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package crazypants.enderio.conduit.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
||||
public class PacketSlotVisibility implements IMessage, IMessageHandler<PacketSlotVisibility, IMessage> {
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package crazypants.enderio.conduit.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
import com.enderio.core.client.gui.button.ColorButton;
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.packet.PacketExtractMode;
|
||||
@@ -11,7 +14,6 @@ import crazypants.enderio.gui.RedstoneModeButton;
|
||||
import crazypants.enderio.machine.IRedstoneModeControlable;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
public class PowerSettings extends BaseSettingsPanel {
|
||||
|
||||
@@ -19,9 +21,9 @@ public class PowerSettings extends BaseSettingsPanel {
|
||||
|
||||
private static final int ID_COLOR_BUTTON = GuiExternalConnection.nextButtonId();
|
||||
|
||||
private IPowerConduit conduit;
|
||||
private RedstoneModeButton rsB;
|
||||
private ColorButton colorB;
|
||||
private final IPowerConduit conduit;
|
||||
private final RedstoneModeButton rsB;
|
||||
private final ColorButton colorB;
|
||||
|
||||
protected PowerSettings(final GuiExternalConnection gui, IConduit con) {
|
||||
super(IconEIO.WRENCH_OVERLAY_POWER, EnderIO.lang.localize("itemPowerConduit.name"), gui, con);
|
||||
@@ -57,7 +59,7 @@ public class PowerSettings extends BaseSettingsPanel {
|
||||
public void actionPerformed(GuiButton guiButton) {
|
||||
super.actionPerformed(guiButton);
|
||||
if (guiButton.id == ID_COLOR_BUTTON) {
|
||||
conduit.setExtractionSignalColor(gui.getDir(), DyeColor.values()[colorB.getColorIndex()]);
|
||||
conduit.setExtractionSignalColor(gui.getDir(), DyeColor.VALUES[colorB.getColorIndex()]);
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketExtractMode(conduit, gui.getDir()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
package crazypants.enderio.conduit.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
import com.enderio.core.client.gui.button.CheckBox;
|
||||
import com.enderio.core.client.gui.button.ColorButton;
|
||||
import com.enderio.core.client.render.ColorUtil;
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.packet.PacketRedstoneConduitOutputStrength;
|
||||
@@ -11,8 +16,6 @@ import crazypants.enderio.conduit.packet.PacketRedstoneConduitSignalColor;
|
||||
import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import java.awt.Color;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
public class RedstoneSettings extends BaseSettingsPanel {
|
||||
|
||||
@@ -22,8 +25,8 @@ public class RedstoneSettings extends BaseSettingsPanel {
|
||||
|
||||
private CheckBox strongCB;
|
||||
|
||||
private String signalColorStr = EnderIO.lang.localize("gui.conduit.redstone.color");
|
||||
private String signalStringthStr = EnderIO.lang.localize("gui.conduit.redstone.signalStrengh");
|
||||
private final String signalColorStr = EnderIO.lang.localize("gui.conduit.redstone.color");
|
||||
private final String signalStringthStr = EnderIO.lang.localize("gui.conduit.redstone.signalStrengh");
|
||||
private IInsulatedRedstoneConduit insCon;
|
||||
|
||||
private int stongLabelX;
|
||||
@@ -58,7 +61,7 @@ public class RedstoneSettings extends BaseSettingsPanel {
|
||||
public void actionPerformed(GuiButton guiButton) {
|
||||
super.actionPerformed(guiButton);
|
||||
if (guiButton.id == ID_COLOR_BUTTON && cb != null) {
|
||||
insCon.setSignalColor(gui.getDir(), DyeColor.values()[cb.getColorIndex()]);
|
||||
insCon.setSignalColor(gui.getDir(), DyeColor.VALUES[cb.getColorIndex()]);
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketRedstoneConduitSignalColor(insCon, gui.getDir()));
|
||||
} else if (guiButton.id == ID_STRONG_BUTTON && strongCB != null) {
|
||||
insCon.setOutputStrength(gui.getDir(), strongCB.isSelected());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package crazypants.enderio.conduit.gui;
|
||||
|
||||
import com.enderio.core.api.client.gui.ITabPanel;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.gas.IGasConduit;
|
||||
import crazypants.enderio.conduit.gui.item.ItemSettings;
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
package crazypants.enderio.conduit.gui.item;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.enderio.core.client.gui.button.CycleButton;
|
||||
import com.enderio.core.client.gui.button.IconButton;
|
||||
import com.enderio.core.client.gui.button.ToggleButton;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.gui.GuiExternalConnection;
|
||||
import crazypants.enderio.conduit.item.filter.FuzzyMode;
|
||||
import crazypants.enderio.conduit.item.filter.ItemFilter;
|
||||
import crazypants.enderio.gui.GuiContainerBaseEIO;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class BasicItemFilterGui implements IItemFilterGui {
|
||||
|
||||
@@ -36,28 +39,19 @@ public class BasicItemFilterGui implements IItemFilterGui {
|
||||
private final IItemFilterContainer filterContainer;
|
||||
private final ItemFilter filter;
|
||||
|
||||
private int buttonIdOffset;
|
||||
private int xOffset;
|
||||
private int yOffset;
|
||||
private final int buttonIdOffset;
|
||||
private final int xOffset;
|
||||
private final int yOffset;
|
||||
|
||||
private boolean isInput;
|
||||
private final boolean isInput;
|
||||
|
||||
public BasicItemFilterGui(
|
||||
GuiContainerBaseEIO gui,
|
||||
IItemFilterContainer filterContainer,
|
||||
boolean isStickyModeAvailable,
|
||||
boolean isInput) {
|
||||
public BasicItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer,
|
||||
boolean isStickyModeAvailable, boolean isInput) {
|
||||
this(gui, filterContainer, isStickyModeAvailable, isInput, isInput ? 104 : 6, 96, isInput ? 0 : 256);
|
||||
}
|
||||
|
||||
public BasicItemFilterGui(
|
||||
GuiContainerBaseEIO gui,
|
||||
IItemFilterContainer filterContainer,
|
||||
boolean isStickyModeAvailable,
|
||||
boolean isInput,
|
||||
int xOffset,
|
||||
int yOffset,
|
||||
int buttonIdOffset) {
|
||||
public BasicItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer,
|
||||
boolean isStickyModeAvailable, boolean isInput, int xOffset, int yOffset, int buttonIdOffset) {
|
||||
this.gui = gui;
|
||||
this.isStickyModeAvailable = isStickyModeAvailable;
|
||||
this.filterContainer = filterContainer;
|
||||
@@ -84,14 +78,24 @@ public class BasicItemFilterGui implements IItemFilterGui {
|
||||
|
||||
x += 16;
|
||||
stickyB = new ToggleButton(
|
||||
gui, ID_STICKY + buttonIdOffset, x, y, IconEIO.FILTER_STICKY_OFF, IconEIO.FILTER_STICKY);
|
||||
gui,
|
||||
ID_STICKY + buttonIdOffset,
|
||||
x,
|
||||
y,
|
||||
IconEIO.FILTER_STICKY_OFF,
|
||||
IconEIO.FILTER_STICKY);
|
||||
stickyB.setSelectedToolTip(EnderIO.lang.localizeList("gui.conduit.item.stickyEnabled"));
|
||||
stickyB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.stickyDisbaled"));
|
||||
stickyB.setPaintSelectedBorder(false);
|
||||
|
||||
if (isStickyModeAvailable) x += 16;
|
||||
useOreDictB = new ToggleButton(
|
||||
gui, ID_ORE_DICT + buttonIdOffset, x, y, IconEIO.FILTER_ORE_DICT_OFF, IconEIO.FILTER_ORE_DICT);
|
||||
gui,
|
||||
ID_ORE_DICT + buttonIdOffset,
|
||||
x,
|
||||
y,
|
||||
IconEIO.FILTER_ORE_DICT_OFF,
|
||||
IconEIO.FILTER_ORE_DICT);
|
||||
useOreDictB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.oreDicEnabled"));
|
||||
useOreDictB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.oreDicDisabled"));
|
||||
useOreDictB.setPaintSelectedBorder(false);
|
||||
@@ -103,11 +107,12 @@ public class BasicItemFilterGui implements IItemFilterGui {
|
||||
useNbtB.setPaintSelectedBorder(false);
|
||||
|
||||
x += 16;
|
||||
fuzzyB = new CycleButton(gui, ID_FUZZY + buttonIdOffset, x, y, FuzzyMode.class);
|
||||
fuzzyB = new CycleButton<>(gui, ID_FUZZY + buttonIdOffset, x, y, FuzzyMode.class);
|
||||
}
|
||||
|
||||
public void createFilterSlots() {
|
||||
filter.createGhostSlots(gui.getGhostSlots(), xOffset + 1, yOffset + 1, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
sendFilterChange();
|
||||
@@ -201,17 +206,13 @@ public class BasicItemFilterGui implements IItemFilterGui {
|
||||
|
||||
private String[] getWhitelistTooltips(boolean isBlacklist) {
|
||||
if (isBlacklist) {
|
||||
return new String[] {
|
||||
EnderIO.lang.localize("gui.conduit.item.blacklist"),
|
||||
EnderIO.lang.localize("gui.conduit.item.blacklist.tooltip.0"),
|
||||
EnderIO.lang.localize("gui.conduit.item.blacklist.tooltip.1")
|
||||
};
|
||||
return new String[] { EnderIO.lang.localize("gui.conduit.item.blacklist"),
|
||||
EnderIO.lang.localize("gui.conduit.item.blacklist.tooltip.0"),
|
||||
EnderIO.lang.localize("gui.conduit.item.blacklist.tooltip.1") };
|
||||
} else {
|
||||
return new String[] {
|
||||
EnderIO.lang.localize("gui.conduit.item.whitelist"),
|
||||
EnderIO.lang.localize("gui.conduit.item.whitelist.tooltip.0"),
|
||||
EnderIO.lang.localize("gui.conduit.item.whitelist.tooltip.1")
|
||||
};
|
||||
return new String[] { EnderIO.lang.localize("gui.conduit.item.whitelist"),
|
||||
EnderIO.lang.localize("gui.conduit.item.whitelist.tooltip.0"),
|
||||
EnderIO.lang.localize("gui.conduit.item.whitelist.tooltip.1") };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,19 @@
|
||||
package crazypants.enderio.conduit.gui.item;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.enderio.core.client.gui.button.CycleButton;
|
||||
import com.enderio.core.client.gui.button.IconButton;
|
||||
import com.enderio.core.client.gui.button.ToggleButton;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.gui.GuiExternalConnection;
|
||||
import crazypants.enderio.conduit.item.filter.FuzzyMode;
|
||||
import crazypants.enderio.conduit.item.filter.ItemFilter;
|
||||
import crazypants.enderio.gui.GuiContainerBaseEIO;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class BigItemFilterGui implements IItemFilterGui {
|
||||
|
||||
@@ -36,26 +39,17 @@ public class BigItemFilterGui implements IItemFilterGui {
|
||||
private final IItemFilterContainer filterContainer;
|
||||
private final ItemFilter filter;
|
||||
|
||||
private int buttonIdOffset;
|
||||
private final int buttonIdOffset;
|
||||
private int xOffset;
|
||||
private int yOffset;
|
||||
|
||||
public BigItemFilterGui(
|
||||
GuiContainerBaseEIO gui,
|
||||
IItemFilterContainer filterContainer,
|
||||
boolean isStickyModeAvailable,
|
||||
boolean isInput) {
|
||||
public BigItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer,
|
||||
boolean isStickyModeAvailable, boolean isInput) {
|
||||
this(gui, filterContainer, isStickyModeAvailable, isInput, isInput ? 104 : 6, 96, isInput ? 0 : 256);
|
||||
}
|
||||
|
||||
public BigItemFilterGui(
|
||||
GuiContainerBaseEIO gui,
|
||||
IItemFilterContainer filterContainer,
|
||||
boolean isStickyModeAvailable,
|
||||
boolean isInput,
|
||||
int xOffset,
|
||||
int yOffset,
|
||||
int buttonIdOffset) {
|
||||
public BigItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer,
|
||||
boolean isStickyModeAvailable, boolean isInput, int xOffset, int yOffset, int buttonIdOffset) {
|
||||
this.gui = gui;
|
||||
this.isStickyModeAvailable = isStickyModeAvailable;
|
||||
this.filterContainer = filterContainer;
|
||||
@@ -81,7 +75,12 @@ public class BigItemFilterGui implements IItemFilterGui {
|
||||
|
||||
x += 16;
|
||||
useOreDictB = new ToggleButton(
|
||||
gui, ID_ORE_DICT + buttonIdOffset, x, y, IconEIO.FILTER_ORE_DICT_OFF, IconEIO.FILTER_ORE_DICT);
|
||||
gui,
|
||||
ID_ORE_DICT + buttonIdOffset,
|
||||
x,
|
||||
y,
|
||||
IconEIO.FILTER_ORE_DICT_OFF,
|
||||
IconEIO.FILTER_ORE_DICT);
|
||||
useOreDictB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.oreDicEnabled"));
|
||||
useOreDictB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.oreDicDisabled"));
|
||||
useOreDictB.setPaintSelectedBorder(false);
|
||||
@@ -93,11 +92,16 @@ public class BigItemFilterGui implements IItemFilterGui {
|
||||
useNbtB.setPaintSelectedBorder(false);
|
||||
|
||||
x += 16;
|
||||
fuzzyB = new CycleButton(gui, ID_FUZZY + buttonIdOffset, x, y, FuzzyMode.class);
|
||||
fuzzyB = new CycleButton<>(gui, ID_FUZZY + buttonIdOffset, x, y, FuzzyMode.class);
|
||||
|
||||
x += 16;
|
||||
stickyB = new ToggleButton(
|
||||
gui, ID_STICKY + buttonIdOffset, x, y, IconEIO.FILTER_STICKY_OFF, IconEIO.FILTER_STICKY);
|
||||
gui,
|
||||
ID_STICKY + buttonIdOffset,
|
||||
x,
|
||||
y,
|
||||
IconEIO.FILTER_STICKY_OFF,
|
||||
IconEIO.FILTER_STICKY);
|
||||
stickyB.setSelectedToolTip(EnderIO.lang.localizeList("gui.conduit.item.stickyEnabled"));
|
||||
stickyB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.stickyDisbaled"));
|
||||
stickyB.setPaintSelectedBorder(false);
|
||||
@@ -110,6 +114,7 @@ public class BigItemFilterGui implements IItemFilterGui {
|
||||
|
||||
public void createFilterSlots() {
|
||||
filter.createGhostSlots(gui.getGhostSlots(), xOffset + 1, yOffset + 1, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
sendFilterChange();
|
||||
|
||||
@@ -1,11 +1,23 @@
|
||||
package crazypants.enderio.conduit.gui.item;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.enderio.core.api.client.gui.IGuiOverlay;
|
||||
import com.enderio.core.api.client.gui.IGuiScreen;
|
||||
import com.enderio.core.client.gui.button.IconButton;
|
||||
import com.enderio.core.client.gui.button.ToggleButton;
|
||||
import com.enderio.core.client.render.RenderUtil;
|
||||
import com.enderio.core.common.vecmath.Vector4f;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.gui.GuiExternalConnection;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
@@ -13,14 +25,6 @@ import crazypants.enderio.conduit.item.filter.ExistingItemFilter;
|
||||
import crazypants.enderio.conduit.packet.PacketItemConduitFilter;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ExistingItemFilterGui implements IItemFilterGui {
|
||||
|
||||
@@ -34,26 +38,26 @@ public class ExistingItemFilterGui implements IItemFilterGui {
|
||||
private static final int ID_SHOW = GuiExternalConnection.nextButtonId();
|
||||
private static final int ID_MERGE = GuiExternalConnection.nextButtonId();
|
||||
|
||||
private IItemConduit itemConduit;
|
||||
private GuiExternalConnection gui;
|
||||
private final IItemConduit itemConduit;
|
||||
private final GuiExternalConnection gui;
|
||||
|
||||
private ToggleButton useMetaB;
|
||||
private ToggleButton useNbtB;
|
||||
private ToggleButton useOreDictB;
|
||||
private ToggleButton stickyB;
|
||||
private final ToggleButton useMetaB;
|
||||
private final ToggleButton useNbtB;
|
||||
private final ToggleButton useOreDictB;
|
||||
private final ToggleButton stickyB;
|
||||
|
||||
private final IconButton whiteListB;
|
||||
|
||||
private GuiButton snapshotB;
|
||||
private GuiButton clearB;
|
||||
private GuiButton showB;
|
||||
private GuiButton mergeB;
|
||||
private SnapshotOverlay snapshotOverlay;
|
||||
private final GuiButton snapshotB;
|
||||
private final GuiButton clearB;
|
||||
private final GuiButton showB;
|
||||
private final GuiButton mergeB;
|
||||
private final SnapshotOverlay snapshotOverlay;
|
||||
|
||||
boolean isInput;
|
||||
private int buttonIdOffset = 0;
|
||||
|
||||
private ExistingItemFilter filter;
|
||||
private final ExistingItemFilter filter;
|
||||
|
||||
public ExistingItemFilterGui(GuiExternalConnection gui, IItemConduit itemConduit, boolean isInput) {
|
||||
this.gui = gui;
|
||||
@@ -82,7 +86,12 @@ public class ExistingItemFilterGui implements IItemFilterGui {
|
||||
|
||||
x += 16;
|
||||
stickyB = new ToggleButton(
|
||||
gui, ID_STICKY + buttonIdOffset, x, y, IconEIO.FILTER_STICKY_OFF, IconEIO.FILTER_STICKY);
|
||||
gui,
|
||||
ID_STICKY + buttonIdOffset,
|
||||
x,
|
||||
y,
|
||||
IconEIO.FILTER_STICKY_OFF,
|
||||
IconEIO.FILTER_STICKY);
|
||||
String[] lines = EnderIO.lang.localizeList("gui.conduit.item.stickyEnabled");
|
||||
stickyB.setSelectedToolTip(lines);
|
||||
stickyB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.stickyDisbaled"));
|
||||
@@ -96,17 +105,37 @@ public class ExistingItemFilterGui implements IItemFilterGui {
|
||||
|
||||
x += 16;
|
||||
useOreDictB = new ToggleButton(
|
||||
gui, ID_ORE_DICT + buttonIdOffset, x, y, IconEIO.FILTER_ORE_DICT_OFF, IconEIO.FILTER_ORE_DICT);
|
||||
gui,
|
||||
ID_ORE_DICT + buttonIdOffset,
|
||||
x,
|
||||
y,
|
||||
IconEIO.FILTER_ORE_DICT_OFF,
|
||||
IconEIO.FILTER_ORE_DICT);
|
||||
useOreDictB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.oreDicEnabled"));
|
||||
useOreDictB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.oreDicDisabled"));
|
||||
useOreDictB.setPaintSelectedBorder(false);
|
||||
|
||||
snapshotB = new GuiButton(
|
||||
ID_SNAPSHOT + buttonIdOffset, 0, 0, 56, 20, EnderIO.lang.localize("gui.conduit.button.snap"));
|
||||
ID_SNAPSHOT + buttonIdOffset,
|
||||
0,
|
||||
0,
|
||||
56,
|
||||
20,
|
||||
EnderIO.lang.localize("gui.conduit.button.snap"));
|
||||
mergeB = new GuiButton(
|
||||
ID_MERGE + buttonIdOffset, 0, 0, 40, 20, EnderIO.lang.localize("gui.conduit.button.merge"));
|
||||
ID_MERGE + buttonIdOffset,
|
||||
0,
|
||||
0,
|
||||
40,
|
||||
20,
|
||||
EnderIO.lang.localize("gui.conduit.button.merge"));
|
||||
clearB = new GuiButton(
|
||||
ID_CLEAR + buttonIdOffset, 0, 0, 56, 20, EnderIO.lang.localize("gui.conduit.button.clear"));
|
||||
ID_CLEAR + buttonIdOffset,
|
||||
0,
|
||||
0,
|
||||
56,
|
||||
20,
|
||||
EnderIO.lang.localize("gui.conduit.button.clear"));
|
||||
showB = new GuiButton(ID_SHOW + buttonIdOffset, 0, 0, 40, 20, EnderIO.lang.localize("gui.conduit.button.show"));
|
||||
|
||||
snapshotOverlay = new SnapshotOverlay();
|
||||
@@ -199,8 +228,7 @@ public class ExistingItemFilterGui implements IItemFilterGui {
|
||||
} else if (guiButton == whiteListB) {
|
||||
filter.setBlacklist(!filter.isBlacklist());
|
||||
sendSnapshotPacket(
|
||||
filter.isBlacklist()
|
||||
? PacketExistingItemFilterSnapshot.Opcode.SET_BLACK
|
||||
filter.isBlacklist() ? PacketExistingItemFilterSnapshot.Opcode.SET_BLACK
|
||||
: PacketExistingItemFilterSnapshot.Opcode.UNSET_BLACK);
|
||||
}
|
||||
}
|
||||
@@ -210,8 +238,8 @@ public class ExistingItemFilterGui implements IItemFilterGui {
|
||||
}
|
||||
|
||||
private void sendSnapshotPacket(PacketExistingItemFilterSnapshot.Opcode opcode) {
|
||||
PacketHandler.INSTANCE.sendToServer(
|
||||
new PacketExistingItemFilterSnapshot(itemConduit, gui.getDir(), isInput, opcode));
|
||||
PacketHandler.INSTANCE
|
||||
.sendToServer(new PacketExistingItemFilterSnapshot(itemConduit, gui.getDir(), isInput, opcode));
|
||||
}
|
||||
|
||||
private void sendFilterChange() {
|
||||
@@ -234,12 +262,12 @@ public class ExistingItemFilterGui implements IItemFilterGui {
|
||||
|
||||
@Override
|
||||
public void renderCustomOptions(int top, float par1, int par2, int par3) {
|
||||
// GL11.glColor3f(1, 1, 1);
|
||||
// RenderUtil.bindTexture("enderio:textures/gui/itemFilter.png");
|
||||
// gui.drawTexturedModalRect(gui.getGuiLeft() + 32, gui.getGuiTop() + 68, 0, 238, 18 * 5, 18);
|
||||
// if(filter.isAdvanced()) {
|
||||
// gui.drawTexturedModalRect(gui.getGuiLeft() + 32, gui.getGuiTop() + 86, 0, 238, 18 * 5, 18);
|
||||
// }
|
||||
// GL11.glColor3f(1, 1, 1);
|
||||
// RenderUtil.bindTexture("enderio:textures/gui/itemFilter.png");
|
||||
// gui.drawTexturedModalRect(gui.getGuiLeft() + 32, gui.getGuiTop() + 68, 0, 238, 18 * 5, 18);
|
||||
// if(filter.isAdvanced()) {
|
||||
// gui.drawTexturedModalRect(gui.getGuiLeft() + 32, gui.getGuiTop() + 86, 0, 238, 18 * 5, 18);
|
||||
// }
|
||||
}
|
||||
|
||||
class SnapshotOverlay implements IGuiOverlay {
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package crazypants.enderio.conduit.gui.item;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.item.filter.IItemFilterUpgrade;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.item.filter.IItemFilterUpgrade;
|
||||
|
||||
public class InventoryUpgrades implements IInventory {
|
||||
|
||||
IItemConduit itemConduit;
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
package crazypants.enderio.conduit.gui.item;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.item.filter.ItemFilter;
|
||||
import crazypants.enderio.conduit.packet.PacketItemConduitFilter;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class ItemConduitFilterContainer implements IItemFilterContainer {
|
||||
|
||||
private IItemConduit itemConduit;
|
||||
private ForgeDirection dir;
|
||||
private boolean isInput;
|
||||
private final IItemConduit itemConduit;
|
||||
private final ForgeDirection dir;
|
||||
private final boolean isInput;
|
||||
|
||||
public ItemConduitFilterContainer(IItemConduit itemConduit, ForgeDirection dir, boolean isInput) {
|
||||
this.itemConduit = itemConduit;
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
package crazypants.enderio.conduit.gui.item;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.enderio.core.client.gui.button.ColorButton;
|
||||
import com.enderio.core.client.gui.button.MultiIconButton;
|
||||
import com.enderio.core.client.gui.button.ToggleButton;
|
||||
import com.enderio.core.client.render.ColorUtil;
|
||||
import com.enderio.core.client.render.EnderWidget;
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
@@ -21,11 +31,7 @@ import crazypants.enderio.gui.RedstoneModeButton;
|
||||
import crazypants.enderio.machine.IRedstoneModeControlable;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import java.awt.*;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import crazypants.util.ColorUtils;
|
||||
|
||||
public class ItemSettings extends BaseSettingsPanel {
|
||||
|
||||
@@ -38,7 +44,7 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
private static final int ID_INSERT_CHANNEL = 23;
|
||||
private static final int ID_EXTRACT_CHANNEL = 27;
|
||||
|
||||
private @Nonnull IItemConduit itemConduit;
|
||||
private final @Nonnull IItemConduit itemConduit;
|
||||
|
||||
private final ToggleButton loopB;
|
||||
private final ToggleButton roundRobinB;
|
||||
@@ -49,11 +55,11 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
private final RedstoneModeButton rsB;
|
||||
private final @Nonnull ColorButton colorB;
|
||||
|
||||
private ColorButton insertChannelB;
|
||||
private ColorButton extractChannelB;
|
||||
private final ColorButton insertChannelB;
|
||||
private final ColorButton extractChannelB;
|
||||
|
||||
private int priLeft = 46;
|
||||
private int priWidth = 32;
|
||||
private static final int priLeft = 46;
|
||||
private static final int priWidth = 32;
|
||||
|
||||
private IItemFilterGui insertFilterGui;
|
||||
private IItemFilterGui extractFilterGui;
|
||||
@@ -101,6 +107,7 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
colorB.setToolTipHeading(EnderIO.lang.localize("gui.conduit.item.channel"));
|
||||
|
||||
rsB = new RedstoneModeButton(gui, ID_REDSTONE_BUTTON, x, y, new IRedstoneModeControlable() {
|
||||
|
||||
@Override
|
||||
public void setRedstoneControlMode(RedstoneControlMode mode) {
|
||||
RedstoneControlMode curMode = getRedstoneControlMode();
|
||||
@@ -121,6 +128,7 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
priDownB = MultiIconButton.createMinusButton(gui, ID_PRIORITY_DOWN, x, y + 8);
|
||||
|
||||
FilterChangeListener fcl = new FilterChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onFilterChanged() {
|
||||
if (insertFilterGui != null) {
|
||||
@@ -167,6 +175,7 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
private void updateButtons() {
|
||||
rsB.onGuiInit();
|
||||
rsB.setMode(itemConduit.getExtractionRedstoneMode(gui.getDir()));
|
||||
colorB.onGuiInit();
|
||||
|
||||
loopB.onGuiInit();
|
||||
loopB.setSelected(itemConduit.isSelfFeedEnabled(gui.getDir()));
|
||||
@@ -206,9 +215,11 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
} else if (guiButton.id == ID_EXTRACT_CHANNEL) {
|
||||
DyeColor col = DyeColor.fromIndex(extractChannelB.getColorIndex());
|
||||
itemConduit.setInputColor(gui.getDir(), col);
|
||||
} else {
|
||||
if (insertFilterGui != null) insertFilterGui.actionPerformed(guiButton);
|
||||
if (extractFilterGui != null) extractFilterGui.actionPerformed(guiButton);
|
||||
return;
|
||||
}
|
||||
if (insertFilterGui != null) insertFilterGui.actionPerformed(guiButton);
|
||||
if (extractFilterGui != null) extractFilterGui.actionPerformed(guiButton);
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketItemConduitFilter(itemConduit, gui.getDir()));
|
||||
}
|
||||
|
||||
@@ -230,7 +241,7 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
|
||||
String priority = EnderIO.lang.localize("gui.conduit.item.priority");
|
||||
fr.drawString(priority, left + 12, top1 + 25, ColorUtil.getRGB(Color.black));
|
||||
fr.drawString(str, left + priLeft + priWidth - sw - gap, top1 + 25, ColorUtil.getRGB(Color.black));
|
||||
fr.drawString(str, left + priLeft + priWidth - sw - gap, top1 + 25, ColorUtils.priorityString.getColor());
|
||||
|
||||
if (insertFilterGui != null) insertFilterGui.renderCustomOptions(top1, par1, par2, par3);
|
||||
if (extractFilterGui != null) extractFilterGui.renderCustomOptions(top1, par1, par2, par3);
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
package crazypants.enderio.conduit.gui.item;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.enderio.core.client.gui.button.CycleButton;
|
||||
import com.enderio.core.client.gui.button.IconButton;
|
||||
import com.enderio.core.client.gui.button.ToggleButton;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.gui.GuiExternalConnection;
|
||||
import crazypants.enderio.conduit.item.filter.FuzzyMode;
|
||||
import crazypants.enderio.conduit.item.filter.ItemFilter;
|
||||
import crazypants.enderio.gui.GuiContainerBaseEIO;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
|
||||
public class LimitedItemFilterGui implements IItemFilterGui {
|
||||
|
||||
private static final int ID_WHITELIST = GuiExternalConnection.nextButtonId();
|
||||
private static final int ID_NBT = GuiExternalConnection.nextButtonId();
|
||||
private static final int ID_META = GuiExternalConnection.nextButtonId();
|
||||
private static final int ID_ORE_DICT = GuiExternalConnection.nextButtonId();
|
||||
private static final int ID_STICKY = GuiExternalConnection.nextButtonId();
|
||||
private static final int ID_FUZZY = GuiExternalConnection.nextButtonId();
|
||||
|
||||
private final GuiContainerBaseEIO gui;
|
||||
|
||||
private final ToggleButton useMetaB;
|
||||
private final ToggleButton useNbtB;
|
||||
private final IconButton whiteListB;
|
||||
private final ToggleButton useOreDictB;
|
||||
private final ToggleButton stickyB;
|
||||
private final CycleButton<FuzzyMode> fuzzyB;
|
||||
|
||||
private final IItemFilterContainer filterContainer;
|
||||
private final ItemFilter filter;
|
||||
private final int buttonIdOffset;
|
||||
private final int xOffset;
|
||||
private final int yOffset;
|
||||
final boolean isStickyModeAvailable;
|
||||
private final boolean isInput;
|
||||
|
||||
public LimitedItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer,
|
||||
boolean isStickyModeAvailable, boolean isInput) {
|
||||
this(gui, filterContainer, isStickyModeAvailable, isInput, isInput ? 104 : 6, 96, isInput ? 0 : 256);
|
||||
}
|
||||
|
||||
public LimitedItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer,
|
||||
boolean isStickyModeAvailable, boolean isInput, int xOffset, int yOffset, int buttonIdOffset) {
|
||||
this.gui = gui;
|
||||
this.isStickyModeAvailable = isStickyModeAvailable;
|
||||
this.filterContainer = filterContainer;
|
||||
this.xOffset = xOffset;
|
||||
this.yOffset = yOffset;
|
||||
this.buttonIdOffset = buttonIdOffset;
|
||||
this.isInput = isInput;
|
||||
|
||||
filter = filterContainer.getItemFilter();
|
||||
|
||||
int butLeft = xOffset;
|
||||
int x = butLeft;
|
||||
int y = yOffset + 40;
|
||||
whiteListB = new IconButton(gui, ID_WHITELIST + buttonIdOffset, x, y, IconEIO.FILTER_WHITELIST);
|
||||
whiteListB.setToolTip(getWhitelistTooltips(false));
|
||||
|
||||
x += 16;
|
||||
useMetaB = new ToggleButton(gui, ID_META + buttonIdOffset, x, y, IconEIO.FILTER_META_OFF, IconEIO.FILTER_META);
|
||||
useMetaB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.matchMetaData"));
|
||||
useMetaB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.ignoreMetaData"));
|
||||
useMetaB.setPaintSelectedBorder(false);
|
||||
|
||||
x += 16;
|
||||
stickyB = new ToggleButton(
|
||||
gui,
|
||||
ID_STICKY + buttonIdOffset,
|
||||
x,
|
||||
y,
|
||||
IconEIO.FILTER_STICKY_OFF,
|
||||
IconEIO.FILTER_STICKY);
|
||||
stickyB.setSelectedToolTip(EnderIO.lang.localizeList("gui.conduit.item.stickyEnabled"));
|
||||
stickyB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.stickyDisbaled"));
|
||||
stickyB.setPaintSelectedBorder(false);
|
||||
|
||||
if (isStickyModeAvailable) x += 16;
|
||||
useOreDictB = new ToggleButton(
|
||||
gui,
|
||||
ID_ORE_DICT + buttonIdOffset,
|
||||
x,
|
||||
y,
|
||||
IconEIO.FILTER_ORE_DICT_OFF,
|
||||
IconEIO.FILTER_ORE_DICT);
|
||||
useOreDictB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.oreDicEnabled"));
|
||||
useOreDictB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.oreDicDisabled"));
|
||||
useOreDictB.setPaintSelectedBorder(false);
|
||||
|
||||
x += 16;
|
||||
useNbtB = new ToggleButton(gui, ID_NBT + buttonIdOffset, x, y, IconEIO.FILTER_NBT_OFF, IconEIO.FILTER_NBT);
|
||||
useNbtB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.matchNBT"));
|
||||
useNbtB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.ignoreNBT"));
|
||||
useNbtB.setPaintSelectedBorder(false);
|
||||
|
||||
x += 16;
|
||||
fuzzyB = new CycleButton<>(gui, ID_FUZZY + buttonIdOffset, x, y, FuzzyMode.class);
|
||||
}
|
||||
|
||||
public void createFilterSlots() {
|
||||
filter.createGhostSlots(gui.getGhostSlots(), xOffset + 1, yOffset + 1, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
sendFilterChange();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int x, int y, int par3) {}
|
||||
|
||||
@Override
|
||||
public void updateButtons() {
|
||||
ItemFilter activeFilter = filter;
|
||||
|
||||
useNbtB.onGuiInit();
|
||||
useNbtB.setSelected(activeFilter.isMatchNBT());
|
||||
|
||||
useOreDictB.onGuiInit();
|
||||
useOreDictB.setSelected(activeFilter.isUseOreDict());
|
||||
|
||||
if (isStickyModeAvailable) {
|
||||
stickyB.onGuiInit();
|
||||
stickyB.setSelected(activeFilter.isSticky());
|
||||
}
|
||||
|
||||
fuzzyB.onGuiInit();
|
||||
fuzzyB.setMode(activeFilter.getFuzzyMode());
|
||||
|
||||
useMetaB.onGuiInit();
|
||||
useMetaB.setSelected(activeFilter.isMatchMeta());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton guiButton) {
|
||||
|
||||
if (guiButton.id == ID_META + buttonIdOffset) {
|
||||
filter.setMatchMeta(useMetaB.isSelected());
|
||||
sendFilterChange();
|
||||
} else if (guiButton.id == ID_NBT + buttonIdOffset) {
|
||||
filter.setMatchNBT(useNbtB.isSelected());
|
||||
sendFilterChange();
|
||||
} else if (guiButton.id == ID_STICKY + buttonIdOffset) {
|
||||
filter.setSticky(stickyB.isSelected());
|
||||
sendFilterChange();
|
||||
} else if (guiButton.id == ID_ORE_DICT + buttonIdOffset) {
|
||||
filter.setUseOreDict(useOreDictB.isSelected());
|
||||
sendFilterChange();
|
||||
} else if (guiButton.id == ID_FUZZY + buttonIdOffset) {
|
||||
filter.setFuzzyMode(fuzzyB.getMode());
|
||||
sendFilterChange();
|
||||
} else if (guiButton.id == ID_WHITELIST + buttonIdOffset) {
|
||||
filter.setBlacklist(!filter.isBlacklist());
|
||||
sendFilterChange();
|
||||
}
|
||||
}
|
||||
|
||||
private void sendFilterChange() {
|
||||
updateButtons();
|
||||
filterContainer.onFilterChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate() {
|
||||
useNbtB.detach();
|
||||
useMetaB.detach();
|
||||
useOreDictB.detach();
|
||||
whiteListB.detach();
|
||||
stickyB.detach();
|
||||
fuzzyB.detach();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderCustomOptions(int top, float par1, int par2, int par3) {
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
gui.bindGuiTexture(1);
|
||||
gui.drawTexturedModalRect(gui.getGuiLeft() + xOffset, gui.getGuiTop() + yOffset, 0, 238, 18 * 5, 18);
|
||||
gui.drawTexturedModalRect(gui.getGuiLeft() + xOffset, gui.getGuiTop() + yOffset + 20, 0, 238, 18 * 5, 18);
|
||||
|
||||
}
|
||||
|
||||
private String[] getWhitelistTooltips(boolean isBlacklist) {
|
||||
if (isBlacklist) {
|
||||
return new String[] { EnderIO.lang.localize("gui.conduit.item.blacklist"),
|
||||
EnderIO.lang.localize("gui.conduit.item.blacklist.tooltip.0"),
|
||||
EnderIO.lang.localize("gui.conduit.item.blacklist.tooltip.1") };
|
||||
} else {
|
||||
return new String[] { EnderIO.lang.localize("gui.conduit.item.whitelist"),
|
||||
EnderIO.lang.localize("gui.conduit.item.whitelist.tooltip.0"),
|
||||
EnderIO.lang.localize("gui.conduit.item.whitelist.tooltip.1") };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,24 @@
|
||||
package crazypants.enderio.conduit.gui.item;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.enderio.core.client.gui.button.IconButton;
|
||||
import com.enderio.core.client.render.ColorUtil;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.gui.GuiExternalConnection;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.item.filter.ModItemFilter;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import java.awt.Color;
|
||||
import java.awt.Rectangle;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ModItemFilterGui implements IItemFilterGui {
|
||||
|
||||
@@ -33,7 +37,6 @@ public class ModItemFilterGui implements IItemFilterGui {
|
||||
|
||||
private final IconButton whiteListB;
|
||||
|
||||
private final int inputOffsetX;
|
||||
private final int tfWidth;
|
||||
private final int tfTextureX;
|
||||
private final int tfTextureY;
|
||||
@@ -52,16 +55,12 @@ public class ModItemFilterGui implements IItemFilterGui {
|
||||
} else {
|
||||
filter = (ModItemFilter) itemConduit.getOutputFilter(gui.getDir());
|
||||
}
|
||||
inputOffsetX = x;
|
||||
tfWidth = 52;
|
||||
tfTextureX = 120;
|
||||
tfTextureY = 214;
|
||||
|
||||
inputBounds = new Rectangle[] {
|
||||
new Rectangle(inputOffsetX, y, 16, 16),
|
||||
new Rectangle(inputOffsetX, y + 18, 16, 16),
|
||||
new Rectangle(inputOffsetX, y + 36, 16, 16)
|
||||
};
|
||||
inputBounds = new Rectangle[] { new Rectangle(x, y, 16, 16), new Rectangle(x, y + 18, 16, 16),
|
||||
new Rectangle(x, y + 36, 16, 16) };
|
||||
|
||||
deleteButs = new IconButton[inputBounds.length];
|
||||
for (int i = 0; i < deleteButs.length; i++) {
|
||||
@@ -121,7 +120,12 @@ public class ModItemFilterGui implements IItemFilterGui {
|
||||
gui.drawTexturedModalRect(gui.getGuiLeft() + r.x - 1, gui.getGuiTop() + r.y - 1, 24, 214, 18, 18);
|
||||
// text box
|
||||
gui.drawTexturedModalRect(
|
||||
gui.getGuiLeft() + r.x + 38, gui.getGuiTop() + r.y - 1, tfTextureX, tfTextureY, tfWidth, 18);
|
||||
gui.getGuiLeft() + r.x + 38,
|
||||
gui.getGuiTop() + r.y - 1,
|
||||
tfTextureX,
|
||||
tfTextureY,
|
||||
tfWidth,
|
||||
18);
|
||||
}
|
||||
|
||||
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
|
||||
|
||||
Loaded 100 of 1590 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user