Compare commits

..
Author SHA1 Message Date
miozune 1402c043ad updateBuildScript 2023-05-07 23:49:53 +09:00
miozune e683c53e5e Fix fluid animation with Hodgepodge loaded 2023-05-07 23:48:34 +09:00
123 changed files with 917 additions and 1946 deletions

No files matched your search

+64 -160
View File
@@ -1,4 +1,4 @@
//version: 1690907958
//version: 1683373797
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
@@ -69,7 +69,7 @@ plugins {
id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version
id 'com.modrinth.minotaur' version '2.+' apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.24'
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.7'
}
print("You might want to check out './gradlew :faq' if your build fails.\n")
@@ -115,8 +115,6 @@ propertyDefaultIfUnset("usesMixinDebug", project.usesMixins)
propertyDefaultIfUnset("forceEnableMixins", false)
propertyDefaultIfUnset("channel", "stable")
propertyDefaultIfUnset("mappingsVersion", "12")
propertyDefaultIfUnset("usesMavenPublishing", true)
propertyDefaultIfUnset("mavenPublishUrl", "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases")
propertyDefaultIfUnset("modrinthProjectId", "")
propertyDefaultIfUnset("modrinthRelations", "")
propertyDefaultIfUnset("curseForgeProjectId", "")
@@ -359,27 +357,7 @@ catch (Exception ignored) {
String identifiedVersion
String versionOverride = System.getenv("VERSION") ?: null
try {
// Produce a version based on the tag, or for branches something like 0.2.2-configurable-maven-and-extras.38+43090270b6-dirty
if (versionOverride == null) {
def gitDetails = versionDetails()
def isDirty = gitVersion().endsWith(".dirty") // No public API for this, isCleanTag has a different meaning
String branchName = gitDetails.branchName ?: (System.getenv('GIT_BRANCH') ?: 'git')
if (branchName.startsWith('origin/')) {
branchName = branchName.minus('origin/')
}
branchName = branchName.replaceAll("[^a-zA-Z0-9-]+", "-") // sanitize branch names for semver
identifiedVersion = gitDetails.lastTag ?: '${gitDetails.gitHash}'
if (gitDetails.commitDistance > 0) {
identifiedVersion += "-${branchName}.${gitDetails.commitDistance}+${gitDetails.gitHash}"
if (isDirty) {
identifiedVersion += "-dirty"
}
} else if (isDirty) {
identifiedVersion += "-${branchName}+${gitDetails.gitHash}-dirty"
}
} else {
identifiedVersion = versionOverride
}
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
}
catch (Exception ignored) {
out.style(Style.Failure).text(
@@ -401,13 +379,9 @@ if (identifiedVersion == versionOverride) {
group = "com.github.GTNewHorizons"
if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
base {
archivesName = customArchiveBaseName
}
archivesBaseName = customArchiveBaseName
} else {
base {
archivesName = modId
}
archivesBaseName = modId
}
@@ -491,19 +465,10 @@ sourceSets {
}
}
if (file('addon.gradle.kts').exists()) {
apply from: 'addon.gradle.kts'
} else if (file('addon.gradle').exists()) {
if (file('addon.gradle').exists()) {
apply from: 'addon.gradle'
}
// File for local tweaks not commited to Git
if (file('addon.local.gradle.kts').exists()) {
apply from: 'addon.local.gradle.kts'
} else if (file('addon.local.gradle').exists()) {
apply from: 'addon.local.gradle'
}
// Allow unsafe repos but warn
repositories.configureEach { repo ->
if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) {
@@ -514,14 +479,7 @@ repositories.configureEach { repo ->
}
}
if (file('repositories.gradle.kts').exists()) {
apply from: 'repositories.gradle.kts'
} else if (file('repositories.gradle').exists()) {
apply from: 'repositories.gradle'
} else {
logger.error("Neither repositories.gradle.kts nor repositories.gradle was found, make sure you extracted the full ExampleMod template.")
throw new RuntimeException("Missing repositories.gradle[.kts]")
}
apply from: 'repositories.gradle'
configurations {
runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
@@ -579,28 +537,13 @@ repositories {
}
}
if (includeWellKnownRepositories.toBoolean()) {
exclusiveContent {
forRepository {
maven {
name "CurseMaven"
url "https://cursemaven.com"
}
}
filter {
maven {
name "CurseMaven"
url "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
}
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
filter {
includeGroup "maven.modrinth"
}
}
maven {
name = "ic2"
url = "https://maven.ic2.player.to/"
@@ -626,12 +569,9 @@ repositories {
def mixinProviderGroup = "io.github.legacymoddingmc"
def mixinProviderModule = "unimixins"
def mixinProviderVersion = "0.1.7.1"
def mixinProviderVersion = "0.1.6"
def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}"
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
ext.mixinProviderSpec = mixinProviderSpec
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
dependencies {
if (usesMixins.toBoolean()) {
@@ -644,7 +584,7 @@ dependencies {
}
}
if (usesMixins.toBoolean()) {
implementation(modUtils.enableMixins(mixinProviderSpec, mixingConfigRefMap))
implementation(mixinProviderSpec)
} else if (forceEnableMixins.toBoolean()) {
runtimeOnlyNonPublishable(mixinProviderSpec)
}
@@ -670,32 +610,12 @@ configurations.all {
}
}
dependencies {
constraints {
def minGtnhLibVersion = "0.0.13"
implementation("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
}
runtimeOnly("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
}
devOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
}
runtimeOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
}
}
}
apply from: 'dependencies.gradle'
if (file('dependencies.gradle.kts').exists()) {
apply from: 'dependencies.gradle.kts'
} else if (file('dependencies.gradle').exists()) {
apply from: 'dependencies.gradle'
} else {
logger.error("Neither dependencies.gradle.kts nor dependencies.gradle was found, make sure you extracted the full ExampleMod template.")
throw new RuntimeException("Missing dependencies.gradle[.kts]")
}
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
def mixinTmpDir = buildDir.path + File.separator + 'tmp' + File.separator + 'mixins'
def refMap = "${mixinTmpDir}" + File.separator + mixingConfigRefMap
def mixinSrg = "${mixinTmpDir}" + File.separator + "mixins.srg"
tasks.register('generateAssets') {
group = "GTNH Buildscript"
@@ -727,17 +647,46 @@ tasks.register('generateAssets') {
}
if (usesMixins.toBoolean()) {
tasks.named("reobfJar", ReobfuscatedJar).configure {
extraSrgFiles.from(mixinSrg)
}
tasks.named("processResources").configure {
dependsOn("generateAssets")
}
tasks.named("compileJava", JavaCompile).configure {
doFirst {
new File(mixinTmpDir).mkdirs()
}
options.compilerArgs += [
"-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}",
"-AoutSrgFile=${mixinSrg}",
"-AoutRefMapFile=${refMap}",
// Elan: from what I understand they are just some linter configs so you get some warning on how to properly code
"-XDenableSunApiLintControl",
"-XDignore.symbol.file"
]
}
pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
kapt {
correctErrorTypes = true
javacOptions {
option("-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}")
option("-AoutSrgFile=$mixinSrg")
option("-AoutRefMapFile=$refMap")
}
}
tasks.configureEach { task ->
if (task.name == "kaptKotlin") {
task.doFirst {
new File(mixinTmpDir).mkdirs()
}
}
}
}
}
tasks.named("processResources", ProcessResources).configure {
@@ -755,6 +704,7 @@ tasks.named("processResources", ProcessResources).configure {
}
if (usesMixins.toBoolean()) {
from refMap
dependsOn("compileJava", "compileScala")
}
}
@@ -773,16 +723,16 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies"
}
dependencies {
def lwjgl3ifyVersion = '1.4.0'
def lwjgl3ifyVersion = '1.3.5'
def asmVersion = '9.4'
if (modId != 'lwjgl3ify') {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
}
if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.26')
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.8')
}
java17PatchDependencies('net.minecraft:launchwrapper:1.17.2') {transitive = false}
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}")
@@ -872,18 +822,6 @@ public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask {
}
this.classpath(project.java17DependenciesCfg)
}
public void setup(Project project) {
super.setup(project)
if (project.usesMixins.toBoolean()) {
this.extraJvmArgs.addAll(project.provider(() -> {
def mixinCfg = project.configurations.detachedConfiguration(project.dependencies.create(project.mixinProviderSpec))
mixinCfg.canBeConsumed = false
mixinCfg.transitive = false
enableHotswap ? ["-javaagent:" + mixinCfg.singleFile.absolutePath] : []
}))
}
}
}
def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Distribution.CLIENT, "runClient")
@@ -1028,9 +966,6 @@ idea {
}
}
runConfigurations {
"0. Build and Test"(Gradle) {
taskNames = ["build"]
}
"1. Run Client"(Gradle) {
taskNames = ["runClient"]
}
@@ -1150,11 +1085,6 @@ tasks.named("processIdeaSettings").configure {
dependsOn("injectTags")
}
tasks.named("ideVirtualMainClasses").configure {
// Make IntelliJ "Build project" build the mod jars
dependsOn("jar", "reobfJar", "spotlessCheck")
}
// workaround variable hiding in pom processing
def projectConfigs = project.configurations
@@ -1175,14 +1105,12 @@ publishing {
}
repositories {
if (usesMavenPublishing.toBoolean()) {
maven {
url = mavenPublishUrl
allowInsecureProtocol = mavenPublishUrl.startsWith("http://") // Mostly for the GTNH maven
credentials {
username = System.getenv("MAVEN_USER") ?: "NONE"
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
}
maven {
url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases"
allowInsecureProtocol = true
credentials {
username = System.getenv("MAVEN_USER") ?: "NONE"
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
}
}
}
@@ -1297,7 +1225,7 @@ def addCurseForgeRelation(String type, String name) {
// Updating
def buildscriptGradleVersion = "8.2.1"
def buildscriptGradleVersion = "8.1.1"
tasks.named('wrapper', Wrapper).configure {
gradleVersion = buildscriptGradleVersion
@@ -1335,14 +1263,10 @@ tasks.register('faq') {
description = 'Prints frequently asked questions about building a project'
doLast {
print("If your build fails to fetch dependencies, run './gradlew updateDependencies'. " +
"Or you can manually check if the versions are still on the distributing sites - " +
"the links can be found in repositories.gradle and build.gradle:repositories, " +
"but not build.gradle:buildscript.repositories - those ones are for gradle plugin metadata.\n\n" +
"If your build fails to recognize the syntax of new Java versions, enable Jabel in your " +
"gradle.properties. See how it's done in GTNH ExampleMod/gradle.properties. " +
"However, keep in mind that Jabel enables only syntax features, but not APIs that were introduced in " +
"Java 9 or later.")
print("If your build fails to fetch dependencies, they might have been deleted and replaced by newer " +
"versions.\nCheck if the versions you try to fetch are still on the distributing sites.\n" +
"The links can be found in repositories.gradle and build.gradle:repositories, " +
"not build.gradle:buildscript.repositories - this one is for gradle plugin metadata.")
}
}
@@ -1403,14 +1327,8 @@ boolean isNewBuildScriptVersionAvailable() {
String currentBuildScript = getFile("build.gradle").getText()
String currentBuildScriptHash = getVersionHash(currentBuildScript)
String availableBuildScriptHash
try {
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
availableBuildScriptHash = getVersionHash(availableBuildScript)
} catch (IOException e) {
logger.warn("Could not check for buildscript update availability: {}", e.message)
return false
}
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
String availableBuildScriptHash = getVersionHash(availableBuildScript)
boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash
return !isUpToDate
@@ -1575,17 +1493,3 @@ def getSecondaryArtifacts() {
if (apiPackage) secondaryArtifacts += [apiJar]
return secondaryArtifacts
}
// For easier scripting of things that require variables defined earlier in the buildscript
if (file('addon.late.gradle.kts').exists()) {
apply from: 'addon.late.gradle.kts'
} else if (file('addon.late.gradle').exists()) {
apply from: 'addon.late.gradle'
}
// File for local tweaks not commited to Git
if (file('addon.late.local.gradle.kts').exists()) {
apply from: 'addon.late.local.gradle.kts'
} else if (file('addon.late.local.gradle').exists()) {
apply from: 'addon.late.local.gradle'
}
+20 -16
View File
@@ -1,24 +1,28 @@
// Add your dependencies here
dependencies {
api('com.github.GTNewHorizons:NotEnoughItems:2.3.80-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-247-GTNH:dev')
api('com.github.GTNewHorizons:NotEnoughItems:2.3.45-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-203-GTNH:dev')
api('curse.maven:cofh-core-69162:2388751')
api('com.github.GTNewHorizons:waila:1.6.0:dev')
compileOnly('com.github.GTNewHorizons:Baubles:1.0.1.16:dev')
api('com.github.GTNewHorizons:waila:1.5.24:dev')
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.33:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:WirelessCraftingTerminal:1.9.0:dev")
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.34:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:WirelessCraftingTerminal:1.9.3:dev")
compileOnly('com.github.GTNewHorizons:ForestryMC:4.6.13:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.4.24:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.43.162:dev') {
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
}
compileOnly('com.github.GTNewHorizons:ForestryMC:4.5.6:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.4.11:dev')
compileOnly('com.github.GTNewHorizons:EnderCore:0.2.13:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.42.82: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.10:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.33:dev') { transitive = false }
compileOnly('com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.9.12-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.4.11-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:GTplusplus:1.9.72:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.2.27:dev") { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.9.1-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.4.1-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:GTplusplus:1.8.42:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.2.10:dev") { transitive = false }
compileOnly('com.github.GTNewHorizons:KekzTech:0.7.8:dev')
api('com.github.GTNewHorizons:Baubles:1.0.1.16:dev')
}
+1 -5
View File
@@ -21,10 +21,6 @@ forgeVersion = 10.13.4.1614
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
developmentEnvironmentUserName = Developer
# Enables using modern java syntax (up to version 17) via Jabel, while still targetting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = true
# Define a source file of your project with:
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's
@@ -39,7 +35,7 @@ gradleTokenGroupName = GRADLETOKEN_GROUPNAME
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
apiPackage = api
apiPackage =
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+5 -6
View File
@@ -85,6 +85,9 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -141,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -149,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -194,10 +197,6 @@ if "$cygwin" || "$msys" ; then
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
@@ -27,7 +27,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
modid = FluidCraft.MODID,
version = FluidCraft.VERSION,
name = FluidCraft.MODNAME,
dependencies = "required-after:appliedenergistics2@[rv3-beta-238,);required-after:CoFHCore;required-after:Baubles;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,7 +77,7 @@ public class FluidCraft {
CalculatorV2PluginLoader.installCalculatorV2Plugins();
}
if (ModAndClassUtil.isTypeFilter) {
AEApi.instance().registries().itemDisplay().addItemFilter(FluidFilter::filter);
FluidFilter.installFilter();
}
proxy.postInit(event);
@@ -1,45 +0,0 @@
package com.glodblock.github.api;
import java.util.HashSet;
import java.util.Set;
import net.minecraftforge.fluids.Fluid;
public final class FluidCraftAPI implements IFluidCraftAPI {
private static final FluidCraftAPI API = new FluidCraftAPI();
/**
* These fluids will not be allowed to be stored in fluid storage cells.
*/
private final Set<Class<? extends Fluid>> blacklistedFluids = new HashSet<>();
/**
* These fluids will not be displayed in a fluid terminal.
*/
private final Set<Class<? extends Fluid>> blacklistedDispFluids = new HashSet<>();
public static FluidCraftAPI instance() {
return API;
}
@Override
public void blacklistFluidInStorage(Class<? extends Fluid> fluid) {
blacklistedFluids.add(fluid);
}
@Override
public void blacklistFluidInDisplay(Class<? extends Fluid> fluid) {
blacklistedDispFluids.add(fluid);
}
@Override
public boolean isBlacklistedInStorage(Class<? extends Fluid> fluid) {
return blacklistedFluids.contains(fluid);
}
@Override
public boolean isBlacklistedInDisplay(Class<? extends Fluid> fluid) {
return blacklistedDispFluids.contains(fluid);
}
}
@@ -1,27 +0,0 @@
package com.glodblock.github.api;
import net.minecraftforge.fluids.Fluid;
@SuppressWarnings("unused")
public interface IFluidCraftAPI {
/**
* Blacklisted fluids will not be allowed to be added to a storage cell.
*/
void blacklistFluidInStorage(Class<? extends Fluid> fluid);
/**
* Blacklisted fluids will not be displayed in fluid terminals.
*/
void blacklistFluidInDisplay(Class<? extends Fluid> fluid);
/**
* Mostly for internal use; queries whether the fluid is blacklisted from storage cells.
*/
boolean isBlacklistedInStorage(Class<? extends Fluid> fluid);
/**
* Mostly for internal use; queries whether the fluid is blacklisted from being displayed.
*/
boolean isBlacklistedInDisplay(Class<? extends Fluid> fluid);
}
@@ -89,7 +89,6 @@ public class GuiDualInterface extends GuiUpgradeable {
Settings.ADVANCED_BLOCKING_MODE,
AdvancedBlockingMode.DEFAULT);
this.buttonList.add(this.advancedBlockingMode);
this.advancedBlockingMode.visible = this.bc.getInstalledUpgrades(Upgrades.ADVANCED_BLOCKING) > 0;
if (isTile()) {
this.sidelessMode = new GuiImgButton(
@@ -129,32 +128,46 @@ public class GuiDualInterface extends GuiUpgradeable {
@Override
protected String getBackground() {
if (!ModAndClassUtil.isBigInterface) return "guis/interface.png";
return switch (((ContainerInterface) this.cvb).getPatternCapacityCardsInstalled()) {
case -1 -> "guis/interfacenone.png";
case 1 -> "guis/interface2.png";
case 2 -> "guis/interface3.png";
case 3 -> "guis/interface4.png";
default -> "guis/interface.png";
};
switch (((ContainerInterface) this.cvb).getPatternCapacityCardsInstalled()) {
case 1:
return "guis/interface2.png";
case 2:
return "guis/interface3.png";
case 3:
return "guis/interface4.png";
}
return "guis/interface.png";
}
@Override
protected void actionPerformed(final GuiButton btn) {
super.actionPerformed(btn);
final boolean backwards = Mouse.isButtonDown(1);
if (btn == null) {
return;
}
if (btn == this.priority) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(GuiType.PRIORITY));
} else if (btn == this.switcher) {
}
if (btn == this.switcher) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(GuiType.DUAL_INTERFACE_FLUID));
} else if (btn == this.interfaceMode) {
}
if (btn == this.interfaceMode) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(Settings.INTERFACE_TERMINAL, backwards));
} else if (btn == this.BlockMode) {
}
if (btn == this.BlockMode) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.BlockMode.getSetting(), backwards));
} else if (btn == this.insertionMode) {
}
if (btn == this.insertionMode) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.insertionMode.getSetting(), backwards));
} else if (btn == this.sidelessMode) {
}
if (btn == this.sidelessMode) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.sidelessMode.getSetting(), backwards));
} else if (btn == this.advancedBlockingMode) {
}
if (btn == this.advancedBlockingMode) {
NetworkHandler.instance
.sendToServer(new PacketConfigButton(this.advancedBlockingMode.getSetting(), backwards));
}
@@ -167,12 +180,4 @@ public class GuiDualInterface extends GuiUpgradeable {
private boolean isTile() {
return this.host instanceof TileFluidInterface;
}
@Override
protected void handleButtonVisibility() {
super.handleButtonVisibility();
if (this.advancedBlockingMode != null) {
this.advancedBlockingMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.ADVANCED_BLOCKING) > 0);
}
}
}
@@ -244,7 +244,9 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
Math.round(uv_y * 16F * 16F / 3F),
Math.round(16F * 16F / 3F),
Math.round(16F * 16F / 3F));
this.mouseDragged(par1Minecraft, par2, par3);
GL11.glPopMatrix();
} else {
GL11.glPushMatrix();
GL11.glTranslatef(this.xPosition, this.yPosition, 0.0F);
@@ -278,9 +280,9 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
Math.round(uv_y * 16F * 16F / 3F),
Math.round(16F * 16F / 3F),
Math.round(16F * 16F / 3F));
this.mouseDragged(par1Minecraft, par2, par3);
GL11.glPopMatrix();
}
this.mouseDragged(par1Minecraft, par2, par3);
GL11.glPopMatrix();
}
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
@@ -1,5 +1,7 @@
package com.glodblock.github.client.gui;
import java.util.*;
import net.minecraft.entity.player.InventoryPlayer;
import com.glodblock.github.FluidCraft;
@@ -164,6 +164,7 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
FluidCraft.proxy.netHandler.sendToServer(new CPacketValueConfig(result, 0));
} catch (final NumberFormatException e) {
// nope..
this.level.setText("0");
}
}
@@ -23,7 +23,6 @@ public class GuiFluidMonitor extends FCGuiMonitor<IAEFluidStack> {
final ContainerFluidMonitor c) {
super(inventoryPlayer, te, c);
this.repo = new FluidRepo(getScrollBar(), this);
this.setScrollBar();
}
@Override
@@ -10,7 +10,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
@@ -23,9 +22,7 @@ import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.network.CPacketFluidUpdate;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.Util;
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEFluidStack;
@@ -97,26 +94,20 @@ public class GuiFluidTerminal extends GuiFluidMonitor {
}
private void drawWidget(int posX, int posY, Fluid fluid) {
if (fluid == null) return;
IIcon icon = fluid.getIcon();
if (icon == null) return;
if (ModAndClassUtil.HODGEPODGE && icon instanceof IPatchedTextureAtlasSprite) {
((IPatchedTextureAtlasSprite) icon).markNeedsAnimationUpdate();
}
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor3f(
(fluid.getColor() >> 16 & 0xFF) / 255.0F,
(fluid.getColor() >> 8 & 0xFF) / 255.0F,
(fluid.getColor() & 0xFF) / 255.0F);
drawTexturedModelRectFromIcon(posX, posY, fluid.getIcon(), 16, 16);
GL11.glColor3f(1, 1, 1);
if (fluid != null && fluid.getIcon() != null) {
GL11.glColor3f(
(fluid.getColor() >> 16 & 0xFF) / 255.0F,
(fluid.getColor() >> 8 & 0xFF) / 255.0F,
(fluid.getColor() & 0xFF) / 255.0F);
drawTexturedModelRectFromIcon(posX, posY, fluid.getIcon(), 16, 16);
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glColor3f(1, 1, 1);
}
@Override
@@ -76,6 +76,7 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
protected static boolean onlyBrokenRecipes = false;
protected GuiTabButton craftingStatusBtn;
// private final IConfigManager configSrc;
private int rows = 3;
private static final String MOLECULAR_ASSEMBLER = "tile.appliedenergistics2.BlockMolecularAssembler";
@@ -209,7 +210,8 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
protected void repositionSlots() {
for (final Object obj : this.inventorySlots.inventorySlots) {
if (obj instanceof final AppEngSlot slot) {
if (obj instanceof AppEngSlot) {
final AppEngSlot slot = (AppEngSlot) obj;
slot.yDisplayPosition = this.ySize + slot.getY() - 78 - 7;
}
}
@@ -218,9 +220,7 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
protected int calculateRowsCount() {
final int maxRows = this.getMaxRows();
final boolean hasNEI = IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.NEI);
final int input = 22;
final int topPanel = 18;
final int NEIPadding = hasNEI ? input + topPanel : 0;
final int NEIPadding = hasNEI ? 22 /* input */ + 18 /* top panel */ : 0;
final int extraSpace = this.height - MAGIC_HEIGHT_NUMBER - NEIPadding;
return Math.max(3, Math.min(maxRows, extraSpace / 18));
@@ -243,7 +243,8 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
final int ex = getScrollBar().getCurrentScroll();
for (int x = 0; x < this.rows && ex + x < this.lines.size(); x++) {
final Object lineObj = this.lines.get(ex + x);
if (lineObj instanceof final ClientDCInternalInv inv) {
if (lineObj instanceof ClientDCInternalInv) {
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
for (int z = 0; z < inv.getInventory().getSizeInventory(); z++) {
if (this.matchedStacks.contains(inv.getInventory().getStackInSlot(z))) drawRect(
z * 18 + 22,
@@ -252,7 +253,8 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
1 + offset + 16,
GuiColors.InterfaceTerminalMatch.getColor());
}
} else if (lineObj instanceof String name) {
} else if (lineObj instanceof String) {
String name = (String) lineObj;
final int rows = this.byName.get(name).size();
String postfix = "";
@@ -307,7 +309,8 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
final int ex = this.getScrollBar().getCurrentScroll();
for (int x = 0; x < this.rows && ex + x < this.lines.size(); x++) {
final Object lineObj = this.lines.get(ex + x);
if (lineObj instanceof final ClientDCInternalInv inv) {
if (lineObj instanceof ClientDCInternalInv) {
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
for (int z = 0; z < inv.getInventory().getSizeInventory(); z++) {
inventorySlots.inventorySlots.add(new SlotDisconnected(inv, z, z * 18 + 22, 1 + offset));
}
@@ -339,21 +342,10 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
@Override
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
boolean focusIn = searchFieldInputs.isFocused();
boolean focusOut = searchFieldOutputs.isFocused();
boolean focusName = searchFieldNames.isFocused();
searchFieldInputs.mouseClicked(xCoord, yCoord, btn);
searchFieldOutputs.mouseClicked(xCoord, yCoord, btn);
searchFieldNames.mouseClicked(xCoord, yCoord, btn);
if (focusIn && !searchFieldInputs.isFocused()) {
searchFieldInputsText = searchFieldInputs.getText();
} else if (focusOut && !searchFieldOutputs.isFocused()) {
searchFieldOutputsText = searchFieldOutputs.getText();
} else if (focusName && !searchFieldNames.isFocused()) {
searchFieldNamesText = searchFieldNames.getText();
}
super.mouseClicked(xCoord, yCoord, btn);
}
@@ -413,7 +405,8 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
} else if (btn == craftingStatusBtn) {
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
} else if (btn instanceof final GuiImgButton iBtn) {
} else if (btn instanceof GuiImgButton) {
final GuiImgButton iBtn = (GuiImgButton) btn;
if (iBtn.getSetting() != Settings.ACTIONS) {
final Enum cv = iBtn.getCurrentValue();
final boolean backwards = Mouse.isButtonDown(1);
@@ -451,7 +444,8 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
for (int x = 0; x < this.rows && ex + x < this.lines.size(); x++) {
final Object lineObj = this.lines.get(ex + x);
if (lineObj instanceof final ClientDCInternalInv inv) {
if (lineObj instanceof ClientDCInternalInv) {
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
GL11.glColor4f(1, 1, 1, 1);
final int width = inv.getInventory().getSizeInventory() * 18;
@@ -545,7 +539,7 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
if (this.refreshList) {
this.refreshList = false;
// invalidate caches on refresh
// invalid caches on refresh
this.cachedSearches.clear();
this.refreshList();
}
@@ -364,33 +364,32 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
public void draw() {
this.getQty().draw();
this.getBatch().draw();
ArrayList<String> message = new ArrayList<>();
ArrayList<String> message = new ArrayList<String>();
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_TITLE) + "\n");
switch (this.state) {
case Idling -> {
case Idling:
this.line.setColor(0xFF55FF55);
message.add(
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT)
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_IDLE));
}
case Crafting -> {
break;
case Crafting:
this.line.setColor(0xFFFFFF55);
message.add(
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT)
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_LINK));
}
case Exporting -> {
break;
case Exporting:
this.line.setColor(0xFFAA00AA);
message.add(
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT)
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_EXPORT));
}
default -> {
break;
default:
this.line.setColor(0);
message.add(
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT)
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_NONE));
}
}
message.add("");
if (isShiftKeyDown()) {
@@ -431,7 +430,7 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
this.textField = textField;
this.textField.setEnableBackgroundDrawing(false);
this.textField.setText("0");
this.textField.setMaxStringLength(10); // this length is enough to useful
this.textField.setMaxStringLength(10); // it's enough to useful
this.idx = idx;
this.action = action;
this.tooltip = tooltip;
@@ -16,7 +16,7 @@ import appeng.core.localization.GuiText;
public class GuiRenamer extends AEBaseGui implements IDropToFillTextField {
private final MEGuiTextField textField;
private MEGuiTextField textField;
public GuiRenamer(InventoryPlayer ip, ITerminalHost monitorable) {
super(new ContainerRenamer(ip, monitorable));
@@ -41,10 +41,10 @@ public abstract class FCGuiAmount extends AEBaseGui {
@SuppressWarnings("unchecked")
public void initGui() {
super.initGui();
final int a = AEConfig.instance.craftItemsByStackAmounts(0);
final int b = AEConfig.instance.craftItemsByStackAmounts(1);
final int c = AEConfig.instance.craftItemsByStackAmounts(2);
final int d = AEConfig.instance.craftItemsByStackAmounts(3);
final int a = AEConfig.instance.priorityByStacksAmounts(0);
final int b = AEConfig.instance.priorityByStacksAmounts(1);
final int c = AEConfig.instance.priorityByStacksAmounts(2);
final int d = AEConfig.instance.priorityByStacksAmounts(3);
this.buttonList.add(this.plus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 26, 22, 20, "+" + a));
this.buttonList.add(this.plus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 26, 28, 20, "+" + b));
@@ -29,11 +29,11 @@ import appeng.api.implementations.tiles.IViewCellStorage;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IDisplayRepo;
import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigurableObject;
import appeng.client.gui.widgets.*;
import appeng.client.me.InternalSlotME;
import appeng.client.me.ItemRepo;
import appeng.client.me.SlotDisconnected;
import appeng.client.me.SlotME;
import appeng.container.AEBaseContainer;
@@ -67,7 +67,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
protected final ItemStack[] myCurrentViewCells = new ItemStack[5];
public FCContainerMonitor<T> monitorableContainer;
public GuiTabButton craftingStatusBtn;
protected IDisplayRepo repo;
protected ItemRepo repo;
protected GuiImgButton craftingStatusImgBtn;
protected FCGuiTextField searchField;
protected int perRow = 9;
@@ -122,8 +122,9 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
if (btn == this.craftingStatusBtn || btn == this.craftingStatusImgBtn) {
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
}
if (btn instanceof final GuiImgButton iBtn) {
if (btn instanceof GuiImgButton) {
final boolean backwards = Mouse.isButtonDown(1);
final GuiImgButton iBtn = (GuiImgButton) btn;
if (iBtn.getSetting() != Settings.ACTIONS) {
final Enum<?> cv = iBtn.getCurrentValue();
final Enum<?> next = Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
@@ -272,8 +273,6 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
AEConfig.instance.settings.getSetting(Settings.TERMINAL_STYLE)));
this.offsetY += 20;
// Right now 80 > offsetX, but that can be changed later.
// noinspection DataFlowIssue
this.searchField = new FCGuiTextField(
this.fontRendererObj,
this.guiLeft + Math.max(80, this.offsetX),
@@ -434,7 +433,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
if (slot instanceof SlotPatternTerm) {
if (mouseButton == 6) {
return; // prevents weird double clicks
return; // prevent weird double clicks..
}
try {
NetworkHandler.instance.sendToServer(((SlotPatternTerm) slot).getRequest(isShiftKeyDown()));
@@ -443,13 +442,13 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
}
} else if (slot instanceof SlotCraftingTerm) {
if (mouseButton == 6) {
return; // prevents weird double clicks
return; // prevent weird double clicks..
}
InventoryAction action;
if (isShiftKeyDown()) {
action = InventoryAction.CRAFT_SHIFT;
} else {
// Craft a stack on right-click, craft a single one on left-click
// Craft stack on right-click, craft single on left-click
action = (mouseButton == 1) ? InventoryAction.CRAFT_STACK : InventoryAction.CRAFT_ITEM;
}
final PacketInventoryAction p = new PacketInventoryAction(action, slotIdx, 0);
@@ -650,7 +649,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
@Override
public void updateScreen() {
this.repo.setPowered(this.monitorableContainer.isPowered());
this.repo.setPower(this.monitorableContainer.isPowered());
super.updateScreen();
}
@@ -13,7 +13,7 @@ import appeng.helpers.IInterfaceHost;
public class ContainerDualInterface extends ContainerInterface {
@GuiSync(11)
@GuiSync(10)
public SidelessMode sidelessMode;
private final boolean isTile;
@@ -119,6 +119,12 @@ public class ContainerEssentiaMonitor extends ContainerFluidPortableCell {
if (slotIndex == -1) {
out.stackSize = fluidContainer.stackSize;
} else {
if (drainStack != null) {
System.out.print("---------\n");
System.out.print(drainStack.right + "\n");
System.out.print(drainStack.left + "\n");
System.out.print(aeFluidStack.getStackSize() + "\n");
}
out.stackSize = (int) (fluidContainer.stackSize
- (aeFluidStack.getStackSize() / drainStack.left));
}
@@ -13,7 +13,6 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
import com.glodblock.github.FluidCraft;
@@ -49,18 +48,6 @@ import appeng.util.item.AEItemStack;
public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
protected final IItemList<IAEFluidStack> fluids = AEApi.instance().storage().createFluidList();
/**
* Index of tuple which indicates remaining tanks that are remaining (not emptied/filled)
*/
protected static final int REM_IDX = 0;
/**
* Index of tuple which indicates remaining tanks that are acted upon (emptied/filled)
*/
protected static final int ACT_IDX = 1;
/**
* Index of tuple which indicates tanks that are partially emptied/filled
*/
protected static final int PARTIAL_IDX = 2;
public ContainerFluidMonitor(final InventoryPlayer ip, final ITerminalHost monitorable) {
this(ip, monitorable, true);
@@ -235,139 +222,77 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
}
/**
* Insert fluid into the ME system
*
* @param canSend the fluidstack to insert
* @param results a tuple of at least size 3 to indicate outputs (1), (2), (3). This will be mutated!
* @param numTanks number of tanks involved in the operation
* @param fluidInTank how much fluid is in the tank initially
* @return the amount of fluid remaining in output (3)
* @see #insertFluid(ItemStack, EntityPlayer, int, int)
*/
private int insertME(IAEFluidStack canSend, int[] results, int numTanks, int fluidInTank) {
final IAEFluidStack notInserted = this.host.getFluidInventory()
.injectItems(canSend, Actionable.MODULATE, this.getActionSource());
// Check if we need to handle partial insertion.
if (notInserted != null && notInserted.getStackSize() > 0) {
if (canSend.getStackSize() == notInserted.getStackSize()) {
// No-op for when system is full
results[REM_IDX] = numTanks;
return fluidInTank;
}
// Populate result list with outputs (1), (2), (3).
results[REM_IDX] = (int) (notInserted.getStackSize() / fluidInTank);
results[ACT_IDX] = numTanks - results[REM_IDX];
// If there is remaining fluid, set partial.
final int remainder = (int) (notInserted.getStackSize() % fluidInTank);
if (remainder > 0) {
results[PARTIAL_IDX] = 1;
results[ACT_IDX]--;
return remainder;
} else {
results[PARTIAL_IDX] = 0;
}
} else {
// Full operation successful
results[REM_IDX] = 0;
results[ACT_IDX] = numTanks;
results[PARTIAL_IDX] = 0;
}
return 0;
}
/**
* The insert operation. For input, we have a filled container stack. For outputs, we have the following:
* <ol>
* <li>Leftover filled container stack</li>
* <li>Empty containers</li>
* <li>Partially filled container x1</li>
* </ol>
* In order above, the itemstack at `slotIndex` is transformed into the output.
* The insert operation. For input, we have an filled container stack. For outputs, we have the following: 1.
* Leftover filled container stack - primary output. 2. Empty containers 3. Partially filled container x1 In order
* above, the itemstack at `slotIndex` is transformed into the output.
*/
private void insertFluid(ItemStack fluidContainer, EntityPlayer player, int slotIndex, int heldContainers) {
IAEFluidStack canSend;
int fluidPerContainer;
ItemStack partialStack = null;
ItemStack emptyStack = null;
int[] insertionResults = new int[3];
// 2 types of containers: IFluidContainerItem and FluidContainerRegistry
// IFluidContainerItem - items are filled w/ volume (portable tanks)
// FluidContainerRegistry - items are filled, or not (buckets)
// The former is easy, the latter takes a bit more work.
if (fluidContainer.getItem() instanceof IFluidContainerItem fcItem) {
// Step 1: Find out how much fluid we can insert.
canSend = AEFluidStack.create(fcItem.getFluid(fluidContainer));
fluidPerContainer = (int) canSend.getStackSize();
canSend.setStackSize((long) fluidPerContainer * fluidContainer.stackSize);
// Step 2: Find out how much fluid we can extract from the container. If this is null or 0, return.
ItemStack test = fluidContainer.copy();
test.stackSize = 1;
FluidStack fluidStack = fcItem.drain(test, 1, false);
if (fluidStack == null || fluidStack.amount == 0) {
return;
}
// Step 3: Find out how much fluid we can insert into the ME system
int partialAmount = insertME(canSend, insertionResults, fluidContainer.stackSize, fluidPerContainer);
// Step 4: Separate the outputs into no drain (1), fully drained (2), and partially drained (3)
// 4.1: Handle the partial stack
if (insertionResults[PARTIAL_IDX] > 0) {
partialStack = fluidContainer.copy();
partialStack.stackSize = 1;
fcItem.drain(partialStack, fluidPerContainer - partialAmount, true);
}
// 4.2: Handle empty output
if (insertionResults[ACT_IDX] > 0) {
emptyStack = fluidContainer.copy();
emptyStack.stackSize = insertionResults[ACT_IDX];
fcItem.drain(emptyStack, fluidPerContainer, true);
}
IAEFluidStack fluid;
int fluidInTank;
if (fluidContainer.getItem() instanceof IFluidContainerItem) {
fluid = AEFluidStack.create(((IFluidContainerItem) fluidContainer.getItem()).getFluid(fluidContainer));
fluidInTank = (int) fluid.getStackSize();
} else if (FluidContainerRegistry.isContainer(fluidContainer)) {
// Step 1: Find out how much fluid we can insert.
canSend = AEFluidStack.create(FluidContainerRegistry.getFluidForFilledItem(fluidContainer));
fluidPerContainer = (int) canSend.getStackSize();
canSend.setStackSize((long) fluidPerContainer * fluidContainer.stackSize);
// Step 2: Find out how much fluid we can extract from the container. If this is null or 0, return.
ItemStack emptyTank = FluidContainerRegistry.drainFluidContainer(fluidContainer);
if (emptyTank == null) {
return;
}
// Step 3: Find out how much fluid we can insert into the ME system
int partialAmount = insertME(canSend, insertionResults, fluidContainer.stackSize, fluidPerContainer);
// Step 4: Separate the outputs into no drain (1), fully drained (2), and partially drained (3)
// 4.1: Handle the partial stack
if (partialAmount > 0) {
// We now extract the extra amount from the ME system. Blame simulate not working :P
int extract = FluidContainerRegistry.getContainerCapacity(fluidContainer) - partialAmount;
if (extract > 0) {
IAEFluidStack toExtract = canSend.copy().setStackSize(extract);
this.host.getFluidInventory().extractItems(toExtract, Actionable.MODULATE, this.getActionSource());
}
insertionResults[PARTIAL_IDX] = 0;
}
// 4.2: Handle empty output
if (insertionResults[ACT_IDX] > 0) {
emptyStack = FluidContainerRegistry.drainFluidContainer(fluidContainer);
emptyStack.stackSize = insertionResults[ACT_IDX];
}
fluid = AEFluidStack.create(FluidContainerRegistry.getFluidForFilledItem(fluidContainer));
fluidInTank = (int) fluid.getStackSize();
} else {
return;
}
// Simulate to know how much will not be inserted
IAEFluidStack canSend = fluid.copy();
canSend.setStackSize((long) fluidInTank * fluidContainer.stackSize);
final IAEFluidStack notInserted = this.host.getFluidInventory()
.injectItems(canSend, Actionable.MODULATE, this.getActionSource());
int emptyTanks = fluidContainer.stackSize;
ItemStack partialStack = fluidContainer.copy();
if (notInserted != null && notInserted.getStackSize() > 0) {
// Here, we cannot insert everything into the system.
if (canSend.getStackSize() == notInserted.getStackSize()) return; // System was full, no op
// Now "refill" the buckets that couldn't enter the system
int refilled = (int) (notInserted.getStackSize() / fluidInTank); // # of full tanks left
emptyTanks -= refilled;
final int remainder = (int) (notInserted.getStackSize() % fluidInTank); // partial tank
// Now handle remaining if applicable
if (remainder > 0) {
notInserted.setStackSize(remainder);
partialStack.stackSize = 1;
if (partialStack.getItem() instanceof IFluidContainerItem) {
((IFluidContainerItem) partialStack.getItem()).drain(partialStack, fluidInTank - remainder, true);
} else if (FluidContainerRegistry.isContainer(fluidContainer)) {
// For "whole containers" (need to round down, no remainders)
ItemStack container = FluidContainerRegistry
.fillFluidContainer(notInserted.getFluidStack(), fluidContainer);
if (container == null) {
// whatever, lets just not have the ME system get filled with any of its fluid
emptyTanks++;
notInserted.setStackSize(fluidInTank - remainder);
this.host.getFluidInventory()
.extractItems(notInserted, Actionable.MODULATE, this.getActionSource());
partialStack.stackSize = 0;
} else {
partialStack = container;
}
}
emptyTanks -= partialStack.stackSize;
} else {
partialStack.stackSize = 0;
}
} else {
partialStack.stackSize = 0;
}
// Now that the 3 outputs are handled, we can now actually put the fluids in
ItemStack emptyStack = fluidContainer.copy();
emptyStack.stackSize = 1;
if (emptyStack.getItem() instanceof IFluidContainerItem) {
((IFluidContainerItem) emptyStack.getItem()).drain(emptyStack, fluidInTank, true);
} else {
emptyStack = FluidContainerRegistry.drainFluidContainer(emptyStack);
}
emptyStack.stackSize = emptyTanks;
int extraTanks = heldContainers - emptyTanks - partialStack.stackSize;
// Done. Put the output in the inventory or ground, and update stack size.
boolean shouldSendStack = true;
int emptyTanks = insertionResults[ACT_IDX];
int extraTanks = heldContainers - emptyTanks - insertionResults[PARTIAL_IDX];
if (slotIndex == -1) {
// Item is in mouse hand
if (extraTanks > 0) {
ItemStack stack = player.inventory.getItemStack();
stack.stackSize = extraTanks;
@@ -378,14 +303,13 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
adjustStack(emptyStack);
player.inventory.setItemStack(emptyStack);
dropItem(partialStack);
} else if (partialStack != null) {
} else if (partialStack.stackSize != 0) {
player.inventory.setItemStack(partialStack);
} else {
player.inventory.setItemStack(null);
shouldSendStack = false;
}
} else {
// Shift clicked in
ItemStack stack = player.inventory.getStackInSlot(slotIndex);
if (extraTanks > 0) {
stack.stackSize = extraTanks;
@@ -396,7 +320,7 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
adjustStack(emptyStack);
player.inventory.setInventorySlotContents(slotIndex, emptyStack);
dropItem(partialStack);
} else if (partialStack != null) {
} else if (partialStack.stackSize != 0) {
player.inventory.setInventorySlotContents(slotIndex, partialStack);
} else {
player.inventory.setItemStack(null);
@@ -409,36 +333,28 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
(EntityPlayerMP) player);
} else {
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(new HashMap<>()), (EntityPlayerMP) player);
}
}
/**
* The extract operation. For input, we have an empty container stack. For outputs, we have the following:
* <ol>
* <li>Leftover empty container stack</li>
* <li>Filled containers (full)</li>
* <li>Partially filled container x1</li>
* </ol>
* In order above, the itemstack at `slotIndex` is transformed into the output.
* The extract operation. For input, we have an empty container stack. For outputs, we have the following: 1.
* Leftover empty container stack - primary output. 2. Filled containers (full) 3. Partially filled container x1 In
* order above, the itemstack at `slotIndex` is transformed into the output.
*/
private void extractFluid(IAEFluidStack fluid, ItemStack fluidContainer, EntityPlayer player, int heldContainers) {
// Step 1: Check if fluid can actually get filled into the fluidContainer
if (fluidContainer.getItem() instanceof IFluidContainerItem fcItem) {
int test = fcItem.fill(fluidContainer, fluid.getFluidStack(), false);
if (test == 0) {
return;
}
IAEFluidStack storedFluid = this.monitor.getStorageList().findPrecise(fluid);
if (storedFluid == null || storedFluid.getStackSize() <= 0) return;
int capacity;
if (fluidContainer.getItem() instanceof IFluidContainerItem) {
capacity = ((IFluidContainerItem) fluidContainer.getItem()).getCapacity(fluidContainer);
} else if (FluidContainerRegistry.isContainer(fluidContainer)) {
ItemStack test = FluidContainerRegistry.fillFluidContainer(fluid.getFluidStack(), fluidContainer);
if (test == null) {
return;
}
// Fill with fluid container registry, or abort if it failed
ItemStack dummy = FluidContainerRegistry.fillFluidContainer(storedFluid.getFluidStack(), fluidContainer);
capacity = FluidContainerRegistry.getContainerCapacity(dummy);
} else {
return;
}
IAEFluidStack storedFluid = this.monitor.getStorageList().findPrecise(fluid);
if (storedFluid == null || storedFluid.getStackSize() <= 0) return;
int capacity = Util.FluidUtil.getCapacity(fluidContainer, storedFluid.getFluid());
if (capacity == 0) return;
// The fluidstack that we will try to extract from the system.
final IAEFluidStack canExtract = storedFluid.copy();
@@ -446,7 +362,7 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
// run into issues w/ remainder fluid later.
canExtract.setStackSize((long) capacity * fluidContainer.stackSize);
IAEFluidStack actualExtract = this.host.getFluidInventory()
.extractItems(canExtract, Actionable.MODULATE, this.getActionSource());
.extractItems(canExtract, Actionable.SIMULATE, this.getActionSource());
if (actualExtract == null) return;
// Calculate the number of full fluid containers we extracted
long toExtract = actualExtract.getStackSize();
@@ -486,14 +402,19 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
if (dummy == null) {
// Failed to fill partial...
partialStack.stackSize = 0;
toExtract -= remainder;
} else {
partialStack = dummy;
toExtract -= FluidContainerRegistry.getContainerCapacity(partialStack);
emptyTanks--;
}
}
} else {
partialStack.stackSize = 0;
}
// Now perform the real extraction.
actualExtract.setStackSize(toExtract);
this.host.getFluidInventory().extractItems(canExtract, Actionable.MODULATE, this.getActionSource());
// Done. Put the output in the inventory or ground, and update stack size.
// We can assume slotIndex == -1, since we don't actually allow extraction via shift click.
@@ -520,11 +441,13 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
(EntityPlayerMP) player);
} else {
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(new HashMap<>()), (EntityPlayerMP) player);
}
}
void adjustStack(ItemStack stack) {
if (stack != null && stack.stackSize > stack.getMaxStackSize()) {
if (stack.stackSize > stack.getMaxStackSize()) {
dropItem(stack, stack.stackSize - stack.getMaxStackSize());
stack.stackSize = stack.getMaxStackSize();
}
@@ -106,10 +106,7 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPa
}
private static IAEItemStack[] collectAeInventory(AeStackInventory<IAEItemStack> inv) {
/*
* AE2 API documentation says the input/output arrays can contain nulls, but their use of the API directly
* contradicts that, so we just go by behaviour and filter out nulls.
*/
// see note at top of DensePatternDetails
List<IAEItemStack> acc = new ArrayList<>();
for (IAEItemStack stack : inv) {
if (stack != null) {
@@ -133,20 +130,20 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPa
if (slot instanceof SlotFluidConvertingFake) {
final ItemStack stack = player.inventory.getItemStack();
switch (action) {
case PICKUP_OR_SET_DOWN -> {
case PICKUP_OR_SET_DOWN:
if (stack == null) {
slot.putStack(null);
} else {
((SlotFluidConvertingFake) slot).putConvertedStack(stack.copy());
}
}
case PLACE_SINGLE -> {
break;
case PLACE_SINGLE:
if (stack != null) {
((SlotFluidConvertingFake) slot)
.putConvertedStack(Objects.requireNonNull(Util.copyStackWithSize(stack, 1)));
}
}
case SPLIT_OR_PLACE_SINGLE -> {
break;
case SPLIT_OR_PLACE_SINGLE:
ItemStack inSlot = slot.getStack();
if (inSlot != null) {
if (stack == null) {
@@ -164,7 +161,7 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPa
((SlotFluidConvertingFake) slot)
.putConvertedStack(Objects.requireNonNull(Util.copyStackWithSize(stack, 1)));
}
}
break;
}
} else {
super.doAction(player, action, slotId, id);
@@ -42,12 +42,13 @@ import appeng.util.inv.WrapperInvSlot;
public class ContainerInterfaceWireless extends FCBaseContainer {
/**
* this stuff is all server side
* this stuff is all server side..
*/
private static long autoBase = Long.MIN_VALUE;
private final Multimap<IInterfaceHost, ContainerInterfaceWireless.InvTracker> diList = HashMultimap.create();
private final Map<Long, ContainerInterfaceWireless.InvTracker> byId = new HashMap<>();
private final Map<Long, ContainerInterfaceWireless.InvTracker> byId = new HashMap<Long, ContainerInterfaceWireless.InvTracker>();
// private final Map<Long, InvTracker> byId = new HashMap<>();
private IGrid grid;
private NBTTagCompound data = new NBTTagCompound();
@@ -113,7 +114,9 @@ public class ContainerInterfaceWireless extends FCBaseContainer {
try {
NetworkHandler.instance
.sendTo(new PacketCompressedNBT(this.data), (EntityPlayerMP) this.getPlayerInv().player);
} catch (final IOException ignored) {}
} catch (final IOException e) {
// :P
}
this.data = new NBTTagCompound();
}
@@ -137,7 +140,7 @@ public class ContainerInterfaceWireless extends FCBaseContainer {
boolean canInsert = true;
switch (action) {
case PICKUP_OR_SET_DOWN -> {
case PICKUP_OR_SET_DOWN:
if (hasItemInHand) {
for (int s = 0; s < interfaceHandler.getSizeInventory(); s++) {
if (Platform.isSameItemPrecise(
@@ -172,8 +175,9 @@ public class ContainerInterfaceWireless extends FCBaseContainer {
final IInventory mySlot = slotInv.getWrapper(slot + inv.offset);
mySlot.setInventorySlotContents(0, playerHand.addItems(mySlot.getStackInSlot(0)));
}
}
case SPLIT_OR_PLACE_SINGLE -> {
break;
case SPLIT_OR_PLACE_SINGLE:
if (hasItemInHand) {
for (int s = 0; s < interfaceHandler.getSizeInventory(); s++) {
if (Platform.isSameItemPrecise(
@@ -201,28 +205,31 @@ public class ContainerInterfaceWireless extends FCBaseContainer {
interfaceSlot.addItems(extra);
}
}
}
case SHIFT_CLICK -> {
break;
case SHIFT_CLICK:
final IInventory mySlot = slotInv.getWrapper(slot + inv.offset);
final InventoryAdaptor playerInv = InventoryAdaptor.getAdaptor(player, ForgeDirection.UNKNOWN);
mySlot.setInventorySlotContents(0, mergeToPlayerInventory(playerInv, mySlot.getStackInSlot(0)));
}
case MOVE_REGION -> {
break;
case MOVE_REGION:
final InventoryAdaptor playerInvAd = InventoryAdaptor.getAdaptor(player, ForgeDirection.UNKNOWN);
for (int x = 0; x < inv.client.getSizeInventory(); x++) {
inv.server.setInventorySlotContents(
x + inv.offset,
mergeToPlayerInventory(playerInvAd, inv.server.getStackInSlot(x + inv.offset)));
}
}
case CREATIVE_DUPLICATE -> {
break;
case CREATIVE_DUPLICATE:
if (player.capabilities.isCreativeMode && !hasItemInHand) {
player.inventory.setItemStack(is == null ? null : is.copy());
}
}
default -> {
break;
default:
return;
}
}
this.updateHeld(player);
@@ -115,7 +115,7 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
return;
}
if (action == InventoryAction.MOVE_REGION) {
super.doAction(player, InventoryAction.MOVE_REGION, slotId, id);
super.doAction(player, InventoryAction.SPLIT_OR_PLACE_SINGLE, slotId, id);
return;
}
if (action == InventoryAction.PICKUP_SINGLE) {
@@ -132,11 +132,11 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
&& (stack.getItem() instanceof IFluidContainerItem || FluidContainerRegistry.isContainer(stack))) {
FluidStack fluid = null;
switch (action) {
case PICKUP_OR_SET_DOWN -> {
case PICKUP_OR_SET_DOWN:
fluid = Util.getFluidFromItem(stack);
slot.putStack(ItemFluidPacket.newStack(fluid));
}
case SPLIT_OR_PLACE_SINGLE -> {
break;
case SPLIT_OR_PLACE_SINGLE:
fluid = Util.getFluidFromItem(Util.copyStackWithSize(stack, 1));
FluidStack origin = ItemFluidPacket.getFluidStack(slot.getStack());
if (fluid != null && fluid.equals(origin)) {
@@ -144,7 +144,7 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
if (fluid.amount <= 0) fluid = null;
}
slot.putStack(ItemFluidPacket.newStack(fluid));
}
break;
}
if (fluid == null) {
super.doAction(player, action, slotId, id);
@@ -523,51 +523,14 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
return false;
}
static boolean canDouble(SlotFake[] slots, int mult) {
for (Slot s : slots) {
ItemStack st = s.getStack();
if (st != null) {
if (st.getItem() instanceof ItemFluidPacket) {
long result = (long) ItemFluidPacket.getFluidAmount(st) * mult;
if (result > Integer.MAX_VALUE) {
return false;
}
} else {
long result = (long) s.getStack().stackSize * mult;
if (result > Integer.MAX_VALUE) {
return false;
}
}
}
}
return true;
}
static void doubleStacksInternal(SlotFake[] slots, int mult) {
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
for (final Slot s : enabledSlots) {
ItemStack st = s.getStack();
if (st != null) {
if (st.getItem() instanceof ItemFluidPacket) {
ItemFluidPacket.setFluidAmount(st, ItemFluidPacket.getFluidAmount(st) * mult);
} else {
st.stackSize *= mult;
}
}
}
}
public void doubleStacks(boolean isShift) {
if (!isCraftingMode()) {
if (isShift) {
if (canDouble(this.craftingSlots, 8) && canDouble(this.outputSlots, 8)) {
doubleStacksInternal(this.craftingSlots, 8);
doubleStacksInternal(this.outputSlots, 8);
}
} else {
if (canDouble(this.craftingSlots, 2) && canDouble(this.outputSlots, 2)) {
doubleStacksInternal(this.craftingSlots, 2);
doubleStacksInternal(this.outputSlots, 2);
if (canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots)) {
doubleStacksInternal(this.craftingSlots);
doubleStacksInternal(this.outputSlots);
if (isShift && (containsItem(outputSlots) || containsItem(craftingSlots))) {
while (canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots)) {
doubleStacksInternal(this.craftingSlots);
doubleStacksInternal(this.outputSlots);
}
}
this.detectAndSendChanges();
@@ -98,7 +98,7 @@ public abstract class FCContainerFluidConfigurable extends ContainerUpgradeable
@Override
protected void standardDetectAndSendChanges() {
if (Platform.isServer()) {
// clear out config items that are no longer valid (for instance, capacity upgrade removed)
// clear out config items that are no longer valid (eg capacity upgrade removed)
final AppEngInternalAEInventory inv = this.getFakeFluidInv();
final Map<Integer, IAEFluidStack> tmp = new HashMap<>();
for (int i = 0; i < inv.getSizeInventory(); ++i) {
@@ -210,7 +210,8 @@ public abstract class FCContainerMonitor<T extends IAEStack<T>> extends FCBaseCo
@Override
public void onListUpdate() {
for (final Object c : this.crafters) {
if (c instanceof final ICrafting cr) {
if (c instanceof ICrafting) {
final ICrafting cr = (ICrafting) c;
this.queueInventory(cr);
}
}
@@ -1,25 +1,17 @@
package com.glodblock.github.client.me;
import java.util.Iterator;
import java.util.regex.Pattern;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.crossmod.thaumcraft.AspectUtil;
import com.glodblock.github.util.FluidSorters;
import appeng.api.config.SearchBoxMode;
import appeng.api.config.Settings;
import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.IScrollSource;
import appeng.client.gui.widgets.ISortSource;
import appeng.core.AEConfig;
public class EssentiaRepo extends FluidRepo {
@@ -29,84 +21,7 @@ public class EssentiaRepo extends FluidRepo {
@Override
public void updateView() {
this.view.clear();
this.dsp.clear();
this.view.ensureCapacity(this.list.size());
this.dsp.ensureCapacity(this.list.size());
final Enum<?> viewMode = this.sortSrc.getSortDisplay();
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
if (searchMode == SearchBoxMode.NEI_AUTOSEARCH || searchMode == SearchBoxMode.NEI_MANUAL_SEARCH) {
this.updateNEI(this.searchString);
}
String innerSearch = this.searchString;
if (innerSearch.startsWith("@")) {
innerSearch = innerSearch.substring(1);
}
Pattern m;
try {
m = Pattern.compile(innerSearch.toLowerCase(), Pattern.CASE_INSENSITIVE);
} catch (final Throwable ignore) {
try {
m = Pattern.compile(Pattern.quote(innerSearch.toLowerCase()), Pattern.CASE_INSENSITIVE);
} catch (final Throwable __) {
return;
}
}
for (IAEItemStack is : this.list) {
if (this.myPartitionList != null) {
if (!this.myPartitionList.isListed(is)) {
continue;
}
}
if (viewMode == ViewItems.CRAFTABLE && !is.isCraftable()) {
continue;
}
if (viewMode == ViewItems.CRAFTABLE) {
is = is.copy();
is.setStackSize(0);
}
if (viewMode == ViewItems.STORED && is.getStackSize() == 0) {
continue;
}
Fluid fluid = ItemFluidDrop.getAeFluidStack(is).getFluid();
if (!AspectUtil.isEssentiaGas(fluid)) {
continue;
}
if (m.matcher(fluid.getLocalizedName().toLowerCase()).find()) {
this.view.add(is);
}
}
final Enum<?> SortBy = this.sortSrc.getSortBy();
final Enum<?> SortDir = this.sortSrc.getSortDir();
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
FluidSorters.init();
if (SortBy == SortOrder.MOD) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_MOD);
} else if (SortBy == SortOrder.AMOUNT) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
} else if (SortBy == SortOrder.INVTWEAKS) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
} else {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
}
for (final IAEItemStack is : this.view) {
this.dsp.add(is.getItemStack());
}
super.updateView();
Iterator<IAEItemStack> it1 = this.view.iterator();
while (it1.hasNext()) {
IAEFluidStack fluid = ItemFluidDrop.getAeFluidStack(it1.next());
@@ -20,7 +20,6 @@ import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.util.FluidSorters;
import com.glodblock.github.util.Util;
@@ -28,36 +27,36 @@ import com.glodblock.github.util.Util;
import appeng.api.AEApi;
import appeng.api.config.*;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IDisplayRepo;
import appeng.api.storage.data.IItemList;
import appeng.client.gui.widgets.IScrollSource;
import appeng.client.gui.widgets.ISortSource;
import appeng.client.me.ItemRepo;
import appeng.core.AEConfig;
import appeng.items.storage.ItemViewCell;
import appeng.util.prioitylist.IPartitionList;
import cpw.mods.fml.relauncher.ReflectionHelper;
public class FluidRepo implements IDisplayRepo {
public class FluidRepo extends ItemRepo {
protected final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
protected final ArrayList<IAEItemStack> view = new ArrayList<>();
protected final ArrayList<ItemStack> dsp = new ArrayList<>();
protected final IScrollSource src;
protected final ISortSource sortSrc;
private final IScrollSource src;
private final ISortSource sortSrc;
protected int rowSize = 9;
private int rowSize = 9;
protected String searchString = "";
protected IPartitionList<IAEItemStack> myPartitionList;
private String searchString = "";
private IPartitionList<IAEItemStack> myPartitionList;
private String NEIWord = null;
private boolean hasPower;
public FluidRepo(final IScrollSource src, final ISortSource sortSrc) {
super(src, sortSrc);
this.src = src;
this.sortSrc = sortSrc;
}
@Override
public IAEItemStack getReferenceItem(int idx) {
idx += this.src.getCurrentScroll() * this.rowSize;
@@ -67,7 +66,6 @@ public class FluidRepo implements IDisplayRepo {
return this.view.get(idx);
}
@Override
public ItemStack getItem(int idx) {
idx += this.src.getCurrentScroll() * this.rowSize;
@@ -77,7 +75,10 @@ public class FluidRepo implements IDisplayRepo {
return this.dsp.get(idx);
}
@Override
void setSearch(final String search) {
this.searchString = search == null ? "" : search;
}
public void postUpdate(final IAEItemStack is) {
final IAEItemStack st = this.list.findPrecise(is);
if (st != null) {
@@ -88,13 +89,11 @@ public class FluidRepo implements IDisplayRepo {
}
}
@Override
public void setViewCell(final ItemStack[] list) {
this.myPartitionList = ItemViewCell.createFilter(list);
this.updateView();
}
@Override
public void updateView() {
this.view.clear();
this.dsp.clear();
@@ -146,13 +145,7 @@ public class FluidRepo implements IDisplayRepo {
if (viewMode == ViewItems.STORED && is.getStackSize() == 0) {
continue;
}
Fluid fluid = ItemFluidDrop.getAeFluidStack(is).getFluid();
if (FluidCraftAPI.instance().isBlacklistedInDisplay(fluid.getClass())) {
continue;
}
if (searchMod) {
if (m.matcher(Util.getFluidModID(fluid).toLowerCase()).find()
|| m.matcher(Util.getFluidModName(fluid).toLowerCase()).find()) {
@@ -186,7 +179,7 @@ public class FluidRepo implements IDisplayRepo {
}
}
protected void updateNEI(final String filter) {
private void updateNEI(final String filter) {
try {
if (this.NEIWord == null || !this.NEIWord.equals(filter)) {
final Class<?> c = ReflectionHelper
@@ -206,23 +199,19 @@ public class FluidRepo implements IDisplayRepo {
}
}
@Override
public int size() {
return this.view.size();
}
@Override
public void clear() {
this.list.resetStatus();
}
@Override
public boolean hasPower() {
return this.hasPower;
}
@Override
public void setPowered(final boolean hasPower) {
public void setPower(final boolean hasPower) {
this.hasPower = hasPower;
}
@@ -19,8 +19,6 @@ import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.render.tank.ModelCertusTank;
import com.glodblock.github.common.tile.TileCertusQuartzTank;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.ModAndClassUtil;
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
import cpw.mods.fml.client.registry.ClientRegistry;
@@ -68,9 +66,6 @@ public class ItemCertusQuartzTankRender implements IItemRenderer {
if (storedFluid != null && storedFluid.getFluid() != null) {
IIcon fluidIcon = storedFluid.getFluid().getIcon();
if (fluidIcon == null) fluidIcon = FluidRegistry.LAVA.getIcon();
if (ModAndClassUtil.HODGEPODGE && fluidIcon instanceof IPatchedTextureAtlasSprite) {
((IPatchedTextureAtlasSprite) fluidIcon).markNeedsAnimationUpdate();
}
Tessellator tessellator = Tessellator.instance;
RenderBlocks renderer = new RenderBlocks();
GL11.glScalef(1, 1, -1);
@@ -37,12 +37,15 @@ public class ItemWalrusRender implements IItemRenderer {
Minecraft.getMinecraft().renderEngine.bindTexture(this.textureWalrus);
GL11.glPushMatrix();
switch (type) {
case EQUIPPED_FIRST_PERSON -> {
case EQUIPPED_FIRST_PERSON:
GL11.glRotated(180, 0, 1, 0);
GL11.glTranslatef(-1F, 0.5F, -0.5F);
}
case INVENTORY -> GL11.glTranslatef(-0.5F, -0.5F, -0.1F);
default -> {}
break;
case INVENTORY:
GL11.glTranslatef(-0.5F, -0.5F, -0.1F);
break;
default:
break;
}
this.modelWalrus.renderAll();
GL11.glPopMatrix();
@@ -3,11 +3,8 @@ package com.glodblock.github.client.render.tank;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nonnull;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.init.Blocks;
import net.minecraft.util.IIcon;
@@ -78,7 +75,7 @@ public class FluidTankRenderer {
return null;
}
Map<Fluid, int[]> cache = flowing ? flowingRenderCache : stillRenderCache;
int[] diplayLists = getCachedData(fluid, cache);
int[] diplayLists = cache.get(fluid);
if (diplayLists != null) {
return diplayLists;
}
@@ -100,7 +97,7 @@ public class FluidTankRenderer {
for (int s = 0; s < DISPLAY_STAGES; ++s) {
diplayLists[s] = GLAllocation.generateDisplayLists(1);
GL11.glNewList(diplayLists[s], GL11.GL_COMPILE);
GL11.glNewList(diplayLists[s], 4864 /* GL_COMPILE */);
liquidBlock.minX = 0.01f;
liquidBlock.minY = 0;
@@ -121,12 +118,4 @@ public class FluidTankRenderer {
return diplayLists;
}
private static int[] getCachedData(@Nonnull Fluid fluid, Map<Fluid, int[]> cache) {
IIcon icon = fluid.getIcon();
if (icon instanceof TextureAtlasSprite sprite && sprite.hasAnimationMetadata()) {
return null;
}
return cache.get(fluid);
}
}
@@ -15,8 +15,8 @@ public class Config {
public static boolean noFluidPacket;
public static boolean fluidIOBus;
public static boolean removeRecipe;
public static boolean blacklistEssentiaGas;
public static double portableCellBattery;
public static boolean fluidP2PInterface;
public static int packetSize;
public static int packetRate;
public static boolean replaceEC2;
@@ -42,16 +42,16 @@ public class Config {
"Fluid Craft for AE2",
true,
"Enable this to add Fluid Import/Export Bus like EC2's one.");
fluidP2PInterface = Config.getBoolean(
"fluidP2PInterface",
"Fluid Craft for AE2",
true,
"Enable the P2P Tunnel - ME Dual Interface feature.");
removeRecipe = Config.getBoolean(
"Disable all recipes",
"Fluid Craft for AE2",
false,
"Disable all recipes, for quick tweaker.");
blacklistEssentiaGas = Config.getBoolean(
"Blacklist Essentia Gas",
"Fluid Craft for AE2",
true,
"Blacklist Essentia Gas from Thaumic Energistics, so they won't be stored in Fluid Storage Cells.");
portableCellBattery = Config.get("Fluid Craft for AE2", "Portable Fluid Cell Battery Capacity", 20000D)
.getDouble();
packetSize = Config.get("Fluid Craft for AE2", "packetSize", 256, "Number of items to be sent per packet")
@@ -62,8 +62,8 @@ public class Config {
.getInt();
if (packetRate <= 0) packetRate = 50;
replaceEC2 = Config.getBoolean(
"replaceEC2",
"Fluid Craft for AE2",
"replaceEC2",
true,
"Set true to handle missing item mappings from EC2. Note to work properly, you must have all relevant parts.");
if (Config.hasChanged()) Config.save();
@@ -78,12 +78,16 @@ public class BlockCertusQuartzTank extends BaseBlockContainer implements IRegist
@Override
public IIcon getIcon(int side, int meta) {
return switch (meta) {
case 1 -> this.sideTopIcon;
case 2 -> this.sideBottomIcon;
case 3 -> this.sideMiddleIcon;
default -> side == 0 ? this.bottomIcon : side == 1 ? this.topIcon : this.sideIcon;
};
switch (meta) {
case 1:
return this.sideTopIcon;
case 2:
return this.sideBottomIcon;
case 3:
return this.sideMiddleIcon;
default:
return side == 0 ? this.bottomIcon : side == 1 ? this.topIcon : this.sideIcon;
}
}
@Override
@@ -99,7 +103,8 @@ public class BlockCertusQuartzTank extends BaseBlockContainer implements IRegist
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileCertusQuartzTank tank) {
if (tile instanceof TileCertusQuartzTank) {
TileCertusQuartzTank tank = (TileCertusQuartzTank) tile;
return tank.getFluidLightLevel();
}
return super.getLightValue(world, x, y, z);
@@ -76,11 +76,21 @@ public class BlockWalrus extends BaseBlockContainer {
@Override
public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int x, int y, int z) {
switch (ForgeDirection.getOrientation(blockAccess.getBlockMetadata(x, y, z))) {
case NORTH -> setBlockBounds(0.0F, 0.0F, -1.0F, 1.0F, 1.0F, 1.0F);
case EAST -> setBlockBounds(0.0F, 0.0F, 0.0F, 2.0F, 1.0F, 1.0F);
case SOUTH -> setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 2.0F);
case WEST -> setBlockBounds(-1.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
default -> setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
case NORTH:
setBlockBounds(0.0F, 0.0F, -1.0F, 1.0F, 1.0F, 1.0F);
break;
case EAST:
setBlockBounds(0.0F, 0.0F, 0.0F, 2.0F, 1.0F, 1.0F);
break;
case SOUTH:
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 2.0F);
break;
case WEST:
setBlockBounds(-1.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
break;
default:
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
break;
}
}
@@ -14,12 +14,13 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.storage.CellType;
import com.glodblock.github.common.storage.IFluidCellInventory;
import com.glodblock.github.common.storage.IFluidCellInventoryHandler;
import com.glodblock.github.common.storage.IStorageFluidCell;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.NameConst;
import com.google.common.base.Optional;
@@ -86,8 +87,10 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
@Override
public boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition) {
return requestedAddition == null || requestedAddition.getFluid() == null
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
if (Config.blacklistEssentiaGas && ModAndClassUtil.ThE && requestedAddition != null) {
return ModAndClassUtil.essentiaGas.isInstance(requestedAddition.getFluid());
}
return false;
}
@Override
@@ -96,7 +99,8 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell()
.getCellInventory(stack, null, StorageChannel.FLUIDS);
if (inventory instanceof final IFluidCellInventoryHandler handler) {
if (inventory instanceof IFluidCellInventoryHandler) {
final IFluidCellInventoryHandler handler = (IFluidCellInventoryHandler) inventory;
final IFluidCellInventory cellInventory = handler.getCellInv();
if (cellInventory != null) {
@@ -46,42 +46,41 @@ public class ItemBasicFluidStorageCell extends FCBaseItemCell
setUnlocalizedName(NameConst.ITEM_FLUID_STORAGE + kilobytes);
switch (this.component) {
case Cell1kPart -> {
case Cell1kPart:
this.idleDrain = 0.5;
this.perType = 8;
}
case Cell4kPart -> {
break;
case Cell4kPart:
this.idleDrain = 1.0;
this.perType = 8;
}
case Cell16kPart -> {
break;
case Cell16kPart:
this.idleDrain = 1.5;
this.perType = 8;
}
case Cell64kPart -> {
break;
case Cell64kPart:
this.idleDrain = 2.0;
this.perType = 8;
}
case Cell256kPart -> {
break;
case Cell256kPart:
this.idleDrain = 2.5;
this.perType = 8;
}
case Cell1024kPart -> {
break;
case Cell1024kPart:
this.idleDrain = 3.0;
this.perType = 8;
}
case Cell4096kPart -> {
break;
case Cell4096kPart:
this.idleDrain = 3.5;
this.perType = 8;
}
case Cell16384kPart -> {
break;
case Cell16384kPart:
this.idleDrain = 4.0;
this.perType = 8;
}
default -> {
break;
default:
this.idleDrain = 0.0;
this.perType = 8;
}
}
}
@@ -10,12 +10,13 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.storage.IFluidCellInventory;
import com.glodblock.github.common.storage.IFluidCellInventoryHandler;
import com.glodblock.github.common.storage.IStorageFluidCell;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.loader.IRegister;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.NameConst;
import appeng.api.AEApi;
@@ -53,8 +54,10 @@ public class ItemCreativeFluidStorageCell extends AEBaseItem
@Override
public boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition) {
return requestedAddition == null || requestedAddition.getFluid() == null
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
if (Config.blacklistEssentiaGas && ModAndClassUtil.ThE && requestedAddition != null) {
return ModAndClassUtil.essentiaGas.isInstance(requestedAddition.getFluid());
}
return false;
}
@Override
@@ -108,7 +111,8 @@ public class ItemCreativeFluidStorageCell extends AEBaseItem
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell()
.getCellInventory(stack, null, StorageChannel.FLUIDS);
if (inventory instanceof final IFluidCellInventoryHandler handler) {
if (inventory instanceof IFluidCellInventoryHandler) {
final IFluidCellInventoryHandler handler = (IFluidCellInventoryHandler) inventory;
final IFluidCellInventory cellInventory = handler.getCellInv();
if (GuiScreen.isCtrlKeyDown()) {
@@ -86,7 +86,6 @@ public class ItemFluidDrop extends FCBaseItem {
shape = aIconRegister.registerIcon(NameConst.RES_KEY + NameConst.ITEM_FLUID_DROP);
}
@Nullable
public static ItemStack newStack(@Nullable FluidStack fluid) {
if (fluid == null || fluid.amount <= 0) {
return null;
@@ -98,7 +97,6 @@ public class ItemFluidDrop extends FCBaseItem {
return stack;
}
@Nullable
public static ItemStack newDisplayStack(FluidStack fluid) {
if (fluid == null) {
return null;
@@ -122,7 +120,6 @@ public class ItemFluidDrop extends FCBaseItem {
return getFluidStack(stack.getItemStack()) != null;
}
@Nullable
public static FluidStack getFluidStack(ItemStack stack) {
if (stack == null || stack.getItem() != ItemAndBlockHolder.DROP || !stack.hasTagCompound()) {
return null;
@@ -142,7 +139,6 @@ public class ItemFluidDrop extends FCBaseItem {
return fluidStack;
}
@Nullable
public static IAEFluidStack getAeFluidStack(@Nullable IAEItemStack stack) {
if (stack == null) {
return null;
@@ -155,7 +151,6 @@ public class ItemFluidDrop extends FCBaseItem {
return fluidStack;
}
@Nullable
public static IAEItemStack newAeStack(@Nullable FluidStack fluid) {
if (fluid == null || fluid.amount <= 0) {
return null;
@@ -168,7 +163,6 @@ public class ItemFluidDrop extends FCBaseItem {
return stack;
}
@Nullable
public static IAEItemStack newAeStack(@Nullable IAEFluidStack fluid) {
if (fluid == null || fluid.getStackSize() <= 0) {
return null;
@@ -12,7 +12,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
@@ -35,7 +34,6 @@ public class ItemFluidPacket extends FCBaseItem {
setMaxStackSize(1);
}
@Nullable
public static FluidStack getFluidStack(ItemStack stack) {
if (stack == null || !stack.hasTagCompound()) {
return null;
@@ -84,28 +82,10 @@ public class ItemFluidPacket extends FCBaseItem {
}
}
@Nullable
public static FluidStack getFluidStack(@Nullable IAEItemStack stack) {
return stack != null ? getFluidStack(stack.getItemStack()) : null;
}
public static void setFluidAmount(ItemStack stack, int amount) {
if (stack == null || !stack.hasTagCompound()
|| !stack.getTagCompound().hasKey("FluidStack", Constants.NBT.TAG_COMPOUND)) {
return;
}
stack.getTagCompound().getCompoundTag("FluidStack").setInteger("Amount", amount);
}
public static int getFluidAmount(ItemStack stack) {
if (stack == null || !stack.hasTagCompound()) {
return 0;
}
// Default to 0 if no tag exists
return stack.getTagCompound().getCompoundTag("FluidStack").getInteger("Amount");
}
@Nullable
public static ItemStack newStack(@Nullable FluidStack fluid) {
if (fluid == null || fluid.amount == 0) {
return null;
@@ -119,7 +99,6 @@ public class ItemFluidPacket extends FCBaseItem {
return stack;
}
@Nullable
public static ItemStack newStack(@Nullable IAEFluidStack fluid) {
if (fluid == null || fluid.getStackSize() == 0) {
return null;
@@ -127,7 +106,6 @@ public class ItemFluidPacket extends FCBaseItem {
return newStack(fluid.getFluidStack());
}
@Nullable
public static ItemStack newDisplayStack(@Nullable FluidStack fluid) {
if (fluid == null) {
return null;
@@ -47,42 +47,41 @@ public class ItemMultiFluidStorageCell extends FCBaseItemCell
setUnlocalizedName(NameConst.ITEM_MULTI_FLUID_STORAGE + kilobytes);
switch (this.component) {
case Cell1kPart -> {
case Cell1kPart:
this.idleDrain = 0.5;
this.perType = 8;
}
case Cell4kPart -> {
break;
case Cell4kPart:
this.idleDrain = 1.0;
this.perType = 32;
}
case Cell16kPart -> {
break;
case Cell16kPart:
this.idleDrain = 1.5;
this.perType = 128;
}
case Cell64kPart -> {
break;
case Cell64kPart:
this.idleDrain = 2.0;
this.perType = 512;
}
case Cell256kPart -> {
break;
case Cell256kPart:
this.idleDrain = 2.5;
this.perType = 2048;
}
case Cell1024kPart -> {
break;
case Cell1024kPart:
this.idleDrain = 3.0;
this.perType = 8192;
}
case Cell4096kPart -> {
break;
case Cell4096kPart:
this.idleDrain = 3.5;
this.perType = 32768;
}
case Cell16384kPart -> {
break;
case Cell16384kPart:
this.idleDrain = 4.0;
this.perType = 131072;
}
default -> {
break;
default:
this.idleDrain = 0.0;
this.perType = 8;
}
}
}
@@ -1,71 +0,0 @@
package com.glodblock.github.common.item;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.parts.PartFluidP2PInterface;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.util.NameConst;
import appeng.api.AEApi;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartItem;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemPartFluidP2PInterface extends FCBaseItem implements IPartItem {
private IIcon icon;
public ItemPartFluidP2PInterface() {
this.setMaxStackSize(64);
this.setUnlocalizedName(NameConst.ITEM_PART_FLUID_P2P_INTERFACE);
AEApi.instance().partHelper().setItemBusRenderer(this);
}
@Nullable
@Override
public IPart createPartFromItemStack(ItemStack is) {
return new PartFluidP2PInterface(is);
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
float xOffset, float yOffset, float zOffset) {
return AEApi.instance().partHelper().placeBus(player.getHeldItem(), x, y, z, side, player, world);
}
@Override
public ItemPartFluidP2PInterface register() {
if (!Config.fluidP2PInterface) return null;
GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_P2P_INTERFACE, FluidCraft.MODID);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@Override
public IIcon getIconFromDamage(int dmg) {
return icon;
}
@Override
public void registerIcons(IIconRegister register) {
if (Config.fluidP2PInterface) {
this.icon = register.registerIcon("appliedenergistics2:ItemPart.P2PTunnel");
}
}
@Override
@SideOnly(Side.CLIENT)
public int getSpriteNumber() {
return 0;
}
}
@@ -13,7 +13,6 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.storage.IFluidCellInventory;
import com.glodblock.github.common.storage.IFluidCellInventoryHandler;
@@ -25,6 +24,7 @@ import com.glodblock.github.inventory.item.IItemInventory;
import com.glodblock.github.inventory.item.PortableFluidCellInventory;
import com.glodblock.github.loader.IRegister;
import com.glodblock.github.util.BlockPos;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.NameConst;
import com.glodblock.github.util.RenderUtil;
import com.google.common.base.Optional;
@@ -78,7 +78,8 @@ public class ItemPortableFluidCell extends AEBasePoweredItem
super.addCheckedInformation(stack, player, lines, displayMoreInfo);
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell()
.getCellInventory(stack, null, StorageChannel.FLUIDS);
if (inventory instanceof final IFluidCellInventoryHandler handler) {
if (inventory instanceof IFluidCellInventoryHandler) {
final IFluidCellInventoryHandler handler = (IFluidCellInventoryHandler) inventory;
final IFluidCellInventory cellInventory = handler.getCellInv();
if (cellInventory != null) {
lines.add(
@@ -131,8 +132,10 @@ public class ItemPortableFluidCell extends AEBasePoweredItem
@Override
public boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition) {
return requestedAddition == null || requestedAddition.getFluid() == null
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
if (Config.blacklistEssentiaGas && ModAndClassUtil.ThE && requestedAddition != null) {
return ModAndClassUtil.essentiaGas.isInstance(requestedAddition.getFluid());
}
return false;
}
@Override
@@ -36,12 +36,10 @@ import appeng.core.localization.PlayerMessages;
import appeng.util.Platform;
import baubles.api.BaubleType;
import baubles.api.IBauble;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles")
public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
implements IBauble, IRegister<ItemWirelessUltraTerminal> {
@@ -102,7 +102,9 @@ public class PartFluidConversionMonitor extends PartFluidStorageMonitor {
}
}
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// :P
}
return true;
}
@@ -151,7 +153,9 @@ public class PartFluidConversionMonitor extends PartFluidStorageMonitor {
player.openContainer.detectAndSendChanges();
}
}
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// :P
}
}
}
}
@@ -163,7 +163,9 @@ public class PartFluidExportBus extends FCSharedFluidBus implements ICraftingReq
}
this.updateSchedulingMode(this.getSchedulingMode(), i);
return didSomething ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
} catch (GridAccessException ignored) {}
} catch (GridAccessException e) {
// Ignore
}
}
return TickRateModulation.SLEEP;
@@ -130,16 +130,10 @@ public class PartFluidLevelEmitter extends PartUpgradeable
return false;
}
final Enum<?> redstoneEmitterSetting = this.getConfigManager().getSetting(Settings.REDSTONE_EMITTER);
final boolean result;
if (redstoneEmitterSetting == RedstoneMode.LOW_SIGNAL) {
result = this.reportingValue >= this.lastReportedValue + 1;
} else {
result = this.reportingValue < this.lastReportedValue + 1;
}
return result;
final boolean flipState = this.getConfigManager().getSetting(Settings.REDSTONE_EMITTER)
== RedstoneMode.LOW_SIGNAL;
return flipState ? this.reportingValue >= this.lastReportedValue + 1
: this.reportingValue < this.lastReportedValue + 1;
}
@MENetworkEventSubscribe
@@ -187,7 +181,9 @@ public class PartFluidLevelEmitter extends PartUpgradeable
this.myWatcher.add(myStack);
}
this.updateReportingValue(this.getProxy().getStorage().getFluidInventory());
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e1) {
// :/
}
}
private void updateReportingValue(final IMEMonitor<IAEFluidStack> monitor) {
@@ -286,7 +282,9 @@ public class PartFluidLevelEmitter extends PartUpgradeable
public void onListUpdate() {
try {
this.updateReportingValue(this.getProxy().getStorage().getFluidInventory());
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// ;P
}
}
@Override
@@ -306,23 +304,40 @@ public class PartFluidLevelEmitter extends PartUpgradeable
Tessellator.instance.startDrawingQuads();
this.renderTorchAtAngle(0, -0.5, 0);
Tessellator.instance.draw();
// rh.setBounds( 7, 7, 10, 9, 9, 15 );
// rh.renderInventoryBox( renderer );
}
private void renderTorchAtAngle(double baseX, double baseY, double baseZ) {
final boolean isOn = this.isLevelEmitterOn();
final IIcon offTexture = this.getItemStack().getIconIndex();
final IIcon IIcon = (isOn ? CableBusTextures.LevelEmitterTorchOn.getIcon() : offTexture);
//
this.centerX = baseX + 0.5;
this.centerY = baseY + 0.5;
this.centerZ = baseZ + 0.5;
baseY += 7.0 / 16.0;
// double par11 = 0;
/*
* double d5 = (double)IIcon.func_94209_e(); double d6 = (double)IIcon.func_94206_g(); double d7 =
* (double)IIcon.func_94212_f(); double d8 = (double)IIcon.func_94210_h(); double d9 =
* (double)IIcon.func_94214_a(7.0D); double d10 = (double)IIcon.func_94207_b(6.0D); double d11 =
* (double)IIcon.func_94214_a(9.0D); double d12 = (double)IIcon.func_94207_b(8.0D); double d13 =
* (double)IIcon.func_94214_a(7.0D); double d14 = (double)IIcon.func_94207_b(13.0D); double d15 =
* (double)IIcon.func_94214_a(9.0D); double d16 = (double)IIcon.func_94207_b(15.0D);
*/
final float var16 = IIcon.getMinU();
final float var17 = IIcon.getMaxU();
final float var18 = IIcon.getMinV();
final float var19 = IIcon.getMaxV();
/*
* float var16 = (float)var14 / 256.0F; float var17 = ((float)var14 + 15.99F) / 256.0F; float var18 =
* (float)var15 / 256.0F; float var19 = ((float)var15 + 15.99F) / 256.0F;
*/
final double var20b = offTexture.getInterpolatedU(7.0D);
final double var24b = offTexture.getInterpolatedU(9.0D);
@@ -361,26 +376,56 @@ public class PartFluidLevelEmitter extends PartUpgradeable
final double var44 = 0.0625D;
final double Zero = 0;
final double par10 = 0;
this.addVertexWithUV(
baseX + Zero * (1.0D - TorchLen) - var44,
baseY + TorchLen - toff,
baseZ + par10 * (1.0D - TorchLen) - var44,
var20,
var22);
this.addVertexWithUV(
baseX + Zero * (1.0D - TorchLen) - var44,
baseY + TorchLen - toff,
baseZ + par10 * (1.0D - TorchLen) + var44,
var20,
var26);
this.addVertexWithUV(
baseX + Zero * (1.0D - TorchLen) + var44,
baseY + TorchLen - toff,
baseZ + par10 * (1.0D - TorchLen) + var44,
var24,
var26);
this.addVertexWithUV(
baseX + Zero * (1.0D - TorchLen) + var44,
baseY + TorchLen - toff,
baseZ + par10 * (1.0D - TorchLen) - var44,
var24,
var22);
final double x = baseX + Zero * (1.0D - TorchLen) - var44;
final double x1 = baseX + Zero * (1.0D - TorchLen) + var44;
final double y = baseY + TorchLen - toff;
final double var422 = 0.1915D + 1.0 / 16.0;
final double y1 = baseY + var422;
final double z = baseZ + par10 * (1.0D - TorchLen) - var44;
final double z1 = baseZ + par10 * (1.0D - TorchLen) + var44;
this.addVertexWithUV(x, y, z, var20, var22);
this.addVertexWithUV(x, y, z1, var20, var26);
this.addVertexWithUV(x1, y, z1, var24, var26);
this.addVertexWithUV(x1, y, z, var24, var22);
this.addVertexWithUV(x1, y1, z, var24b, var22b);
this.addVertexWithUV(x1, y1, z1, var24b, var26b);
this.addVertexWithUV(x, y1, z1, var20b, var26b);
this.addVertexWithUV(x, y1, z, var20b, var22b);
this.addVertexWithUV(
baseX + Zero * (1.0D - TorchLen) + var44,
baseY + var422,
baseZ + par10 * (1.0D - TorchLen) - var44,
var24b,
var22b);
this.addVertexWithUV(
baseX + Zero * (1.0D - TorchLen) + var44,
baseY + var422,
baseZ + par10 * (1.0D - TorchLen) + var44,
var24b,
var26b);
this.addVertexWithUV(
baseX + Zero * (1.0D - TorchLen) - var44,
baseY + var422,
baseZ + par10 * (1.0D - TorchLen) + var44,
var20b,
var26b);
this.addVertexWithUV(
baseX + Zero * (1.0D - TorchLen) - var44,
baseY + var422,
baseZ + par10 * (1.0D - TorchLen) - var44,
var20b,
var22b);
this.addVertexWithUV(baseX + var44 + Zero, baseY, baseZ - var44 + par10, var32, var30);
this.addVertexWithUV(baseX + var44 + Zero, baseY, baseZ + var44 + par10, var32, var34);
@@ -458,6 +503,13 @@ public class PartFluidLevelEmitter extends PartUpgradeable
public void renderStatic(final int x, final int y, final int z, final IPartRenderHelper rh,
final RenderBlocks renderer) {
rh.setTexture(this.getItemStack().getIconIndex());
// rh.setTexture( CableBusTextures.ItemPartLevelEmitterOn.getIcon() );
// rh.setBounds( 2, 2, 14, 14, 14, 16 );
// rh.renderBlock( x, y, z, renderer );
// rh.setBounds( 7, 7, 10, 9, 9, 15 );
// rh.renderBlock( x, y, z, renderer );
renderer.renderAllFaces = true;
@@ -471,6 +523,8 @@ public class PartFluidLevelEmitter extends PartUpgradeable
rh.setBounds(7, 7, 11, 9, 9, 12);
this.renderLights(x, y, z, rh, renderer);
// super.renderWorldBlock( world, x, y, z, block, modelId, renderer );
}
@Override
@@ -1,521 +0,0 @@
package com.glodblock.github.common.parts;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Objects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.inventory.AEFluidInventory;
import com.glodblock.github.inventory.IAEFluidTank;
import com.glodblock.github.inventory.IDualHost;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.BlockPos;
import com.glodblock.github.util.DualityFluidInterface;
import com.glodblock.github.util.Util;
import com.google.common.collect.ImmutableSet;
import appeng.api.config.Actionable;
import appeng.api.config.Upgrades;
import appeng.api.implementations.tiles.ITileStorageMonitorable;
import appeng.api.networking.IGridNode;
import appeng.api.networking.crafting.ICraftingLink;
import appeng.api.networking.crafting.ICraftingPatternDetails;
import appeng.api.networking.crafting.ICraftingProviderHelper;
import appeng.api.networking.energy.IEnergyGrid;
import appeng.api.networking.events.MENetworkChannelsChanged;
import appeng.api.networking.events.MENetworkCraftingPatternChange;
import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.MachineSource;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPart;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.IStorageMonitorable;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.IConfigManager;
import appeng.helpers.DualityInterface;
import appeng.helpers.IInterfaceHost;
import appeng.helpers.IPriorityHost;
import appeng.me.GridAccessException;
import appeng.parts.automation.UpgradeInventory;
import appeng.parts.p2p.PartP2PTunnelStatic;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.inventory.IAEAppEngInventory;
import appeng.tile.inventory.InvOperation;
import appeng.util.Platform;
import appeng.util.inv.IInventoryDestination;
import appeng.util.item.AEFluidStack;
public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInterface>
implements IGridTickable, IStorageMonitorable, IInventoryDestination, IDualHost, ISidedInventory,
IAEAppEngInventory, ITileStorageMonitorable, IPriorityHost, IInterfaceHost {
private final DualityInterface duality = new DualityInterface(this.getProxy(), this) {
@Override
public void updateCraftingList() {
if (!isOutput()) {
super.updateCraftingList();
try {
for (PartFluidP2PInterface p2p : getOutputs()) p2p.duality.updateCraftingList();
} catch (GridAccessException e) {
// ?
}
} else {
PartFluidP2PInterface p2p = getInput();
if (p2p != null) {
this.craftingList = p2p.duality.craftingList;
try {
this.gridProxy.getGrid()
.postEvent(new MENetworkCraftingPatternChange(this, this.gridProxy.getNode()));
} catch (final GridAccessException e) {
// :P
}
}
}
}
@Override
public int getInstalledUpgrades(Upgrades u) {
if (isOutput() && u == Upgrades.PATTERN_CAPACITY) return -1;
return super.getInstalledUpgrades(u);
}
};
private final DualityFluidInterface dualityFluid = new DualityFluidInterface(this.getProxy(), this);
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, 6);
private final BaseActionSource ownActionSource = new MachineSource(this);
public PartFluidP2PInterface(ItemStack is) {
super(is);
}
@MENetworkEventSubscribe
public void stateChange(final MENetworkChannelsChanged c) {
dualityFluid.onChannelStateChange(c);
duality.notifyNeighbors();
}
@MENetworkEventSubscribe
public void stateChange(final MENetworkPowerStatusChange c) {
dualityFluid.onPowerStateChange(c);
duality.notifyNeighbors();
}
@Override
public void gridChanged() {
super.gridChanged();
dualityFluid.gridChanged();
}
@Override
public boolean onPartActivate(final EntityPlayer player, final Vec3 pos) {
AppEngInternalInventory patterns = (AppEngInternalInventory) duality.getPatterns();
if (super.onPartActivate(player, pos)) {
ArrayList<ItemStack> drops = new ArrayList<>();
for (int i = 0; i < patterns.getSizeInventory(); i++) {
if (patterns.getStackInSlot(i) == null) continue;
drops.add(patterns.getStackInSlot(i));
}
final IPart tile = this.getHost().getPart(this.getSide());
if (tile instanceof PartFluidP2PInterface dualTile) {
DualityInterface newDuality = dualTile.duality;
// Copy interface storage, upgrades, and settings over
UpgradeInventory upgrades = (UpgradeInventory) duality.getInventoryByName("upgrades");
dualTile.duality.getStorage();
UpgradeInventory newUpgrade = (UpgradeInventory) newDuality.getInventoryByName("upgrades");
for (int i = 0; i < upgrades.getSizeInventory(); ++i) {
newUpgrade.setInventorySlotContents(i, upgrades.getStackInSlot(i));
}
IInventory storage = duality.getStorage();
IInventory newStorage = newDuality.getStorage();
for (int i = 0; i < storage.getSizeInventory(); ++i) {
newStorage.setInventorySlotContents(i, storage.getStackInSlot(i));
}
IConfigManager config = duality.getConfigManager();
config.getSettings().forEach(
setting -> newDuality.getConfigManager().putSetting(setting, config.getSetting(setting)));
}
TileEntity te = getTileEntity();
Platform.spawnDrops(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, drops);
return true;
}
if (player.isSneaking()) {
return false;
}
if (Platform.isServer()) {
InventoryHandler.openGui(
player,
this.getHost().getTile().getWorldObj(),
new BlockPos(this.getHost().getTile()),
Objects.requireNonNull(this.getSide()),
GuiType.DUAL_INTERFACE);
}
return true;
}
@Override
public IIcon getTypeTexture() {
return ItemAndBlockHolder.INTERFACE.getBlockTextureFromSide(0);
}
@Override
public IStorageMonitorable getMonitorable(ForgeDirection side, BaseActionSource src) {
return duality.getMonitorable(side, src, this);
}
@Override
public TickingRequest getTickingRequest(IGridNode node) {
TickingRequest item = duality.getTickingRequest(node);
TickingRequest fluid = dualityFluid.getTickingRequest(node);
return new TickingRequest(
Math.min(item.minTickRate, fluid.minTickRate),
Math.max(item.maxTickRate, fluid.maxTickRate),
item.isSleeping && fluid.isSleeping,
true);
}
@Override
public TickRateModulation tickingRequest(IGridNode node, int ticksSinceLastCall) {
TickRateModulation item = duality.tickingRequest(node, ticksSinceLastCall);
TickRateModulation fluid = dualityFluid.tickingRequest(node, ticksSinceLastCall);
if (item.ordinal() >= fluid.ordinal()) {
return item;
} else {
return fluid;
}
}
@Override
public int getInstalledUpgrades(Upgrades u) {
return duality.getInstalledUpgrades(u);
}
@Override
public IMEMonitor<IAEItemStack> getItemInventory() {
return duality.getItemInventory();
}
@Override
public IMEMonitor<IAEFluidStack> getFluidInventory() {
return duality.getFluidInventory();
}
@Override
public int getPriority() {
return duality.getPriority();
}
@Override
public void setPriority(int newValue) {
duality.setPriority(newValue);
}
@Override
public void onTunnelNetworkChange() {
duality.updateCraftingList();
}
@Override
public void onChangeInventory(IInventory inv, int slot, InvOperation op, ItemStack removedStack,
ItemStack newStack) {
duality.onChangeInventory(inv, slot, op, removedStack, newStack);
}
@Override
public boolean canInsert(ItemStack stack) {
return duality.canInsert(stack);
}
@Override
public int getSizeInventory() {
return duality.getStorage().getSizeInventory();
}
@Override
public ItemStack getStackInSlot(int slotIn) {
return duality.getStorage().getStackInSlot(slotIn);
}
@Override
public ItemStack decrStackSize(int index, int count) {
return duality.getStorage().decrStackSize(index, count);
}
@Override
public ItemStack getStackInSlotOnClosing(int index) {
return duality.getStorage().getStackInSlotOnClosing(index);
}
@Override
public void setInventorySlotContents(int index, ItemStack stack) {
duality.getStorage().setInventorySlotContents(index, stack);
}
@Override
public IInventory getInventoryByName(String name) {
return duality.getInventoryByName(name);
}
@Override
public IConfigManager getConfigManager() {
return duality.getConfigManager();
}
@Override
public IIcon getBreakingTexture() {
return getItemStack().getIconIndex();
}
@Override
public String getInventoryName() {
return duality.getStorage().getInventoryName();
}
@Override
public boolean hasCustomInventoryName() {
return duality.getStorage().hasCustomInventoryName();
}
@Override
public int getInventoryStackLimit() {
return duality.getStorage().getInventoryStackLimit();
}
@Override
public void markDirty() {
duality.markDirty();
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
return duality.getStorage().isUseableByPlayer(player);
}
@Override
public void openInventory() {
duality.getStorage().openInventory();
}
@Override
public void closeInventory() {
duality.getStorage().closeInventory();
}
@Override
public boolean isItemValidForSlot(int index, ItemStack stack) {
return duality.getStorage().isItemValidForSlot(index, stack);
}
@Override
public int[] getAccessibleSlotsFromSide(int side) {
return duality.getAccessibleSlotsFromSide(side);
}
@Override
public boolean canInsertItem(int p_102007_1_, ItemStack itemStack, int p_102007_3_) {
return true;
}
@Override
public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) {
return true;
}
private IMEMonitor<IAEFluidStack> getFluidGrid() {
try {
return getProxy().getGrid().<IStorageGrid>getCache(IStorageGrid.class).getFluidInventory();
} catch (GridAccessException e) {
return null;
}
}
private IEnergyGrid getEnergyGrid() {
try {
return getProxy().getGrid().getCache(IEnergyGrid.class);
} catch (GridAccessException e) {
return null;
}
}
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
IMEMonitor<IAEFluidStack> fluidGrid = getFluidGrid();
IEnergyGrid energyGrid = getEnergyGrid();
if (energyGrid == null || fluidGrid == null || resource == null) return 0;
int ori = resource.amount;
IAEFluidStack remove;
if (doFill) {
remove = fluidGrid.injectItems(AEFluidStack.create(resource), Actionable.MODULATE, ownActionSource);
} else {
remove = fluidGrid.injectItems(AEFluidStack.create(resource), Actionable.SIMULATE, ownActionSource);
}
return remove == null ? ori : (int) (ori - remove.getStackSize());
}
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
return dualityFluid.drain(from, resource, doDrain);
}
@Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
return dualityFluid.drain(from, maxDrain, doDrain);
}
@Override
public boolean canFill(ForgeDirection from, Fluid fluid) {
return true;
}
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid) {
return true;
}
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
return dualityFluid.getTankInfo(from);
}
@Override
public void onFluidInventoryChanged(IAEFluidTank inv, int slot) {
saveChanges();
getTileEntity().markDirty();
dualityFluid.onFluidInventoryChanged(inv, slot);
}
@Override
public AEFluidInventory getInternalFluid() {
return dualityFluid.getInternalFluid();
}
@Override
public DualityFluidInterface getDualityFluid() {
return dualityFluid;
}
@Override
public AppEngInternalAEInventory getConfig() {
Util.mirrorFluidToPacket(config, dualityFluid.getConfig());
return config;
}
@Override
public void setConfig(int id, IAEFluidStack fluid) {
if (id >= 0 && id < 6) {
config.setInventorySlotContents(
id,
ItemFluidPacket.newDisplayStack(fluid == null ? null : fluid.getFluidStack()));
dualityFluid.getConfig().setFluidInSlot(id, dualityFluid.getStandardFluid(fluid));
}
}
@Override
public void setFluidInv(int id, IAEFluidStack fluid) {
if (id >= 0 && id < 6) {
dualityFluid.getInternalFluid().setFluidInSlot(id, fluid);
}
}
@Override
public DualityInterface getInterfaceDuality() {
return duality;
}
@Override
public EnumSet<ForgeDirection> getTargets() {
return EnumSet.of(this.getSide());
}
@Override
public TileEntity getTileEntity() {
return super.getHost().getTile();
}
@Override
public void provideCrafting(ICraftingProviderHelper craftingTracker) {
duality.provideCrafting(craftingTracker);
}
@Override
public boolean pushPattern(ICraftingPatternDetails patternDetails, InventoryCrafting table) {
return duality.pushPattern(patternDetails, table);
}
@Override
public boolean isBusy() {
return duality.isBusy();
}
@Override
public ImmutableSet<ICraftingLink> getRequestedJobs() {
return duality.getRequestedJobs();
}
@Override
public IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack items, Actionable mode) {
return duality.injectCraftedItems(link, items, mode);
}
@Override
public void jobStateChange(ICraftingLink link) {
duality.jobStateChange(link);
}
@Override
public void readFromNBT(NBTTagCompound data) {
super.readFromNBT(data);
duality.readFromNBT(data);
}
@Override
public void writeToNBT(NBTTagCompound data) {
super.writeToNBT(data);
duality.writeToNBT(data);
}
@Override
public void addToWorld() {
super.addToWorld();
this.duality.initialize();
}
@Override
public void getDrops(List<ItemStack> drops, boolean wrenched) {
super.getDrops(drops, wrenched);
duality.addDrops(drops);
}
@Override
public boolean shouldDisplay() {
return IInterfaceHost.super.shouldDisplay() && !isOutput();
}
}
@@ -41,8 +41,9 @@ public class PartFluidPatternTerminal extends FCFluidEncodeTerminal {
final ItemStack removedStack, final ItemStack newStack) {
if (inv == this.pattern && slot == 1) {
final ItemStack is = inv.getStackInSlot(1);
if (is != null && is.getItem() instanceof final ICraftingPatternItem craftingPatternItem) {
final ICraftingPatternDetails details = craftingPatternItem
if (is != null && is.getItem() instanceof ICraftingPatternItem) {
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
final ICraftingPatternDetails details = pattern
.getPatternForItem(is, this.getHost().getTile().getWorldObj());
if (details != null) {
final IAEItemStack[] inItems = details.getInputs();
@@ -40,8 +40,9 @@ public class PartFluidPatternTerminalEx extends FCFluidEncodeTerminal {
if (inv == this.pattern && slot == 1) {
final ItemStack is = inv.getStackInSlot(1);
if (is != null && is.getItem() instanceof final ICraftingPatternItem craftingPatternItem) {
final ICraftingPatternDetails details = craftingPatternItem
if (is != null && is.getItem() instanceof ICraftingPatternItem) {
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
final ICraftingPatternDetails details = pattern
.getPatternForItem(is, this.getHost().getTile().getWorldObj());
if (details != null) {
@@ -348,7 +348,8 @@ public class PartFluidStorageBus extends PartUpgradeable
if (esh != null) {
final IMEInventory<?> inv = esh
.getInventory(target, this.getSide().getOpposite(), StorageChannel.FLUIDS, this.source);
if (inv instanceof final MEMonitorIFluidHandler h) {
if (inv instanceof MEMonitorIFluidHandler) {
final MEMonitorIFluidHandler h = (MEMonitorIFluidHandler) inv;
h.setMode((StorageFilter) this.getConfigManager().getSetting(Settings.STORAGE_FILTER));
h.setActionSource(new MachineSource(this));
this.monitor = (MEMonitorIFluidHandler) inv;
@@ -179,8 +179,8 @@ public abstract class FCFluidEncodeTerminal extends FCPart implements IItemPatte
@Override
public void sortCraftingItems() {
List<ItemStack> items = new ArrayList<>();
List<ItemStack> fluids = new ArrayList<>();
List<ItemStack> items = new ArrayList<ItemStack>();
List<ItemStack> fluids = new ArrayList<ItemStack>();
for (ItemStack is : this.crafting) {
if (is == null) continue;
if (is.getItem() instanceof ItemFluidPacket) {
@@ -76,7 +76,7 @@ public abstract class FCPart extends AEBasePart
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
this.getProxy().setIdlePowerUsage(1.0 / 2.0);
} else {
this.getProxy().setIdlePowerUsage(1.0 / 16.0); // lights drain a little
this.getProxy().setIdlePowerUsage(1.0 / 16.0); // lights drain a little bit.
}
this.cm.registerSetting(Settings.SORT_BY, SortOrder.NAME);
this.cm.registerSetting(Settings.VIEW_MODE, ViewItems.ALL);
@@ -163,7 +163,9 @@ public abstract class FCPart extends AEBasePart
if (this.getProxy().getNode().meetsChannelRequirements()) {
this.clientFlags = this.getClientFlags() | FCPart.CHANNEL_FLAG;
}
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// um.. nothing.
}
data.writeByte((byte) this.getClientFlags());
}
@@ -193,10 +195,18 @@ public abstract class FCPart extends AEBasePart
}
switch (this.getSpin()) {
case 0 -> this.spin = 1;
case 1 -> this.spin = 3;
case 2 -> this.spin = 0;
case 3 -> this.spin = 2;
case 0:
this.spin = 1;
break;
case 1:
this.spin = 3;
break;
case 2:
this.spin = 0;
break;
case 3:
this.spin = 2;
break;
}
this.getHost().markForUpdate();
@@ -266,7 +276,9 @@ public abstract class FCPart extends AEBasePart
public IMEMonitor<IAEItemStack> getItemInventory() {
try {
return this.getProxy().getStorage().getItemInventory();
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// err nope?
}
return null;
}
@@ -274,7 +286,9 @@ public abstract class FCPart extends AEBasePart
public IMEMonitor<IAEFluidStack> getFluidInventory() {
try {
return this.getProxy().getStorage().getFluidInventory();
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// err nope?
}
return null;
}
@@ -420,27 +434,27 @@ public abstract class FCPart extends AEBasePart
/**
* The texture used for the bright front layer.
* <p>
* The final texture can overlap any of the texture in no particular order.
* The final texture can overlap any of the the texture in no particular order.
*/
public abstract FCPartsTexture getFrontBright();
/**
* The texture used for the colored (medium) front layer.
* <p>
* The final texture can overlap any of the texture in no particular order.
* The final texture can overlap any of the the texture in no particular order.
*/
public abstract FCPartsTexture getFrontColored();
/**
* The texture used for the dark front layer.
* <p>
* The final texture can overlap any of the texture in no particular order.
* The final texture can overlap any of the the texture in no particular order.
*/
public abstract FCPartsTexture getFrontDark();
/**
* Should the part emit light. This actually only affects the light level, light source use a level of 15 and
* non-light source 9.
* Should the part emit light. This actually only affects the light level, light source use a level of 15 and non
* light source 9.
*/
public abstract boolean isLightSource();
}
@@ -175,7 +175,9 @@ public abstract class FCPartMonitor extends AbstractPartDisplay implements IPart
this.updateReportingValue(this.getProxy().getStorage().getFluidInventory());
}
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// >.>
}
}
protected void extractItem(final EntityPlayer player) {}
@@ -246,35 +248,41 @@ public abstract class FCPartMonitor extends AbstractPartDisplay implements IPart
}
private void tesrRenderScreen(final Tessellator tess, final IAEFluidStack ais) {
// GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
final ForgeDirection d = this.getSide();
GL11.glTranslated(d.offsetX * 0.77, d.offsetY * 0.77, d.offsetZ * 0.77);
switch (d) {
case UP -> {
case UP:
GL11.glScalef(1.0f, -1.0f, 1.0f);
GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
GL11.glRotatef(this.getSpin() * 90.0F, 0, 0, 1);
}
case DOWN -> {
break;
case DOWN:
GL11.glScalef(1.0f, -1.0f, 1.0f);
GL11.glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
GL11.glRotatef(this.getSpin() * -90.0F, 0, 0, 1);
}
case EAST -> {
break;
case EAST:
GL11.glScalef(-1.0f, -1.0f, -1.0f);
GL11.glRotatef(-90.0f, 0.0f, 1.0f, 0.0f);
}
case WEST -> {
break;
case WEST:
GL11.glScalef(-1.0f, -1.0f, -1.0f);
GL11.glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
}
case NORTH -> GL11.glScalef(-1.0f, -1.0f, -1.0f);
case SOUTH -> {
break;
case NORTH:
GL11.glScalef(-1.0f, -1.0f, -1.0f);
break;
case SOUTH:
GL11.glScalef(-1.0f, -1.0f, -1.0f);
GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f);
}
default -> {}
break;
default:
break;
}
final ItemStack sis = ItemFluidPacket.newDisplayStack(ais.getFluidStack());
@@ -288,6 +296,7 @@ public abstract class FCPartMonitor extends AbstractPartDisplay implements IPart
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
// RenderHelper.enableGUIStandardItemLighting();
tess.setColorOpaque_F(1.0f, 1.0f, 1.0f);
ClientHelper.proxy.doRenderItem(sis, this.getTile().getWorldObj());
@@ -309,6 +318,7 @@ public abstract class FCPartMonitor extends AbstractPartDisplay implements IPart
GL11.glTranslatef(-0.5f * width, 0.0f, -1.0f);
fr.drawString(renderedStackSize, 0, 0, 0);
}
// GL11.glPopAttrib();
}
@Override
@@ -62,7 +62,9 @@ public abstract class FCSharedFluidBus extends PartUpgradeable implements IGridT
} else {
this.getProxy().getTick().sleepDevice(this.getProxy().getNode());
}
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// :P
}
}
@Override
@@ -57,15 +57,24 @@ public enum CellType {
}
public static EnumChatFormatting getTypeColor(CellType type) {
return switch (type) {
case Cell1kPart -> EnumChatFormatting.GOLD;
case Cell4kPart -> EnumChatFormatting.YELLOW;
case Cell16kPart -> EnumChatFormatting.GREEN;
case Cell64kPart -> EnumChatFormatting.AQUA;
case Cell256kPart -> EnumChatFormatting.BLUE;
case Cell1024kPart -> EnumChatFormatting.LIGHT_PURPLE;
case Cell4096kPart -> EnumChatFormatting.RED;
case Cell16384kPart -> EnumChatFormatting.DARK_PURPLE;
};
switch (type) {
case Cell1kPart:
return EnumChatFormatting.GOLD;
case Cell4kPart:
return EnumChatFormatting.YELLOW;
case Cell16kPart:
return EnumChatFormatting.GREEN;
case Cell64kPart:
return EnumChatFormatting.AQUA;
case Cell256kPart:
return EnumChatFormatting.BLUE;
case Cell1024kPart:
return EnumChatFormatting.LIGHT_PURPLE;
case Cell4096kPart:
return EnumChatFormatting.RED;
case Cell16384kPart:
return EnumChatFormatting.DARK_PURPLE;
}
return EnumChatFormatting.WHITE;
}
}
@@ -49,7 +49,8 @@ public class FluidCellHandler implements ICellHandler {
public void openChestGui(final EntityPlayer player, final IChestOrDrive chest, final ICellHandler cellHandler,
final IMEInventoryHandler inv, final ItemStack is, final StorageChannel chan) {
if (chan == StorageChannel.FLUIDS) {
if (chest instanceof TileEntity te) {
if (chest instanceof TileEntity) {
TileEntity te = (TileEntity) chest;
InventoryHandler
.openGui(player, te.getWorldObj(), new BlockPos(te), chest.getUp(), GuiType.FLUID_TERMINAL);
}
@@ -58,7 +59,8 @@ public class FluidCellHandler implements ICellHandler {
@Override
public int getStatusForCell(final ItemStack is, final IMEInventory handler) {
if (handler instanceof final FluidCellInventoryHandler ci) {
if (handler instanceof FluidCellInventoryHandler) {
final FluidCellInventoryHandler ci = (FluidCellInventoryHandler) handler;
return ci.getStatusForCell();
}
return 0;
@@ -3,8 +3,6 @@ package com.glodblock.github.common.storage;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nonnull;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -387,11 +385,6 @@ public class FluidCellInventory implements IFluidCellInventory {
return out;
}
@Override
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request) {
return this.getCellFluids().findPrecise(request);
}
@Override
public List<IAEFluidStack> getContents() {
List<IAEFluidStack> ret = new ArrayList<>();
@@ -99,8 +99,9 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
if (drained == null || drained.amount < fluid.amount) {
TileEntity offTE = this.worldObj.getTileEntity(this.xCoord, this.yCoord - 1, this.zCoord);
if (offTE instanceof TileCertusQuartzTank tileCertusQuartzTank) {
FluidStack externallyDrained = tileCertusQuartzTank.drain(
if (offTE instanceof TileCertusQuartzTank) {
TileCertusQuartzTank tank = (TileCertusQuartzTank) offTE;
FluidStack externallyDrained = tank.drain(
new FluidStack(fluid.getFluid(), fluid.amount - (drained != null ? drained.amount : 0)),
doDrain,
false);
@@ -157,18 +158,16 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
if (filled < fluid.amount) {
TileEntity offTE = this.worldObj.getTileEntity(this.xCoord, this.yCoord + 1, this.zCoord);
if (offTE instanceof TileCertusQuartzTank tileCertusQuartzTank) {
return filled + tileCertusQuartzTank
.fill(new FluidStack(fluid.getFluid(), fluid.amount - filled), doFill, false);
if (offTE instanceof TileCertusQuartzTank) {
TileCertusQuartzTank tank = (TileCertusQuartzTank) offTE;
return filled + tank.fill(new FluidStack(fluid.getFluid(), fluid.amount - filled), doFill, false);
}
}
return filled;
}
/**
* An override for {@link IFluidHandler}
*/
/* IFluidHandler */
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
if (resource == null || this.tank.getFluid() != null && resource.getFluid() != this.tank.getFluid().getFluid())
@@ -224,7 +223,7 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
private TileCertusQuartzTank getTankBelow(TileEntity tile) {
TileEntity tank = new BlockPos(tile).getOffSet(0, -1, 0).getTileEntity();
if (tank instanceof TileCertusQuartzTank) {
if (tank != null && tank instanceof TileCertusQuartzTank) {
return (TileCertusQuartzTank) tank;
}
return null;
@@ -50,7 +50,9 @@ public class TileFluidBuffer extends AENetworkTile implements IAEFluidInventory,
.findPrecise(AEFluidStack.create(fs));
this.invFluids.setFluidInSlot(0, ias);
if (ias != null) return true;
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// :P
}
return false;
}
@@ -65,7 +67,9 @@ public class TileFluidBuffer extends AENetworkTile implements IAEFluidInventory,
this.source);
if (notInserted != null) return fluidStack.amount -= notInserted.getStackSize();
return fluidStack.amount;
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// :P
}
}
return 0;
}
@@ -88,7 +92,9 @@ public class TileFluidBuffer extends AENetworkTile implements IAEFluidInventory,
.extractItems(ias, actionable, this.source);
if (extracted == null) return null;
return extracted.getFluidStack();
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// :P
}
return null;
}
@@ -107,7 +113,9 @@ public class TileFluidBuffer extends AENetworkTile implements IAEFluidInventory,
try {
return this.getProxy().getStorage().getFluidInventory().getStorageList()
.findPrecise(this.getAEFluidStack());
} catch (final GridAccessException ignored) {}
} catch (final GridAccessException e) {
// :P
}
return null;
}
@@ -4,9 +4,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.item.ItemFluidDrop;
import appeng.api.AEApi;
@@ -46,6 +43,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
@Override
public boolean canBeRotated() {
return false;
// based
}
@Override
@@ -192,8 +190,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
if (fluidGrid != null) {
for (IAEFluidStack fluid : fluidGrid.getStorageList()) {
IAEItemStack stack = ItemFluidDrop.newAeStack(fluid);
if (stack != null
&& !FluidCraftAPI.instance().isBlacklistedInDisplay(fluid.getFluid().getClass())) {
if (stack != null) {
itemCache.add(stack);
}
}
@@ -205,24 +202,6 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
return out;
}
@Override
public IAEItemStack getAvailableItem(@Nonnull IAEItemStack request) {
IMEMonitor<IAEFluidStack> fluidGrid = getFluidGrid();
if (fluidGrid == null) {
return null;
}
IAEFluidStack fluidRequest = ItemFluidDrop.getAeFluidStack(request);
if (fluidRequest == null) {
return null;
}
IAEFluidStack availableFluid = fluidGrid.getAvailableItem(fluidRequest);
if (availableFluid == null || availableFluid.getFluid() == null
|| FluidCraftAPI.instance().isBlacklistedInDisplay(availableFluid.getFluid().getClass())) {
return null;
}
return ItemFluidDrop.newAeStack(availableFluid);
}
@Override
public StorageChannel getChannel() {
return StorageChannel.ITEMS;
@@ -231,7 +210,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
@Override
public boolean isValid(Object verificationToken) {
IMEMonitor<IAEFluidStack> fluidGrid = getFluidGrid();
return fluidGrid != null && fluidGrid == verificationToken;
return fluidGrid != null && fluidGrid == verificationToken /* && !conflict */;
}
@Override
@@ -242,8 +221,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
List<IAEItemStack> mappedChanges = new ArrayList<>();
for (IAEFluidStack fluidStack : change) {
IAEItemStack itemStack = ItemFluidDrop.newAeStack(fluidStack);
if (itemStack != null
&& !FluidCraftAPI.instance().isBlacklistedInDisplay(fluidStack.getFluid().getClass())) {
if (itemStack != null) {
mappedChanges.add(itemStack);
}
}
@@ -297,11 +275,6 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
return out;
}
@Override
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request) {
return null;
}
@Override
public StorageChannel getChannel() {
return StorageChannel.FLUIDS;
@@ -14,17 +14,34 @@ public class FCClassTransformer implements IClassTransformer {
public byte[] transform(String name, String transformedName, byte[] code) {
Transform tform;
switch (transformedName) {
case "appeng.crafting.CraftingTreeNode" -> tform = CraftingTreeNodeTransformer.INSTANCE;
case "appeng.me.cluster.implementations.CraftingCPUCluster" -> tform = CraftingCpuTransformer.INSTANCE;
case "appeng.helpers.DualityInterface" -> tform = DualityInterfaceTransformer.INSTANCE;
case "appeng.container.implementations.ContainerInterfaceTerminal" -> tform = ContainerInterfaceTerminalTransformer.INSTANCE;
case "appeng.client.gui.implementations.GuiCraftingCPU", "appeng.client.gui.implementations.GuiCraftConfirm", "net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm", "appeng.client.gui.widgets.GuiCraftingTree" -> tform = GuiCraftingTransformer.INSTANCE;
case "appeng.integration.modules.NEI" -> tform = NEITransfermer.INSTANCE;
case "appeng.core.features.registries.ExternalStorageRegistry" -> tform = ExternalStorageRegistryTransformer.INSTANCE;
case "appeng.core.sync.packets.PacketCompressedNBT" -> tform = PacketCompressedNBTTransformer.INSTANCE;
default -> {
case "appeng.crafting.CraftingTreeNode":
tform = CraftingTreeNodeTransformer.INSTANCE;
break;
case "appeng.me.cluster.implementations.CraftingCPUCluster":
tform = CraftingCpuTransformer.INSTANCE;
break;
case "appeng.helpers.DualityInterface":
tform = DualityInterfaceTransformer.INSTANCE;
break;
case "appeng.container.implementations.ContainerInterfaceTerminal":
tform = ContainerInterfaceTerminalTransformer.INSTANCE;
break;
case "appeng.client.gui.implementations.GuiCraftingCPU":
case "appeng.client.gui.implementations.GuiCraftConfirm":
case "net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm":
tform = GuiCraftingTransformer.INSTANCE;
break;
case "appeng.integration.modules.NEI":
tform = NEITransfermer.INSTANCE;
break;
case "appeng.core.features.registries.ExternalStorageRegistry":
tform = ExternalStorageRegistryTransformer.INSTANCE;
break;
case "appeng.core.sync.packets.PacketCompressedNBT":
tform = PacketCompressedNBTTransformer.INSTANCE;
break;
default:
return code;
}
}
System.out.println("[AE2FC] Transforming class: " + transformedName);
return tform.transformClass(code);
@@ -27,12 +27,16 @@ public class DualityInterfaceTransformer extends FCClassTransformer.ClassMapper
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
return switch (name) {
case "pushItemsOut", "pushPattern", "isBusy" -> new TransformInvAdaptorCalls(
api,
super.visitMethod(access, name, desc, signature, exceptions));
default -> super.visitMethod(access, name, desc, signature, exceptions);
};
switch (name) {
case "pushItemsOut":
case "pushPattern":
case "isBusy":
return new TransformInvAdaptorCalls(
api,
super.visitMethod(access, name, desc, signature, exceptions));
default:
return super.visitMethod(access, name, desc, signature, exceptions);
}
}
}
@@ -27,7 +27,7 @@ public class GuiCraftingTransformer extends FCClassTransformer.ClassMapper {
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
if ("drawFG".equals(name) || "drawListFG".equals(name) || "drawStack".equals(name)) {
if ("drawFG".equals(name)) {
return new TransformFluidIcon(api, super.visitMethod(access, name, desc, signature, exceptions));
}
return super.visitMethod(access, name, desc, signature, exceptions);
@@ -27,15 +27,16 @@ public class NEITransfermer extends FCClassTransformer.ClassMapper {
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
return switch (name) {
case "getStackUnderMouse" -> new TransformStackUnderMouse(
api,
super.visitMethod(access, name, desc, signature, exceptions));
case "shouldShowTooltip" -> new TransformShowTooltip(
api,
super.visitMethod(access, name, desc, signature, exceptions));
default -> super.visitMethod(access, name, desc, signature, exceptions);
};
switch (name) {
case "getStackUnderMouse":
return new TransformStackUnderMouse(
api,
super.visitMethod(access, name, desc, signature, exceptions));
case "shouldShowTooltip":
return new TransformShowTooltip(api, super.visitMethod(access, name, desc, signature, exceptions));
default:
return super.visitMethod(access, name, desc, signature, exceptions);
}
}
}
@@ -24,6 +24,8 @@ public class EC2Replacer {
if (m.type == GameRegistry.Type.ITEM && ItemReplacements.registry.containsKey(m.name)) {
Item toRemap = ItemReplacements.registry.get(m.name);
m.remap(toRemap);
} else {
m.warn();
}
}
}
@@ -22,7 +22,7 @@ import li.cil.oc.api.Items;
import li.cil.oc.api.detail.ItemInfo;
/**
* A shell class to organize proxy replacements and hide the ugliness
* Shell class to organize proxy replacements and hide the ugliness
*/
public class ItemReplacements {
@@ -78,11 +78,9 @@ public class ItemReplacements {
registry.put("extracells:storage.physical.void", voidCell);
deprecateItem("pattern.fluid", ItemAndBlockHolder.PATTERN);
deprecateWireless("terminal.fluid.wireless", ItemAndBlockHolder.WIRELESS_FLUID_TERM);
/* Storage casings */
deprecateItem("storage.casing", 0, AEApi.instance().definitions().materials().emptyAdvancedStorageCell());
deprecateItem("storage.casing", 1, ItemAndBlockHolder.CELL_HOUSING, 2);
/* Storage components (1k component, etc.) */
deprecateItem("storage.component", 0, AEApi.instance().definitions().materials().cell256kPart());
deprecateItem("storage.component", 1, AEApi.instance().definitions().materials().cell1024kPart());
@@ -69,7 +69,8 @@ public class ProxyItem extends FCBaseItem {
@Override
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int p_77663_4_, boolean p_77663_5_) {
if (!worldIn.isRemote && entityIn instanceof EntityPlayer player) {
if (!worldIn.isRemote && entityIn instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entityIn;
for (int i = 0; i < player.inventory.getSizeInventory(); ++i) {
ItemStack s = player.inventory.getStackInSlot(i);
if (s == stack) {
@@ -4,8 +4,6 @@ import java.lang.ref.WeakReference;
import java.util.List;
import java.util.Random;
import javax.annotation.Nonnull;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@@ -188,7 +186,6 @@ public class ProxyPart implements IPart, IPartDeprecated {
return def;
}
@Nonnull
@Override
public NBTTagCompound transformNBT(NBTTagCompound extra) {
return extra;
@@ -23,6 +23,12 @@ public class ProxyPartItem extends ProxyItem implements IPartItem {
super(ec2itemName);
}
/**
*
* @param srcMeta
* @param replacement
* @param part
*/
protected void addItemPart(int srcMeta, Item replacement, Function<ProxyPartItem, ProxyPart> part) {
this.replacements.put(srcMeta, new PartReplacement(replacement, part));
}
@@ -36,7 +42,8 @@ public class ProxyPartItem extends ProxyItem implements IPartItem {
@Override
public IPart createPartFromItemStack(ItemStack is) {
final int meta = is.getItemDamage();
if (this.replacements.get(meta) instanceof PartReplacement part) {
if (this.replacements.get(meta) instanceof PartReplacement) {
PartReplacement part = (PartReplacement) this.replacements.get(meta);
return part.proxyPart.apply(this);
}
return null;
@@ -2,8 +2,6 @@ package com.glodblock.github.crossmod.extracells.parts;
import static net.minecraftforge.common.util.Constants.NBT.TAG_COMPOUND;
import javax.annotation.Nonnull;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
@@ -27,7 +25,6 @@ public class ProxyFluidBusIO extends ProxyPart {
super(partItem);
}
@Nonnull
@Override
public NBTTagCompound transformNBT(NBTTagCompound extra) {
// Transform NBT in place
@@ -53,10 +50,18 @@ public class ProxyFluidBusIO extends ProxyPart {
// Redstone mode
RedstoneMode redstoneMode = RedstoneMode.values()[extra.getInteger("redstoneMode")];
switch (redstoneMode) {
case LOW_SIGNAL -> extra.setString("REDSTONE_CONTROLLED", "LOW_SIGNAL");
case HIGH_SIGNAL -> extra.setString("REDSTONE_CONTROLLED", "HIGH_SIGNAL");
case SIGNAL_PULSE -> extra.setString("REDSTONE_CONTROLLED", "SIGNAL_PULSE");
default -> extra.setString("REDSTONE_CONTROLLED", "IGNORE");
case LOW_SIGNAL:
extra.setString("REDSTONE_CONTROLLED", "LOW_SIGNAL");
break;
case HIGH_SIGNAL:
extra.setString("REDSTONE_CONTROLLED", "HIGH_SIGNAL");
break;
case SIGNAL_PULSE:
extra.setString("REDSTONE_CONTROLLED", "SIGNAL_PULSE");
break;
default:
extra.setString("REDSTONE_CONTROLLED", "IGNORE");
break;
}
extra.removeTag("redstoneMode");
// Part data
@@ -1,7 +1,5 @@
package com.glodblock.github.crossmod.extracells.parts;
import javax.annotation.Nonnull;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.util.Constants;
@@ -15,7 +13,6 @@ public class ProxyFluidInterface extends ProxyPart {
super(item);
}
@Nonnull
@Override
public NBTTagCompound transformNBT(NBTTagCompound extra) {
// Internal fluids - ConfigInv and FluidInv
@@ -2,8 +2,6 @@ package com.glodblock.github.crossmod.extracells.parts;
import static net.minecraftforge.common.util.Constants.NBT.TAG_COMPOUND;
import javax.annotation.Nonnull;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
@@ -33,7 +31,6 @@ public class ProxyFluidStorage extends ProxyPart {
super(item);
}
@Nonnull
@Override
public NBTTagCompound transformNBT(NBTTagCompound extra) {
// Transform in place, less messy IMO
@@ -1,7 +1,5 @@
package com.glodblock.github.crossmod.extracells.parts;
import javax.annotation.Nonnull;
import net.minecraft.nbt.NBTTagCompound;
import com.glodblock.github.crossmod.extracells.ProxyPart;
@@ -15,7 +13,6 @@ public class ProxyLevelEmitter extends ProxyPart {
super(item);
}
@Nonnull
@Override
public NBTTagCompound transformNBT(NBTTagCompound extra) {
// Fluid
@@ -1,7 +1,5 @@
package com.glodblock.github.crossmod.extracells.parts;
import javax.annotation.Nonnull;
import net.minecraft.nbt.NBTTagCompound;
import com.glodblock.github.crossmod.extracells.ProxyPart;
@@ -15,10 +13,9 @@ public class ProxyOreDictExportBus extends ProxyPart {
super(item);
}
@Nonnull
@Override
public NBTTagCompound transformNBT(NBTTagCompound extra) {
// TODO: Node tag... should use OOP here.
// Node tag... should've used OOP here but im too lazy to fix it now
extra.setTag("part", extra.getCompoundTag("node").getCompoundTag("node0"));
extra.removeTag("node");
// Ore dict card
@@ -1,7 +1,5 @@
package com.glodblock.github.crossmod.extracells.parts;
import javax.annotation.Nonnull;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
@@ -15,7 +13,6 @@ public class ProxyStorageMonitor extends ProxyPart {
super(item);
}
@Nonnull
@Override
public NBTTagCompound transformNBT(NBTTagCompound extra) {
// Fluid
@@ -3,9 +3,10 @@ package com.glodblock.github.crossmod.extracells.storage;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.storage.IStorageFluidCell;
import com.glodblock.github.crossmod.extracells.ProxyItem;
import com.glodblock.github.util.ModAndClassUtil;
import appeng.api.config.FuzzyMode;
import appeng.api.storage.data.IAEFluidStack;
@@ -45,8 +46,10 @@ public class ProxyFluidStorageCell extends ProxyItem implements IStorageFluidCel
@Override
public boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition) {
return requestedAddition == null || requestedAddition.getFluid() == null
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
if (Config.blacklistEssentiaGas && ModAndClassUtil.ThE && requestedAddition != null) {
return ModAndClassUtil.essentiaGas.isInstance(requestedAddition.getFluid());
}
return false;
}
@Override
@@ -28,7 +28,8 @@ public class ProxyVoidStorageCell extends ItemVoidStorageCell {
@Override
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int p_77663_4_, boolean p_77663_5_) {
if (!worldIn.isRemote && entityIn instanceof EntityPlayer player) {
if (!worldIn.isRemote && entityIn instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entityIn;
for (int i = 0; i < player.inventory.getSizeInventory(); ++i) {
ItemStack s = player.inventory.getStackInSlot(i);
if (s == stack) {
@@ -73,7 +73,8 @@ public class DriverDualFluidInterface implements SidedBlock {
}
Node node = node().network().node(address);
if (!(node instanceof Component)) throw new IllegalArgumentException("no such component");
if (!(node.host() instanceof Database database)) throw new IllegalArgumentException("not a database");
if (!(node.host() instanceof Database)) throw new IllegalArgumentException("not a database");
Database database = (Database) node.host();
if (index >= 0 && index < DualityFluidInterface.NUMBER_OF_TANKS) {
ItemStack data = database.getStackInSlot(entry - 1);
if (data == null) {
@@ -77,8 +77,9 @@ public class DriverOCPatternEditor extends DriverSidedTileEntity {
if (pattern == null) {
throw new IllegalArgumentException("No pattern here!");
}
if (pattern.getItem() instanceof ItemEncodedPattern iep
if (pattern.getItem() instanceof ItemEncodedPattern
&& !(pattern.getItem() instanceof ItemFluidEncodedPattern)) {
ItemEncodedPattern iep = (ItemEncodedPattern) pattern.getItem();
return iep.getOutput(pattern) == null;
}
return true;
@@ -4,7 +4,6 @@ import java.util.Objects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import org.apache.commons.lang3.tuple.ImmutablePair;
@@ -12,11 +11,9 @@ import org.apache.commons.lang3.tuple.MutablePair;
import appeng.api.storage.data.IAEFluidStack;
import appeng.util.item.AEFluidStack;
import cpw.mods.fml.common.Optional;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.IEssentiaContainerItem;
import thaumcraft.common.Thaumcraft;
import thaumicenergistics.api.ThEApi;
import thaumicenergistics.api.storage.IAspectStack;
import thaumicenergistics.common.fluids.GaseousEssentia;
import thaumicenergistics.common.integration.tc.EssentiaItemContainerHelper;
@@ -25,12 +22,7 @@ import thaumicenergistics.common.storage.AspectStack;
public class AspectUtil {
public static final EssentiaItemContainerHelper HELPER = EssentiaItemContainerHelper.INSTANCE;
public static int R = 128;
@Optional.Method(modid = "thaumicenergistics")
public static void init() {
R = ThEApi.instance().config().conversionMultiplier();
}
public static final int R = 128;
public static boolean isPlayerDiscoveredAspect(final EntityPlayer player, final Aspect aspect) {
if (player != null && aspect != null) {
@@ -39,10 +31,6 @@ public class AspectUtil {
return false;
}
public static boolean isEssentiaGas(Fluid fluid) {
return fluid instanceof GaseousEssentia;
}
public static boolean isEssentiaGas(FluidStack fluid) {
return fluid != null && fluid.getFluid() instanceof GaseousEssentia;
}
@@ -35,7 +35,8 @@ public class FCTooltipHandlerWaila extends TooltipHandlerWaila {
+ EnumChatFormatting.RESET);
}
String modName = Util.getFluidModName(fs.getFluid());
if (modName != null && !modName.equals("")) currenttip.set(currenttip.size() - 1, "§9§o" + modName);
if (modName != null && !modName.equals(""))
currenttip.set(currenttip.size() - 1, "\u00a79\u00a7o" + modName);
}
return currenttip;
}
@@ -49,7 +49,7 @@ public class PartWailaDataProvider implements IWailaDataProvider {
ItemStack wailaStack = null;
for (final IPartWailaDataProvider provider : this.providers) {
wailaStack = provider.getWailaStack(part, config, null);
wailaStack = provider.getWailaStack(part, config, wailaStack);
if (wailaStack != null) break;
}
return wailaStack;
@@ -349,7 +349,7 @@ public class AEFluidInventory implements IAEFluidTank {
@Override
public int getCapacity() {
return AEFluidInventory.this.capacity;
return Math.min(AEFluidInventory.this.capacity, Integer.MAX_VALUE);
}
@Override
@@ -17,7 +17,6 @@ import com.glodblock.github.common.Config;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.common.parts.PartFluidExportBus;
import com.glodblock.github.common.parts.PartFluidInterface;
import com.glodblock.github.common.parts.PartFluidP2PInterface;
import com.glodblock.github.common.tile.TileFluidInterface;
import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.BlockPos;
@@ -83,14 +82,14 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
}
public static InventoryAdaptor wrap(TileEntity capProvider, ForgeDirection face) {
// sometimes i wish 1.7.10 has cap system.
TileEntity inter = capProvider.getWorldObj().getTileEntity(
capProvider.xCoord + face.offsetX,
capProvider.yCoord + face.offsetY,
capProvider.zCoord + face.offsetZ);
if (!Config.noFluidPacket && !(inter instanceof TileFluidInterface
|| Util.getPart(inter, face.getOpposite()) instanceof PartFluidInterface
|| Util.getPart(inter, face.getOpposite()) instanceof PartFluidExportBus
|| Util.getPart(inter, face.getOpposite()) instanceof PartFluidP2PInterface))
|| Util.getPart(inter, face.getOpposite()) instanceof PartFluidExportBus))
return InventoryAdaptor.getAdaptor(capProvider, face);
InventoryAdaptor item = InventoryAdaptor.getAdaptor(capProvider, face);
IFluidHandler fluid = capProvider instanceof IFluidHandler ? (IFluidHandler) capProvider : null;
@@ -377,8 +376,9 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
}
if (tank != null && tank.getTankInfo(direction) != null) {
List<FluidTankInfo[]> tankInfos = new LinkedList<>();
if (Util.getPart(tank, direction) instanceof PartP2PLiquids invFluidsP2P) {
if (Util.getPart(tank, direction) instanceof PartP2PLiquids) {
// read other ends of p2p for blocking mode
PartP2PLiquids invFluidsP2P = (PartP2PLiquids) Util.getPart(tank, direction);
try {
Iterator<PartP2PLiquids> it = invFluidsP2P.getOutputs().iterator();
boolean checkedInput = false;
@@ -393,10 +393,7 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
if (p2p == invFluidsP2P || p2p == null) continue;
IFluidHandler target = Ae2Reflect.getP2PLiquidTarget(p2p);
if (target == null) continue;
FluidTankInfo[] info = target.getTankInfo(p2p.getSide().getOpposite());
if (info != null) {
tankInfos.add(info);
}
tankInfos.add(target.getTankInfo(p2p.getSide().getOpposite()));
}
} catch (GridAccessException ignore) {}
} else {
@@ -433,7 +430,7 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
if (te instanceof IGregTechTileEntity) {
IMetaTileEntity mte = ((IGregTechTileEntity) te).getMetaTileEntity();
if (mte instanceof MetaPipeEntity) {
return ((MetaPipeEntity) mte).isConnectedAtSide(direction);
return ((MetaPipeEntity) mte).isConnectedAtSide(direction.ordinal());
}
}
return true;
@@ -22,6 +22,7 @@ public class FluidConvertingInventoryCrafting extends InventoryCrafting {
if (fluid != null) {
super.setInventorySlotContents(index, ItemFluidPacket.newStack(new FluidStack(fluid, stack.stackSize)));
} else {
// wtf?
super.setInventorySlotContents(
index,
ItemFluidPacket.newStack(new FluidStack(FluidRegistry.WATER, 1000)));
@@ -2,8 +2,6 @@ package com.glodblock.github.inventory;
import java.util.*;
import javax.annotation.Nonnull;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
@@ -183,19 +181,16 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
}
public IItemList<IAEFluidStack> getAvailableItems(IItemList out) {
Iterator<?> var2 = this.cache.iterator();
for (IAEFluidStack fs : this.cache) {
while (var2.hasNext()) {
IAEFluidStack fs = (IAEFluidStack) var2.next();
out.addStorage(fs);
}
return out;
}
@Override
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request) {
return this.cache.findPrecise(request);
}
public IItemList<IAEFluidStack> getStorageList() {
return this.cache;
}
@@ -30,8 +30,9 @@ public class AEFluidInterfaceHandler implements IExternalStorageHandler {
if (te instanceof ITileStorageMonitorable
&& ((ITileStorageMonitorable) te).getMonitorable(d, src) != null) {
return ((ITileStorageMonitorable) te).getMonitorable(d, src).getFluidInventory();
} else if (Util.getPart(te, d.getOpposite()) instanceof ITileStorageMonitorable part
} else if (Util.getPart(te, d.getOpposite()) instanceof ITileStorageMonitorable
&& ((ITileStorageMonitorable) Util.getPart(te, d.getOpposite())).getMonitorable(d, src) != null) {
ITileStorageMonitorable part = (ITileStorageMonitorable) Util.getPart(te, d.getOpposite());
return part.getMonitorable(d, src).getFluidInventory();
}
}
@@ -27,7 +27,7 @@ import appeng.helpers.IPriorityHost;
public enum GuiType {
RENAMER(new PartOrItemGuiFactory<>(ITerminalHost.class) {
RENAMER(new PartOrItemGuiFactory<ITerminalHost>(ITerminalHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
@@ -39,7 +39,7 @@ public enum GuiType {
return new GuiRenamer(player.inventory, inv);
}
}),
FLUID_AUTO_FILLER(new TileGuiFactory<>(TileFluidAutoFiller.class) {
FLUID_AUTO_FILLER(new TileGuiFactory<TileFluidAutoFiller>(TileFluidAutoFiller.class) {
@Override
protected Object createServerGui(EntityPlayer player, TileFluidAutoFiller inv) {
@@ -52,7 +52,7 @@ public enum GuiType {
}
}),
FLUID_LEVEL_EMITTER(new PartGuiFactory<>(PartFluidLevelEmitter.class) {
FLUID_LEVEL_EMITTER(new PartGuiFactory<PartFluidLevelEmitter>(PartFluidLevelEmitter.class) {
@Override
protected Object createServerGui(EntityPlayer player, PartFluidLevelEmitter inv) {
@@ -65,7 +65,7 @@ public enum GuiType {
}
}),
LEVEL_MAINTAINER(new TileGuiFactory<>(TileLevelMaintainer.class) {
LEVEL_MAINTAINER(new TileGuiFactory<TileLevelMaintainer>(TileLevelMaintainer.class) {
@Override
protected Object createServerGui(EntityPlayer player, TileLevelMaintainer inv) {
@@ -78,7 +78,7 @@ public enum GuiType {
}
}),
OC_PATTERN_EDITOR(new TileGuiFactory<>(TileOCPatternEditor.class) {
OC_PATTERN_EDITOR(new TileGuiFactory<TileOCPatternEditor>(TileOCPatternEditor.class) {
@Override
protected Object createServerGui(EntityPlayer player, TileOCPatternEditor inv) {
@@ -91,7 +91,7 @@ public enum GuiType {
}
}),
DUAL_INTERFACE(new TileOrPartGuiFactory<>(IInterfaceHost.class) {
DUAL_INTERFACE(new TileOrPartGuiFactory<IInterfaceHost>(IInterfaceHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, IInterfaceHost inv) {
@@ -104,7 +104,7 @@ public enum GuiType {
}
}),
DUAL_INTERFACE_FLUID(new TileOrPartGuiFactory<>(IDualHost.class) {
DUAL_INTERFACE_FLUID(new TileOrPartGuiFactory<IDualHost>(IDualHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, IDualHost inv) {
@@ -117,7 +117,7 @@ public enum GuiType {
}
}),
PRIORITY(new TileOrPartGuiFactory<>(IPriorityHost.class) {
PRIORITY(new TileOrPartGuiFactory<IPriorityHost>(IPriorityHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, IPriorityHost inv) {
@@ -130,7 +130,7 @@ public enum GuiType {
}
}),
FLUID_BUS_IO(new PartGuiFactory<>(FCSharedFluidBus.class) {
FLUID_BUS_IO(new PartGuiFactory<FCSharedFluidBus>(FCSharedFluidBus.class) {
@Override
protected Object createServerGui(EntityPlayer player, FCSharedFluidBus inv) {
@@ -143,7 +143,7 @@ public enum GuiType {
}
}),
FLUID_STORAGE_BUS(new PartGuiFactory<>(PartFluidStorageBus.class) {
FLUID_STORAGE_BUS(new PartGuiFactory<PartFluidStorageBus>(PartFluidStorageBus.class) {
@Override
protected Object createServerGui(EntityPlayer player, PartFluidStorageBus inv) {
@@ -156,7 +156,7 @@ public enum GuiType {
}
}),
INGREDIENT_BUFFER(new TileGuiFactory<>(TileIngredientBuffer.class) {
INGREDIENT_BUFFER(new TileGuiFactory<TileIngredientBuffer>(TileIngredientBuffer.class) {
@Override
protected Object createServerGui(EntityPlayer player, TileIngredientBuffer inv) {
@@ -169,7 +169,7 @@ public enum GuiType {
}
}),
LARGE_INGREDIENT_BUFFER(new TileGuiFactory<>(TileLargeIngredientBuffer.class) {
LARGE_INGREDIENT_BUFFER(new TileGuiFactory<TileLargeIngredientBuffer>(TileLargeIngredientBuffer.class) {
@Override
protected Object createServerGui(EntityPlayer player, TileLargeIngredientBuffer inv) {
@@ -182,7 +182,7 @@ public enum GuiType {
}
}),
CRAFTING_STATUS(new PartOrItemGuiFactory<>(ITerminalHost.class) {
CRAFTING_STATUS(new PartOrItemGuiFactory<ITerminalHost>(ITerminalHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
@@ -195,7 +195,7 @@ public enum GuiType {
}
}),
FLUID_TERMINAL(new TileOrPartGuiFactory<>(ITerminalHost.class) {
FLUID_TERMINAL(new TileOrPartGuiFactory<ITerminalHost>(ITerminalHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
@@ -208,7 +208,7 @@ public enum GuiType {
}
}),
PORTABLE_FLUID_CELL(new ItemGuiFactory<>(IFluidPortableCell.class) {
PORTABLE_FLUID_CELL(new ItemGuiFactory<IFluidPortableCell>(IFluidPortableCell.class) {
@Override
protected Object createServerGui(EntityPlayer player, IFluidPortableCell inv) {
@@ -221,7 +221,7 @@ public enum GuiType {
}
}),
WIRELESS_FLUID_TERMINAL(new ItemGuiFactory<>(IWirelessTerminal.class) {
WIRELESS_FLUID_TERMINAL(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
@Override
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
@@ -234,7 +234,7 @@ public enum GuiType {
}
}),
WIRELESS_ESSENTIA_TERMINAL(new ItemGuiFactory<>(IWirelessTerminal.class) {
WIRELESS_ESSENTIA_TERMINAL(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
@Override
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
@@ -247,7 +247,7 @@ public enum GuiType {
}
}),
WIRELESS_FLUID_PATTERN_TERMINAL(new ItemGuiFactory<>(IWirelessTerminal.class) {
WIRELESS_FLUID_PATTERN_TERMINAL(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
@Override
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
@@ -259,7 +259,7 @@ public enum GuiType {
return new GuiFluidPatternWireless(player.inventory, inv);
}
}),
WIRELESS_FLUID_PATTERN_TERMINAL_EX(new ItemGuiFactory<>(IWirelessTerminal.class) {
WIRELESS_FLUID_PATTERN_TERMINAL_EX(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
@Override
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
@@ -271,7 +271,7 @@ public enum GuiType {
return new GuiFluidPatternExWireless(player.inventory, inv);
}
}),
WIRELESS_INTERFACE_TERMINAL(new ItemGuiFactory<>(IWirelessTerminal.class) {
WIRELESS_INTERFACE_TERMINAL(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
@Override
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
@@ -284,7 +284,7 @@ public enum GuiType {
}
}),
WIRELESS_CRAFTING_TERMINAL(new ItemGuiFactory<>(IWirelessTerminal.class) {
WIRELESS_CRAFTING_TERMINAL(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
@Override
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
@@ -297,7 +297,7 @@ public enum GuiType {
}
}),
FLUID_PATTERN_TERMINAL(new PartGuiFactory<>(ITerminalHost.class) {
FLUID_PATTERN_TERMINAL(new PartGuiFactory<ITerminalHost>(ITerminalHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
@@ -310,7 +310,7 @@ public enum GuiType {
}
}),
FLUID_PATTERN_TERMINAL_EX(new PartGuiFactory<>(ITerminalHost.class) {
FLUID_PATTERN_TERMINAL_EX(new PartGuiFactory<ITerminalHost>(ITerminalHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
@@ -323,7 +323,7 @@ public enum GuiType {
}
}),
FLUID_PATTERN_ENCODER(new TileGuiFactory<>(TileFluidPatternEncoder.class) {
FLUID_PATTERN_ENCODER(new TileGuiFactory<TileFluidPatternEncoder>(TileFluidPatternEncoder.class) {
@Override
protected Object createServerGui(EntityPlayer player, TileFluidPatternEncoder inv) {
@@ -336,7 +336,7 @@ public enum GuiType {
}
}),
FLUID_CRAFTING_CONFIRM(new PartGuiFactory<>(FCPart.class) {
FLUID_CRAFTING_CONFIRM(new PartGuiFactory<FCPart>(FCPart.class) {
@Override
protected Object createServerGui(EntityPlayer player, FCPart inv) {
@@ -349,7 +349,7 @@ public enum GuiType {
}
}),
FLUID_CRAFTING_CONFIRM_ITEM(new ItemGuiFactory<>(IWirelessTerminal.class) {
FLUID_CRAFTING_CONFIRM_ITEM(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
@Override
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
@@ -362,7 +362,7 @@ public enum GuiType {
}
}),
FLUID_CRAFTING_AMOUNT(new PartOrItemGuiFactory<>(ITerminalHost.class) {
FLUID_CRAFTING_AMOUNT(new PartOrItemGuiFactory<ITerminalHost>(ITerminalHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
@@ -375,7 +375,7 @@ public enum GuiType {
}
}),
FLUID_PACKET_DECODER(new TileGuiFactory<>(TileFluidPacketDecoder.class) {
FLUID_PACKET_DECODER(new TileGuiFactory<TileFluidPacketDecoder>(TileFluidPacketDecoder.class) {
@Override
protected Object createServerGui(EntityPlayer player, TileFluidPacketDecoder inv) {
@@ -388,7 +388,7 @@ public enum GuiType {
}
}),
PATTERN_VALUE_SET(new PartOrItemGuiFactory<>(ITerminalHost.class) {
PATTERN_VALUE_SET(new PartOrItemGuiFactory<ITerminalHost>(ITerminalHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
@@ -177,8 +177,9 @@ public class WirelessPatternTerminalExInventory extends MEMonitorHandler<IAEItem
if (inv == this.pattern && slot == 1) {
final ItemStack is = inv.getStackInSlot(1);
if (is != null && is.getItem() instanceof final ICraftingPatternItem craftingPatternItem) {
final ICraftingPatternDetails details = craftingPatternItem
if (is != null && is.getItem() instanceof ICraftingPatternItem) {
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
final ICraftingPatternDetails details = pattern
.getPatternForItem(is, this.getActionableNode().getWorld());
if (details != null) {
@@ -372,8 +373,8 @@ public class WirelessPatternTerminalExInventory extends MEMonitorHandler<IAEItem
@Override
public void sortCraftingItems() {
List<ItemStack> items = new ArrayList<>();
List<ItemStack> fluids = new ArrayList<>();
List<ItemStack> items = new ArrayList<ItemStack>();
List<ItemStack> fluids = new ArrayList<ItemStack>();
for (ItemStack is : this.crafting) {
if (is == null) continue;
if (is.getItem() instanceof ItemFluidPacket) {
@@ -174,8 +174,9 @@ public class WirelessPatternTerminalInventory extends MEMonitorHandler<IAEItemSt
ItemStack newStack) {
if (inv == this.pattern && slot == 1) {
final ItemStack is = inv.getStackInSlot(1);
if (is != null && is.getItem() instanceof final ICraftingPatternItem craftingPatternItem) {
final ICraftingPatternDetails details = craftingPatternItem
if (is != null && is.getItem() instanceof ICraftingPatternItem) {
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
final ICraftingPatternDetails details = pattern
.getPatternForItem(is, this.getActionableNode().getWorld());
if (details != null) {
final IAEItemStack[] inItems = details.getInputs();
@@ -344,8 +345,8 @@ public class WirelessPatternTerminalInventory extends MEMonitorHandler<IAEItemSt
@Override
public void sortCraftingItems() {
List<ItemStack> items = new ArrayList<>();
List<ItemStack> fluids = new ArrayList<>();
List<ItemStack> items = new ArrayList<ItemStack>();
List<ItemStack> fluids = new ArrayList<ItemStack>();
for (ItemStack is : this.crafting) {
if (is == null) continue;
if (is.getItem() instanceof ItemFluidPacket) {
@@ -28,7 +28,6 @@ public class ItemAndBlockHolder {
public static ItemPartFluidPatternTerminal FLUID_TERMINAL = new ItemPartFluidPatternTerminal().register();
public static ItemPartFluidPatternTerminalEx FLUID_TERMINAL_EX = new ItemPartFluidPatternTerminalEx().register();
public static ItemPartFluidInterface FLUID_INTERFACE = new ItemPartFluidInterface().register();
public static ItemPartFluidP2PInterface FLUID_INTERFACE_P2P = new ItemPartFluidP2PInterface().register();
public static ItemFluidImportBus FLUID_IMPORT_BUS = new ItemFluidImportBus().register();
public static ItemFluidExportBus FLUID_EXPORT_BUS = new ItemFluidExportBus().register();
public static ItemPartFluidStorageBus FLUID_STORAGE_BUS = new ItemPartFluidStorageBus().register();
@@ -2,6 +2,7 @@ package com.glodblock.github.loader;
import static com.glodblock.github.common.storage.CellType.Cell16384kPart;
import static com.glodblock.github.loader.ItemAndBlockHolder.*;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL4KM;
import static net.minecraft.init.Blocks.redstone_torch;
import static net.minecraft.init.Items.fish;
@@ -21,7 +22,6 @@ import com.glodblock.github.common.storage.CellType;
import com.glodblock.github.loader.recipe.WirelessTerminalRecipe;
import com.glodblock.github.util.ModAndClassUtil;
import appeng.api.AEApi;
import cpw.mods.fml.common.registry.GameRegistry;
import extracells.registries.ItemEnum;
@@ -103,7 +103,6 @@ public class RecipeLoader implements Runnable {
54);
public static final ItemStack AE2_WIRELESS_TERMINAL = GameRegistry
.findItemStack("appliedenergistics2", "item.ToolWirelessTerminal", 1);
public static final ItemStack AE2_P2P_ME = AEApi.instance().definitions().parts().p2PTunnelME().maybeStack(1).get();
public static final ItemStack AE2_ME_CHEST = GameRegistry
.findItemStack("appliedenergistics2", "tile.BlockChest", 1);
public static final ItemStack AE2_ENERGY_CELL = GameRegistry
@@ -148,10 +147,6 @@ public class RecipeLoader implements Runnable {
'E',
AE2_INTERFACE));
GameRegistry.addShapelessRecipe(FLUID_INTERFACE.stack(), INTERFACE.stack());
if (Config.fluidP2PInterface) {
GameRegistry.addShapelessRecipe(FLUID_INTERFACE_P2P.stack(), AE2_P2P_ME, INTERFACE.stack());
GameRegistry.addShapelessRecipe(FLUID_INTERFACE_P2P.stack(), AE2_P2P_ME, FLUID_INTERFACE.stack());
}
GameRegistry.addShapelessRecipe(INTERFACE.stack(), FLUID_INTERFACE.stack());
GameRegistry.addShapelessRecipe(WIRELESS_FLUID_TERM.stack(), AE2_WIRELESS_TERMINAL, BUCKET);
GameRegistry.addShapelessRecipe(WIRELESS_PATTERN_TERM.stack(), WIRELESS_FLUID_TERM, FLUID_TERMINAL);
@@ -9,21 +9,24 @@ import com.glodblock.github.common.item.ItemFluidDrop;
import appeng.api.config.TypeFilter;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.client.me.ItemRepo;
public class FluidFilter {
public static boolean filter(TypeFilter typeFilter, IAEStack<?> stack) {
public static void installFilter() {
ItemRepo.registerTypeHandler(FluidFilter::filter, FLUIDS);
}
private static boolean filter(IAEStack<?> stack, TypeFilter typeFilter) {
if (typeFilter == ALL) return true;
if (stack instanceof IAEItemStack) {
Item item = ((IAEItemStack) stack).getItem();
if (item != null) {
switch (typeFilter) {
case ITEMS -> {
case ITEMS:
return !(item instanceof ItemFluidDrop);
}
case FLUIDS -> {
case FLUIDS:
return item instanceof ItemFluidDrop;
}
}
}
}
@@ -1,36 +0,0 @@
package com.glodblock.github.nei;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidPacket;
import codechicken.nei.api.IStackStringifyHandler;
public class FCStackStringifyHandler implements IStackStringifyHandler {
@Override
public NBTTagCompound convertItemStackToNBT(ItemStack stack, boolean saveStackSize) {
return null;
}
@Override
public ItemStack convertNBTToItemStack(NBTTagCompound nbtTag) {
return null;
}
@Override
public FluidStack getFluid(ItemStack item) {
if (item.getItem() instanceof ItemFluidDrop) {
FluidStack fluid = ItemFluidDrop.getFluidStack(item);
if (fluid == null) return null;
fluid.amount /= Math.max(item.stackSize, 1);
return fluid;
} else if (item.getItem() instanceof ItemFluidPacket) {
return ItemFluidPacket.getFluidStack(item);
}
return null;
}
}
@@ -50,7 +50,7 @@ public class FluidCraftingTransferHandler implements IOverlayHandler {
Slot slot = (Slot) o;
if (slot.getSlotIndex() == col + row * 3) {
final NBTTagList tags = new NBTTagList();
final List<ItemStack> list = new LinkedList<>();
final List<ItemStack> list = new LinkedList<ItemStack>();
// prefer pure crystals.
for (int x = 0; x < positionedStack.items.length; x++) {
if (Platform.isRecipePrioritized(positionedStack.items[x])) {
@@ -41,7 +41,8 @@ public class NEIItemFilter implements SearchField.ISearchProvider {
if (itemStack.getItem() instanceof IStorageFluidCell) {
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell()
.getCellInventory(itemStack, null, StorageChannel.FLUIDS);
if (inventory instanceof final IFluidCellInventoryHandler handler) {
if (inventory instanceof IFluidCellInventoryHandler) {
final IFluidCellInventoryHandler handler = (IFluidCellInventoryHandler) inventory;
final IFluidCellInventory cellInventory = handler.getCellInv();
if (cellInventory != null) {
for (IAEFluidStack fluid : cellInventory.getContents()) {
@@ -23,7 +23,8 @@ public class NEIUtils {
if (currentStack.stackSize == 0) continue;
boolean find = false;
for (OrderStack<?> storedStack : comp) {
if (storedStack == null || !(storedStack.getStack() instanceof ItemStack firstStack)) continue;
if (storedStack == null || !(storedStack.getStack() instanceof ItemStack)) continue;
ItemStack firstStack = (ItemStack) storedStack.getStack();
boolean areItemStackEqual = firstStack.isItemEqual(currentStack)
&& ItemStack.areItemStackTagsEqual(firstStack, currentStack);
if (areItemStackEqual
@@ -8,14 +8,12 @@ import com.glodblock.github.util.ModAndClassUtil;
import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
@SuppressWarnings("unused")
public class NEI_FC_Config implements IConfigureNEI {
@Override
public void loadConfig() {
API.registerNEIGuiHandler(new NEIGuiHandler());
API.addSearchProvider(new NEIItemFilter());
API.registerStackStringifyHandler(new FCStackStringifyHandler());
if (ModAndClassUtil.AVARITIA) {
API.registerGuiOverlay(GuiFluidPatternWireless.class, "extreme", null);
Loaded 100 of 123 files, more files were not shown because too many files have changed in this diff. Show more