mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-23 05:19:49 +00:00
Compare commits
52
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
262f61ec0b | ||
|
|
44158e0e3d | ||
|
|
67ce947cbe | ||
|
|
c92f8bdd7c | ||
|
|
ab7769a45d | ||
|
|
d2c03bc903 | ||
|
|
e8664328ed | ||
|
|
84e395e470 | ||
|
|
0a01bb008b | ||
|
|
f73f79da7b | ||
|
|
16f207ce80 | ||
|
|
18f31ac3ef | ||
|
|
3ff42b3d18 | ||
|
|
b205d3f53f | ||
|
|
6505967826 | ||
|
|
78e9291fc6 | ||
|
|
6c4e12e968 | ||
|
|
ebf5a23ab9 | ||
|
|
161e38cbda | ||
|
|
948dcdcbce | ||
|
|
0b99ba974f | ||
|
|
2407653e96 | ||
|
|
acfb5b1d48 | ||
|
|
232b64e819 | ||
|
|
7438c7075c | ||
|
|
9615e1cbf0 | ||
|
|
98c633e13d | ||
|
|
704dbf6eec | ||
|
|
bf7190ce21 | ||
|
|
883ae61395 | ||
|
|
a203f2ff6b | ||
|
|
fee5c6ee76 | ||
|
|
fb003da0a3 | ||
|
|
0e774f4e66 | ||
|
|
25763691ca | ||
|
|
bc053b2690 | ||
|
|
9761008907 | ||
|
|
1a7acf4d28 | ||
|
|
c21752b80d | ||
|
|
80c364455d | ||
|
|
aef677868b | ||
|
|
09c1c49529 | ||
|
|
18fb84de69 | ||
|
|
271917c765 | ||
|
|
e9c6c75ac9 | ||
|
|
7d09bf606f | ||
|
|
098561a01d | ||
|
|
e292a4d35c | ||
|
|
52a985765c | ||
|
|
4f8811d376 | ||
|
|
bfcf33975c | ||
|
|
b4a5c070e2 |
No files matched your search
+290
-19
@@ -1,4 +1,4 @@
|
||||
//version: 1675173326
|
||||
//version: 1678003329
|
||||
/*
|
||||
DO NOT CHANGE THIS FILE!
|
||||
Also, you may replace this file at any time if there is an update available.
|
||||
@@ -9,13 +9,18 @@
|
||||
import com.diffplug.blowdryer.Blowdryer
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import com.gtnewhorizons.retrofuturagradle.ObfuscationAttribute
|
||||
import com.gtnewhorizons.retrofuturagradle.mcp.ReobfuscatedJar
|
||||
import com.gtnewhorizons.retrofuturagradle.minecraft.RunMinecraftTask
|
||||
import com.matthewprenger.cursegradle.CurseArtifact
|
||||
import com.matthewprenger.cursegradle.CurseRelation
|
||||
import com.modrinth.minotaur.dependencies.ModDependency
|
||||
import com.modrinth.minotaur.dependencies.VersionDependency
|
||||
import cpw.mods.fml.relauncher.Side
|
||||
import org.gradle.api.tasks.options.Option;
|
||||
import org.gradle.internal.logging.text.StyledTextOutput.Style
|
||||
import org.gradle.internal.logging.text.StyledTextOutputFactory
|
||||
import org.gradle.internal.xml.XmlTransformer
|
||||
import org.jetbrains.gradle.ext.*
|
||||
|
||||
import java.nio.file.Files
|
||||
@@ -23,10 +28,10 @@ import java.nio.file.Paths
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipOutputStream
|
||||
import javax.inject.Inject
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
|
||||
maven {
|
||||
@@ -47,6 +52,8 @@ buildscript {
|
||||
name 'Scala CI dependencies'
|
||||
url 'https://repo1.maven.org/maven2/'
|
||||
}
|
||||
|
||||
mavenLocal()
|
||||
}
|
||||
}
|
||||
plugins {
|
||||
@@ -66,7 +73,7 @@ plugins {
|
||||
id 'com.diffplug.spotless' version '6.7.2' apply false
|
||||
id 'com.modrinth.minotaur' version '2.+' apply false
|
||||
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
|
||||
id 'com.gtnewhorizons.retrofuturagradle' version '1.1.3'
|
||||
id 'com.gtnewhorizons.retrofuturagradle' version '1.2.3'
|
||||
}
|
||||
boolean settingsupdated = verifySettingsGradle()
|
||||
settingsupdated = verifyGitAttributes() || settingsupdated
|
||||
@@ -122,6 +129,9 @@ propertyDefaultIfUnset("gradleTokenGroupName", "")
|
||||
propertyDefaultIfUnset("enableModernJavaSyntax", false) // On by default for new projects only
|
||||
propertyDefaultIfUnset("enableGenericInjection", false) // On by default for new projects only
|
||||
|
||||
// this is meant to be set using the user wide property file. by default we do nothing.
|
||||
propertyDefaultIfUnset("ideaOverrideBuildType", "") // Can be nothing, "gradle" or "idea"
|
||||
|
||||
project.extensions.add(Blowdryer, "Blowdryer", Blowdryer) // Make blowdryer available in "apply from:" scripts
|
||||
if (!disableSpotless) {
|
||||
apply plugin: 'com.diffplug.spotless'
|
||||
@@ -143,7 +153,7 @@ java {
|
||||
} else {
|
||||
languageVersion.set(projectJavaVersion)
|
||||
}
|
||||
vendor.set(JvmVendorSpec.ADOPTIUM)
|
||||
vendor.set(JvmVendorSpec.AZUL)
|
||||
}
|
||||
if (!noPublishedSources) {
|
||||
withSourcesJar()
|
||||
@@ -186,11 +196,21 @@ configurations {
|
||||
}
|
||||
|
||||
if (enableModernJavaSyntax.toBoolean()) {
|
||||
repositories {
|
||||
mavenCentral {
|
||||
mavenContent {
|
||||
includeGroup("me.eigenraven.java8unsupported")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0'
|
||||
compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') {
|
||||
transitive = false // We only care about the 1 annotation class
|
||||
}
|
||||
// Allow using jdk.unsupported classes like sun.misc.Unsafe in the compiled code, working around JDK-8206937.
|
||||
patchedMinecraft('me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0')
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
@@ -202,7 +222,7 @@ if (enableModernJavaSyntax.toBoolean()) {
|
||||
|
||||
javaCompiler.set(javaToolchains.compilerFor {
|
||||
languageVersion.set(JavaLanguageVersion.of(17))
|
||||
vendor.set(JvmVendorSpec.ADOPTIUM)
|
||||
vendor.set(JvmVendorSpec.AZUL)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -234,12 +254,14 @@ if (apiPackage) {
|
||||
}
|
||||
|
||||
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)
|
||||
for (atFile in accessTransformersFile.split(",")) {
|
||||
String targetFile = "src/main/resources/META-INF/" + atFile.trim()
|
||||
if (!getFile(targetFile).exists()) {
|
||||
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
|
||||
}
|
||||
tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(targetFile)
|
||||
tasks.srgifyBinpatchedJar.accessTransformerFiles.from(targetFile)
|
||||
}
|
||||
tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(targetFile)
|
||||
tasks.srgifyBinpatchedJar.accessTransformerFiles.from(targetFile)
|
||||
} else {
|
||||
boolean atsFound = false
|
||||
for (File at : sourceSets.getByName("main").resources.files) {
|
||||
@@ -367,6 +389,10 @@ minecraft {
|
||||
injectMissingGenerics.set(true)
|
||||
}
|
||||
|
||||
username = developmentEnvironmentUserName.toString()
|
||||
|
||||
lwjgl3Version = "3.3.2-SNAPSHOT"
|
||||
|
||||
// Enable assertions in the current mod
|
||||
extraRunJvmArguments.add("-ea:${modGroup}")
|
||||
|
||||
@@ -401,6 +427,16 @@ configurations.configureEach {
|
||||
}
|
||||
}
|
||||
}
|
||||
def obfuscationAttr = it.attributes.getAttribute(ObfuscationAttribute.OBFUSCATION_ATTRIBUTE)
|
||||
if (obfuscationAttr != null && obfuscationAttr.name == ObfuscationAttribute.SRG) {
|
||||
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
|
||||
// Remap CoFH core cursemaven dev jar to the obfuscated version for runObfClient/Server
|
||||
if (details.requested.group == 'curse.maven' && details.requested.name.endsWith('-69162') && details.requested.version == '2388751') {
|
||||
details.useVersion '2388750'
|
||||
details.because 'Pick obfuscated jar'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure tests have access to minecraft classes
|
||||
@@ -430,8 +466,9 @@ repositories.configureEach { repo ->
|
||||
apply from: 'repositories.gradle'
|
||||
|
||||
configurations {
|
||||
runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
|
||||
testRuntimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
|
||||
for (config in [compileClasspath, runtimeClasspath, testCompileClasspath, testRuntimeClasspath]) {
|
||||
config.extendsFrom(runtimeOnlyNonPublishable)
|
||||
if (usesShadowedDependencies.toBoolean()) {
|
||||
config.extendsFrom(shadowImplementation)
|
||||
// TODO: remove Compile after all uses are refactored to Implementation
|
||||
@@ -484,6 +521,13 @@ repositories {
|
||||
}
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name 'sonatype'
|
||||
url 'https://oss.sonatype.org/content/repositories/snapshots/'
|
||||
content {
|
||||
includeGroup "org.lwjgl"
|
||||
}
|
||||
}
|
||||
if (includeWellKnownRepositories.toBoolean()) {
|
||||
maven {
|
||||
name "CurseMaven"
|
||||
@@ -520,20 +564,20 @@ dependencies {
|
||||
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('com.gtnewhorizon:gtnhmixins:2.1.10:processor')
|
||||
annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.13:processor')
|
||||
if (usesMixinDebug.toBoolean()) {
|
||||
runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16')
|
||||
}
|
||||
}
|
||||
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
|
||||
implementation('com.gtnewhorizon:gtnhmixins:2.1.10')
|
||||
implementation('com.gtnewhorizon:gtnhmixins:2.1.13')
|
||||
}
|
||||
}
|
||||
|
||||
pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
|
||||
if (usesMixins.toBoolean()) {
|
||||
dependencies {
|
||||
kapt('com.gtnewhorizon:gtnhmixins:2.1.10:processor')
|
||||
kapt('com.gtnewhorizon:gtnhmixins:2.1.13:processor')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -633,9 +677,150 @@ tasks.named("processResources", ProcessResources).configure {
|
||||
|
||||
if (usesMixins.toBoolean()) {
|
||||
from refMap
|
||||
dependsOn("compileJava", "compileScala")
|
||||
}
|
||||
}
|
||||
|
||||
ext.java17Toolchain = (JavaToolchainSpec spec) -> {
|
||||
spec.languageVersion.set(JavaLanguageVersion.of(17))
|
||||
spec.vendor.set(JvmVendorSpec.matching("jetbrains"))
|
||||
}
|
||||
|
||||
ext.java17DependenciesCfg = configurations.create("java17Dependencies") {
|
||||
extendsFrom(configurations.getByName("runtimeClasspath")) // Ensure consistent transitive dependency resolution
|
||||
canBeConsumed = false
|
||||
}
|
||||
ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies") {
|
||||
canBeConsumed = false
|
||||
}
|
||||
|
||||
dependencies {
|
||||
def lwjgl3ifyVersion = '1.1.35'
|
||||
def asmVersion = '9.4'
|
||||
if (modId != 'lwjgl3ify') {
|
||||
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
|
||||
}
|
||||
if (modId != 'hodgepodge') {
|
||||
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.0.40')
|
||||
}
|
||||
|
||||
java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false}
|
||||
java17PatchDependencies("org.ow2.asm:asm:${asmVersion}")
|
||||
java17PatchDependencies("org.ow2.asm:asm-commons:${asmVersion}")
|
||||
java17PatchDependencies("org.ow2.asm:asm-tree:${asmVersion}")
|
||||
java17PatchDependencies("org.ow2.asm:asm-analysis:${asmVersion}")
|
||||
java17PatchDependencies("org.ow2.asm:asm-util:${asmVersion}")
|
||||
java17PatchDependencies('org.ow2.asm:asm-deprecated:7.1')
|
||||
java17PatchDependencies("org.apache.commons:commons-lang3:3.12.0")
|
||||
java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false}
|
||||
}
|
||||
|
||||
ext.java17JvmArgs = [
|
||||
// Java 9+ support
|
||||
"--illegal-access=warn",
|
||||
"-Djava.security.manager=allow",
|
||||
"-Dfile.encoding=UTF-8",
|
||||
"--add-opens", "java.base/jdk.internal.loader=ALL-UNNAMED",
|
||||
"--add-opens", "java.base/java.net=ALL-UNNAMED",
|
||||
"--add-opens", "java.base/java.nio=ALL-UNNAMED",
|
||||
"--add-opens", "java.base/java.io=ALL-UNNAMED",
|
||||
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
|
||||
"--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED",
|
||||
"--add-opens", "java.base/java.text=ALL-UNNAMED",
|
||||
"--add-opens", "java.base/java.util=ALL-UNNAMED",
|
||||
"--add-opens", "java.base/jdk.internal.reflect=ALL-UNNAMED",
|
||||
"--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED",
|
||||
"--add-opens", "jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED,java.naming",
|
||||
"--add-opens", "java.desktop/sun.awt.image=ALL-UNNAMED",
|
||||
"--add-modules", "jdk.dynalink",
|
||||
"--add-opens", "jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED",
|
||||
"--add-modules", "java.sql.rowset",
|
||||
"--add-opens", "java.sql.rowset/javax.sql.rowset.serial=ALL-UNNAMED"
|
||||
]
|
||||
|
||||
ext.hotswapJvmArgs = [
|
||||
// DCEVM advanced hot reload
|
||||
"-XX:+AllowEnhancedClassRedefinition",
|
||||
"-XX:HotswapAgent=fatjar"
|
||||
]
|
||||
|
||||
ext.setupHotswapAgentTask = tasks.register("setupHotswapAgent") {
|
||||
group = "GTNH Buildscript"
|
||||
description = "Installs a recent version of HotSwapAgent into the Java 17 JetBrains runtime directory"
|
||||
def hsaUrl = 'https://github.com/HotswapProjects/HotswapAgent/releases/download/1.4.2-SNAPSHOT/hotswap-agent-1.4.2-SNAPSHOT.jar'
|
||||
def targetFolderProvider = javaToolchains.launcherFor(java17Toolchain).map {it.metadata.installationPath.dir("lib/hotswap")}
|
||||
def targetFilename = "hotswap-agent.jar"
|
||||
onlyIf {
|
||||
!targetFolderProvider.get().file(targetFilename).asFile.exists()
|
||||
}
|
||||
doLast {
|
||||
def targetFolder = targetFolderProvider.get()
|
||||
targetFolder.asFile.mkdirs()
|
||||
download.run {
|
||||
src hsaUrl
|
||||
dest targetFolder.file(targetFilename).asFile
|
||||
overwrite false
|
||||
tempAndMove true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask {
|
||||
// IntelliJ doesn't seem to allow commandline arguments so we also support an env variable
|
||||
private boolean enableHotswap = Boolean.valueOf(System.getenv("HOTSWAP"));
|
||||
|
||||
@Input
|
||||
public boolean getEnableHotswap() { return enableHotswap }
|
||||
@Option(option = "hotswap", description = "Enables HotSwapAgent for enhanced class reloading under a debugger")
|
||||
public boolean setEnableHotswap(boolean enable) { enableHotswap = enable }
|
||||
|
||||
@Inject
|
||||
public RunHotswappableMinecraftTask(Side side, String superTask, org.gradle.api.invocation.Gradle gradle) {
|
||||
super(side, gradle)
|
||||
|
||||
this.lwjglVersion = 3
|
||||
this.javaLauncher = project.javaToolchains.launcherFor(project.java17Toolchain)
|
||||
this.extraJvmArgs.addAll(project.java17JvmArgs)
|
||||
this.extraJvmArgs.addAll(project.provider(() -> enableHotswap ? project.hotswapJvmArgs : []))
|
||||
|
||||
this.classpath(project.java17PatchDependenciesCfg)
|
||||
if (side == Side.CLIENT) {
|
||||
this.classpath(project.minecraftTasks.lwjgl3Configuration)
|
||||
}
|
||||
// Use a raw provider instead of map to not create a dependency on the task
|
||||
this.classpath(project.provider(() -> project.tasks.named(superTask, RunMinecraftTask).get().classpath))
|
||||
this.classpath.filter { file ->
|
||||
!file.path.contains("2.9.4-nightly-20150209") // Remove lwjgl2
|
||||
}
|
||||
this.classpath(project.java17DependenciesCfg)
|
||||
|
||||
if (!(project.usesMixins.toBoolean() || project.forceEnableMixins.toBoolean())) {
|
||||
this.extraArgs.addAll("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Side.CLIENT, "runClient")
|
||||
runClient17Task.configure {
|
||||
setup(project)
|
||||
group = "Modded Minecraft"
|
||||
description = "Runs the modded client using Java 17, lwjgl3ify and Hodgepodge"
|
||||
dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar')
|
||||
mainClass = "GradleStart"
|
||||
username = minecraft.username
|
||||
userUUID = minecraft.userUUID
|
||||
}
|
||||
|
||||
def runServer17Task = tasks.register("runServer17", RunHotswappableMinecraftTask, Side.SERVER, "runServer")
|
||||
runServer17Task.configure {
|
||||
setup(project)
|
||||
group = "Modded Minecraft"
|
||||
description = "Runs the modded server using Java 17, lwjgl3ify and Hodgepodge"
|
||||
dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar')
|
||||
mainClass = "GradleStartServer"
|
||||
extraArgs.add("nogui")
|
||||
}
|
||||
|
||||
def getManifestAttributes() {
|
||||
def manifestAttributes = [:]
|
||||
if (!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) {
|
||||
@@ -670,7 +855,7 @@ if (usesShadowedDependencies.toBoolean()) {
|
||||
tasks.register('relocateShadowJar', ConfigureShadowRelocation) {
|
||||
target = tasks.shadowJar
|
||||
prefix = modGroup + ".shadow"
|
||||
enabled = minimizeShadowedDependencies.toBoolean()
|
||||
enabled = relocateShadowedDependencies.toBoolean()
|
||||
}
|
||||
tasks.named("shadowJar", ShadowJar).configure {
|
||||
manifest {
|
||||
@@ -686,7 +871,7 @@ if (usesShadowedDependencies.toBoolean()) {
|
||||
project.configurations.shadeCompile
|
||||
]
|
||||
archiveClassifier.set('dev')
|
||||
if (minimizeShadowedDependencies.toBoolean()) {
|
||||
if (relocateShadowedDependencies.toBoolean()) {
|
||||
dependsOn(relocateShadowJar)
|
||||
}
|
||||
}
|
||||
@@ -705,7 +890,7 @@ if (usesShadowedDependencies.toBoolean()) {
|
||||
javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) {
|
||||
skip()
|
||||
}
|
||||
for (runTask in ["runClient", "runServer"]) {
|
||||
for (runTask in ["runClient", "runServer", "runClient17", "runServer17"]) {
|
||||
tasks.named(runTask).configure {
|
||||
dependsOn("shadowJar")
|
||||
}
|
||||
@@ -747,6 +932,19 @@ idea {
|
||||
}
|
||||
project {
|
||||
settings {
|
||||
if (ideaOverrideBuildType != "") {
|
||||
delegateActions {
|
||||
if ("gradle".equalsIgnoreCase(ideaOverrideBuildType)) {
|
||||
delegateBuildRunToGradle = true
|
||||
testRunner = org.jetbrains.gradle.ext.ActionDelegationConfig.TestRunner.GRADLE
|
||||
} else if ("idea".equalsIgnoreCase(ideaOverrideBuildType)) {
|
||||
delegateBuildRunToGradle = false
|
||||
testRunner = org.jetbrains.gradle.ext.ActionDelegationConfig.TestRunner.PLATFORM
|
||||
} else {
|
||||
throw GradleScriptException('Accepted value for ideaOverrideBuildType is one of gradle or idea.')
|
||||
}
|
||||
}
|
||||
}
|
||||
runConfigurations {
|
||||
"1. Run Client"(Gradle) {
|
||||
taskNames = ["runClient"]
|
||||
@@ -754,6 +952,20 @@ idea {
|
||||
"2. Run Server"(Gradle) {
|
||||
taskNames = ["runServer"]
|
||||
}
|
||||
"1a. Run Client (Java 17)"(Gradle) {
|
||||
taskNames = ["runClient17"]
|
||||
}
|
||||
"2a. Run Server (Java 17)"(Gradle) {
|
||||
taskNames = ["runServer17"]
|
||||
}
|
||||
"1b. Run Client (Java 17, Hotswap)"(Gradle) {
|
||||
taskNames = ["runClient17"]
|
||||
envs = ["HOTSWAP": "true"]
|
||||
}
|
||||
"2b. Run Server (Java 17, Hotswap)"(Gradle) {
|
||||
taskNames = ["runServer17"]
|
||||
envs = ["HOTSWAP": "true"]
|
||||
}
|
||||
"3. Run Obfuscated Client"(Gradle) {
|
||||
taskNames = ["runObfClient"]
|
||||
}
|
||||
@@ -771,7 +983,7 @@ idea {
|
||||
}
|
||||
"Run Client (IJ Native)"(Application) {
|
||||
mainClass = "GradleStart"
|
||||
moduleName = project.name + ".main"
|
||||
moduleName = project.name + ".ideVirtualMain"
|
||||
afterEvaluate {
|
||||
workingDirectory = tasks.runClient.workingDir.absolutePath
|
||||
programParameters = tasks.runClient.calculateArgs(project).collect { '"' + it + '"' }.join(' ')
|
||||
@@ -782,7 +994,7 @@ idea {
|
||||
}
|
||||
"Run Server (IJ Native)"(Application) {
|
||||
mainClass = "GradleStartServer"
|
||||
moduleName = project.name + ".main"
|
||||
moduleName = project.name + ".ideVirtualMain"
|
||||
afterEvaluate {
|
||||
workingDirectory = tasks.runServer.workingDir.absolutePath
|
||||
programParameters = tasks.runServer.calculateArgs(project).collect { '"' + it + '"' }.join(' ')
|
||||
@@ -799,6 +1011,51 @@ idea {
|
||||
]
|
||||
}
|
||||
}
|
||||
withIDEADir { File ideaDir ->
|
||||
if (!ideaDir.path.contains(".idea")) {
|
||||
// If an .ipr file exists, the project root directory is passed here instead of the .idea subdirectory
|
||||
ideaDir = new File(ideaDir, ".idea")
|
||||
}
|
||||
if (ideaDir.isDirectory()) {
|
||||
def miscFile = new File(ideaDir, "misc.xml")
|
||||
if (miscFile.isFile()) {
|
||||
boolean dirty = false
|
||||
def miscTransformer = new XmlTransformer()
|
||||
miscTransformer.addAction { root ->
|
||||
Node rootNode = root.asNode()
|
||||
def rootManager = rootNode
|
||||
.component.find { it.@name == 'ProjectRootManager' }
|
||||
if (!rootManager) {
|
||||
rootManager = rootNode.appendNode('component', ['name': 'ProjectRootManager', 'version': '2'])
|
||||
dirty = true
|
||||
}
|
||||
def output = rootManager.output
|
||||
if (!output) {
|
||||
output = rootManager.appendNode('output')
|
||||
dirty = true
|
||||
}
|
||||
if (!output.@url) {
|
||||
// Only modify the output url if it doesn't yet have one, or if the existing one is blank somehow.
|
||||
// This is a sensible default for most setups
|
||||
output.@url = 'file://$PROJECT_DIR$/build/ideaBuild'
|
||||
dirty = true
|
||||
}
|
||||
}
|
||||
def result = miscTransformer.transform(miscFile.text)
|
||||
if (dirty) {
|
||||
miscFile.write(result)
|
||||
}
|
||||
} else {
|
||||
miscFile.text = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2">
|
||||
<output url="file://\$PROJECT_DIR\$/out" />
|
||||
</component>
|
||||
</project>
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -946,10 +1203,21 @@ def addCurseForgeRelation(String type, String name) {
|
||||
}
|
||||
|
||||
// Updating
|
||||
|
||||
def buildscriptGradleVersion = "8.0.1"
|
||||
|
||||
tasks.named('wrapper', Wrapper).configure {
|
||||
gradleVersion = buildscriptGradleVersion
|
||||
}
|
||||
|
||||
tasks.register('updateBuildScript') {
|
||||
group = 'GTNH Buildscript'
|
||||
description = 'Updates the build script to the latest version'
|
||||
|
||||
if (gradle.gradleVersion != buildscriptGradleVersion && !Boolean.getBoolean('DISABLE_BUILDSCRIPT_GRADLE_UPDATE')) {
|
||||
dependsOn('wrapper')
|
||||
}
|
||||
|
||||
doLast {
|
||||
if (performBuildScriptUpdate()) return
|
||||
|
||||
@@ -962,6 +1230,9 @@ if (!project.getGradle().startParameter.isOffline() && !Boolean.getBoolean('DISA
|
||||
performBuildScriptUpdate()
|
||||
} else {
|
||||
out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'")
|
||||
if (gradle.gradleVersion != buildscriptGradleVersion) {
|
||||
out.style(Style.SuccessHeader).println("updateBuildScript can update gradle from ${gradle.gradleVersion} to ${buildscriptGradleVersion}\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+16
-16
@@ -1,27 +1,27 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
compile('com.github.GTNewHorizons:NotEnoughItems:2.3.21-GTNH:dev')
|
||||
compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-156-GTNH:dev')
|
||||
compile('com.github.GTNewHorizons:NotEnoughItems:2.3.32-GTNH:dev')
|
||||
compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-176-GTNH-pre:dev')
|
||||
compile('curse.maven:cofh-core-69162:2388751')
|
||||
compile('com.github.GTNewHorizons:waila:1.5.22:dev')
|
||||
compile('com.github.GTNewHorizons:waila:1.5.24:dev')
|
||||
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.32:dev') { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:WirelessCraftingTerminal:1.8.9.2:dev")
|
||||
compileOnly("com.github.GTNewHorizons:WirelessCraftingTerminal:1.8.9.3:dev")
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.5.6:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.3.1.49:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderCore:0.2.11:dev')
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.41.216:dev')
|
||||
compileOnly('com.github.GTNewHorizons:StructureLib:1.2.0-beta.2:dev')
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.5.8:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.4.0:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderCore:0.2.13:dev')
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.42.00:dev')
|
||||
compileOnly('com.github.GTNewHorizons:StructureLib:1.2.6:dev')
|
||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
||||
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
compileOnly('com.github.GTNewHorizons:AppleCore:3.2.5:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.28:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:AppleCore:3.2.10:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.31:dev') { transitive = false }
|
||||
compileOnly('com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.8.0.5-GTNH:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.3.27-GTNH:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:GTplusplus:1.7.191:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.8.0.13-GTNH:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.3.30-GTNH:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:GTplusplus:1.8.0:dev') { transitive = false }
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:KekzTech:0.6.25:dev')
|
||||
runtimeOnly('com.github.GTNewHorizons:Baubles:1.0.1.14:dev')
|
||||
compileOnly('com.github.GTNewHorizons:KekzTech:0.6.32:dev')
|
||||
compile('com.github.GTNewHorizons:Baubles:1.0.1.16:dev')
|
||||
}
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -13,6 +13,7 @@ import com.glodblock.github.loader.CalculatorV2PluginLoader;
|
||||
import com.glodblock.github.loader.ChannelLoader;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.loader.RecipeLoader;
|
||||
import com.glodblock.github.loader.filter.FluidFilter;
|
||||
import com.glodblock.github.proxy.CommonProxy;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
@@ -28,7 +29,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
modid = FluidCraft.MODID,
|
||||
version = FluidCraft.VERSION,
|
||||
name = FluidCraft.MODNAME,
|
||||
dependencies = "required-after:appliedenergistics2;required-after:CoFHCore;after:waila;after:thaumicenergistics;after:ae2wct")
|
||||
dependencies = "required-after:appliedenergistics2;required-after:CoFHCore;required-after:Baubles;after:waila;after:thaumicenergistics;after:ae2wct")
|
||||
public class FluidCraft {
|
||||
|
||||
public static final String MODID = "GRADLETOKEN_MODID";
|
||||
@@ -77,6 +78,9 @@ public class FluidCraft {
|
||||
if (ModAndClassUtil.isV2) {
|
||||
CalculatorV2PluginLoader.installCalculatorV2Plugins();
|
||||
}
|
||||
if (ModAndClassUtil.isTypeFilter) {
|
||||
FluidFilter.installFilter();
|
||||
}
|
||||
|
||||
proxy.postInit(event);
|
||||
}
|
||||
|
||||
@@ -57,6 +57,8 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
this.registerApp(13, "ESSENTIA_TEM", "YES", "essentia_terminal_w");
|
||||
this.registerApp(14, "INTERFACE_TEM", "YES", "interface_terminal_w");
|
||||
this.registerApp(15, "PATTERN_EX_TEM", "YES", "pattern_terminal_ex_w");
|
||||
this.registerApp(16, "FILL_PATTERN", "DO_FILL", "fill_pattern");
|
||||
this.registerApp(17, "NOT_FILL_PATTERN", "DONT_FILL", "not_fill_pattern");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,13 @@ package com.glodblock.github.client.gui;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.client.gui.implementations.GuiUpgradeable;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidIO;
|
||||
import com.glodblock.github.common.parts.PartFluidExportBus;
|
||||
import com.glodblock.github.common.parts.PartFluidImportBus;
|
||||
import com.glodblock.github.common.parts.base.FCSharedFluidBus;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
@@ -58,4 +60,13 @@ public class GuiFluidIO extends GuiUpgradeable {
|
||||
this.schedulingMode.set(this.cvb.getSchedulingMode());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleButtonVisibility() {
|
||||
super.handleButtonVisibility();
|
||||
if (this.schedulingMode != null) {
|
||||
this.schedulingMode.setVisibility(
|
||||
this.bc.getInstalledUpgrades(Upgrades.CAPACITY) > 0 && this.bc instanceof PartFluidExportBus);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,9 @@ package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.container.slot.SlotDisabled;
|
||||
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
|
||||
public class GuiFluidPatternExWireless extends GuiFluidPatternTerminalEx {
|
||||
@@ -9,4 +12,13 @@ public class GuiFluidPatternExWireless extends GuiFluidPatternTerminalEx {
|
||||
public GuiFluidPatternExWireless(InventoryPlayer inventoryPlayer, IWirelessTerminal te) {
|
||||
super(inventoryPlayer, te);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void repositionSlot(final AppEngSlot s) {
|
||||
if (s instanceof SlotDisabled || s.isPlayerSide()) {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 5;
|
||||
} else {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,8 @@ import appeng.core.localization.GuiText;
|
||||
|
||||
import com.glodblock.github.client.gui.base.FCGuiEncodeTerminal;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminal;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidPatternWireless;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
@@ -29,6 +31,10 @@ public class GuiFluidPatternTerminal extends FCGuiEncodeTerminal {
|
||||
super(inventoryPlayer, te, new ContainerFluidPatternTerminal(inventoryPlayer, te));
|
||||
}
|
||||
|
||||
public GuiFluidPatternTerminal(final InventoryPlayer inventoryPlayer, final IWirelessTerminal te) {
|
||||
super(inventoryPlayer, te, new ContainerFluidPatternWireless(inventoryPlayer, te));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initGui() {
|
||||
|
||||
@@ -11,7 +11,9 @@ import appeng.client.gui.widgets.GuiImgButton;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.base.FCGuiEncodeTerminal;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidPatternExWireless;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminalEx;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
@@ -24,6 +26,12 @@ public class GuiFluidPatternTerminalEx extends FCGuiEncodeTerminal {
|
||||
processingScrollBar.setTexture(FluidCraft.MODID, "gui/pattern3.png", 242, 0);
|
||||
}
|
||||
|
||||
public GuiFluidPatternTerminalEx(final InventoryPlayer inventoryPlayer, final IWirelessTerminal te) {
|
||||
super(inventoryPlayer, te, new ContainerFluidPatternExWireless(inventoryPlayer, te));
|
||||
processingScrollBar.setHeight(70).setWidth(7).setLeft(6).setRange(0, 1, 1);
|
||||
processingScrollBar.setTexture(FluidCraft.MODID, "gui/pattern3.png", 242, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initGui() {
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.container.slot.SlotDisabled;
|
||||
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
|
||||
public class GuiFluidPatternWireless extends GuiFluidPatternTerminal {
|
||||
@@ -9,4 +12,13 @@ public class GuiFluidPatternWireless extends GuiFluidPatternTerminal {
|
||||
public GuiFluidPatternWireless(InventoryPlayer inventoryPlayer, IWirelessTerminal te) {
|
||||
super(inventoryPlayer, te);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void repositionSlot(final AppEngSlot s) {
|
||||
if (s instanceof SlotDisabled || s.isPlayerSide()) {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 5;
|
||||
} else {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,6 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.*;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.client.gui.widgets.*;
|
||||
import appeng.client.me.ClientDCInternalInv;
|
||||
@@ -42,6 +41,7 @@ import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.network.CPacketRenamer;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.Util;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
|
||||
public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropToFillTextField {
|
||||
@@ -52,7 +52,7 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
|
||||
|
||||
private final HashMap<Long, ClientDCInternalInv> byId = new HashMap<>();
|
||||
private final HashMultimap<String, ClientDCInternalInv> byName = HashMultimap.create();
|
||||
private final HashMap<ClientDCInternalInv, DimensionalCoordSide> blockPosHashMap = new HashMap<>();
|
||||
private final HashMap<ClientDCInternalInv, Util.DimensionalCoordSide> blockPosHashMap = new HashMap<>();
|
||||
private final HashMap<GuiButton, ClientDCInternalInv> guiButtonHashMap = new HashMap<>();
|
||||
private final ArrayList<String> names = new ArrayList<>();
|
||||
private final ArrayList<Object> lines = new ArrayList<>();
|
||||
@@ -302,6 +302,7 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
|
||||
buttonList.add(terminalStyleBox);
|
||||
buttonList.add(searchStringSave);
|
||||
buttonList.add(craftingStatusBtn);
|
||||
this.guiButtonHashMap.clear();
|
||||
addSwitchGuiBtns();
|
||||
|
||||
int offset = 51;
|
||||
@@ -351,10 +352,15 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (guiButtonHashMap.containsKey(btn)) {
|
||||
DimensionalCoordSide blockPos = blockPosHashMap.get(guiButtonHashMap.get(btn));
|
||||
Util.DimensionalCoordSide blockPos = blockPosHashMap.get(guiButtonHashMap.get(btn));
|
||||
if (btn instanceof GuiFCImgButton) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketRenamer(blockPos.x, blockPos.y, blockPos.z, blockPos.getDimension(), blockPos.side));
|
||||
new CPacketRenamer(
|
||||
blockPos.x,
|
||||
blockPos.y,
|
||||
blockPos.z,
|
||||
blockPos.getDimension(),
|
||||
blockPos.getSide()));
|
||||
} else {
|
||||
|
||||
WorldCoord blockPos2 = new WorldCoord(
|
||||
@@ -496,17 +502,6 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
|
||||
return false;
|
||||
}
|
||||
|
||||
private static class DimensionalCoordSide extends DimensionalCoord {
|
||||
|
||||
private ForgeDirection side = ForgeDirection.UNKNOWN;
|
||||
|
||||
public DimensionalCoordSide(final int _x, final int _y, final int _z, final int _dim, ForgeDirection side) {
|
||||
super(_x, _y, _z, _dim);
|
||||
this.side = side;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void postUpdate(final NBTTagCompound in) {
|
||||
if (in.getBoolean("clear")) {
|
||||
this.byId.clear();
|
||||
@@ -526,7 +521,9 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
|
||||
int Z = invData.getInteger("z");
|
||||
int dim = invData.getInteger("dim");
|
||||
ForgeDirection side = ForgeDirection.getOrientation(invData.getInteger("side"));
|
||||
blockPosHashMap.put(current, new DimensionalCoordSide(X, Y, Z, dim, side));
|
||||
blockPosHashMap.put(
|
||||
current,
|
||||
new Util.DimensionalCoordSide(X, Y, Z, dim, side, current.getUnlocalizedName()));
|
||||
|
||||
for (int x = 0; x < current.getInventory().getSizeInventory(); x++) {
|
||||
final String which = Integer.toString(x);
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.IDropToFillTextField;
|
||||
import appeng.client.gui.widgets.MEGuiTextField;
|
||||
import appeng.core.localization.GuiColors;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerRenamer;
|
||||
import com.glodblock.github.network.CPacketRenamer;
|
||||
|
||||
public class GuiRenamer extends AEBaseGui implements IDropToFillTextField {
|
||||
|
||||
private MEGuiTextField textField;
|
||||
|
||||
public GuiRenamer(InventoryPlayer ip, ITerminalHost monitorable) {
|
||||
super(new ContainerRenamer(ip, monitorable));
|
||||
this.xSize = 256;
|
||||
|
||||
this.textField = new MEGuiTextField(230, 12);
|
||||
this.textField.setMaxStringLength(32);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketRenamer(CPacketRenamer.Action.GET_TEXT));
|
||||
this.textField.x = this.guiLeft + 12;
|
||||
this.textField.y = this.guiTop + 35;
|
||||
this.textField.setFocused(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
this.fontRendererObj.drawString(GuiText.Renamer.getLocal(), 12, 8, GuiColors.RenamerTitle.getColor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
this.bindTexture("guis/renamer.png");
|
||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
|
||||
this.textField.drawTextBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
|
||||
this.textField.mouseClicked(xCoord, yCoord, btn);
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(final char character, final int key) {
|
||||
if (key == 28) { // Enter
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketRenamer(this.textField.getText()));
|
||||
} else if (!this.textField.textboxKeyTyped(character, key)) {
|
||||
super.keyTyped(character, key);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isOverTextField(final int mousex, final int mousey) {
|
||||
return textField.isMouseIn(mousex, mousey);
|
||||
}
|
||||
|
||||
public void setTextFieldValue(final String displayName, final int mousex, final int mousey, final ItemStack stack) {
|
||||
textField.setText(displayName);
|
||||
}
|
||||
|
||||
public void postUpdate(String text) {
|
||||
this.textField.setText(text);
|
||||
}
|
||||
}
|
||||
@@ -10,10 +10,11 @@ import net.minecraft.inventory.Container;
|
||||
import appeng.client.gui.AEBaseMEGui;
|
||||
|
||||
import com.glodblock.github.client.gui.*;
|
||||
import com.glodblock.github.client.gui.container.base.FCBaseContainer;
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
public abstract class FCBaseMEGui extends AEBaseMEGui {
|
||||
|
||||
@@ -28,21 +29,23 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
|
||||
|
||||
public FCBaseMEGui(final InventoryPlayer inventoryPlayer, Container container) {
|
||||
super(container);
|
||||
if (inventoryPlayer.getCurrentItem() != null
|
||||
&& inventoryPlayer.getCurrentItem().getItem() instanceof ItemWirelessUltraTerminal)
|
||||
this.drawSwitchGuiBtn = true;
|
||||
if (container instanceof FCBaseContainer) {
|
||||
Object target = ((FCBaseContainer) container).getTarget();
|
||||
if (target instanceof IWirelessTerminal
|
||||
&& ((IWirelessTerminal) target).getItemStack().getItem() instanceof ItemWirelessUltraTerminal) {
|
||||
this.drawSwitchGuiBtn = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
super.onGuiClosed();
|
||||
Util.MouseHandler.saveMousePos();
|
||||
}
|
||||
|
||||
protected void initGuiDone() {
|
||||
if (drawSwitchGuiBtn) {
|
||||
drawSwitchGuiBtns();
|
||||
Util.MouseHandler.loadMousePos();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,14 +141,4 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
|
||||
}
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,8 @@ public abstract class FCGuiEncodeTerminal extends GuiItemMonitor {
|
||||
protected GuiImgButton beSubstitutionsDisabledBtn;
|
||||
protected GuiFCImgButton combineEnableBtn;
|
||||
protected GuiFCImgButton combineDisableBtn;
|
||||
protected GuiFCImgButton autoFillPatternEnableBtn;
|
||||
protected GuiFCImgButton autoFillPatternDisableBtn;
|
||||
protected final GuiScrollbar processingScrollBar = new GuiScrollbar();
|
||||
protected final AppEngRenderItem stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
|
||||
|
||||
@@ -62,6 +64,24 @@ public abstract class FCGuiEncodeTerminal extends GuiItemMonitor {
|
||||
setReservedSpace(81);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.buttonList.add(
|
||||
this.autoFillPatternEnableBtn = new GuiFCImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.offsetY,
|
||||
"FILL_PATTERN",
|
||||
"DO_FILL"));
|
||||
this.buttonList.add(
|
||||
this.autoFillPatternDisableBtn = new GuiFCImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.offsetY,
|
||||
"NOT_FILL_PATTERN",
|
||||
"DONT_FILL"));
|
||||
this.offsetY += 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
@@ -108,6 +128,11 @@ public abstract class FCGuiEncodeTerminal extends GuiItemMonitor {
|
||||
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsEnabledBtn == btn) {
|
||||
FluidCraft.proxy.netHandler
|
||||
.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "0"));
|
||||
} else if (this.autoFillPatternDisableBtn == btn || this.autoFillPatternEnableBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminal.AutoFillerPattern",
|
||||
this.autoFillPatternDisableBtn == btn ? "1" : "0"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,6 +149,8 @@ public abstract class FCGuiEncodeTerminal extends GuiItemMonitor {
|
||||
updateButton(this.beSubstitutionsDisabledBtn, !this.container.beSubstitute);
|
||||
updateButton(this.fluidPrioritizedEnabledBtn, this.container.prioritize);
|
||||
updateButton(this.fluidPrioritizedDisabledBtn, !this.container.prioritize);
|
||||
updateButton(this.autoFillPatternEnableBtn, this.container.autoFillPattern);
|
||||
updateButton(this.autoFillPatternDisableBtn, !this.container.autoFillPattern);
|
||||
super.drawFG(offsetX, offsetY, mouseX, mouseY);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,10 +33,8 @@ import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketInventoryAction;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
@@ -50,6 +48,8 @@ import codechicken.nei.util.TextHistory;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.*;
|
||||
import com.glodblock.github.client.gui.container.base.FCContainerMonitor;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.network.CPacketInventoryAction;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
@@ -84,6 +84,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
||||
protected GuiImgButton searchBoxSettings;
|
||||
protected GuiImgButton terminalStyleBox;
|
||||
protected GuiImgButton searchStringSave;
|
||||
protected GuiImgButton typeFilter;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public FCGuiMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te, final FCContainerMonitor<T> c) {
|
||||
@@ -119,7 +120,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (btn == this.craftingStatusBtn || btn == this.craftingStatusImgBtn) {
|
||||
NetworkHandler.instance.sendToServer(new PacketSwitchGuis(GuiBridge.GUI_CRAFTING_STATUS));
|
||||
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
|
||||
}
|
||||
if (btn instanceof GuiImgButton) {
|
||||
final boolean backwards = Mouse.isButtonDown(1);
|
||||
@@ -228,6 +229,15 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
||||
this.configSrc.getSetting(Settings.VIEW_MODE)));
|
||||
this.offsetY += 20;
|
||||
}
|
||||
if (ModAndClassUtil.isTypeFilter && this instanceof GuiItemMonitor) {
|
||||
this.buttonList.add(
|
||||
this.typeFilter = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.offsetY,
|
||||
Settings.TYPE_FILTER,
|
||||
this.configSrc.getSetting(Settings.TYPE_FILTER)));
|
||||
this.offsetY += 20;
|
||||
}
|
||||
|
||||
this.buttonList.add(
|
||||
this.SortDirBox = new GuiImgButton(
|
||||
@@ -314,7 +324,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
||||
|
||||
for (final Object s : this.inventorySlots.inventorySlots) {
|
||||
if (s instanceof AppEngSlot) {
|
||||
if (((Slot) s).xDisplayPosition < 195) {
|
||||
if (((Slot) s).xDisplayPosition < 195 || s instanceof SlotDisabled) {
|
||||
this.repositionSlot((AppEngSlot) s);
|
||||
}
|
||||
}
|
||||
@@ -658,6 +668,11 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
||||
return this.configSrc.getSetting(Settings.VIEW_MODE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getTypeFilter() {
|
||||
return this.configSrc.getSetting(Settings.TYPE_FILTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSetting(final IConfigManager manager, final Enum settingName, final Enum newValue) {
|
||||
if (this.SortByBox != null) {
|
||||
@@ -671,6 +686,9 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
||||
if (this.ViewBox != null) {
|
||||
this.ViewBox.set(this.configSrc.getSetting(Settings.VIEW_MODE));
|
||||
}
|
||||
if (this.typeFilter != null) {
|
||||
this.typeFilter.set(this.configSrc.getSetting(Settings.TYPE_FILTER));
|
||||
}
|
||||
|
||||
this.repo.updateView();
|
||||
}
|
||||
|
||||
+1
-1
@@ -294,7 +294,7 @@ public class ContainerFluidCraftConfirm extends AEBaseContainer {
|
||||
InventoryHandler.openGui(
|
||||
this.getInventoryPlayer().player,
|
||||
getWorld(),
|
||||
new BlockPos(this.getPlayerInv().currentItem, 0, 0),
|
||||
new BlockPos(((IWirelessTerminal) ah).getInventorySlot(), 0, 0),
|
||||
ForgeDirection.UNKNOWN,
|
||||
originalGui);
|
||||
} else if (this.getOpenContext() != null) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.glodblock.github.client.gui.container;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import appeng.api.config.SchedulingMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.util.IConfigManager;
|
||||
@@ -35,6 +36,11 @@ public class ContainerFluidIO extends FCContainerFluidConfigurable {
|
||||
super.loadSettingsFromHost(cm);
|
||||
if (Ae2Reflect.getUpgradeableHost(this) instanceof PartFluidExportBus) {
|
||||
this.setCraftingMode((YesNo) cm.getSetting(Settings.CRAFT_ONLY));
|
||||
this.setSchedulingMode((SchedulingMode) cm.getSetting(Settings.SCHEDULING_MODE));
|
||||
}
|
||||
}
|
||||
|
||||
public void setSchedulingMode(final SchedulingMode schedulingMode) {
|
||||
this.schedulingMode = schedulingMode;
|
||||
}
|
||||
}
|
||||
+41
-35
@@ -18,8 +18,6 @@ import org.apache.commons.lang3.tuple.MutablePair;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.api.implementations.tiles.IMEChest;
|
||||
import appeng.api.implementations.tiles.IViewCellStorage;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
@@ -28,6 +26,7 @@ import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.storage.IBaseMonitor;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
@@ -42,7 +41,6 @@ import appeng.util.item.AEItemStack;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.base.FCContainerMonitor;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.inventory.item.IFluidPortableCell;
|
||||
import com.glodblock.github.network.CPacketFluidUpdate;
|
||||
import com.glodblock.github.network.SPacketFluidUpdate;
|
||||
import com.glodblock.github.network.SPacketMEInventoryUpdate;
|
||||
@@ -61,27 +59,28 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
|
||||
super(ip, monitorable, bindInventory);
|
||||
if (Platform.isServer()) {
|
||||
this.serverCM = monitorable.getConfigManager();
|
||||
this.monitor = monitorable.getFluidInventory();
|
||||
if (this.monitor != null) {
|
||||
this.monitor.addListener(this, null);
|
||||
if (monitorable instanceof IFluidPortableCell) {
|
||||
this.setPowerSource((IEnergySource) monitorable);
|
||||
} else if (monitorable instanceof IPortableCell) {
|
||||
this.setPowerSource((IEnergySource) monitorable);
|
||||
} else if (monitorable instanceof IMEChest) {
|
||||
this.setPowerSource((IEnergySource) monitorable);
|
||||
} else if (monitorable instanceof IGridHost) {
|
||||
final IGridNode node = ((IGridHost) monitorable).getGridNode(ForgeDirection.UNKNOWN);
|
||||
if (node != null) {
|
||||
this.networkNode = node;
|
||||
final IGrid g = node.getGrid();
|
||||
if (g != null) {
|
||||
this.setPowerSource(new ChannelPowerSrc(this.networkNode, g.getCache(IEnergyGrid.class)));
|
||||
if (monitorable instanceof IGridHost) {
|
||||
final IGridNode node = ((IGridHost) monitorable).getGridNode(ForgeDirection.UNKNOWN);
|
||||
if (node != null) {
|
||||
this.networkNode = node;
|
||||
final IGrid g = node.getGrid();
|
||||
if (g != null) {
|
||||
this.setPowerSource(new ChannelPowerSrc(this.networkNode, g.getCache(IEnergyGrid.class)));
|
||||
IStorageGrid storageGrid = g.getCache(IStorageGrid.class);
|
||||
this.monitor = storageGrid.getFluidInventory();
|
||||
if (this.monitor == null) {
|
||||
this.setValidContainer(false);
|
||||
} else {
|
||||
this.monitor.addListener(this, null);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.setValidContainer(false);
|
||||
}
|
||||
} else {
|
||||
this.setValidContainer(false);
|
||||
this.monitor = monitorable.getFluidInventory();
|
||||
this.monitor.addListener(this, null);
|
||||
this.setPowerSource((IEnergySource) monitorable);
|
||||
}
|
||||
} else {
|
||||
this.monitor = null;
|
||||
@@ -151,11 +150,6 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isInvalid() {
|
||||
return this.monitor != this.host.getFluidInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void queueInventory(final ICrafting c) {
|
||||
if (Platform.isServer() && c instanceof EntityPlayer && this.monitor != null) {
|
||||
@@ -224,26 +218,38 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
|
||||
MutablePair<Integer, ItemStack> fillStack = Util.FluidUtil.fillStack(out, toExtract.getFluidStack());
|
||||
if (fillStack.right == null || fillStack.left <= 0) continue;
|
||||
toExtract.setStackSize((long) fillStack.left * fluidContainer.stackSize);
|
||||
IAEFluidStack tmp = this.host.getFluidInventory()
|
||||
.extractItems(toExtract, Actionable.SIMULATE, this.getActionSource());
|
||||
if (tmp == null) continue;
|
||||
fillStack.right.stackSize = (int) (tmp.getStackSize() / fillStack.left);
|
||||
this.dropItem(fillStack.right);
|
||||
out.stackSize = fillStack.right.stackSize;
|
||||
// The real result may don't match simulation result.
|
||||
if (fillStack.right.getItem() instanceof IFluidContainerItem) {
|
||||
this.host.getFluidInventory().extractItems(toExtract, Actionable.MODULATE, this.getActionSource());
|
||||
if ((int) (tmp.getStackSize() % fillStack.left) > 0) {
|
||||
IAEFluidStack real = this.host.getFluidInventory()
|
||||
.extractItems(toExtract, Actionable.MODULATE, this.getActionSource());
|
||||
if (real == null) continue;
|
||||
// Refill the container
|
||||
out = fluidContainer.copy();
|
||||
out.stackSize = 1;
|
||||
fillStack = Util.FluidUtil.fillStack(out, real.getFluidStack());
|
||||
fillStack.right.stackSize = (int) (real.getStackSize() / fillStack.left);
|
||||
out.stackSize = fillStack.right.stackSize;
|
||||
if ((int) (real.getStackSize() % fillStack.left) > 0) {
|
||||
this.dropItem(
|
||||
Util.FluidUtil.setFluidContainerAmount(
|
||||
fillStack.right,
|
||||
(int) (tmp.getStackSize() % fillStack.left)),
|
||||
(int) (real.getStackSize() % fillStack.left)),
|
||||
1);
|
||||
out.stackSize++;
|
||||
}
|
||||
} else if (FluidContainerRegistry.isContainer(fillStack.right)) {
|
||||
IAEFluidStack real = this.host.getFluidInventory()
|
||||
.extractItems(toExtract, Actionable.MODULATE, this.getActionSource());
|
||||
if (real == null) continue;
|
||||
// Refill the container
|
||||
out = fluidContainer.copy();
|
||||
out.stackSize = 1;
|
||||
fillStack = Util.FluidUtil.fillStack(out, real.getFluidStack());
|
||||
fillStack.right.stackSize = (int) (real.getStackSize() / fillStack.left);
|
||||
out.stackSize = fillStack.right.stackSize;
|
||||
toExtract.setStackSize((long) fillStack.right.stackSize * fillStack.left);
|
||||
this.host.getFluidInventory().extractItems(toExtract, Actionable.MODULATE, this.getActionSource());
|
||||
}
|
||||
this.dropItem(fillStack.right);
|
||||
} else if (!Util.FluidUtil.isEmpty(fluidContainer)) {
|
||||
// add fluid to ae network
|
||||
AEFluidStack fluidStack = Util.getAEFluidFromItem(fluidContainer);
|
||||
|
||||
@@ -9,8 +9,6 @@ import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.api.implementations.tiles.IMEChest;
|
||||
import appeng.api.implementations.tiles.IViewCellStorage;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
@@ -19,6 +17,7 @@ import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.storage.IBaseMonitor;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
@@ -43,26 +42,30 @@ public class ContainerItemMonitor extends FCContainerMonitor<IAEItemStack> {
|
||||
super(ip, monitorable, bindInventory);
|
||||
if (Platform.isServer()) {
|
||||
this.serverCM = monitorable.getConfigManager();
|
||||
this.monitor = monitorable.getItemInventory();
|
||||
if (this.monitor != null) {
|
||||
this.monitor.addListener(this, null);
|
||||
this.setCellInventory(this.monitor);
|
||||
if (monitorable instanceof IPortableCell) {
|
||||
this.setPowerSource((IEnergySource) monitorable);
|
||||
} else if (monitorable instanceof IMEChest) {
|
||||
this.setPowerSource((IEnergySource) monitorable);
|
||||
} else if (monitorable instanceof IGridHost) {
|
||||
final IGridNode node = ((IGridHost) monitorable).getGridNode(ForgeDirection.UNKNOWN);
|
||||
if (node != null) {
|
||||
this.networkNode = node;
|
||||
final IGrid g = node.getGrid();
|
||||
if (g != null) {
|
||||
this.setPowerSource(new ChannelPowerSrc(this.networkNode, g.getCache(IEnergyGrid.class)));
|
||||
if (monitorable instanceof IGridHost) {
|
||||
final IGridNode node = ((IGridHost) monitorable).getGridNode(ForgeDirection.UNKNOWN);
|
||||
if (node != null) {
|
||||
this.networkNode = node;
|
||||
final IGrid g = node.getGrid();
|
||||
if (g != null) {
|
||||
this.setPowerSource(new ChannelPowerSrc(this.networkNode, g.getCache(IEnergyGrid.class)));
|
||||
IStorageGrid storageGrid = g.getCache(IStorageGrid.class);
|
||||
this.monitor = storageGrid.getItemInventory();
|
||||
if (this.monitor == null) {
|
||||
this.setValidContainer(false);
|
||||
} else {
|
||||
this.monitor.addListener(this, null);
|
||||
this.setCellInventory(this.monitor);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.setValidContainer(false);
|
||||
}
|
||||
} else {
|
||||
this.setValidContainer(false);
|
||||
this.monitor = monitorable.getItemInventory();
|
||||
this.monitor.addListener(this, null);
|
||||
this.setCellInventory(this.monitor);
|
||||
this.setPowerSource((IEnergySource) monitorable);
|
||||
}
|
||||
} else {
|
||||
this.monitor = null;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.container.AEBaseContainer;
|
||||
|
||||
public class ContainerRenamer extends AEBaseContainer {
|
||||
|
||||
public ContainerRenamer(InventoryPlayer ip, ITerminalHost monitorable) {
|
||||
super(ip, monitorable);
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,9 @@ public abstract class FCBaseContainer extends AEBaseContainer {
|
||||
if (isWirelessTerminal()) {
|
||||
if (this.host != null) {
|
||||
final int slotIndex = this.host.getInventorySlot();
|
||||
this.lockPlayerInventorySlot(slotIndex);
|
||||
if (Util.GuiHelper.decodeInvType(slotIndex).getLeft() == Util.GuiHelper.InvType.PLAYER_INV) {
|
||||
this.lockPlayerInventorySlot(slotIndex);
|
||||
}
|
||||
return slotIndex;
|
||||
} else {
|
||||
this.lockPlayerInventorySlot(ip.currentItem);
|
||||
|
||||
+35
@@ -18,6 +18,7 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
@@ -75,6 +76,9 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
|
||||
@GuiSync(91)
|
||||
public boolean prioritize = false;
|
||||
|
||||
@GuiSync(90)
|
||||
public boolean autoFillPattern = false;
|
||||
|
||||
public FCContainerEncodeTerminal(final InventoryPlayer ip, final ITerminalHost monitorable) {
|
||||
super(ip, monitorable);
|
||||
this.patternTerminal = (IItemPatternTerminal) monitorable;
|
||||
@@ -302,6 +306,7 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
|
||||
}
|
||||
this.patternSlotOUT.putStack(null);
|
||||
}
|
||||
fillPattern();
|
||||
}
|
||||
|
||||
public void encodeAllItemAndMoveToInventory() {
|
||||
@@ -315,9 +320,38 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
|
||||
this.patternSlotOUT.putStack(null);
|
||||
this.patternSlotIN.putStack(null);
|
||||
}
|
||||
fillPattern();
|
||||
}
|
||||
|
||||
private void fillPattern() {
|
||||
if (this.autoFillPattern && this.getHost().getItemInventory() != null) {
|
||||
// try to use me network item to fill pattern input slot
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
int fillStackSize = this.patternSlotIN.getHasStack() ? 64 - this.patternSlotIN.getStack().stackSize : 64;
|
||||
if (fillStackSize == 0) return;
|
||||
for (ItemStack blankPattern : definitions.materials().blankPattern().maybeStack(fillStackSize).asSet()) {
|
||||
IAEItemStack iBlankPattern = AEApi.instance().storage().createItemStack(blankPattern);
|
||||
if (this.patternSlotIN.getHasStack() && !iBlankPattern.isSameType(this.patternSlotIN.getStack()))
|
||||
continue;
|
||||
IAEItemStack out = this.getHost().getItemInventory()
|
||||
.extractItems(iBlankPattern, Actionable.MODULATE, this.getActionSource());
|
||||
if (out != null) {
|
||||
ItemStack outPattern;
|
||||
if (this.patternSlotIN.getHasStack()) {
|
||||
outPattern = this.patternSlotIN.getStack().copy();
|
||||
outPattern.stackSize += out.getItemStack().stackSize;
|
||||
} else {
|
||||
outPattern = out.getItemStack();
|
||||
}
|
||||
this.patternSlotIN.putStack(outPattern);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void encode() {
|
||||
fillPattern();
|
||||
if (!checkHasFluidPattern()) {
|
||||
encodeItemPattern();
|
||||
return;
|
||||
@@ -454,6 +488,7 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
|
||||
this.combine = this.patternTerminal.shouldCombine();
|
||||
this.beSubstitute = this.patternTerminal.canBeSubstitute();
|
||||
this.prioritize = this.patternTerminal.isPrioritize();
|
||||
this.autoFillPattern = this.patternTerminal.isAutoFillPattern();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-1
@@ -61,6 +61,11 @@ public abstract class FCContainerMonitor<T extends IAEStack<T>> extends FCBaseCo
|
||||
this.clientCM.registerSetting(Settings.SORT_BY, SortOrder.NAME);
|
||||
this.clientCM.registerSetting(Settings.VIEW_MODE, ViewItems.ALL);
|
||||
this.clientCM.registerSetting(Settings.SORT_DIRECTION, SortDir.ASCENDING);
|
||||
this.clientCM.registerSetting(Settings.TYPE_FILTER, TypeFilter.ALL);
|
||||
}
|
||||
|
||||
public IMEMonitor<T> getMonitor() {
|
||||
return this.monitor;
|
||||
}
|
||||
|
||||
public IGridNode getNetworkNode() {
|
||||
@@ -112,7 +117,7 @@ public abstract class FCContainerMonitor<T extends IAEStack<T>> extends FCBaseCo
|
||||
protected abstract void processItemList();
|
||||
|
||||
protected boolean isInvalid() {
|
||||
return this.monitor != this.host.getItemInventory();
|
||||
return this.monitor == null;
|
||||
}
|
||||
|
||||
protected void updatePowerStatus() {
|
||||
|
||||
@@ -10,6 +10,9 @@ import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.ActivityState;
|
||||
import appeng.core.features.BlockStackSrc;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.loader.IRegister;
|
||||
@@ -27,6 +30,7 @@ public abstract class FCBaseBlock extends AEBaseTileBlock implements IRegister<F
|
||||
|
||||
@Override
|
||||
public void setTileEntity(final Class<? extends TileEntity> clazz) {
|
||||
AEBaseTile.registerTileItem(clazz, new BlockStackSrc(this, 0, ActivityState.Enabled));
|
||||
super.setTileEntity(clazz);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,11 @@ package com.glodblock.github.common.item;
|
||||
import static net.minecraft.client.gui.GuiScreen.isShiftKeyDown;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -13,11 +15,15 @@ import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.util.Platform;
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.IBauble;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
@@ -36,7 +42,7 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
|
||||
implements IRegister<ItemWirelessUltraTerminal> {
|
||||
implements IBauble, IRegister<ItemWirelessUltraTerminal> {
|
||||
|
||||
public final static String MODE = "mode_main";
|
||||
private final static List<GuiType> guis = new ArrayList<>();
|
||||
@@ -72,6 +78,8 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
|
||||
if (isShiftKeyDown()) {
|
||||
lines.add(StatCollector.translateToLocal(NameConst.TT_ULTRA_TERMINAL));
|
||||
lines.add(StatCollector.translateToLocal(NameConst.TT_ULTRA_TERMINAL + "." + guiGuiType(stack)));
|
||||
lines.add(NameConst.i18n(NameConst.TT_ULTRA_TERMINAL_TIPS));
|
||||
lines.addAll(Arrays.asList(NameConst.i18n(NameConst.TT_ULTRA_TERMINAL_TIPS_DESC).split("\\\\n")));
|
||||
} else {
|
||||
lines.add(NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE));
|
||||
}
|
||||
@@ -162,9 +170,10 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
|
||||
}
|
||||
|
||||
public static void switchTerminal(EntityPlayer player, GuiType guiType) {
|
||||
if (player.inventory.getCurrentItem().getItem() instanceof ItemWirelessUltraTerminal) {
|
||||
((ItemWirelessUltraTerminal) player.inventory.getCurrentItem().getItem())
|
||||
.setMode(guiType, player.inventory.getCurrentItem());
|
||||
ImmutablePair<Integer, ItemStack> term = Util.getUltraWirelessTerm(player);
|
||||
if (term == null) return;
|
||||
if (term.getRight().getItem() instanceof ItemWirelessUltraTerminal) {
|
||||
((ItemWirelessUltraTerminal) term.getRight().getItem()).setMode(guiType, term.getRight());
|
||||
}
|
||||
if (Platform.isClient()) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(guiType, true));
|
||||
@@ -173,7 +182,7 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
|
||||
player,
|
||||
player.worldObj,
|
||||
new BlockPos(
|
||||
player.inventory.currentItem,
|
||||
term.getLeft(),
|
||||
Util.GuiHelper.encodeType(
|
||||
guis.indexOf(GuiType.valueOf(guiType.toString())),
|
||||
Util.GuiHelper.GuiType.ITEM),
|
||||
@@ -191,4 +200,34 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
|
||||
public GuiType guiGuiType(ItemStack stack) {
|
||||
return readMode(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaubleType getBaubleType(ItemStack itemStack) {
|
||||
return BaubleType.RING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWornTick(ItemStack itemStack, EntityLivingBase entityLivingBase) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEquipped(ItemStack itemStack, EntityLivingBase entityLivingBase) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnequipped(ItemStack itemStack, EntityLivingBase entityLivingBase) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquip(ItemStack itemStack, EntityLivingBase entityLivingBase) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUnequip(ItemStack itemStack, EntityLivingBase entityLivingBase) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.glodblock.github.common.parts;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -26,6 +27,7 @@ import appeng.core.AELog;
|
||||
import appeng.helpers.MultiCraftingTracker;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
@@ -43,6 +45,9 @@ public class PartFluidExportBus extends FCSharedFluidBus implements ICraftingReq
|
||||
|
||||
private final BaseActionSource source;
|
||||
private final MultiCraftingTracker craftingTracker = new MultiCraftingTracker(this, 9);
|
||||
private int nextSlot = 0;
|
||||
private long fluidToSend = 1000;
|
||||
private boolean didSomething;
|
||||
|
||||
public PartFluidExportBus(ItemStack is) {
|
||||
super(is);
|
||||
@@ -73,12 +78,33 @@ public class PartFluidExportBus extends FCSharedFluidBus implements ICraftingReq
|
||||
return this.getProxy().isActive();
|
||||
}
|
||||
|
||||
private int getStartingSlot(final SchedulingMode schedulingMode, final int x) {
|
||||
if (schedulingMode == SchedulingMode.RANDOM) {
|
||||
return Platform.getRandom().nextInt(this.availableSlots());
|
||||
}
|
||||
|
||||
if (schedulingMode == SchedulingMode.ROUNDROBIN) {
|
||||
return (this.nextSlot + x) % this.availableSlots();
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
private int availableSlots() {
|
||||
return Math.min(1 + this.getInstalledUpgrades(Upgrades.CAPACITY) * 4, this.getInv().getSizeInventory());
|
||||
}
|
||||
|
||||
private IInventory getInv() {
|
||||
return this.getInventoryByName("config");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TickRateModulation doBusWork() {
|
||||
if (!this.canDoBusWork()) {
|
||||
return TickRateModulation.IDLE;
|
||||
}
|
||||
|
||||
this.didSomething = false;
|
||||
this.fluidToSend = this.calculateAmountToSend();
|
||||
final TileEntity te = this.getConnectedTE();
|
||||
|
||||
if (te instanceof IFluidHandler) {
|
||||
@@ -87,10 +113,11 @@ public class PartFluidExportBus extends FCSharedFluidBus implements ICraftingReq
|
||||
final ICraftingGrid cg = this.getProxy().getCrafting();
|
||||
final IFluidHandler fh = (IFluidHandler) te;
|
||||
final IMEMonitor<IAEFluidStack> inv = this.getProxy().getStorage().getFluidInventory();
|
||||
|
||||
for (int i = 0; i < this.getInventoryByName("config").getSizeInventory(); i++) {
|
||||
int i;
|
||||
for (i = 0; i < this.availableSlots() && this.fluidToSend > 0; i++) {
|
||||
final int slotToExport = this.getStartingSlot(this.getSchedulingMode(), i);
|
||||
IAEFluidStack fluid = AEFluidStack
|
||||
.create(ItemFluidPacket.getFluidStack(this.getInventoryByName("config").getStackInSlot(i)));
|
||||
.create(ItemFluidPacket.getFluidStack(getInv().getStackInSlot(slotToExport)));
|
||||
if (fluid != null) {
|
||||
boolean isAllowed = true;
|
||||
|
||||
@@ -110,20 +137,18 @@ public class PartFluidExportBus extends FCSharedFluidBus implements ICraftingReq
|
||||
this.source);
|
||||
}
|
||||
|
||||
final IAEFluidStack out = inv.extractItems(toExtract, Actionable.SIMULATE, this.source);
|
||||
|
||||
if (out != null && isAllowed) {
|
||||
int wasInserted = fh.fill(this.getSide().getOpposite(), out.getFluidStack(), true);
|
||||
|
||||
if (wasInserted > 0) {
|
||||
toExtract.setStackSize(wasInserted);
|
||||
inv.extractItems(toExtract, Actionable.MODULATE, this.source);
|
||||
|
||||
return TickRateModulation.FASTER;
|
||||
int space = fh.fill(this.getSide().getOpposite(), toExtract.getFluidStack(), false);
|
||||
toExtract.setStackSize(space);
|
||||
final IAEFluidStack real = inv.extractItems(toExtract, Actionable.MODULATE, this.source);
|
||||
if (real != null && isAllowed) {
|
||||
int realInserted = fh.fill(this.getSide().getOpposite(), real.getFluidStack(), true);
|
||||
if (realInserted < real.getStackSize()) {
|
||||
toExtract.setStackSize(real.getStackSize() - realInserted);
|
||||
inv.injectItems(toExtract, Actionable.MODULATE, this.source);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isCraftingEnabled()) {
|
||||
this.fluidToSend -= realInserted;
|
||||
didSomething = true;
|
||||
} else if (this.isCraftingEnabled()) {
|
||||
this.craftingTracker.handleCrafting(
|
||||
i,
|
||||
toExtract.getStackSize(),
|
||||
@@ -136,8 +161,8 @@ public class PartFluidExportBus extends FCSharedFluidBus implements ICraftingReq
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TickRateModulation.SLOWER;
|
||||
this.updateSchedulingMode(this.getSchedulingMode(), i);
|
||||
return didSomething ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
|
||||
} catch (GridAccessException e) {
|
||||
// Ignore
|
||||
}
|
||||
@@ -146,6 +171,12 @@ public class PartFluidExportBus extends FCSharedFluidBus implements ICraftingReq
|
||||
return TickRateModulation.SLEEP;
|
||||
}
|
||||
|
||||
private void updateSchedulingMode(final SchedulingMode schedulingMode, final int x) {
|
||||
if (schedulingMode == SchedulingMode.ROUNDROBIN) {
|
||||
this.nextSlot = (this.nextSlot + x) % this.availableSlots();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBoxes(final IPartCollisionHelper bch) {
|
||||
bch.addBox(4, 4, 12, 12, 12, 14);
|
||||
@@ -216,6 +247,10 @@ public class PartFluidExportBus extends FCSharedFluidBus implements ICraftingReq
|
||||
return (RedstoneMode) this.getConfigManager().getSetting(Settings.REDSTONE_CONTROLLED);
|
||||
}
|
||||
|
||||
public SchedulingMode getSchedulingMode() {
|
||||
return (SchedulingMode) this.getConfigManager().getSetting(Settings.SCHEDULING_MODE);
|
||||
}
|
||||
|
||||
private boolean craftOnly() {
|
||||
return this.getConfigManager().getSetting(Settings.CRAFT_ONLY) == YesNo.YES;
|
||||
}
|
||||
|
||||
@@ -259,7 +259,9 @@ public class PartFluidStorageBus extends PartUpgradeable
|
||||
|
||||
@Override
|
||||
public void onNeighborChanged() {
|
||||
BlockPos neighbor = new BlockPos(this.getTile()).getOffSet(this.getSide());
|
||||
TileEntity tile = this.getTile();
|
||||
if (tile == null || this.getProxy() == null || !this.getProxy().isActive()) return;
|
||||
BlockPos neighbor = new BlockPos(tile).getOffSet(this.getSide());
|
||||
final TileEntity te = neighbor.getTileEntity();
|
||||
// In case the TE was destroyed, we have to do a full reset immediately.
|
||||
if (te instanceof TileCableBus) {
|
||||
@@ -288,6 +290,7 @@ public class PartFluidStorageBus extends PartUpgradeable
|
||||
} else {
|
||||
this.resetCache(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,6 +25,7 @@ public abstract class FCFluidEncodeTerminal extends FCPart implements IItemPatte
|
||||
protected boolean prioritize = false;
|
||||
protected boolean inverted = false;
|
||||
protected boolean beSubstitute = false;
|
||||
protected boolean autoFillPattern = false;
|
||||
protected int activePage = 0;
|
||||
|
||||
public FCFluidEncodeTerminal(ItemStack is) {
|
||||
@@ -51,6 +52,7 @@ public abstract class FCFluidEncodeTerminal extends FCPart implements IItemPatte
|
||||
this.setPrioritization(data.getBoolean("priorization"));
|
||||
this.setInverted(data.getBoolean("inverted"));
|
||||
this.setActivePage(data.getInteger("activePage"));
|
||||
this.setAutoFillPattern(data.getBoolean("autoFillPattern"));
|
||||
this.pattern.readFromNBT(data, "pattern");
|
||||
this.output.readFromNBT(data, "outputList");
|
||||
this.crafting.readFromNBT(data, "craftingGrid");
|
||||
@@ -66,6 +68,7 @@ public abstract class FCFluidEncodeTerminal extends FCPart implements IItemPatte
|
||||
data.setBoolean("substitute", this.substitute);
|
||||
data.setBoolean("inverted", this.inverted);
|
||||
data.setInteger("activePage", this.activePage);
|
||||
data.setBoolean("autoFillPattern", this.autoFillPattern);
|
||||
this.pattern.writeToNBT(data, "pattern");
|
||||
this.output.writeToNBT(data, "outputList");
|
||||
this.crafting.writeToNBT(data, "craftingGrid");
|
||||
@@ -204,4 +207,14 @@ public abstract class FCFluidEncodeTerminal extends FCPart implements IItemPatte
|
||||
}
|
||||
saveChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoFillPattern() {
|
||||
return this.autoFillPattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAutoFillPattern(boolean canFill) {
|
||||
this.autoFillPattern = canFill;
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,7 @@ public abstract class FCPart extends AEBasePart
|
||||
this.cm.registerSetting(Settings.SORT_BY, SortOrder.NAME);
|
||||
this.cm.registerSetting(Settings.VIEW_MODE, ViewItems.ALL);
|
||||
this.cm.registerSetting(Settings.SORT_DIRECTION, SortDir.ASCENDING);
|
||||
this.cm.registerSetting(Settings.TYPE_FILTER, TypeFilter.ALL);
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
|
||||
@@ -35,6 +35,7 @@ import appeng.client.texture.CableBusTextures;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.parts.reporting.AbstractPartDisplay;
|
||||
import appeng.parts.reporting.PartPanel;
|
||||
@@ -199,7 +200,7 @@ public abstract class FCPartMonitor extends AbstractPartDisplay implements IPart
|
||||
super.finalize();
|
||||
|
||||
if (this.dspList != null) {
|
||||
GLAllocation.deleteDisplayLists(this.dspList);
|
||||
TickHandler.INSTANCE.scheduleCallListDelete(this.dspList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package com.glodblock.github.common.tile;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
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.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
||||
import com.glodblock.github.loader.ChannelLoader;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
|
||||
public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
|
||||
@@ -26,6 +29,7 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
return this;
|
||||
}
|
||||
};
|
||||
private boolean hasUpdate;
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
@@ -191,6 +195,40 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
return (float) this.tank.getFluidAmount() / this.tank.getCapacity();
|
||||
}
|
||||
|
||||
private void onComparatorUpdate(World world, int x, int y, int z, Block block) {
|
||||
world.func_147453_f(x, y, z, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (this.tank.getFluid() != null) {
|
||||
TileCertusQuartzTank below = getTankBelow(this);
|
||||
if (below != null) {
|
||||
FluidStack filled = this.tank.getFluid().copy();
|
||||
filled.amount = below.fill(this.tank.getFluid(), true, true);
|
||||
if (filled.amount >= 0) {
|
||||
this.drain(filled, true, true);
|
||||
this.hasUpdate = true;
|
||||
below.hasUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.hasUpdate) {
|
||||
onComparatorUpdate(this.worldObj, this.xCoord, this.yCoord, this.zCoord, this.getBlockType());
|
||||
this.hasUpdate = false;
|
||||
}
|
||||
}
|
||||
|
||||
private TileCertusQuartzTank getTankBelow(TileEntity tile) {
|
||||
TileEntity tank = new BlockPos(tile).getOffSet(0, -1, 0).getTileEntity();
|
||||
if (tank != null && tank instanceof TileCertusQuartzTank) {
|
||||
return (TileCertusQuartzTank) tank;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public FluidTankInfo[] getTankInfo(boolean goToMainTank) {
|
||||
if (!goToMainTank) return new FluidTankInfo[] { this.tank.getInfo() };
|
||||
|
||||
@@ -212,12 +250,12 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
break;
|
||||
}
|
||||
|
||||
yOff = 0;
|
||||
offTE = this.worldObj.getTileEntity(this.xCoord, this.yCoord + yOff, this.zCoord);
|
||||
yOff -= 1;
|
||||
offTE = this.worldObj.getTileEntity(this.xCoord, this.yCoord - yOff, this.zCoord);
|
||||
while (true) {
|
||||
if (offTE instanceof TileCertusQuartzTank) {
|
||||
mainTank = (TileCertusQuartzTank) offTE;
|
||||
if (mainTank.getFluid() == null || mainTank.getFluid() == getFluid()) {
|
||||
if (mainTank.getFluid() == null || getFluid() == null || mainTank.getFluid() == getFluid()) {
|
||||
FluidTankInfo info = mainTank.getTankInfo(false)[0];
|
||||
if (info != null) {
|
||||
capacity += info.capacity;
|
||||
@@ -226,8 +264,7 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
if (info.fluid.getFluid() != null) fluid = info.fluid.getFluid();
|
||||
}
|
||||
}
|
||||
yOff++;
|
||||
offTE = this.worldObj.getTileEntity(this.xCoord, this.yCoord + yOff, this.zCoord);
|
||||
offTE = new BlockPos(offTE).getOffSet(0, 1, 0).getTileEntity();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -274,4 +311,8 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
public void writeToNBTWithoutCoords(NBTTagCompound tag) {
|
||||
this.tank.writeToNBT(tag);
|
||||
}
|
||||
|
||||
public FluidTankInfo[] getInternalFluid() {
|
||||
return this.getTankInfo(true);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -30,7 +31,8 @@ import appeng.util.item.AEFluidStack;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
|
||||
public class TileFluidPacketDecoder extends AENetworkTile implements IGridTickable, IAEAppEngInventory, IInventory {
|
||||
public class TileFluidPacketDecoder extends AENetworkTile
|
||||
implements IGridTickable, IAEAppEngInventory, IInventory, IFluidHandler {
|
||||
|
||||
private final AppEngInternalInventory inventory = new AppEngInternalInventory(this, 1);
|
||||
private final BaseActionSource ownActionSource = new MachineSource(this);
|
||||
@@ -164,4 +166,68 @@ public class TileFluidPacketDecoder extends AENetworkTile implements IGridTickab
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return stack.getItem() instanceof ItemFluidPacket;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack requestFluid, boolean doDrain) {
|
||||
return this.drain(requestFluid, doDrain);
|
||||
}
|
||||
|
||||
private FluidStack drain(FluidStack requestFluid, boolean doDrain) {
|
||||
if (requestFluid == null || requestFluid.amount <= 0) return null;
|
||||
ItemStack fluidPacket = this.inventory.getStackInSlot(0);
|
||||
if (fluidPacket != null) {
|
||||
FluidStack fs = ItemFluidPacket.getFluidStack(fluidPacket);
|
||||
if (fs == null) return null;
|
||||
if (fs.isFluidEqual(requestFluid)) {
|
||||
if (fs.amount > requestFluid.amount) {
|
||||
fs.amount -= requestFluid.amount;
|
||||
if (doDrain) this.inventory.setInventorySlotContents(0, ItemFluidPacket.newStack(fs));
|
||||
return requestFluid;
|
||||
} else {
|
||||
if (doDrain) this.inventory.setInventorySlotContents(0, null);
|
||||
return fs;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
ItemStack fluidPacket = this.inventory.getStackInSlot(0);
|
||||
if (fluidPacket != null) {
|
||||
FluidStack requestFluid = ItemFluidPacket.getFluidStack(fluidPacket);
|
||||
if (requestFluid == null) return null;
|
||||
requestFluid.amount = maxDrain;
|
||||
return this.drain(requestFluid, doDrain);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
ItemStack fluidPacket = this.inventory.getStackInSlot(0);
|
||||
if (fluidPacket == null) {
|
||||
return new FluidTankInfo[0];
|
||||
} else {
|
||||
FluidStack fs = ItemFluidPacket.getFluidStack(fluidPacket);
|
||||
if (fs == null) return new FluidTankInfo[0];
|
||||
return new FluidTankInfo[] { new FluidTankInfo(fs, fs.amount) };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,9 +40,6 @@ public class FCClassTransformer implements IClassTransformer {
|
||||
case "appeng.core.sync.packets.PacketCompressedNBT":
|
||||
tform = PacketCompressedNBTTransformer.INSTANCE;
|
||||
break;
|
||||
case "appeng.client.gui.implementations.GuiRenamer":
|
||||
tform = GuiRenamerTransformer.INSTANCE;
|
||||
break;
|
||||
default:
|
||||
return code;
|
||||
}
|
||||
|
||||
@@ -2,16 +2,9 @@ package com.glodblock.github.coremod.hooker;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.GuiInterfaceTerminalWireless;
|
||||
import com.glodblock.github.common.item.ItemWirelessInterfaceTerminal;
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.network.CPacketSwitchGuis;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -26,12 +19,4 @@ public class CoreModHooksClient {
|
||||
}
|
||||
}
|
||||
|
||||
public static void reopenInterfaceTerminal() {
|
||||
EntityPlayer p = Minecraft.getMinecraft().thePlayer;
|
||||
ItemStack c = p.getCurrentEquippedItem();
|
||||
if (c.getItem() instanceof ItemWirelessInterfaceTerminal || c.getItem() instanceof ItemWirelessUltraTerminal) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(GuiType.WIRELESS_INTERFACE_TERMINAL, true));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package com.glodblock.github.coremod.transform;
|
||||
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
||||
import com.glodblock.github.coremod.FCClassTransformer;
|
||||
|
||||
public class GuiRenamerTransformer extends FCClassTransformer.ClassMapper {
|
||||
|
||||
public static final GuiRenamerTransformer INSTANCE = new GuiRenamerTransformer();
|
||||
|
||||
private GuiRenamerTransformer() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClassVisitor getClassMapper(ClassVisitor downstream) {
|
||||
return new GuiRenamerTransformer.TransformGuiRenamer(Opcodes.ASM5, downstream);
|
||||
}
|
||||
|
||||
private static class TransformGuiRenamer extends ClassVisitor {
|
||||
|
||||
TransformGuiRenamer(int api, ClassVisitor cv) {
|
||||
super(api, cv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
|
||||
if (name.equals("keyTyped")) {
|
||||
return new GuiRenamerTransformer.TransformKeyTyped(
|
||||
api,
|
||||
super.visitMethod(access, name, desc, signature, exceptions));
|
||||
}
|
||||
return super.visitMethod(access, name, desc, signature, exceptions);
|
||||
}
|
||||
}
|
||||
|
||||
private static class TransformKeyTyped extends MethodVisitor {
|
||||
|
||||
TransformKeyTyped(int api, MethodVisitor mv) {
|
||||
super(api, mv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
|
||||
super.visitMethodInsn(opcode, owner, name, desc, itf);
|
||||
if (owner.equals("net/minecraft/client/entity/EntityClientPlayerMP") && name.equals("closeScreen")) {
|
||||
super.visitMethodInsn(
|
||||
Opcodes.INVOKESTATIC,
|
||||
"com/glodblock/github/coremod/hooker/CoreModHooksClient",
|
||||
"reopenInterfaceTerminal",
|
||||
"()V",
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,14 @@ public class Tooltip {
|
||||
return String.format("%s: %s mB", name, NumberFormat.getInstance().format(amount));
|
||||
}
|
||||
|
||||
public static String fluidFormat(String name, long amount, long capacity) {
|
||||
return String.format(
|
||||
"%s: %s mB / %s mB",
|
||||
name,
|
||||
NumberFormat.getInstance().format(amount),
|
||||
NumberFormat.getInstance().format(capacity));
|
||||
}
|
||||
|
||||
public static String partFluidBusFormat(int amount) {
|
||||
return String
|
||||
.format("%s: %s mB/t", I18n.format(NameConst.WAILA_SPEED), NumberFormat.getInstance().format(amount));
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.glodblock.github.crossmod.waila;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.crossmod.waila.vanilla.FluidInvWailaDataProvider;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public class VanillaTileWailaDataProvider implements IWailaDataProvider {
|
||||
|
||||
private final List<IWailaDataProvider> providers;
|
||||
|
||||
public VanillaTileWailaDataProvider() {
|
||||
final IWailaDataProvider fluidInv = new FluidInvWailaDataProvider();
|
||||
this.providers = Lists.newArrayList(fluidInv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(final IWailaDataAccessor accessor, final IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(final ItemStack itemStack, final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor, final IWailaConfigHandler config) {
|
||||
for (final IWailaDataProvider provider : this.providers) {
|
||||
provider.getWailaHead(itemStack, currentToolTip, accessor, config);
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(final ItemStack itemStack, final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor, final IWailaConfigHandler config) {
|
||||
for (final IWailaDataProvider provider : this.providers) {
|
||||
provider.getWailaBody(itemStack, currentToolTip, accessor, config);
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(final ItemStack itemStack, final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor, final IWailaConfigHandler config) {
|
||||
for (final IWailaDataProvider provider : this.providers) {
|
||||
provider.getWailaTail(itemStack, currentToolTip, accessor, config);
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(final EntityPlayerMP player, final TileEntity te, final NBTTagCompound tag,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
for (final IWailaDataProvider provider : this.providers) {
|
||||
provider.getNBTData(player, te, tag, world, x, y, z);
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,9 @@ package com.glodblock.github.crossmod.waila;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.IWailaRegistrar;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
@@ -23,5 +26,10 @@ public class WailaInit {
|
||||
final IWailaDataProvider tile = new TileWailaDataProvider();
|
||||
registrar.registerBodyProvider(tile, AEBaseTile.class);
|
||||
registrar.registerNBTProvider(tile, AEBaseTile.class);
|
||||
|
||||
final IWailaDataProvider vanillaTile = new VanillaTileWailaDataProvider();
|
||||
registrar.registerBodyProvider(vanillaTile, TileEntity.class);
|
||||
registrar.registerNBTProvider(vanillaTile, TileEntity.class);
|
||||
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.glodblock.github.crossmod.waila.vanilla;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import appeng.integration.modules.waila.BaseWailaDataProvider;
|
||||
|
||||
import com.glodblock.github.common.tile.TileCertusQuartzTank;
|
||||
import com.glodblock.github.crossmod.waila.Tooltip;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
public class FluidInvWailaDataProvider extends BaseWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(final ItemStack itemStack, final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor, final IWailaConfigHandler config) {
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
if (te instanceof TileCertusQuartzTank) {
|
||||
if (accessor.getNBTData().hasKey("fluidInv")) {
|
||||
NBTTagCompound data = (NBTTagCompound) accessor.getNBTData().getTag("fluidInv");
|
||||
for (FluidTankInfo info : Util.FluidUtil.fluidTankInfoReadFromNBT(data)) {
|
||||
if (info.fluid == null) continue;
|
||||
currentToolTip
|
||||
.add(Tooltip.fluidFormat(info.fluid.getLocalizedName(), info.fluid.amount, info.capacity));
|
||||
}
|
||||
}
|
||||
}
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(final EntityPlayerMP player, final TileEntity te, final NBTTagCompound tag,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
if (te instanceof TileCertusQuartzTank) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
Util.FluidUtil.fluidTankInfoWriteToNBT(((TileCertusQuartzTank) te).getInternalFluid(), data);
|
||||
tag.setTag("fluidInv", data);
|
||||
te.writeToNBT(tag);
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
+305
-74
@@ -1,9 +1,8 @@
|
||||
package com.glodblock.github.inventory;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -16,9 +15,14 @@ import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.InsertionMode;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.helpers.DualityInterface;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.parts.p2p.PartP2PLiquids;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.inv.IInventoryDestination;
|
||||
import appeng.util.inv.ItemSlot;
|
||||
@@ -34,24 +38,47 @@ import com.glodblock.github.util.BlockPos;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
|
||||
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
|
||||
import gregtech.api.metatileentity.MetaPipeEntity;
|
||||
|
||||
public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
|
||||
|
||||
// facing is the target TE direction
|
||||
// |T|-facing->|I|
|
||||
public FluidConvertingInventoryAdaptor(@Nullable InventoryAdaptor invItems, @Nullable IFluidHandler invFluids,
|
||||
ForgeDirection facing, BlockPos pos, boolean isOnmi, Object eioConduct) {
|
||||
ForgeDirection facing, BlockPos pos, boolean isOnmi) {
|
||||
this.invItems = invItems;
|
||||
this.invFluids = invFluids;
|
||||
this.side = facing;
|
||||
this.posInterface = pos;
|
||||
this.eioDuct = eioConduct;
|
||||
this.onmi = isOnmi;
|
||||
this.selfInterface = getInterfaceTE(pos.getTileEntity(), facing.getOpposite());
|
||||
}
|
||||
|
||||
private final InventoryAdaptor invItems;
|
||||
private final IFluidHandler invFluids;
|
||||
private final ForgeDirection side;
|
||||
private final BlockPos posInterface;
|
||||
private final Object eioDuct;
|
||||
@Nullable
|
||||
private final IInterfaceHost selfInterface;
|
||||
private final boolean onmi;
|
||||
private static Method eioTypeCheck;
|
||||
private static Class<?> conduitClazz;
|
||||
|
||||
static {
|
||||
if (ModAndClassUtil.EIO) {
|
||||
try {
|
||||
conduitClazz = Class.forName("crazypants.enderio.conduit.TileConduitBundle");
|
||||
eioTypeCheck = conduitClazz.getDeclaredMethod("getConduit", Class.class);
|
||||
} catch (ClassNotFoundException | NoSuchMethodException e) {
|
||||
eioTypeCheck = null;
|
||||
}
|
||||
} else {
|
||||
eioTypeCheck = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static InventoryAdaptor wrap(TileEntity capProvider, ForgeDirection face) {
|
||||
// sometimes i wish 1.7.10 has cap system.
|
||||
@@ -69,31 +96,69 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
|
||||
if (inter instanceof TileInterface) {
|
||||
onmi = ((TileInterface) inter).getTargets().size() > 1;
|
||||
}
|
||||
Object conduct = null;
|
||||
if (ModAndClassUtil.COFH && capProvider instanceof IItemDuct) {
|
||||
conduct = capProvider;
|
||||
}
|
||||
return new FluidConvertingInventoryAdaptor(item, fluid, face, new BlockPos(inter), onmi, conduct);
|
||||
return new FluidConvertingInventoryAdaptor(item, fluid, face, new BlockPos(inter), onmi);
|
||||
}
|
||||
|
||||
public ItemStack addItems(ItemStack toBeAdded, InsertionMode insertionMode) {
|
||||
FluidStack fluid = Util.getFluidFromVirtual(toBeAdded);
|
||||
if (fluid != null) {
|
||||
if (invFluids != null) {
|
||||
if (invFluids.canFill(side, fluid.getFluid())) {
|
||||
int filled = invFluids.fill(side, fluid, true);
|
||||
if (filled > 0) {
|
||||
fluid.amount -= filled;
|
||||
return ItemFluidPacket.newStack(fluid);
|
||||
}
|
||||
}
|
||||
if (!this.onmi) {
|
||||
if (!checkValidSide(
|
||||
this.posInterface.getOffSet(this.side.getOpposite()).getTileEntity(),
|
||||
this.side.getOpposite())) {
|
||||
return toBeAdded;
|
||||
}
|
||||
if (fluid != null) {
|
||||
int filled = fillSideFluid(fluid, this.invFluids, this.side, true);
|
||||
fluid.amount -= filled;
|
||||
return ItemFluidPacket.newStack(fluid);
|
||||
} else {
|
||||
ItemStack notFilled = fillSideItem(toBeAdded, this.invItems, insertionMode, true);
|
||||
if (notFilled != null) {
|
||||
// Fill EIO Conduit at last.
|
||||
return fillEIOConduit(
|
||||
notFilled,
|
||||
this.posInterface.getOffSet(this.side.getOpposite()).getTileEntity(),
|
||||
this.side);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if (fluid != null) {
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (fluid.amount <= 0) {
|
||||
return null;
|
||||
}
|
||||
if (!checkValidSide(this.posInterface.getOffSet(dir).getTileEntity(), dir)) {
|
||||
continue;
|
||||
}
|
||||
int filled = fillSideFluid(fluid, getSideFluid(dir), dir.getOpposite(), true);
|
||||
fluid.amount -= filled;
|
||||
}
|
||||
return ItemFluidPacket.newStack(fluid);
|
||||
} else {
|
||||
ItemStack item = toBeAdded.copy();
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (item == null || item.stackSize <= 0) {
|
||||
return null;
|
||||
}
|
||||
if (!checkValidSide(this.posInterface.getOffSet(dir).getTileEntity(), dir)) {
|
||||
continue;
|
||||
}
|
||||
item = fillSideItem(item, getSideItem(dir), insertionMode, true);
|
||||
}
|
||||
// Fill EIO Conduit at last.
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (item == null || item.stackSize <= 0) {
|
||||
return null;
|
||||
}
|
||||
if (!checkValidSide(this.posInterface.getOffSet(dir).getTileEntity(), dir)) {
|
||||
continue;
|
||||
}
|
||||
item = fillEIOConduit(item, this.posInterface.getOffSet(dir).getTileEntity(), dir.getOpposite());
|
||||
}
|
||||
return item;
|
||||
}
|
||||
return toBeAdded;
|
||||
}
|
||||
if (eioDuct != null) {
|
||||
return ((IItemDuct) eioDuct).insertItem(side, toBeAdded);
|
||||
}
|
||||
return invItems != null ? invItems.addItems(toBeAdded, insertionMode) : toBeAdded;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -109,35 +174,56 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
|
||||
@Override
|
||||
public ItemStack simulateAdd(ItemStack toBeSimulated, InsertionMode insertionMode) {
|
||||
FluidStack fluid = Util.getFluidFromVirtual(toBeSimulated);
|
||||
if (fluid != null) {
|
||||
if (onmi) {
|
||||
boolean sus = false;
|
||||
for (ForgeDirection dir : ForgeDirection.values()) {
|
||||
TileEntity te = posInterface.getOffSet(dir).getTileEntity();
|
||||
if (te instanceof IFluidHandler) {
|
||||
int filled = ((IFluidHandler) te).fill(dir.getOpposite(), fluid, false);
|
||||
if (filled > 0) {
|
||||
sus = true;
|
||||
break;
|
||||
}
|
||||
if (!this.onmi) {
|
||||
if (!checkValidSide(
|
||||
this.posInterface.getOffSet(this.side.getOpposite()).getTileEntity(),
|
||||
this.side.getOpposite())) {
|
||||
return toBeSimulated;
|
||||
}
|
||||
if (fluid != null) {
|
||||
int filled = fillSideFluid(fluid, this.invFluids, this.side, false);
|
||||
fluid.amount -= filled;
|
||||
return ItemFluidPacket.newStack(fluid);
|
||||
} else {
|
||||
// Assert EIO conduit can hold all item, as it is the origin practice in AE2
|
||||
if (isConduit(this.posInterface.getOffSet(this.side.getOpposite()).getTileEntity())) {
|
||||
return null;
|
||||
} else {
|
||||
return fillSideItem(toBeSimulated, this.invItems, insertionMode, false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// In onmi mode, fluid/item only need to be partly inserted.
|
||||
boolean sus = false;
|
||||
if (fluid != null) {
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (!checkValidSide(this.posInterface.getOffSet(dir).getTileEntity(), dir)) {
|
||||
continue;
|
||||
}
|
||||
int filled = fillSideFluid(fluid, getSideFluid(dir), dir.getOpposite(), false);
|
||||
if (filled > 0) {
|
||||
sus = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return sus ? null : toBeSimulated;
|
||||
}
|
||||
if (invFluids != null) {
|
||||
int filled = invFluids.fill(side, fluid, false);
|
||||
if (filled > 0) {
|
||||
fluid.amount -= filled;
|
||||
return ItemFluidPacket.newStack(fluid);
|
||||
} else {
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (!checkValidSide(this.posInterface.getOffSet(dir).getTileEntity(), dir)) {
|
||||
continue;
|
||||
}
|
||||
// Assert EIO conduit can hold all item, as it is the origin practice in AE2
|
||||
if (isConduit(this.posInterface.getOffSet(dir).getTileEntity())) {
|
||||
return null;
|
||||
}
|
||||
ItemStack notFilled = fillSideItem(toBeSimulated, getSideItem(dir), insertionMode, false);
|
||||
if (notFilled == null || notFilled.stackSize < toBeSimulated.stackSize) {
|
||||
sus = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return toBeSimulated;
|
||||
return sus ? null : toBeSimulated;
|
||||
}
|
||||
// Assert EIO conduct can hold all item, as it is the origin practice in AE2
|
||||
if (eioDuct != null) {
|
||||
return null;
|
||||
}
|
||||
return invItems != null ? invItems.simulateAdd(toBeSimulated, insertionMode) : toBeSimulated;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -164,15 +250,123 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
|
||||
|
||||
@Override
|
||||
public boolean containsItems() {
|
||||
if (invFluids == null && invItems == null) {
|
||||
// If this entity doesn't have fluid or item inventory, we just view it as full of things.
|
||||
return true;
|
||||
if (!this.onmi) {
|
||||
// If there is no fluid tank or item inventory, it shouldn't send stuff here.
|
||||
return checkItemFluids(this.invFluids, this.invItems, this.side) > 0;
|
||||
}
|
||||
if (invFluids != null && invFluids.getTankInfo(this.side) != null) {
|
||||
boolean anyValid = false;
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
// Avoid sending stuff into itself me network
|
||||
if (checkValidSide(this.posInterface.getOffSet(dir).getTileEntity(), dir)
|
||||
&& !isItemConduit(this.posInterface.getOffSet(dir).getTileEntity())) {
|
||||
final int result = checkItemFluids(this.getSideFluid(dir), this.getSideItem(dir), dir.getOpposite());
|
||||
if (result == 1) {
|
||||
return true;
|
||||
}
|
||||
if (result != 2) {
|
||||
anyValid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Same here. if there is no fluid tank or item inventory existed, it shouldn't send stuff here.
|
||||
return !anyValid;
|
||||
}
|
||||
|
||||
public boolean hasSlots() {
|
||||
return (invFluids != null && invFluids.getTankInfo(side).length > 0) || (invItems != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<ItemSlot> iterator() {
|
||||
return new SlotIterator(
|
||||
invFluids != null ? invFluids.getTankInfo(side) : new FluidTankInfo[0],
|
||||
invItems != null ? invItems.iterator() : Collections.emptyIterator());
|
||||
}
|
||||
|
||||
private IFluidHandler getSideFluid(ForgeDirection direction) {
|
||||
TileEntity te = this.posInterface.getOffSet(direction).getTileEntity();
|
||||
if (te instanceof IFluidHandler) {
|
||||
return (IFluidHandler) te;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private int fillSideFluid(FluidStack fluid, IFluidHandler tank, ForgeDirection direction, boolean doFill) {
|
||||
if (tank != null) {
|
||||
return tank.fill(direction, fluid, doFill);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EIO conduit isn't considered here
|
||||
private ItemStack fillSideItem(ItemStack item, InventoryAdaptor inv, InsertionMode mode, boolean doFill) {
|
||||
if (inv != null) {
|
||||
if (doFill) {
|
||||
return inv.addItems(item, mode);
|
||||
} else {
|
||||
return inv.simulateAdd(item, mode);
|
||||
}
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
private int gtMachineCircuitCheck(InventoryAdaptor ad) {
|
||||
if (ad == null) {
|
||||
return 0;
|
||||
}
|
||||
for (ItemSlot i : ad) {
|
||||
ItemStack is = i.getItemStack();
|
||||
if (is == null || Objects.requireNonNull(is.getItem()).getUnlocalizedName().equals("gt.integrated_circuit"))
|
||||
continue;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private boolean isGTMachine(Object o) {
|
||||
return ModAndClassUtil.GT5 && o instanceof TileEntity
|
||||
&& ((TileEntity) o).getBlockType().getUnlocalizedName().equals("gt.blockmachines");
|
||||
}
|
||||
|
||||
private boolean isItemConduit(TileEntity te) {
|
||||
if (ModAndClassUtil.EIO && conduitClazz.isInstance(te)) {
|
||||
try {
|
||||
return eioTypeCheck.invoke(te, IItemConduit.class) != null;
|
||||
} catch (InvocationTargetException | IllegalAccessException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isConduit(TileEntity te) {
|
||||
return ModAndClassUtil.EIO && te instanceof IItemDuct;
|
||||
}
|
||||
|
||||
private ItemStack fillEIOConduit(ItemStack item, TileEntity te, ForgeDirection direction) {
|
||||
if (isConduit(te)) {
|
||||
return ((IItemDuct) te).insertItem(direction, item);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
private InventoryAdaptor getSideItem(ForgeDirection direction) {
|
||||
TileEntity te = this.posInterface.getOffSet(direction).getTileEntity();
|
||||
return InventoryAdaptor.getAdaptor(te, direction.getOpposite());
|
||||
}
|
||||
|
||||
// 0 - It is empty
|
||||
// 1 - It contains item/fluid
|
||||
// 2 - It doesn't exist
|
||||
private int checkItemFluids(IFluidHandler tank, InventoryAdaptor inv, ForgeDirection direction) {
|
||||
if (tank == null && inv == null) {
|
||||
return 2;
|
||||
}
|
||||
if (tank != null && tank.getTankInfo(direction) != null) {
|
||||
List<FluidTankInfo[]> tankInfos = new LinkedList<>();
|
||||
if (Util.getPart(invFluids, this.side) instanceof PartP2PLiquids) {
|
||||
if (Util.getPart(tank, direction) instanceof PartP2PLiquids) {
|
||||
// read other ends of p2p for blocking mode
|
||||
PartP2PLiquids invFluidsP2P = (PartP2PLiquids) Util.getPart(invFluids, this.side);
|
||||
PartP2PLiquids invFluidsP2P = (PartP2PLiquids) Util.getPart(tank, direction);
|
||||
try {
|
||||
Iterator<PartP2PLiquids> it = invFluidsP2P.getOutputs().iterator();
|
||||
boolean checkedInput = false;
|
||||
@@ -191,35 +385,72 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
|
||||
}
|
||||
} catch (GridAccessException ignore) {}
|
||||
} else {
|
||||
tankInfos.add(invFluids.getTankInfo(this.side));
|
||||
tankInfos.add(tank.getTankInfo(direction));
|
||||
}
|
||||
boolean hasTank = false;
|
||||
for (FluidTankInfo[] tankInfoArray : tankInfos) {
|
||||
for (FluidTankInfo tank : tankInfoArray) {
|
||||
for (FluidTankInfo tankInfo : tankInfoArray) {
|
||||
hasTank = true;
|
||||
FluidStack fluid = tank.fluid;
|
||||
FluidStack fluid = tankInfo.fluid;
|
||||
if (fluid != null && fluid.amount > 0) {
|
||||
return true;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!hasTank && invItems == null) {
|
||||
// If this entity doesn't have fluid or item inventory, we just view it as full of things.
|
||||
if (!hasTank && inv == null) {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
if (isGTMachine(tank)) {
|
||||
return gtMachineCircuitCheck(inv);
|
||||
}
|
||||
return inv != null && inv.containsItems() ? 1 : 0;
|
||||
}
|
||||
|
||||
private boolean checkValidSide(TileEntity te, ForgeDirection direction) {
|
||||
if (isGTMachine(te)) {
|
||||
return checkGTPipeConnection(te, direction.getOpposite());
|
||||
}
|
||||
return isDifferentGrid(getInterfaceTE(te, direction.getOpposite()));
|
||||
}
|
||||
|
||||
private boolean checkGTPipeConnection(TileEntity te, ForgeDirection direction) {
|
||||
if (te instanceof IGregTechTileEntity) {
|
||||
IMetaTileEntity mte = ((IGregTechTileEntity) te).getMetaTileEntity();
|
||||
if (mte instanceof MetaPipeEntity) {
|
||||
return ((MetaPipeEntity) mte).isConnectedAtSide(direction.ordinal());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static IInterfaceHost getInterfaceTE(TileEntity te, ForgeDirection face) {
|
||||
if (te instanceof IInterfaceHost) {
|
||||
return (IInterfaceHost) te;
|
||||
} else if (te instanceof TileCableBus) {
|
||||
IPart part = ((TileCableBus) te).getPart(face);
|
||||
if (part instanceof IInterfaceHost) {
|
||||
return (IInterfaceHost) part;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isDifferentGrid(IInterfaceHost target) {
|
||||
if (this.selfInterface != null && target != null) {
|
||||
DualityInterface other = target.getInterfaceDuality();
|
||||
DualityInterface self = this.selfInterface.getInterfaceDuality();
|
||||
try {
|
||||
AENetworkProxy proxy1 = Ae2Reflect.getInterfaceProxy(other);
|
||||
AENetworkProxy proxy2 = Ae2Reflect.getInterfaceProxy(self);
|
||||
if (proxy1.getGrid() == proxy2.getGrid()) {
|
||||
return false;
|
||||
}
|
||||
} catch (GridAccessException e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return invItems != null && invItems.containsItems();
|
||||
}
|
||||
|
||||
public boolean hasSlots() {
|
||||
return (invFluids != null && invFluids.getTankInfo(side).length > 0) || (invItems != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<ItemSlot> iterator() {
|
||||
return new SlotIterator(
|
||||
invFluids != null ? invFluids.getTankInfo(side) : new FluidTankInfo[0],
|
||||
invItems != null ? invItems.iterator() : Collections.emptyIterator());
|
||||
return true;
|
||||
}
|
||||
|
||||
private static class SlotIterator implements Iterator<ItemSlot> {
|
||||
|
||||
@@ -19,6 +19,14 @@ public class ItemBiggerAppEngInventory extends BiggerAppEngInventory {
|
||||
this.readFromNBT(Platform.openNbtData(is), name);
|
||||
}
|
||||
|
||||
public void setCraftingMode(boolean mode) {
|
||||
Platform.openNbtData(is).setBoolean("craftingMode", mode);
|
||||
}
|
||||
|
||||
public boolean getCraftingMode(boolean mode) {
|
||||
return Platform.openNbtData(is).getBoolean("craftingMode");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
boolean isCraft = Platform.openNbtData(is).getBoolean("craftingMode");
|
||||
|
||||
@@ -27,6 +27,18 @@ import com.google.common.collect.ImmutableList;
|
||||
|
||||
public enum GuiType {
|
||||
|
||||
RENAMER(new PartOrItemGuiFactory<ITerminalHost>(ITerminalHost.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
|
||||
return new ContainerRenamer(player.inventory, inv);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object createClientGui(EntityPlayer player, ITerminalHost inv) {
|
||||
return new GuiRenamer(player.inventory, inv);
|
||||
}
|
||||
}),
|
||||
FLUID_AUTO_FILLER(new TileGuiFactory<TileFluidAutoFiller>(TileFluidAutoFiller.class) {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,6 +12,7 @@ import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerOpenContext;
|
||||
|
||||
import com.glodblock.github.inventory.item.IItemInventory;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
public abstract class ItemGuiFactory<T> implements IGuiFactory {
|
||||
|
||||
@@ -29,7 +30,7 @@ public abstract class ItemGuiFactory<T> implements IGuiFactory {
|
||||
@Nullable
|
||||
@Override
|
||||
public Object createServerGui(EntityPlayer player, World world, int x, int y, int z, ForgeDirection face) {
|
||||
ItemStack item = player.getHeldItem();
|
||||
ItemStack item = Util.getWirelessTerminal(player, x);
|
||||
if (item == null || !(item.getItem() instanceof IItemInventory)) {
|
||||
return null;
|
||||
}
|
||||
@@ -56,7 +57,7 @@ public abstract class ItemGuiFactory<T> implements IGuiFactory {
|
||||
@Nullable
|
||||
@Override
|
||||
public Object createClientGui(EntityPlayer player, World world, int x, int y, int z, ForgeDirection face) {
|
||||
ItemStack item = player.getHeldItem();
|
||||
ItemStack item = Util.getWirelessTerminal(player, x);
|
||||
if (item == null || !(item.getItem() instanceof IItemInventory)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -30,9 +30,8 @@ public abstract class PartOrItemGuiFactory<T> extends PartGuiFactory<T> {
|
||||
@Override
|
||||
public Object createServerGui(EntityPlayer player, World world, int x, int y, int z, ForgeDirection face) {
|
||||
ImmutablePair<Util.GuiHelper.GuiType, Integer> result = Util.GuiHelper.decodeType(y);
|
||||
|
||||
if (result.getLeft() == Util.GuiHelper.GuiType.ITEM) {
|
||||
ItemStack item = player.getHeldItem();
|
||||
ItemStack item = Util.getWirelessTerminal(player, x);
|
||||
if (item == null || !(item.getItem() instanceof IItemInventory)) {
|
||||
return null;
|
||||
}
|
||||
@@ -63,7 +62,7 @@ public abstract class PartOrItemGuiFactory<T> extends PartGuiFactory<T> {
|
||||
public Object createClientGui(EntityPlayer player, World world, int x, int y, int z, ForgeDirection face) {
|
||||
ImmutablePair<Util.GuiHelper.GuiType, Integer> result = Util.GuiHelper.decodeType(y);
|
||||
if (result.left == Util.GuiHelper.GuiType.ITEM) {
|
||||
ItemStack item = player.getHeldItem();
|
||||
ItemStack item = Util.getWirelessTerminal(player, x);
|
||||
if (item == null || !(item.getItem() instanceof IItemInventory)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -35,4 +35,8 @@ public interface IItemPatternTerminal extends IItemTerminal {
|
||||
boolean isCraftingRecipe();
|
||||
|
||||
void sortCraftingItems();
|
||||
|
||||
boolean isAutoFillPattern();
|
||||
|
||||
void setAutoFillPattern(boolean canFill);
|
||||
}
|
||||
@@ -1,4 +1,10 @@
|
||||
package com.glodblock.github.inventory.item;
|
||||
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
public interface IWirelessInterfaceTerminal extends IWirelessTerminal {
|
||||
|
||||
void setClickedInterface(Util.DimensionalCoordSide tile);
|
||||
|
||||
Util.DimensionalCoordSide getClickedInterface();
|
||||
}
|
||||
+1
@@ -95,6 +95,7 @@ public class WirelessCraftingTerminalInventory extends MEMonitorHandler<IAEItemS
|
||||
out.registerSetting(Settings.SORT_BY, SortOrder.NAME);
|
||||
out.registerSetting(Settings.VIEW_MODE, ViewItems.ALL);
|
||||
out.registerSetting(Settings.SORT_DIRECTION, SortDir.ASCENDING);
|
||||
out.registerSetting(Settings.TYPE_FILTER, TypeFilter.ALL);
|
||||
out.readFromNBT((NBTTagCompound) Platform.openNbtData(this.target).copy());
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -88,6 +88,7 @@ public class WirelessFluidTerminalInventory extends MEMonitorHandler<IAEFluidSta
|
||||
out.registerSetting(Settings.VIEW_MODE, ViewItems.ALL);
|
||||
out.registerSetting(Settings.SORT_DIRECTION, SortDir.ASCENDING);
|
||||
out.readFromNBT((NBTTagCompound) Platform.openNbtData(this.target).copy());
|
||||
out.putSetting(Settings.VIEW_MODE, ViewItems.ALL);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
+34
@@ -1,5 +1,7 @@
|
||||
package com.glodblock.github.inventory.item;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -10,6 +12,7 @@ import appeng.api.config.*;
|
||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
@@ -19,18 +22,38 @@ import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.ConfigManager;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
public class WirelessInterfaceTerminalInventory implements IWirelessInterfaceTerminal {
|
||||
|
||||
private final ItemStack target;
|
||||
private final IAEItemPowerStorage ips;
|
||||
private final int inventorySlot;
|
||||
private final IGridNode grid;
|
||||
private Util.DimensionalCoordSide tile;
|
||||
|
||||
public WirelessInterfaceTerminalInventory(ItemStack is, int slot, IGridNode gridNode, EntityPlayer player) {
|
||||
Objects.requireNonNull(Util.getWirelessInv(is, player, StorageChannel.ITEMS));
|
||||
this.ips = (ToolWirelessTerminal) is.getItem();
|
||||
this.grid = gridNode;
|
||||
this.target = is;
|
||||
this.inventorySlot = slot;
|
||||
readFromNBT();
|
||||
}
|
||||
|
||||
public void readFromNBT() {
|
||||
NBTTagCompound data = Platform.openNbtData(this.target);
|
||||
if (data.hasKey("clickedInterface")) {
|
||||
NBTTagCompound tileMsg = (NBTTagCompound) data.getTag("clickedInterface");
|
||||
this.tile = Util.DimensionalCoordSide.readFromNBT(tileMsg);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT() {
|
||||
NBTTagCompound data = Platform.openNbtData(this.target);
|
||||
NBTTagCompound tileMsg = new NBTTagCompound();
|
||||
tile.writeToNBT(tileMsg);
|
||||
data.setTag("clickedInterface", tileMsg);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,4 +131,15 @@ public class WirelessInterfaceTerminalInventory implements IWirelessInterfaceTer
|
||||
ItemStack newStack) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClickedInterface(Util.DimensionalCoordSide tile) {
|
||||
this.tile = tile;
|
||||
this.writeToNBT();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Util.DimensionalCoordSide getClickedInterface() {
|
||||
return this.tile;
|
||||
}
|
||||
}
|
||||
+16
@@ -56,6 +56,7 @@ public class WirelessPatternTerminalExInventory extends MEMonitorHandler<IAEItem
|
||||
protected boolean prioritize = false;
|
||||
protected boolean inverted = false;
|
||||
protected boolean beSubstitute = false;
|
||||
protected boolean autoFillPattern = false;
|
||||
protected int activePage = 0;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -111,6 +112,7 @@ public class WirelessPatternTerminalExInventory extends MEMonitorHandler<IAEItem
|
||||
this.setPrioritization(data.getBoolean("priorization"));
|
||||
this.setInverted(data.getBoolean("inverted"));
|
||||
this.setActivePage(data.getInteger("activePage"));
|
||||
this.setAutoFillPattern(data.getBoolean("autoFillPattern"));
|
||||
}
|
||||
|
||||
public void writeToNBT() {
|
||||
@@ -121,6 +123,7 @@ public class WirelessPatternTerminalExInventory extends MEMonitorHandler<IAEItem
|
||||
data.setBoolean("priorization", this.prioritize);
|
||||
data.setBoolean("inverted", this.inverted);
|
||||
data.setInteger("activePage", this.activePage);
|
||||
data.setBoolean("autoFillPattern", this.autoFillPattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -132,6 +135,7 @@ public class WirelessPatternTerminalExInventory extends MEMonitorHandler<IAEItem
|
||||
out.registerSetting(Settings.SORT_BY, SortOrder.NAME);
|
||||
out.registerSetting(Settings.VIEW_MODE, ViewItems.ALL);
|
||||
out.registerSetting(Settings.SORT_DIRECTION, SortDir.ASCENDING);
|
||||
out.registerSetting(Settings.TYPE_FILTER, TypeFilter.ALL);
|
||||
out.readFromNBT((NBTTagCompound) Platform.openNbtData(this.target).copy());
|
||||
this.readFromNBT();
|
||||
return out;
|
||||
@@ -323,6 +327,8 @@ public class WirelessPatternTerminalExInventory extends MEMonitorHandler<IAEItem
|
||||
public void setCraftingRecipe(boolean craftingMode) {
|
||||
this.craftingMode = craftingMode;
|
||||
this.fixCraftingRecipes();
|
||||
// force update crafting mode
|
||||
((ItemBiggerAppEngInventory) this.crafting).setCraftingMode(craftingMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -396,6 +402,16 @@ public class WirelessPatternTerminalExInventory extends MEMonitorHandler<IAEItem
|
||||
saveChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoFillPattern() {
|
||||
return this.autoFillPattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAutoFillPattern(boolean canFill) {
|
||||
this.autoFillPattern = canFill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveSettings() {
|
||||
this.writeToNBT();
|
||||
|
||||
+18
-6
@@ -56,6 +56,7 @@ public class WirelessPatternTerminalInventory extends MEMonitorHandler<IAEItemSt
|
||||
protected boolean prioritize = false;
|
||||
protected boolean inverted = false;
|
||||
protected boolean beSubstitute = false;
|
||||
protected boolean autoFillPattern = false;
|
||||
protected int activePage = 0;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -109,9 +110,8 @@ public class WirelessPatternTerminalInventory extends MEMonitorHandler<IAEItemSt
|
||||
this.setSubstitution(data.getBoolean("substitute"));
|
||||
this.setCombineMode(data.getBoolean("combine"));
|
||||
this.setBeSubstitute(data.getBoolean("beSubstitute"));
|
||||
this.setPrioritization(data.getBoolean("priorization"));
|
||||
this.setInverted(data.getBoolean("inverted"));
|
||||
this.setActivePage(data.getInteger("activePage"));
|
||||
this.setAutoFillPattern(data.getBoolean("autoFillPattern"));
|
||||
}
|
||||
|
||||
public void writeToNBT() {
|
||||
@@ -120,9 +120,8 @@ public class WirelessPatternTerminalInventory extends MEMonitorHandler<IAEItemSt
|
||||
data.setBoolean("substitute", this.substitute);
|
||||
data.setBoolean("combine", this.combine);
|
||||
data.setBoolean("beSubstitute", this.beSubstitute);
|
||||
data.setBoolean("priorization", this.prioritize);
|
||||
data.setBoolean("inverted", this.inverted);
|
||||
data.setInteger("activePage", this.activePage);
|
||||
data.setBoolean("autoFillPattern", this.autoFillPattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,6 +133,7 @@ public class WirelessPatternTerminalInventory extends MEMonitorHandler<IAEItemSt
|
||||
out.registerSetting(Settings.SORT_BY, SortOrder.NAME);
|
||||
out.registerSetting(Settings.VIEW_MODE, ViewItems.ALL);
|
||||
out.registerSetting(Settings.SORT_DIRECTION, SortDir.ASCENDING);
|
||||
out.registerSetting(Settings.TYPE_FILTER, TypeFilter.ALL);
|
||||
out.readFromNBT((NBTTagCompound) Platform.openNbtData(this.target).copy());
|
||||
this.readFromNBT();
|
||||
return out;
|
||||
@@ -239,7 +239,7 @@ public class WirelessPatternTerminalInventory extends MEMonitorHandler<IAEItemSt
|
||||
|
||||
@Override
|
||||
public boolean isInverted() {
|
||||
return this.inverted;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -266,7 +266,7 @@ public class WirelessPatternTerminalInventory extends MEMonitorHandler<IAEItemSt
|
||||
|
||||
@Override
|
||||
public boolean isPrioritize() {
|
||||
return this.prioritize;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -299,6 +299,8 @@ public class WirelessPatternTerminalInventory extends MEMonitorHandler<IAEItemSt
|
||||
public void setCraftingRecipe(boolean craftingMode) {
|
||||
this.craftingMode = craftingMode;
|
||||
this.fixCraftingRecipes();
|
||||
// force update crafting mode
|
||||
((ItemBiggerAppEngInventory) this.crafting).setCraftingMode(craftingMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -372,6 +374,16 @@ public class WirelessPatternTerminalInventory extends MEMonitorHandler<IAEItemSt
|
||||
saveChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoFillPattern() {
|
||||
return this.autoFillPattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAutoFillPattern(boolean canFill) {
|
||||
this.autoFillPattern = canFill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveSettings() {
|
||||
this.writeToNBT();
|
||||
|
||||
@@ -54,6 +54,8 @@ public class ChannelLoader implements Runnable {
|
||||
.registerMessage(new SPacketSetItemAmount.Handler(), SPacketSetItemAmount.class, id++, Side.CLIENT);
|
||||
FluidCraft.proxy.netHandler
|
||||
.registerMessage(new CPacketRenamer.Handler(), CPacketRenamer.class, id++, Side.SERVER);
|
||||
FluidCraft.proxy.netHandler
|
||||
.registerMessage(new SPacketStringUpdate.Handler(), SPacketStringUpdate.class, id++, Side.CLIENT);
|
||||
}
|
||||
|
||||
public static void sendPacketToAllPlayers(Packet packet, World world) {
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.glodblock.github.loader;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class KeybindLoader implements Runnable {
|
||||
|
||||
public static KeyBinding openTerminal;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
openTerminal = new KeyBinding("key.OpenTerminal", Keyboard.CHAR_NONE, "itemGroup.ae2fc");
|
||||
ClientRegistry.registerKeyBinding(openTerminal);
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onKeyInput(InputEvent.KeyInputEvent event) {
|
||||
if (Minecraft.getMinecraft().currentScreen != null) return;
|
||||
EntityClientPlayerMP p = Minecraft.getMinecraft().thePlayer;
|
||||
if (p.openContainer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (openTerminal.isPressed()) {
|
||||
ImmutablePair<Integer, ItemStack> term = Util.getUltraWirelessTerm(p);
|
||||
if (term != null && term.getRight().getItem() instanceof ItemWirelessUltraTerminal) {
|
||||
ItemWirelessUltraTerminal.switchTerminal(
|
||||
p,
|
||||
((ItemWirelessUltraTerminal) term.getRight().getItem()).guiGuiType(term.getRight()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.glodblock.github.loader.filter;
|
||||
|
||||
import static appeng.api.config.TypeFilter.*;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import appeng.api.config.TypeFilter;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.client.me.ItemRepo;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
|
||||
public class FluidFilter {
|
||||
|
||||
public static void installFilter() {
|
||||
ItemRepo.registerTypeHandler(FluidFilter::filter, FLUIDS);
|
||||
}
|
||||
|
||||
private static boolean filter(IAEStack<?> stack, TypeFilter typeFilter) {
|
||||
if (stack instanceof IAEItemStack) {
|
||||
Item item = ((IAEItemStack) stack).getItem();
|
||||
if (item != null) {
|
||||
switch (typeFilter) {
|
||||
case ITEMS:
|
||||
return !(item instanceof ItemFluidDrop);
|
||||
case FLUIDS:
|
||||
return item instanceof ItemFluidDrop;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.glodblock.github.nei;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -43,24 +41,11 @@ public class NEIUtils {
|
||||
}
|
||||
|
||||
public static List<OrderStack<?>> clearNull(List<OrderStack<?>> list) {
|
||||
List<OrderStack<?>> cleared = new LinkedList<>();
|
||||
HashMap<Integer, Object> map = new HashMap<>();
|
||||
int upper = 0;
|
||||
for (OrderStack<?> orderStack : list) {
|
||||
if (orderStack != null && orderStack.getStack() != null) {
|
||||
if (orderStack.getStack() instanceof ItemStack && ((ItemStack) orderStack.getStack()).stackSize == 0)
|
||||
continue;
|
||||
map.put(orderStack.getIndex(), orderStack.getStack());
|
||||
upper = Math.max(upper, orderStack.getIndex());
|
||||
}
|
||||
}
|
||||
int id = 0;
|
||||
for (int i = 0; i <= upper; i++) {
|
||||
if (map.containsKey(i)) {
|
||||
cleared.add(new OrderStack<>(map.get(i), id));
|
||||
id++;
|
||||
}
|
||||
}
|
||||
return cleared;
|
||||
AtomicInteger i = new AtomicInteger(0);
|
||||
return list.stream().filter(Objects::nonNull)
|
||||
.filter(
|
||||
orderStack -> !(orderStack.getStack() != null && orderStack.getStack() instanceof ItemStack
|
||||
&& ((ItemStack) orderStack.getStack()).stackSize == 0))
|
||||
.peek(orderStack -> orderStack.setIndex(i.getAndIncrement())).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import codechicken.nei.api.IConfigureNEI;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.*;
|
||||
import com.glodblock.github.nei.recipes.FluidRecipe;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
public class NEI_FC_Config implements IConfigureNEI {
|
||||
|
||||
@@ -13,27 +14,46 @@ public class NEI_FC_Config implements IConfigureNEI {
|
||||
public void loadConfig() {
|
||||
API.registerNEIGuiHandler(new NEIGuiHandler());
|
||||
API.addSearchProvider(new NEIItemFilter());
|
||||
|
||||
if (ModAndClassUtil.AVARITIA) {
|
||||
API.registerGuiOverlay(GuiFluidPatternWireless.class, "extreme", null);
|
||||
API.registerGuiOverlay(GuiFluidPatternExWireless.class, "extreme", null);
|
||||
API.registerGuiOverlay(GuiFluidPatternTerminal.class, "extreme", null);
|
||||
API.registerGuiOverlay(GuiFluidPatternTerminalEx.class, "extreme", null);
|
||||
}
|
||||
|
||||
for (String identifier : FluidRecipe.getSupportRecipes()) {
|
||||
API.registerGuiOverlayHandler(
|
||||
GuiFluidCraftingWireless.class,
|
||||
FluidCraftingTransferHandler.INSTANCE,
|
||||
identifier);
|
||||
API.registerGuiOverlayHandler(
|
||||
GuiFluidPatternWireless.class,
|
||||
FluidPatternTerminalRecipeTransferHandler.INSTANCE,
|
||||
identifier);
|
||||
API.registerGuiOverlayHandler(
|
||||
GuiFluidPatternExWireless.class,
|
||||
FluidPatternTerminalRecipeTransferHandler.INSTANCE,
|
||||
identifier);
|
||||
API.registerGuiOverlayHandler(
|
||||
GuiFluidPatternTerminal.class,
|
||||
FluidPatternTerminalRecipeTransferHandler.INSTANCE,
|
||||
identifier);
|
||||
API.registerGuiOverlayHandler(
|
||||
GuiFluidPatternTerminalEx.class,
|
||||
FluidPatternTerminalRecipeTransferHandler.INSTANCE,
|
||||
identifier);
|
||||
// that NEE handlers take priority
|
||||
if (!API.hasGuiOverlayHandler(GuiFluidCraftingWireless.class, identifier)) {
|
||||
API.registerGuiOverlayHandler(
|
||||
GuiFluidCraftingWireless.class,
|
||||
FluidCraftingTransferHandler.INSTANCE,
|
||||
identifier);
|
||||
}
|
||||
if (!API.hasGuiOverlayHandler(GuiFluidPatternWireless.class, identifier)) {
|
||||
API.registerGuiOverlayHandler(
|
||||
GuiFluidPatternWireless.class,
|
||||
FluidPatternTerminalRecipeTransferHandler.INSTANCE,
|
||||
identifier);
|
||||
}
|
||||
if (!API.hasGuiOverlayHandler(GuiFluidPatternExWireless.class, identifier)) {
|
||||
API.registerGuiOverlayHandler(
|
||||
GuiFluidPatternExWireless.class,
|
||||
FluidPatternTerminalRecipeTransferHandler.INSTANCE,
|
||||
identifier);
|
||||
}
|
||||
if (!API.hasGuiOverlayHandler(GuiFluidPatternTerminal.class, identifier)) {
|
||||
API.registerGuiOverlayHandler(
|
||||
GuiFluidPatternTerminal.class,
|
||||
FluidPatternTerminalRecipeTransferHandler.INSTANCE,
|
||||
identifier);
|
||||
}
|
||||
if (!API.hasGuiOverlayHandler(GuiFluidPatternTerminalEx.class, identifier)) {
|
||||
API.registerGuiOverlayHandler(
|
||||
GuiFluidPatternTerminalEx.class,
|
||||
FluidPatternTerminalRecipeTransferHandler.INSTANCE,
|
||||
identifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.glodblock.github.nei.object;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
@@ -15,7 +19,8 @@ import com.glodblock.github.util.Util;
|
||||
public class OrderStack<T> {
|
||||
|
||||
private T RealStack;
|
||||
private final int index;
|
||||
private int index;
|
||||
private ItemStack[] items;
|
||||
|
||||
public static final int ITEM = 1;
|
||||
public static final int FLUID = 2;
|
||||
@@ -28,10 +33,29 @@ public class OrderStack<T> {
|
||||
this.index = order;
|
||||
}
|
||||
|
||||
public OrderStack(T stack, int order, ItemStack[] items) {
|
||||
this(stack, order);
|
||||
if (items.length > 1) {
|
||||
this.items = items;
|
||||
}
|
||||
}
|
||||
|
||||
public void putStack(T stack) {
|
||||
this.RealStack = stack;
|
||||
}
|
||||
|
||||
public void putItems(ItemStack[] items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public ItemStack[] getItems() {
|
||||
return this.items;
|
||||
}
|
||||
|
||||
public final void setIndex(int i) {
|
||||
this.index = i;
|
||||
}
|
||||
|
||||
public T getStack() {
|
||||
return RealStack;
|
||||
}
|
||||
@@ -71,6 +95,16 @@ public class OrderStack<T> {
|
||||
NBTTagCompound tmp = new NBTTagCompound();
|
||||
tmp.setByte("t", (byte) ITEM);
|
||||
((ItemStack) RealStack).writeToNBT(tmp);
|
||||
// replacement items
|
||||
if (items != null) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
for (ItemStack is : this.items) {
|
||||
NBTTagCompound t = new NBTTagCompound();
|
||||
is.writeToNBT(t);
|
||||
list.appendTag(t);
|
||||
}
|
||||
tmp.setTag(index + ":", list);
|
||||
}
|
||||
buf.setTag(index + ":", tmp);
|
||||
} else if (RealStack instanceof FluidStack) {
|
||||
NBTTagCompound tmp = new NBTTagCompound();
|
||||
@@ -91,7 +125,15 @@ public class OrderStack<T> {
|
||||
byte id = info.getByte("t");
|
||||
switch (id) {
|
||||
case ITEM:
|
||||
return new OrderStack<>(ItemStack.loadItemStackFromNBT(info), index);
|
||||
List<ItemStack> list = new ArrayList<>();
|
||||
if (info.hasKey(index + ":")) {
|
||||
NBTTagList items = info.getTagList(index + ":", 10);
|
||||
for (int x = 0; x < items.tagCount(); x++) {
|
||||
final NBTTagCompound item = items.getCompoundTagAt(x);
|
||||
list.add(ItemStack.loadItemStackFromNBT(item));
|
||||
}
|
||||
}
|
||||
return new OrderStack<>(ItemStack.loadItemStackFromNBT(info), index, list.toArray(new ItemStack[0]));
|
||||
case FLUID:
|
||||
return new OrderStack<>(FluidStack.loadFluidStackFromNBT(info), index);
|
||||
case CUSTOM:
|
||||
|
||||
@@ -50,6 +50,10 @@ public class DefaultExtractorLoader implements Runnable {
|
||||
FluidRecipe.addRecipeMap("EnderIOVat", new EnderIORecipeExtractor());
|
||||
}
|
||||
|
||||
if (ModAndClassUtil.AVARITIA) {
|
||||
FluidRecipe.addRecipeMap("extreme", new AvaritiaRecipeExtractor());
|
||||
}
|
||||
|
||||
if (ModAndClassUtil.FTR) {
|
||||
// GTNH
|
||||
FluidRecipe.addRecipeMap("forestry.bottler", new ForestryRecipeExtractor(new NEIHandlerBottler()));
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.glodblock.github.nei.recipes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -30,7 +28,8 @@ public final class FluidRecipe {
|
||||
|
||||
public static List<OrderStack<?>> getPackageInputs(IRecipeHandler recipe, int index, boolean priority) {
|
||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
||||
if (tRecipe == null || !IdentifierMap.containsKey(tRecipe.getOverlayIdentifier())) return new ArrayList<>();
|
||||
if (tRecipe == null) return new ArrayList<>();
|
||||
if (!IdentifierMap.containsKey(tRecipe.getOverlayIdentifier())) return getDefaultPackageInputs(tRecipe, index);
|
||||
if (tRecipe.getOverlayIdentifier() == null) return getPackageInputsLegacy(recipe, index);
|
||||
IRecipeExtractor extractor = IdentifierMap.get(tRecipe.getOverlayIdentifier());
|
||||
if (extractor == null) return new ArrayList<>();
|
||||
@@ -54,9 +53,26 @@ public final class FluidRecipe {
|
||||
return out;
|
||||
}
|
||||
|
||||
private static List<OrderStack<?>> getDefaultPackageInputs(TemplateRecipeHandler tRecipe, int index) {
|
||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||
AtomicInteger i = new AtomicInteger(0);
|
||||
tRecipe.getIngredientStacks(index)
|
||||
.forEach(ps -> tmp.add(new OrderStack<>(ps.item, i.getAndIncrement(), ps.items)));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
private static List<OrderStack<?>> getDefaultPackageOutputs(TemplateRecipeHandler tRecipe, int index) {
|
||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||
AtomicInteger i = new AtomicInteger(0);
|
||||
tmp.add(new OrderStack<>(tRecipe.getResultStack(index).item, i.getAndIncrement()));
|
||||
tRecipe.getOtherStacks(index).forEach(ps -> tmp.add(new OrderStack<>(ps.item, i.getAndIncrement())));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
public static List<OrderStack<?>> getPackageOutputs(IRecipeHandler recipe, int index, boolean useOther) {
|
||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
||||
if (tRecipe == null || !IdentifierMap.containsKey(tRecipe.getOverlayIdentifier())) return new ArrayList<>();
|
||||
if (tRecipe == null) return new ArrayList<>();
|
||||
if (!IdentifierMap.containsKey(tRecipe.getOverlayIdentifier())) return getDefaultPackageOutputs(tRecipe, index);
|
||||
if (tRecipe.getOverlayIdentifier() == null) return getPackageOutputsLegacy(recipe, index, useOther);
|
||||
IRecipeExtractor extractor = IdentifierMap.get(tRecipe.getOverlayIdentifier());
|
||||
if (extractor == null) return new ArrayList<>();
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.glodblock.github.nei.recipes.extractor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import com.glodblock.github.nei.NEIUtils;
|
||||
import com.glodblock.github.nei.object.IRecipeExtractor;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
|
||||
public class AvaritiaRecipeExtractor implements IRecipeExtractor {
|
||||
|
||||
public AvaritiaRecipeExtractor() {}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs, IRecipeHandler recipe, int index) {
|
||||
return getInputIngredients(rawInputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs, IRecipeHandler recipe,
|
||||
int index) {
|
||||
return getOutputIngredients(rawOutputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||
return NEIUtils.compress(ExtractorUtil.packItemStack(rawInputs));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||
return ExtractorUtil.packItemStack(rawOutputs);
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public final class ExtractorUtil {
|
||||
return items.stream().map(item -> {
|
||||
index.getAndIncrement();
|
||||
Object o = transformer.apply(item);
|
||||
return o != null ? new OrderStack<>(o, index.get()) : null;
|
||||
return o != null ? new OrderStack<>(o, index.get(), item.items) : null;
|
||||
}).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import appeng.core.AELog;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidCraftConfirm;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
@@ -97,11 +98,11 @@ public class CPacketCraftRequest implements IMessage {
|
||||
new BlockPos(te),
|
||||
Objects.requireNonNull(context.getSide()),
|
||||
GuiType.FLUID_CRAFTING_CONFIRM);
|
||||
} else {
|
||||
} else if (target instanceof IWirelessTerminal) {
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
player.worldObj,
|
||||
new BlockPos(player.inventory.currentItem, 0, 0),
|
||||
new BlockPos(((IWirelessTerminal) target).getInventorySlot(), 0, 0),
|
||||
Objects.requireNonNull(context.getSide()),
|
||||
GuiType.FLUID_CRAFTING_CONFIRM_ITEM);
|
||||
}
|
||||
|
||||
@@ -116,6 +116,9 @@ public class CPacketFluidPatternTermBtns implements IMessage {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "PatternTerminal.AutoFillerPattern":
|
||||
cpt.getPatternTerminal().setAutoFillPattern(Value.equals("1"));
|
||||
break;
|
||||
}
|
||||
cpt.getPatternTerminal().saveSettings();
|
||||
} else if (Name.equals("Terminal.Cpu") && c instanceof ContainerFluidCraftConfirm) {
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.glodblock.github.client.gui.container.ContainerPatternValueAmount;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
@@ -94,6 +95,7 @@ public class CPacketInventoryAction implements IMessage {
|
||||
final EntityPlayerMP sender = ctx.getServerHandler().playerEntity;
|
||||
if (sender.openContainer instanceof AEBaseContainer) {
|
||||
final AEBaseContainer baseContainer = (AEBaseContainer) sender.openContainer;
|
||||
Object target = baseContainer.getTarget();
|
||||
if (message.action == InventoryAction.AUTO_CRAFT) {
|
||||
final ContainerOpenContext context = baseContainer.getOpenContext();
|
||||
if (context != null) {
|
||||
@@ -105,12 +107,12 @@ public class CPacketInventoryAction implements IMessage {
|
||||
new BlockPos(te),
|
||||
Objects.requireNonNull(baseContainer.getOpenContext().getSide()),
|
||||
GuiType.FLUID_CRAFTING_AMOUNT);
|
||||
} else {
|
||||
} else if (target instanceof IWirelessTerminal) {
|
||||
InventoryHandler.openGui(
|
||||
sender,
|
||||
sender.worldObj,
|
||||
new BlockPos(
|
||||
sender.inventory.currentItem,
|
||||
((IWirelessTerminal) target).getInventorySlot(),
|
||||
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
|
||||
0),
|
||||
ForgeDirection.UNKNOWN,
|
||||
@@ -136,12 +138,12 @@ public class CPacketInventoryAction implements IMessage {
|
||||
new BlockPos(te),
|
||||
Objects.requireNonNull(baseContainer.getOpenContext().getSide()),
|
||||
GuiType.PATTERN_VALUE_SET);
|
||||
} else {
|
||||
} else if (target instanceof IWirelessTerminal) {
|
||||
InventoryHandler.openGui(
|
||||
sender,
|
||||
sender.worldObj,
|
||||
new BlockPos(
|
||||
sender.inventory.currentItem,
|
||||
((IWirelessTerminal) target).getInventorySlot(),
|
||||
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
|
||||
0),
|
||||
ForgeDirection.UNKNOWN,
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.gui.PartOrItemGuiFactory;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
@@ -85,11 +86,11 @@ public class CPacketPatternValueSet implements IMessage {
|
||||
0),
|
||||
Objects.requireNonNull(context.getSide()),
|
||||
message.originGui);
|
||||
} else {
|
||||
} else if (target instanceof IWirelessTerminal) {
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
player.worldObj,
|
||||
new BlockPos(player.inventory.currentItem, 0, 0),
|
||||
new BlockPos(((IWirelessTerminal) target).getInventorySlot(), 0, 0),
|
||||
Objects.requireNonNull(context.getSide()),
|
||||
message.originGui);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
package com.glodblock.github.network;
|
||||
|
||||
import static com.glodblock.github.common.item.ItemWirelessUltraTerminal.getGuis;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.util.Platform;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.helpers.ICustomNameObject;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessInterfaceTerminal;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
@@ -19,10 +30,28 @@ public class CPacketRenamer implements IMessage {
|
||||
private int z;
|
||||
private int dim;
|
||||
private ForgeDirection side;
|
||||
private Action action;
|
||||
private String text;
|
||||
|
||||
public enum Action {
|
||||
OPEN,
|
||||
GET_TEXT,
|
||||
SET_TEXT,
|
||||
}
|
||||
|
||||
public CPacketRenamer() {}
|
||||
|
||||
public CPacketRenamer(String text) {
|
||||
this.action = Action.SET_TEXT;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public CPacketRenamer(Action a) {
|
||||
this.action = a;
|
||||
}
|
||||
|
||||
public CPacketRenamer(int x, int y, int z, int dim, ForgeDirection side) {
|
||||
this.action = Action.OPEN;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
@@ -32,31 +61,114 @@ public class CPacketRenamer implements IMessage {
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
this.x = buf.readInt();
|
||||
this.y = buf.readInt();
|
||||
this.z = buf.readInt();
|
||||
this.dim = buf.readInt();
|
||||
this.side = ForgeDirection.getOrientation(buf.readInt());
|
||||
this.action = Action.values()[buf.readInt()];
|
||||
if (this.action == Action.OPEN) {
|
||||
this.x = buf.readInt();
|
||||
this.y = buf.readInt();
|
||||
this.z = buf.readInt();
|
||||
this.dim = buf.readInt();
|
||||
this.side = ForgeDirection.getOrientation(buf.readInt());
|
||||
} else if (this.action == Action.SET_TEXT) {
|
||||
int leName = buf.readInt();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < leName; i++) {
|
||||
sb.append(buf.readChar());
|
||||
}
|
||||
this.text = sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeInt(this.x);
|
||||
buf.writeInt(this.y);
|
||||
buf.writeInt(this.z);
|
||||
buf.writeInt(this.dim);
|
||||
buf.writeInt(side.ordinal());
|
||||
buf.writeInt(this.action.ordinal());
|
||||
if (this.action == Action.OPEN) {
|
||||
buf.writeInt(this.x);
|
||||
buf.writeInt(this.y);
|
||||
buf.writeInt(this.z);
|
||||
buf.writeInt(this.dim);
|
||||
buf.writeInt(side.ordinal());
|
||||
} else if (this.action == Action.SET_TEXT) {
|
||||
buf.writeInt(this.text.length());
|
||||
for (int i = 0; i < this.text.length(); i++) {
|
||||
buf.writeChar(this.text.charAt(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<CPacketRenamer, IMessage> {
|
||||
|
||||
private String getName(TileEntity tile, ForgeDirection side) {
|
||||
if (tile instanceof TileCableBus) {
|
||||
return ((ICustomNameObject) ((TileCableBus) tile).getPart(side)).getCustomName();
|
||||
} else {
|
||||
return ((ICustomNameObject) tile).getCustomName();
|
||||
}
|
||||
}
|
||||
|
||||
private void setName(TileEntity tile, ForgeDirection side, String text) {
|
||||
if (tile instanceof TileCableBus) {
|
||||
((ICustomNameObject) ((TileCableBus) tile).getPart(side)).setCustomName(text);
|
||||
} else {
|
||||
((ICustomNameObject) tile).setCustomName(text);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(CPacketRenamer message, MessageContext ctx) {
|
||||
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||
TileEntity tile = DimensionManager.getWorld(message.dim).getTileEntity(message.x, message.y, message.z);
|
||||
if (tile != null) {
|
||||
Platform.openGUI(player, tile, message.side, GuiBridge.GUI_RENAMER);
|
||||
AEBaseContainer con = (AEBaseContainer) player.openContainer;
|
||||
TileEntity tile;
|
||||
if (message.action == Action.OPEN) {
|
||||
tile = DimensionManager.getWorld(message.dim).getTileEntity(message.x, message.y, message.z);
|
||||
if (tile != null && con.getTarget() instanceof IWirelessInterfaceTerminal
|
||||
&& tile instanceof ICustomNameObject) {
|
||||
String name = getName(tile, message.side);
|
||||
((IWirelessInterfaceTerminal) con.getTarget()).setClickedInterface(
|
||||
new Util.DimensionalCoordSide(
|
||||
message.x,
|
||||
message.y,
|
||||
message.z,
|
||||
message.dim,
|
||||
message.side,
|
||||
name));
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
player.worldObj,
|
||||
new BlockPos(
|
||||
((IWirelessInterfaceTerminal) con.getTarget()).getInventorySlot(),
|
||||
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
|
||||
1),
|
||||
message.side,
|
||||
GuiType.RENAMER);
|
||||
}
|
||||
} else {
|
||||
if (con.getTarget() instanceof IWirelessInterfaceTerminal) {
|
||||
Util.DimensionalCoordSide intMsg = ((IWirelessInterfaceTerminal) con.getTarget())
|
||||
.getClickedInterface();
|
||||
tile = DimensionManager.getWorld(intMsg.getDimension()).getTileEntity(intMsg.x, intMsg.y, intMsg.z);
|
||||
if (message.action == Action.GET_TEXT) {
|
||||
FluidCraft.proxy.netHandler
|
||||
.sendTo(new SPacketStringUpdate(this.getName(tile, intMsg.getSide())), player);
|
||||
} else {
|
||||
this.setName(tile, intMsg.getSide(), message.text);
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
player.worldObj,
|
||||
new BlockPos(
|
||||
((IWirelessInterfaceTerminal) con.getTarget()).getInventorySlot(),
|
||||
Util.GuiHelper.encodeType(
|
||||
getGuis().indexOf(
|
||||
GuiType.valueOf(
|
||||
GuiType.WIRELESS_INTERFACE_TERMINAL.toString())),
|
||||
Util.GuiHelper.GuiType.ITEM),
|
||||
0),
|
||||
ForgeDirection.UNKNOWN,
|
||||
GuiType.WIRELESS_INTERFACE_TERMINAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import appeng.container.ContainerOpenContext;
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
@@ -84,12 +85,12 @@ public class CPacketSwitchGuis implements IMessage {
|
||||
new BlockPos(te),
|
||||
Objects.requireNonNull(context.getSide()),
|
||||
message.guiType);
|
||||
} else {
|
||||
} else if (((AEBaseContainer) cont).getTarget() instanceof IWirelessTerminal) {
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
player.worldObj,
|
||||
new BlockPos(
|
||||
player.inventory.currentItem,
|
||||
((IWirelessTerminal) ((AEBaseContainer) cont).getTarget()).getInventorySlot(),
|
||||
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
|
||||
0),
|
||||
Objects.requireNonNull(context.getSide()),
|
||||
|
||||
@@ -12,8 +12,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
|
||||
@@ -97,12 +96,10 @@ public class CPacketTransferRecipe implements IMessage {
|
||||
public IMessage onMessage(CPacketTransferRecipe message, MessageContext ctx) {
|
||||
Container c = ctx.getServerHandler().playerEntity.openContainer;
|
||||
if (c instanceof ContainerItemMonitor) {
|
||||
ITerminalHost host = ((ContainerItemMonitor) c).getHost();
|
||||
IItemList<IAEItemStack> storageList;
|
||||
if (host != null) {
|
||||
storageList = host.getItemInventory().getStorageList();
|
||||
} else {
|
||||
storageList = AEApi.instance().storage().createItemList();
|
||||
IMEMonitor<IAEItemStack> monitor = ((ContainerItemMonitor) c).getMonitor();
|
||||
IItemList<IAEItemStack> storageList = AEApi.instance().storage().createItemList();
|
||||
if (monitor != null) {
|
||||
storageList = monitor.getStorageList();
|
||||
}
|
||||
if (c instanceof FCContainerEncodeTerminal) {
|
||||
// pattern terminal only
|
||||
@@ -130,16 +127,15 @@ public class CPacketTransferRecipe implements IMessage {
|
||||
// using exists item to fill slot
|
||||
if (message.shift && !storageList.isEmpty()) {
|
||||
for (OrderStack stack : message.inputs) {
|
||||
if (stack.getStack() instanceof FluidStack) continue;
|
||||
ItemStack is = (ItemStack) stack.getStack();
|
||||
IAEItemStack iaeItemStack = AEApi.instance().storage().createItemStack(is);
|
||||
if (stack.getStack() instanceof FluidStack || stack.getItems() == null) continue;
|
||||
IAEItemStack iaeItemStack = AEApi.instance().storage()
|
||||
.createItemStack((ItemStack) stack.getStack());
|
||||
if (storageList.findPrecise(iaeItemStack) == null) {
|
||||
for (IAEItemStack tmp : storageList.findFuzzy(iaeItemStack, FuzzyMode.IGNORE_ALL)) {
|
||||
if (iaeItemStack.sameOre(tmp)) {
|
||||
ItemStack substitute = tmp.getItemStack().copy();
|
||||
substitute.stackSize = is.stackSize;
|
||||
stack.putStack(substitute);
|
||||
break;
|
||||
// try to replace item
|
||||
for (ItemStack replaceItemStack : stack.getItems()) {
|
||||
if (storageList.findPrecise(
|
||||
AEApi.instance().storage().createItemStack(replaceItemStack)) != null) {
|
||||
stack.putStack(replaceItemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.glodblock.github.network;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
import com.glodblock.github.client.gui.*;
|
||||
|
||||
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;
|
||||
|
||||
public class SPacketStringUpdate implements IMessage {
|
||||
|
||||
private String text;
|
||||
private int slot;
|
||||
|
||||
public SPacketStringUpdate() {}
|
||||
|
||||
public SPacketStringUpdate(String text, int slot) {
|
||||
this.text = text;
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
public SPacketStringUpdate(String text) {
|
||||
this.text = text;
|
||||
this.slot = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
this.slot = buf.readInt();
|
||||
int leName = buf.readInt();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < leName; i++) {
|
||||
sb.append(buf.readChar());
|
||||
}
|
||||
this.text = sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeInt(this.slot);
|
||||
buf.writeInt(this.text.length());
|
||||
for (int i = 0; i < this.text.length(); i++) {
|
||||
buf.writeChar(this.text.charAt(i));
|
||||
}
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<SPacketStringUpdate, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(SPacketStringUpdate message, MessageContext ctx) {
|
||||
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
|
||||
if (gs instanceof GuiRenamer) {
|
||||
((GuiRenamer) gs).postUpdate(message.text);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.glodblock.github.proxy;
|
||||
|
||||
import com.glodblock.github.loader.KeybindLoader;
|
||||
import com.glodblock.github.loader.ListenerLoader;
|
||||
import com.glodblock.github.loader.RenderLoader;
|
||||
import com.glodblock.github.nei.recipes.DefaultExtractorLoader;
|
||||
@@ -21,6 +22,7 @@ public class ClientProxy extends CommonProxy {
|
||||
super.init(event);
|
||||
(new ListenerLoader()).run();
|
||||
(new RenderLoader()).run();
|
||||
(new KeybindLoader()).run();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,7 +16,9 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.implementations.ContainerUpgradeable;
|
||||
import appeng.container.implementations.CraftingCPURecord;
|
||||
import appeng.crafting.MECraftingInventory;
|
||||
import appeng.helpers.DualityInterface;
|
||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.me.storage.MEInventoryHandler;
|
||||
import appeng.me.storage.MEPassThrough;
|
||||
import appeng.parts.p2p.PartP2PLiquids;
|
||||
@@ -35,6 +37,7 @@ public class Ae2Reflect {
|
||||
private static final Field fCPU_inventory;
|
||||
private static final Field fCPU_machineSrc;
|
||||
private static final Field fContainerUpgradeable_upgradeable;
|
||||
private static final Field fDualInterface_gridProxy;
|
||||
private static final Method mItemSlot_setExtractable;
|
||||
private static final Method mCPU_getGrid;
|
||||
private static final Method mCPU_postChange;
|
||||
@@ -54,6 +57,7 @@ public class Ae2Reflect {
|
||||
fCPU_machineSrc = Ae2Reflect.reflectField(CraftingCPUCluster.class, "machineSrc");
|
||||
fContainerUpgradeable_upgradeable = Ae2Reflect.reflectField(ContainerUpgradeable.class, "upgradeable");
|
||||
mItemSlot_setExtractable = reflectMethod(ItemSlot.class, "setExtractable", boolean.class);
|
||||
fDualInterface_gridProxy = reflectField(DualityInterface.class, "gridProxy");
|
||||
mCPU_getGrid = reflectMethod(CraftingCPUCluster.class, "getGrid");
|
||||
mCPU_postChange = reflectMethod(
|
||||
CraftingCPUCluster.class,
|
||||
@@ -164,6 +168,10 @@ public class Ae2Reflect {
|
||||
return Ae2Reflect.readField(owner, fContainerUpgradeable_upgradeable);
|
||||
}
|
||||
|
||||
public static AENetworkProxy getInterfaceProxy(DualityInterface owner) {
|
||||
return Ae2Reflect.readField(owner, fDualInterface_gridProxy);
|
||||
}
|
||||
|
||||
public static void postCPUChange(CraftingCPUCluster cpu, IAEItemStack stack, MachineSource src) {
|
||||
try {
|
||||
mCPU_postChange.invoke(cpu, stack, src);
|
||||
|
||||
@@ -40,6 +40,10 @@ public class BlockPos {
|
||||
return new BlockPos(this.x + face.offsetX, this.y + face.offsetY, this.z + face.offsetZ, this.w);
|
||||
}
|
||||
|
||||
public BlockPos getOffSet(int x, int y, int z) {
|
||||
return new BlockPos(this.x + x, this.y + y, this.z + z, this.w);
|
||||
}
|
||||
|
||||
public TileEntity getTileEntity() {
|
||||
if (w != null) {
|
||||
return w.getTileEntity(x, y, z);
|
||||
|
||||
@@ -25,7 +25,9 @@ public final class ModAndClassUtil {
|
||||
public static boolean COFH = false;
|
||||
public static boolean GTPP = false;
|
||||
public static boolean WAILA = false;
|
||||
public static boolean AVARITIA = false;
|
||||
public static boolean isV2;
|
||||
public static boolean isTypeFilter;
|
||||
public static boolean isDoubleButton;
|
||||
public static boolean isSaveText;
|
||||
public static boolean isSearchStringTooltip;
|
||||
@@ -110,6 +112,13 @@ public final class ModAndClassUtil {
|
||||
} catch (ClassNotFoundException e) {
|
||||
isV2 = false;
|
||||
}
|
||||
try {
|
||||
Field filters = Class.forName("appeng.client.me.ItemRepo").getDeclaredField("filters");
|
||||
if (filters == null) isTypeFilter = false;
|
||||
isTypeFilter = true;
|
||||
} catch (ClassNotFoundException | NoSuchFieldException e) {
|
||||
isTypeFilter = false;
|
||||
}
|
||||
|
||||
try {
|
||||
essentiaGas = Class.forName("thaumicenergistics.common.fluids.GaseousEssentia");
|
||||
@@ -130,5 +139,6 @@ public final class ModAndClassUtil {
|
||||
if (Loader.isModLoaded("CoFHCore")) COFH = true;
|
||||
if (Loader.isModLoaded("miscutils")) GTPP = true;
|
||||
if (Loader.isModLoaded("Waila")) WAILA = true;
|
||||
if (Loader.isModLoaded("Avaritia")) AVARITIA = true;
|
||||
}
|
||||
}
|
||||
@@ -85,6 +85,8 @@ public class NameConst {
|
||||
public static final String TT_WIRELESS_INSTALLED = TT_WIRELESS + "installed";
|
||||
public static final String TT_FLUID_AUTO_FILLER = TT_KEY + "fluid_auto_filler";
|
||||
public static final String TT_ULTRA_TERMINAL = TT_KEY + "ultra_terminal";
|
||||
public static final String TT_ULTRA_TERMINAL_TIPS = TT_ULTRA_TERMINAL + ".tips";
|
||||
public static final String TT_ULTRA_TERMINAL_TIPS_DESC = TT_ULTRA_TERMINAL_TIPS + ".desc";
|
||||
|
||||
public static final String WAILA_KEY = FluidCraft.MODID + ".waila.";
|
||||
public static final String WAILA_ENABLE = WAILA_KEY + "enable";
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.glodblock.github.util;
|
||||
import static com.glodblock.github.common.item.ItemBaseWirelessTerminal.infinityBoosterCard;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -16,7 +18,6 @@ import net.minecraftforge.fluids.*;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.MutablePair;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
@@ -32,6 +33,7 @@ import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.items.tools.powered.ToolWirelessTerminal;
|
||||
@@ -40,10 +42,12 @@ import appeng.tile.networking.TileCableBus;
|
||||
import appeng.tile.networking.TileWireless;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
import baubles.api.BaublesApi;
|
||||
|
||||
import com.glodblock.github.common.item.ItemBaseWirelessTerminal;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import com.glodblock.github.inventory.item.IFluidPortableCell;
|
||||
|
||||
@@ -53,39 +57,30 @@ import io.netty.buffer.ByteBuf;
|
||||
|
||||
public final class Util {
|
||||
|
||||
public static class MouseHandler {
|
||||
|
||||
private static int mouse_x = 0;
|
||||
private static int mouse_y = 0;
|
||||
|
||||
public static void saveMousePos() {
|
||||
mouse_x = Mouse.getX();
|
||||
mouse_y = Mouse.getY();
|
||||
}
|
||||
|
||||
public static void loadMousePos() {
|
||||
if (mouse_x != 0 && mouse_y != 0) {
|
||||
Mouse.setCursorPosition(mouse_x, mouse_y);
|
||||
mouse_y = 0;
|
||||
mouse_x = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int drainItemPower(AEBaseContainer c, InventoryPlayer ip, int slot, int ticks, double pm,
|
||||
IFluidPortableCell wt) {
|
||||
final ItemStack currentItem = slot < 0 ? ip.getCurrentItem() : ip.getStackInSlot(slot);
|
||||
if (wt != null) {
|
||||
if (currentItem != wt.getItemStack()) {
|
||||
if (currentItem != null) {
|
||||
if (Platform.isSameItem(wt.getItemStack(), currentItem)) {
|
||||
ip.setInventorySlotContents(ip.currentItem, wt.getItemStack());
|
||||
if (slot != -1) {
|
||||
final ItemStack currentItem = getWirelessTerminal(ip.player, slot);
|
||||
if (wt != null) {
|
||||
if (currentItem != wt.getItemStack()) {
|
||||
if (currentItem != null) {
|
||||
if (Platform.isSameItem(wt.getItemStack(), currentItem)) {
|
||||
if (GuiHelper.decodeInvType(slot).getLeft() == GuiHelper.InvType.PLAYER_INV) {
|
||||
ip.setInventorySlotContents(slot, wt.getItemStack());
|
||||
} else {
|
||||
BaublesApi.getBaubles(ip.player).setInventorySlotContents(
|
||||
GuiHelper.decodeInvType(slot).getRight(),
|
||||
wt.getItemStack());
|
||||
}
|
||||
} else {
|
||||
c.setValidContainer(false);
|
||||
}
|
||||
} else {
|
||||
c.setValidContainer(false);
|
||||
}
|
||||
} else {
|
||||
c.setValidContainer(false);
|
||||
}
|
||||
} else {
|
||||
c.setValidContainer(false);
|
||||
}
|
||||
} else {
|
||||
c.setValidContainer(false);
|
||||
@@ -118,10 +113,11 @@ public final class Util {
|
||||
}
|
||||
|
||||
public static IMEInventoryHandler<?> getWirelessInv(ItemStack is, EntityPlayer player, StorageChannel channel) {
|
||||
if (Platform.isClient()) return new NullInventory<>();
|
||||
IGridNode gridNode = getWirelessGrid(is);
|
||||
if (gridNode == null) return new NullInventory<>();
|
||||
if (gridNode == null) return null;
|
||||
IGrid grid = gridNode.getGrid();
|
||||
if (grid == null) return new NullInventory<>();
|
||||
if (grid == null) return null;
|
||||
boolean canConnect = false;
|
||||
if (hasInfinityBoosterCard(is)) {
|
||||
canConnect = true;
|
||||
@@ -149,7 +145,41 @@ public final class Util {
|
||||
}
|
||||
}
|
||||
}
|
||||
return new NullInventory<>();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ItemStack getWirelessTerminal(EntityPlayer player, int x) {
|
||||
ImmutablePair<GuiHelper.InvType, Integer> result = GuiHelper.decodeInvType(x);
|
||||
if (result.getLeft() == GuiHelper.InvType.PLAYER_INV) {
|
||||
return player.inventory.getStackInSlot(result.getRight());
|
||||
} else {
|
||||
return BaublesApi.getBaubles(player).getStackInSlot(result.getRight());
|
||||
}
|
||||
}
|
||||
|
||||
public static ImmutablePair<Integer, ItemStack> getUltraWirelessTerm(EntityPlayer player) {
|
||||
int invSize = player.inventory.getSizeInventory();
|
||||
|
||||
if (invSize <= 0) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < invSize; ++i) {
|
||||
ItemStack is = player.inventory.getStackInSlot(i);
|
||||
if (is != null && is.getItem() instanceof ItemWirelessUltraTerminal) {
|
||||
return new ImmutablePair<>(i, is);
|
||||
}
|
||||
}
|
||||
IInventory handler = BaublesApi.getBaubles(player);
|
||||
if (handler != null) {
|
||||
invSize = handler.getSizeInventory();
|
||||
for (int i = 0; i < invSize; ++i) {
|
||||
ItemStack is = handler.getStackInSlot(i);
|
||||
if (is != null && is.getItem() instanceof ItemWirelessUltraTerminal) {
|
||||
return new ImmutablePair<>(GuiHelper.encodeType(i, GuiHelper.InvType.PLAYER_BAUBLES), is);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int findItemInPlayerInvSlot(EntityPlayer player, ItemStack itemStack) {
|
||||
@@ -343,6 +373,11 @@ public final class Util {
|
||||
ITEM
|
||||
}
|
||||
|
||||
public enum InvType {
|
||||
PLAYER_INV,
|
||||
PLAYER_BAUBLES
|
||||
}
|
||||
|
||||
private static final int value = 1 << 30;
|
||||
|
||||
public static int encodeType(int y, GuiType type) {
|
||||
@@ -352,6 +387,13 @@ public final class Util {
|
||||
return value | (type.ordinal() << 29) | y;
|
||||
}
|
||||
|
||||
public static int encodeType(int x, InvType type) {
|
||||
if (Math.abs(x) > (1 << 28)) {
|
||||
throw new IllegalArgumentException("out of range");
|
||||
}
|
||||
return value | (type.ordinal() << 29) | x;
|
||||
}
|
||||
|
||||
public static ImmutablePair<GuiType, Integer> decodeType(int y) {
|
||||
if (Math.abs(y) > (1 << 28)) {
|
||||
return new ImmutablePair<>(GuiType.values()[y >> 29 & 1], y - (3 << 29 & y));
|
||||
@@ -359,6 +401,14 @@ public final class Util {
|
||||
return new ImmutablePair<>(GuiType.TILE, y);
|
||||
}
|
||||
}
|
||||
|
||||
public static ImmutablePair<InvType, Integer> decodeInvType(int x) {
|
||||
if (Math.abs(x) > (1 << 28)) {
|
||||
return new ImmutablePair<>(InvType.values()[x >> 29 & 1], x - (3 << 29 & x));
|
||||
} else {
|
||||
return new ImmutablePair<>(InvType.PLAYER_INV, x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int clamp(int value, int min, int max) {
|
||||
@@ -367,6 +417,36 @@ public final class Util {
|
||||
|
||||
public static class FluidUtil {
|
||||
|
||||
public static void fluidTankInfoWriteToNBT(FluidTankInfo[] infos, NBTTagCompound data) {
|
||||
int i = 0;
|
||||
for (FluidTankInfo info : infos) {
|
||||
if (info.fluid != null && info.fluid.amount > 0) {
|
||||
NBTTagCompound fs = new NBTTagCompound();
|
||||
info.fluid.writeToNBT(fs);
|
||||
fs.setInteger("capacity", info.capacity);
|
||||
data.setTag("#" + i, fs);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
data.setInteger("fluidInvSize", i);
|
||||
}
|
||||
|
||||
public static FluidTankInfo[] fluidTankInfoReadFromNBT(NBTTagCompound data) {
|
||||
int i = 0;
|
||||
List<FluidTankInfo> infos = new ArrayList<>();
|
||||
while (data.hasKey("fluidInvSize") && i < data.getInteger("fluidInvSize")) {
|
||||
if (data.hasKey("#" + i)) {
|
||||
NBTTagCompound tag = (NBTTagCompound) data.getTag("#" + i);
|
||||
FluidStack fs = FluidStack.loadFluidStackFromNBT(tag);
|
||||
infos.add(new FluidTankInfo(fs, tag.getInteger("capacity")));
|
||||
} else {
|
||||
infos.add(new FluidTankInfo(null, 0));
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return infos.toArray(new FluidTankInfo[0]);
|
||||
}
|
||||
|
||||
public static IAEFluidStack createAEFluidStack(Fluid fluid) {
|
||||
return createAEFluidStack(new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME));
|
||||
}
|
||||
@@ -507,4 +587,43 @@ public final class Util {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static class DimensionalCoordSide extends DimensionalCoord {
|
||||
|
||||
private ForgeDirection side = ForgeDirection.UNKNOWN;
|
||||
private final String name;
|
||||
|
||||
public DimensionalCoordSide(final int _x, final int _y, final int _z, final int _dim, ForgeDirection side,
|
||||
String name) {
|
||||
super(_x, _y, _z, _dim);
|
||||
this.side = side;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ForgeDirection getSide() {
|
||||
return this.side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound data) {
|
||||
data.setInteger("side", this.side.ordinal());
|
||||
data.setString("name", this.name);
|
||||
super.writeToNBT(data);
|
||||
}
|
||||
|
||||
public static DimensionalCoordSide readFromNBT(final NBTTagCompound data) {
|
||||
return new DimensionalCoordSide(
|
||||
data.getInteger("x"),
|
||||
data.getInteger("y"),
|
||||
data.getInteger("z"),
|
||||
data.getInteger("dim"),
|
||||
ForgeDirection.getOrientation(data.getInteger("side")),
|
||||
data.getString("name"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -100,6 +100,8 @@ ae2fc.tooltip.ultra_terminal.WIRELESS_ESSENTIA_TERMINAL=Mode: Essentia Terminal
|
||||
ae2fc.tooltip.ultra_terminal.WIRELESS_INTERFACE_TERMINAL=Mode: Interface Terminal
|
||||
ae2fc.tooltip.ultra_terminal.WIRELESS_FLUID_PATTERN_TERMINAL_EX=Mode: Processing Pattern Terminal
|
||||
ae2fc.tooltip.ultra_terminal=Right click + sneaking to switch mode.
|
||||
ae2fc.tooltip.ultra_terminal.tips=ToolTips:
|
||||
ae2fc.tooltip.ultra_terminal.tips.desc=1.You can put it to baubles slot and use hotkey to open.\n2.Interface mode hold §3Shift§7 toggle interface renamer button.\n3.When you are in the crafting plan screen.\nHold §3Shift§7 click cancel button will automatically add missing items to NEI bookmark.
|
||||
|
||||
ae2fc.tooltip.cell_contents=Contains Fluid:
|
||||
ae2fc.tooltip.cell_empty=Cell is empty
|
||||
@@ -131,6 +133,10 @@ ae2fc.tooltip.submit=Submit
|
||||
ae2fc.tooltip.enable=Enabled
|
||||
ae2fc.tooltip.disable=Disabled
|
||||
ae2fc.tooltip.edit=Edit
|
||||
ae2fc.tooltip.fill_pattern=Allow auto fill blank pattern
|
||||
ae2fc.tooltip.not_fill_pattern=Allow auto fill blank pattern
|
||||
ae2fc.tooltip.fill_pattern.hint=Enabled
|
||||
ae2fc.tooltip.not_fill_pattern.hint=Disabled
|
||||
|
||||
ae2fc.gui.part_fluid_pattern_terminal=Fluid Pattern Terminal
|
||||
ae2fc.gui.part_fluid_pattern_terminal_ex=Fluid Processing Pattern Terminal
|
||||
@@ -157,4 +163,6 @@ ae2fc.gui.fluid_auto_filler=ME Fluid Auto Filler
|
||||
|
||||
error.unknown=Unknown
|
||||
|
||||
key.OpenTerminal=Open Wireless Universal Terminal
|
||||
|
||||
itemGroup.ae2fc=Fluid Craft For AE2
|
||||
@@ -64,7 +64,8 @@ tile.level_maintainer.name=ME库存维持器
|
||||
tile.fluid_buffer.name=ME流体缓存器
|
||||
tile.walrus.name=海象
|
||||
tile.fluid_auto_filler.name=ME流体自动装填器
|
||||
tile.certus_quartz_tank.name=赛特斯石英水槽
|
||||
tile.certus_quartz_tank.name=赛特斯石英水槽 - %s
|
||||
tile.certus_quartz_tank_empty.name=赛特斯石英水槽
|
||||
|
||||
ae2fc.waila.speed=速度
|
||||
ae2fc.waila.enable=启用
|
||||
@@ -99,6 +100,8 @@ ae2fc.tooltip.ultra_terminal.WIRELESS_ESSENTIA_TERMINAL=模式: 源质
|
||||
ae2fc.tooltip.ultra_terminal.WIRELESS_INTERFACE_TERMINAL=模式: 接口
|
||||
ae2fc.tooltip.ultra_terminal.WIRELESS_FLUID_PATTERN_TERMINAL_EX=模式: 增广样板
|
||||
ae2fc.tooltip.ultra_terminal=Shift右击切换模式。
|
||||
ae2fc.tooltip.ultra_terminal.tips=使用提示:
|
||||
ae2fc.tooltip.ultra_terminal.tips.desc=1.你可以把它放到饰品栏内并用热键打开.\n2.接口模式按§3Shift§7切换出接口命名按钮.\n3.当你在合成计划界面时.\n按§3Shift§7点击取消按钮会自动添加合成缺失的物品到NEI收藏栏.
|
||||
|
||||
ae2fc.tooltip.cell_contents=内含流体:
|
||||
ae2fc.tooltip.cell_empty=空存储
|
||||
@@ -130,6 +133,10 @@ ae2fc.tooltip.submit=提交
|
||||
ae2fc.tooltip.enable=启用
|
||||
ae2fc.tooltip.disable=禁用
|
||||
ae2fc.tooltip.edit=编辑
|
||||
ae2fc.tooltip.fill_pattern=允许自动填充空白样板
|
||||
ae2fc.tooltip.not_fill_pattern=允许自动填充空白样板
|
||||
ae2fc.tooltip.fill_pattern.hint=启用
|
||||
ae2fc.tooltip.not_fill_pattern.hint=禁用
|
||||
|
||||
ae2fc.gui.part_fluid_pattern_terminal=ME流体样板终端
|
||||
ae2fc.gui.part_fluid_pattern_terminal_ex=ME增广流体样板终端
|
||||
@@ -156,7 +163,8 @@ ae2fc.gui.fluid_auto_filler=ME流体自动装填器
|
||||
|
||||
error.unknown=未知流体
|
||||
|
||||
key.OpenTerminal=打开无线通用终端
|
||||
|
||||
itemGroup.ae2fc=AE2流体合成套件重置
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 2.0 KiB |
Reference in new issue
Block a user