mirror of
https://github.com/GTNewHorizons/NotEnoughEnergistics.git
synced 2026-10-26 14:23:58 +00:00
updateBuildScript & spotlessApply
This commit is contained in:
1 parent
d066fa13ba
commit
34a31ddfe9
66 files changed
+1217
-788
No files matched your search
+203
-16
@@ -1,4 +1,4 @@
|
||||
//version: 1652851397
|
||||
//version: 1656760732
|
||||
/*
|
||||
DO NOT CHANGE THIS FILE!
|
||||
|
||||
@@ -12,7 +12,12 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.internal.logging.text.StyledTextOutput.Style
|
||||
import org.gradle.internal.logging.text.StyledTextOutputFactory
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Paths
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipInputStream
|
||||
import java.util.zip.ZipOutputStream
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
@@ -52,6 +57,7 @@ plugins {
|
||||
id 'com.palantir.git-version' version '0.13.0' apply false
|
||||
id 'de.undercouch.download' version '5.0.1'
|
||||
id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false
|
||||
id "com.diffplug.spotless" version "6.7.2"
|
||||
}
|
||||
|
||||
if (project.file('.git/HEAD').isFile()) {
|
||||
@@ -78,6 +84,37 @@ idea {
|
||||
}
|
||||
}
|
||||
|
||||
// Spotless autoformatter
|
||||
// See https://github.com/diffplug/spotless/tree/main/plugin-gradle
|
||||
// Can be locally toggled via spotless:off/spotless:on comments
|
||||
spotless {
|
||||
encoding 'UTF-8'
|
||||
|
||||
format 'misc', {
|
||||
target '.gitignore'
|
||||
|
||||
trimTrailingWhitespace()
|
||||
indentWithSpaces(4)
|
||||
endWithNewline()
|
||||
}
|
||||
java {
|
||||
toggleOffOn()
|
||||
importOrder()
|
||||
removeUnusedImports()
|
||||
palantirJavaFormat('1.1.0') // last version supporting jvm 8
|
||||
}
|
||||
kotlin {
|
||||
toggleOffOn()
|
||||
ktfmt('0.39')
|
||||
}
|
||||
groovyGradle {
|
||||
toggleOffOn()
|
||||
importOrder()
|
||||
target '*.gradle'
|
||||
greclipse('4.19.0') // last version supporting jvm 8
|
||||
}
|
||||
}
|
||||
|
||||
if(JavaVersion.current() != JavaVersion.VERSION_1_8) {
|
||||
throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current())
|
||||
}
|
||||
@@ -105,6 +142,10 @@ checkPropertyExists("developmentEnvironmentUserName")
|
||||
|
||||
boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
|
||||
boolean usesMixinDebug = project.findProperty('usesMixinDebug') ?: project.usesMixins.toBoolean()
|
||||
boolean forceEnableMixins = project.findProperty('forceEnableMixins') ? project.forceEnableMixins.toBoolean() : false
|
||||
String channel = project.findProperty('channel') ? project.channel : 'stable'
|
||||
String mappingsVersion = project.findProperty('mappingsVersion') ? project.mappingsVersion : '12'
|
||||
String remoteMappings = project.findProperty('remoteMappings') ? project.remoteMappings : 'https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/'
|
||||
|
||||
String javaSourceDir = "src/main/java/"
|
||||
String scalaSourceDir = "src/main/scala/"
|
||||
@@ -215,7 +256,7 @@ else {
|
||||
def arguments = []
|
||||
def jvmArguments = []
|
||||
|
||||
if (usesMixins.toBoolean()) {
|
||||
if (usesMixins.toBoolean() || forceEnableMixins) {
|
||||
arguments += [
|
||||
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
|
||||
]
|
||||
@@ -280,7 +321,7 @@ repositories {
|
||||
name 'Overmind forge repo mirror'
|
||||
url 'https://gregtech.overminddl1.com/'
|
||||
}
|
||||
if(usesMixins.toBoolean()) {
|
||||
if(usesMixins.toBoolean() || forceEnableMixins) {
|
||||
maven {
|
||||
name 'sponge'
|
||||
url 'https://repo.spongepowered.org/repository/maven-public'
|
||||
@@ -297,6 +338,8 @@ dependencies {
|
||||
annotationProcessor('com.google.guava:guava:24.1.1-jre')
|
||||
annotationProcessor('com.google.code.gson:gson:2.8.6')
|
||||
annotationProcessor('org.spongepowered:mixin:0.8-SNAPSHOT')
|
||||
}
|
||||
if(usesMixins.toBoolean() || forceEnableMixins) {
|
||||
// using 0.8 to workaround a issue in 0.7 which fails mixin application
|
||||
compile('com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH') {
|
||||
// Mixin includes a lot of dependencies that are too up-to-date
|
||||
@@ -669,7 +712,103 @@ configure(updateBuildScript) {
|
||||
description = 'Updates the build script to the latest version'
|
||||
}
|
||||
|
||||
// Deobfuscation
|
||||
// Parameter Deobfuscation
|
||||
|
||||
task deobfParams {
|
||||
doLast {
|
||||
|
||||
String mcpDir = "$project.gradle.gradleUserHomeDir/caches/minecraft/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion"
|
||||
String mcpZIP = "$mcpDir/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip"
|
||||
String paramsCSV = "$mcpDir/params.csv"
|
||||
|
||||
download.run {
|
||||
src "https://maven.minecraftforge.net/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion-$minecraftVersion/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip"
|
||||
dest mcpZIP
|
||||
overwrite false
|
||||
}
|
||||
|
||||
if(!file(paramsCSV).exists()) {
|
||||
println("Extracting MCP archive ...")
|
||||
unzip(mcpZIP, mcpDir)
|
||||
}
|
||||
|
||||
println("Parsing params.csv ...")
|
||||
Map<String, String> params = new HashMap<>()
|
||||
Files.lines(Paths.get(paramsCSV)).forEach{line ->
|
||||
String[] cells = line.split(",")
|
||||
if(cells.length > 2 && cells[0].matches("p_i?\\d+_\\d+_")) {
|
||||
params.put(cells[0], cells[1])
|
||||
}
|
||||
}
|
||||
|
||||
out.style(Style.Success).println("Modified ${replaceParams(file("$projectDir/src/main/java"), params)} files!")
|
||||
out.style(Style.Failure).println("Don't forget to verify that the code still works as before!\n It could be broken due to duplicate variables existing now\n or parameters taking priority over other variables.")
|
||||
}
|
||||
}
|
||||
|
||||
static int replaceParams(File file, Map<String, String> params) {
|
||||
int fileCount = 0
|
||||
|
||||
if(file.isDirectory()) {
|
||||
for(File f : file.listFiles()) {
|
||||
fileCount += replaceParams(f, params)
|
||||
}
|
||||
return fileCount
|
||||
}
|
||||
println("Visiting ${file.getName()} ...")
|
||||
try {
|
||||
String content = new String(Files.readAllBytes(file.toPath()))
|
||||
int hash = content.hashCode()
|
||||
params.forEach{key, value ->
|
||||
content = content.replaceAll(key, value)
|
||||
}
|
||||
if(hash != content.hashCode()) {
|
||||
Files.write(file.toPath(), content.getBytes("UTF-8"))
|
||||
return 1
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// Credit: bitsnaps (https://gist.github.com/bitsnaps/00947f2dce66f4bbdabc67d7e7b33681)
|
||||
static unzip(String zipFileName, String outputDir) {
|
||||
byte[] buffer = new byte[16384]
|
||||
ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFileName))
|
||||
ZipEntry zipEntry = zis.getNextEntry()
|
||||
while (zipEntry != null) {
|
||||
File newFile = new File(outputDir + File.separator, zipEntry.name)
|
||||
if (zipEntry.isDirectory()) {
|
||||
if (!newFile.isDirectory() && !newFile.mkdirs()) {
|
||||
throw new IOException("Failed to create directory $newFile")
|
||||
}
|
||||
} else {
|
||||
// fix for Windows-created archives
|
||||
File parent = newFile.parentFile
|
||||
if (!parent.isDirectory() && !parent.mkdirs()) {
|
||||
throw new IOException("Failed to create directory $parent")
|
||||
}
|
||||
// write file content
|
||||
FileOutputStream fos = new FileOutputStream(newFile)
|
||||
int len = 0
|
||||
while ((len = zis.read(buffer)) > 0) {
|
||||
fos.write(buffer, 0, len)
|
||||
}
|
||||
fos.close()
|
||||
}
|
||||
zipEntry = zis.getNextEntry()
|
||||
}
|
||||
zis.closeEntry()
|
||||
zis.close()
|
||||
}
|
||||
|
||||
configure(deobfParams) {
|
||||
group = 'forgegradle'
|
||||
description = 'Rename all obfuscated parameter names inherited from Minecraft classes'
|
||||
}
|
||||
|
||||
// Dependency Deobfuscation
|
||||
|
||||
def deobf(String sourceURL) {
|
||||
try {
|
||||
@@ -682,7 +821,7 @@ def deobf(String sourceURL) {
|
||||
fileName = fileName.substring(lastSlash + 1)
|
||||
}
|
||||
//get rid of extension:
|
||||
if(fileName.endsWith(".jar")) {
|
||||
if(fileName.endsWith(".jar") || fileName.endsWith(".litemod")) {
|
||||
fileName = fileName.substring(0, fileName.lastIndexOf("."))
|
||||
}
|
||||
|
||||
@@ -694,26 +833,40 @@ def deobf(String sourceURL) {
|
||||
Collections.reverse(parts)
|
||||
hostName = String.join(".", parts)
|
||||
|
||||
return deobf(sourceURL, hostName + "/" + fileName)
|
||||
return deobf(sourceURL, "$hostName/$fileName")
|
||||
} catch(Exception e) {
|
||||
return deobf(sourceURL, "deobf/" + String.valueOf(sourceURL.hashCode()))
|
||||
return deobf(sourceURL, "deobf/${sourceURL.hashCode()}")
|
||||
}
|
||||
}
|
||||
|
||||
// The method above is to be preferred. Use this method if the filename is not at the end of the URL.
|
||||
def deobf(String sourceURL, String fileName) {
|
||||
String cacheDir = System.getProperty("user.home") + "/.gradle/caches/"
|
||||
String bon2Dir = cacheDir + "forge_gradle/deobf"
|
||||
String bon2File = bon2Dir + "/BON2-2.5.0.jar"
|
||||
String obfFile = cacheDir + "modules-2/files-2.1/" + fileName + ".jar"
|
||||
String deobfFile = cacheDir + "modules-2/files-2.1/" + fileName + "-deobf.jar"
|
||||
def deobf(String sourceURL, String rawFileName) {
|
||||
String bon2Version = "2.5.1"
|
||||
String fileName = URLDecoder.decode(rawFileName, "UTF-8")
|
||||
String cacheDir = "$project.gradle.gradleUserHomeDir/caches"
|
||||
String bon2Dir = "$cacheDir/forge_gradle/deobf"
|
||||
String bon2File = "$bon2Dir/BON2-${bon2Version}.jar"
|
||||
String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar"
|
||||
String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar"
|
||||
|
||||
if(file(deobfFile).exists()) {
|
||||
return files(deobfFile)
|
||||
}
|
||||
|
||||
String mappingsVer
|
||||
if(remoteMappings) {
|
||||
String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion"
|
||||
String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip"
|
||||
|
||||
zipMappings(mappingsZIP, remoteMappings, bon2Dir)
|
||||
|
||||
mappingsVer = "snapshot_$id"
|
||||
} else {
|
||||
mappingsVer = "${channel}_$mappingsVersion"
|
||||
}
|
||||
|
||||
download.run {
|
||||
src 'https://github.com/GTNewHorizons/BON2/releases/download/2.5.0/BON2-2.5.0.CUSTOM-all.jar'
|
||||
src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar"
|
||||
dest bon2File
|
||||
quiet true
|
||||
overwrite false
|
||||
@@ -727,14 +880,48 @@ def deobf(String sourceURL, String fileName) {
|
||||
}
|
||||
|
||||
exec {
|
||||
commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', '1.7.10', '--mappingsVer', 'stable_12', '--notch'
|
||||
commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch'
|
||||
workingDir bon2Dir
|
||||
standardOutput = new ByteArrayOutputStream()
|
||||
standardOutput = new FileOutputStream("${deobfFile}.log")
|
||||
}
|
||||
|
||||
return files(deobfFile)
|
||||
}
|
||||
|
||||
def zipMappings(String zipPath, String url, String bon2Dir) {
|
||||
File zipFile = new File(zipPath)
|
||||
if(zipFile.exists()) {
|
||||
return
|
||||
}
|
||||
|
||||
String fieldsCache = "$bon2Dir/data/fields.csv"
|
||||
String methodsCache = "$bon2Dir/data/methods.csv"
|
||||
|
||||
download.run {
|
||||
src "${url}fields.csv"
|
||||
dest fieldsCache
|
||||
quiet true
|
||||
}
|
||||
download.run {
|
||||
src "${url}methods.csv"
|
||||
dest methodsCache
|
||||
quiet true
|
||||
}
|
||||
|
||||
zipFile.getParentFile().mkdirs()
|
||||
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile))
|
||||
|
||||
zos.putNextEntry(new ZipEntry("fields.csv"))
|
||||
Files.copy(Paths.get(fieldsCache), zos)
|
||||
zos.closeEntry()
|
||||
|
||||
zos.putNextEntry(new ZipEntry("methods.csv"))
|
||||
Files.copy(Paths.get(methodsCache), zos)
|
||||
zos.closeEntry()
|
||||
|
||||
zos.close()
|
||||
}
|
||||
|
||||
// Helper methods
|
||||
|
||||
def checkPropertyExists(String propertyName) {
|
||||
|
||||
+17
-17
@@ -1,21 +1,21 @@
|
||||
dependencies {
|
||||
compile("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-84-GTNH:dev")
|
||||
compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.3:dev")
|
||||
compile("com.github.GTNewHorizons:CodeChickenCore:1.1.3:dev")
|
||||
compile("com.github.GTNewHorizons:NotEnoughItems:2.2.15-GTNH:dev")
|
||||
compile("com.github.GTNewHorizons:Baubles:1.0.1.14:dev")
|
||||
compile("com.github.GTNewHorizons:WirelessCraftingTerminal:1.8.8.5:dev")
|
||||
compile("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-84-GTNH:dev")
|
||||
compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.3:dev")
|
||||
compile("com.github.GTNewHorizons:CodeChickenCore:1.1.3:dev")
|
||||
compile("com.github.GTNewHorizons:NotEnoughItems:2.2.15-GTNH:dev")
|
||||
compile("com.github.GTNewHorizons:Baubles:1.0.1.14:dev")
|
||||
compile("com.github.GTNewHorizons:WirelessCraftingTerminal:1.8.8.5:dev")
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:Avaritiaddons:1.5.3-GTNH:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:BuildCraftCompat:7.1.11:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:EnderIO:2.3.1.32:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:ForestryMC:4.4.6:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.40.48:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:GTplusplus:1.7.32:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:ThaumicEnergistics:1.3.16-GTNH:dev") { transitive = false }
|
||||
compileOnly("com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev") { transitive = false }
|
||||
compileOnly("curse.maven:thaumcraft-nei-plugin-225095:2241913") { transitive = false }
|
||||
compileOnly("curse.maven:thermal-expansion-69163:2388759") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:Avaritiaddons:1.5.3-GTNH:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:BuildCraftCompat:7.1.11:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:EnderIO:2.3.1.32:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:ForestryMC:4.4.6:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.40.48:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:GTplusplus:1.7.32:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:ThaumicEnergistics:1.3.16-GTNH:dev") { transitive = false }
|
||||
compileOnly("com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev") { transitive = false }
|
||||
compileOnly("curse.maven:thaumcraft-nei-plugin-225095:2241913") { transitive = false }
|
||||
compileOnly("curse.maven:thermal-expansion-69163:2388759") { transitive = false }
|
||||
|
||||
runtime("curse.maven:cofh-core-69162:2388751")
|
||||
runtime("curse.maven:cofh-core-69162:2388751")
|
||||
}
|
||||
+16
-16
@@ -1,18 +1,18 @@
|
||||
repositories {
|
||||
maven {
|
||||
name "GTNH Maven"
|
||||
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||
}
|
||||
maven {
|
||||
name "OvermindDL1 Maven"
|
||||
url "http://gregtech.overminddl1.com/"
|
||||
}
|
||||
maven {
|
||||
name "Curse Maven"
|
||||
url "https://cursemaven.com"
|
||||
}
|
||||
maven {
|
||||
name "Jitpack"
|
||||
url "https://jitpack.io"
|
||||
}
|
||||
maven {
|
||||
name "GTNH Maven"
|
||||
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||
}
|
||||
maven {
|
||||
name "OvermindDL1 Maven"
|
||||
url "http://gregtech.overminddl1.com/"
|
||||
}
|
||||
maven {
|
||||
name "Curse Maven"
|
||||
url "https://cursemaven.com"
|
||||
}
|
||||
maven {
|
||||
name "Jitpack"
|
||||
url "https://jitpack.io"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.github.vfyjxf.nee;
|
||||
|
||||
import static com.github.vfyjxf.nee.NotEnoughEnergistics.logger;
|
||||
|
||||
import com.github.vfyjxf.nee.config.NEEConfig;
|
||||
import com.github.vfyjxf.nee.processor.IRecipeProcessor;
|
||||
import com.github.vfyjxf.nee.processor.RecipeProcessor;
|
||||
@@ -7,6 +9,9 @@ import com.github.vfyjxf.nee.utils.ItemUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
@@ -14,12 +19,6 @@ import net.minecraft.command.WrongUsageException;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static com.github.vfyjxf.nee.NotEnoughEnergistics.logger;
|
||||
|
||||
public class NEECommands extends CommandBase {
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
@@ -37,7 +36,8 @@ public class NEECommands extends CommandBase {
|
||||
if ("help".equalsIgnoreCase(args[0])) {
|
||||
sender.addChatMessage(new ChatComponentText("Usage:"));
|
||||
sender.addChatMessage(new ChatComponentText("/nee add blacklist/priorityItem processor_id identifier"));
|
||||
sender.addChatMessage(new ChatComponentText("/nee add blacklist/priorityItem/itemCombination identifier"));
|
||||
sender.addChatMessage(
|
||||
new ChatComponentText("/nee add blacklist/priorityItem/itemCombination identifier"));
|
||||
} else if ("processor".equalsIgnoreCase(args[0])) {
|
||||
for (IRecipeProcessor processor : RecipeProcessor.recipeProcessors) {
|
||||
logger.info("RecipeProcessor:" + processor.getRecipeProcessorId() + " identifier:");
|
||||
@@ -50,7 +50,8 @@ public class NEECommands extends CommandBase {
|
||||
ItemStack currentStack = Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem();
|
||||
if (currentStack != null) {
|
||||
String currentItemJsonString = ItemUtils.toItemJsonString(currentStack);
|
||||
JsonObject itemJsonObject = new JsonParser().parse(currentItemJsonString).getAsJsonObject();
|
||||
JsonObject itemJsonObject =
|
||||
new JsonParser().parse(currentItemJsonString).getAsJsonObject();
|
||||
if (args.length >= 3) {
|
||||
boolean hasRecipeProcessor = ItemUtils.hasRecipeProcessor(args[2]);
|
||||
boolean hasOverlayIdentifier = ItemUtils.hasOverlayIdentifier(args[2]);
|
||||
@@ -70,10 +71,11 @@ public class NEECommands extends CommandBase {
|
||||
} else if (!hasRecipeProcessor) {
|
||||
sender.addChatMessage(new ChatComponentText("Can't find identifier: " + args[2]));
|
||||
}
|
||||
|
||||
}
|
||||
String newJsonString = new Gson().toJson(itemJsonObject);
|
||||
String[] oldList = "blacklist".equalsIgnoreCase(args[1]) ? NEEConfig.transformBlacklist : NEEConfig.transformPriorityList;
|
||||
String[] oldList = "blacklist".equalsIgnoreCase(args[1])
|
||||
? NEEConfig.transformBlacklist
|
||||
: NEEConfig.transformPriorityList;
|
||||
List<String> newList = new ArrayList<>(Arrays.asList(oldList));
|
||||
for (String currentJsonString : oldList) {
|
||||
if (currentJsonString.equals(newJsonString)) {
|
||||
@@ -116,8 +118,12 @@ public class NEECommands extends CommandBase {
|
||||
|
||||
@Override
|
||||
public List addTabCompletionOptions(ICommandSender sender, String[] args) {
|
||||
return args.length <= 1 ? CommandBase.getListOfStringsMatchingLastWord(args, "help", "reload", "add", "processor") :
|
||||
args.length == 2 ? CommandBase.getListOfStringsMatchingLastWord(args, "blacklist", "priorityItem", "priorityMod", "itemCombination") : null;
|
||||
return args.length <= 1
|
||||
? CommandBase.getListOfStringsMatchingLastWord(args, "help", "reload", "add", "processor")
|
||||
: args.length == 2
|
||||
? CommandBase.getListOfStringsMatchingLastWord(
|
||||
args, "blacklist", "priorityItem", "priorityMod", "itemCombination")
|
||||
: null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,27 +10,22 @@ import codechicken.nei.api.IConfigureNEI;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.guihook.IContainerInputHandler;
|
||||
import com.github.vfyjxf.nee.client.GuiEventHandler;
|
||||
import com.github.vfyjxf.nee.client.NEEContainerDrawHandler;
|
||||
import com.github.vfyjxf.nee.config.NEEConfig;
|
||||
import com.github.vfyjxf.nee.nei.NEECraftingHandler;
|
||||
import com.github.vfyjxf.nee.nei.NEECraftingHelper;
|
||||
import com.github.vfyjxf.nee.processor.IRecipeProcessor;
|
||||
import com.github.vfyjxf.nee.processor.RecipeProcessor;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import java.util.*;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import thaumicenergistics.client.gui.GuiKnowledgeInscriber;
|
||||
import wanion.avaritiaddons.block.extremeautocrafter.GuiExtremeAutoCrafter;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class NEINeeConfig implements IConfigureNEI {
|
||||
|
||||
private static final List<Class<?>> transferBlacklist = new ArrayList<>(Arrays.asList(
|
||||
GuiInterface.class, GuiPatternTerm.class
|
||||
));
|
||||
private static final List<Class<?>> transferBlacklist =
|
||||
new ArrayList<>(Arrays.asList(GuiInterface.class, GuiPatternTerm.class));
|
||||
|
||||
@Override
|
||||
public void loadConfig() {
|
||||
@@ -41,13 +36,11 @@ public class NEINeeConfig implements IConfigureNEI {
|
||||
|
||||
registerGuiHandler();
|
||||
|
||||
Set<String> defaultIdentifiers = new HashSet<>(
|
||||
Arrays.asList("crafting", "crafting2x2", "brewing", "smelting", "fuel", null)
|
||||
);
|
||||
Set<String> defaultIdentifiers =
|
||||
new HashSet<>(Arrays.asList("crafting", "crafting2x2", "brewing", "smelting", "fuel", null));
|
||||
Set<String> identifiers = new HashSet<>(defaultIdentifiers);
|
||||
|
||||
RecipeProcessor.recipeProcessors
|
||||
.stream()
|
||||
RecipeProcessor.recipeProcessors.stream()
|
||||
.map(IRecipeProcessor::getAllOverlayIdentifier)
|
||||
.forEach(identifiers::addAll);
|
||||
|
||||
@@ -86,7 +79,7 @@ public class NEINeeConfig implements IConfigureNEI {
|
||||
|
||||
private void registerGuiHandler() {
|
||||
API.registerNEIGuiHandler(GuiEventHandler.instance);
|
||||
//disable MouseScrollTransfer in some gui
|
||||
// disable MouseScrollTransfer in some gui
|
||||
replaceNEIController();
|
||||
}
|
||||
|
||||
@@ -100,16 +93,15 @@ public class NEINeeConfig implements IConfigureNEI {
|
||||
}
|
||||
if (controllerIndex > 0) {
|
||||
GuiContainerManager.inputHandlers.remove(controllerIndex);
|
||||
GuiContainerManager.inputHandlers.add(controllerIndex,
|
||||
new NEIController() {
|
||||
@Override
|
||||
public boolean mouseScrolled(GuiContainer gui, int mouseX, int mouseY, int scrolled) {
|
||||
if (transferBlacklist.contains(gui.getClass())) {
|
||||
return false;
|
||||
}
|
||||
return super.mouseScrolled(gui, mouseX, mouseY, scrolled);
|
||||
}
|
||||
});
|
||||
GuiContainerManager.inputHandlers.add(controllerIndex, new NEIController() {
|
||||
@Override
|
||||
public boolean mouseScrolled(GuiContainer gui, int mouseX, int mouseY, int scrolled) {
|
||||
if (transferBlacklist.contains(gui.getClass())) {
|
||||
return false;
|
||||
}
|
||||
return super.mouseScrolled(gui, mouseX, mouseY, scrolled);
|
||||
}
|
||||
});
|
||||
NotEnoughEnergistics.logger.info("NEIController replaced success");
|
||||
}
|
||||
}
|
||||
@@ -140,8 +132,8 @@ public class NEINeeConfig implements IConfigureNEI {
|
||||
API.registerGuiOverlay(GuiKnowledgeInscriber.class, "arcaneshapedrecipes");
|
||||
API.registerGuiOverlay(GuiKnowledgeInscriber.class, "arcaneshapelessrecipes");
|
||||
API.registerGuiOverlayHandler(GuiKnowledgeInscriber.class, new NEECraftingHandler(), "arcaneshapedrecipes");
|
||||
API.registerGuiOverlayHandler(GuiKnowledgeInscriber.class, new NEECraftingHandler(), "arcaneshapelessrecipes");
|
||||
|
||||
API.registerGuiOverlayHandler(
|
||||
GuiKnowledgeInscriber.class, new NEECraftingHandler(), "arcaneshapelessrecipes");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +145,7 @@ public class NEINeeConfig implements IConfigureNEI {
|
||||
}
|
||||
identifiers.remove("crafting");
|
||||
identifiers.remove("crafting2x2");
|
||||
//PatternTermEx Support
|
||||
// PatternTermEx Support
|
||||
for (String ident : identifiers) {
|
||||
API.registerGuiOverlay(GuiPatternTermEx.class, ident);
|
||||
API.registerGuiOverlayHandler(GuiPatternTermEx.class, new NEECraftingHandler(), ident);
|
||||
@@ -173,4 +165,4 @@ public class NEINeeConfig implements IConfigureNEI {
|
||||
API.registerGuiOverlayHandler(GuiExtremeAutoCrafter.class, new NEECraftingHandler(), "extreme");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,14 +12,13 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import java.io.File;
|
||||
import net.minecraft.launchwrapper.Launch;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
||||
@Mod(modid = NotEnoughEnergistics.MODID,
|
||||
@Mod(
|
||||
modid = NotEnoughEnergistics.MODID,
|
||||
version = NotEnoughEnergistics.VERSION,
|
||||
name = NotEnoughEnergistics.NAME,
|
||||
dependencies = NotEnoughEnergistics.DEPENDENCIES,
|
||||
@@ -29,11 +28,14 @@ public class NotEnoughEnergistics {
|
||||
public static final String MODID = "neenergistics";
|
||||
public static final String NAME = "NotEnoughEnergistics";
|
||||
public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
public static final String DEPENDENCIES = "required-after:NotEnoughItems;required-after:appliedenergistics2;after:ae2wct";
|
||||
public static final String DEPENDENCIES =
|
||||
"required-after:NotEnoughItems;required-after:appliedenergistics2;after:ae2wct";
|
||||
public static final String GUI_FACTORY = "com.github.vfyjxf.nee.config.NEEConfigGuiFactory";
|
||||
public static final Logger logger = LogManager.getLogger("NotEnoughEnergistics");
|
||||
|
||||
@SidedProxy(clientSide = "com.github.vfyjxf.nee.proxy.ClientProxy", serverSide = "com.github.vfyjxf.nee.proxy.ServerProxy")
|
||||
@SidedProxy(
|
||||
clientSide = "com.github.vfyjxf.nee.proxy.ClientProxy",
|
||||
serverSide = "com.github.vfyjxf.nee.proxy.ServerProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
@Mod.Instance(MODID)
|
||||
@@ -56,5 +58,4 @@ public class NotEnoughEnergistics {
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(this, new NEEGuiHandler());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.github.vfyjxf.nee.asm;
|
||||
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHandler.INPUT_KEY;
|
||||
|
||||
import appeng.client.gui.implementations.GuiInterface;
|
||||
import appeng.client.gui.implementations.GuiPatternTerm;
|
||||
import appeng.container.slot.SlotFake;
|
||||
@@ -12,6 +14,8 @@ import com.github.vfyjxf.nee.network.packet.PacketSlotStackChange;
|
||||
import com.github.vfyjxf.nee.network.packet.PacketStackCountChange;
|
||||
import com.github.vfyjxf.nee.utils.GuiUtils;
|
||||
import com.github.vfyjxf.nee.utils.ItemUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -19,11 +23,6 @@ import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHandler.INPUT_KEY;
|
||||
|
||||
public class AppengHelper {
|
||||
|
||||
/**
|
||||
@@ -33,7 +32,8 @@ public class AppengHelper {
|
||||
*/
|
||||
public static boolean handleMouseWheelInput(int dWheel) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
boolean isPatternTerm = mc.currentScreen instanceof GuiPatternTerm || GuiUtils.isPatternTermExGui(mc.currentScreen);
|
||||
boolean isPatternTerm =
|
||||
mc.currentScreen instanceof GuiPatternTerm || GuiUtils.isPatternTermExGui(mc.currentScreen);
|
||||
boolean isInterface = mc.currentScreen instanceof GuiInterface;
|
||||
if (isPatternTerm || isInterface) {
|
||||
if (dWheel != 0) {
|
||||
@@ -41,13 +41,15 @@ public class AppengHelper {
|
||||
int y = mc.currentScreen.height - Mouse.getEventY() * mc.currentScreen.height / mc.displayHeight - 1;
|
||||
Slot currentSlot = ((GuiContainer) mc.currentScreen).getSlotAtPosition(x, y);
|
||||
if (currentSlot instanceof SlotFake && currentSlot.getHasStack()) {
|
||||
//try to change current itemstack to next ingredient;
|
||||
if (Keyboard.isKeyDown(NEIClientConfig.getKeyBinding("nee.ingredient")) && GuiUtils.isCraftingSlot(currentSlot)) {
|
||||
// try to change current itemstack to next ingredient;
|
||||
if (Keyboard.isKeyDown(NEIClientConfig.getKeyBinding("nee.ingredient"))
|
||||
&& GuiUtils.isCraftingSlot(currentSlot)) {
|
||||
handleRecipeIngredientChange((GuiContainer) mc.currentScreen, currentSlot, dWheel);
|
||||
return true;
|
||||
} else if (Keyboard.isKeyDown(NEIClientConfig.getKeyBinding("nee.count"))) {
|
||||
int changeCount = dWheel / 120;
|
||||
NEENetworkHandler.getInstance().sendToServer(new PacketStackCountChange(currentSlot.slotNumber, changeCount));
|
||||
NEENetworkHandler.getInstance()
|
||||
.sendToServer(new PacketStackCountChange(currentSlot.slotNumber, changeCount));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -78,28 +80,29 @@ public class AppengHelper {
|
||||
if (NEEConfig.allowSynchronousSwitchIngredient) {
|
||||
for (Slot slot : getCraftingSlots(gui)) {
|
||||
|
||||
PositionedStack slotIngredients = NEECraftingHandler.ingredients.get(INPUT_KEY + slot.getSlotIndex());
|
||||
PositionedStack slotIngredients =
|
||||
NEECraftingHandler.ingredients.get(INPUT_KEY + slot.getSlotIndex());
|
||||
|
||||
boolean areItemStackEqual = currentSlot.getHasStack() &&
|
||||
slot.getHasStack() &&
|
||||
currentSlot.getStack().isItemEqual(slot.getStack()) &&
|
||||
ItemStack.areItemStackTagsEqual(currentSlot.getStack(), slot.getStack());
|
||||
boolean areItemStackEqual = currentSlot.getHasStack()
|
||||
&& slot.getHasStack()
|
||||
&& currentSlot.getStack().isItemEqual(slot.getStack())
|
||||
&& ItemStack.areItemStackTagsEqual(currentSlot.getStack(), slot.getStack());
|
||||
|
||||
boolean areIngredientEqual = slotIngredients != null && currentIngredients.contains(slotIngredients.items[0]);
|
||||
boolean areIngredientEqual =
|
||||
slotIngredients != null && currentIngredients.contains(slotIngredients.items[0]);
|
||||
|
||||
if (areItemStackEqual && areIngredientEqual) {
|
||||
craftingSlots.add(slot.slotNumber);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
craftingSlots.add(currentSlot.slotNumber);
|
||||
}
|
||||
NEENetworkHandler.getInstance().sendToServer(new PacketSlotStackChange(currentStack, craftingSlots));
|
||||
NEENetworkHandler.getInstance()
|
||||
.sendToServer(new PacketSlotStackChange(currentStack, craftingSlots));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -112,5 +115,4 @@ public class AppengHelper {
|
||||
}
|
||||
return craftingSlots;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,18 +1,17 @@
|
||||
package com.github.vfyjxf.nee.asm;
|
||||
|
||||
import static org.objectweb.asm.Opcodes.*;
|
||||
|
||||
import codechicken.lib.asm.ASMInit;
|
||||
import codechicken.lib.asm.ObfMapping;
|
||||
import com.github.vfyjxf.nee.NotEnoughEnergistics;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.tree.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.objectweb.asm.Opcodes.*;
|
||||
|
||||
public class NEEClassTransformer implements IClassTransformer {
|
||||
|
||||
static {
|
||||
@@ -21,44 +20,43 @@ public class NEEClassTransformer implements IClassTransformer {
|
||||
|
||||
private static final List<String> transformedClassNames = Arrays.asList(
|
||||
"appeng/integration/modules/NEIHelpers/NEIInscriberRecipeHandler",
|
||||
"appeng/integration/modules/NEIHelpers/NEIGrinderRecipeHandler"
|
||||
);
|
||||
"appeng/integration/modules/NEIHelpers/NEIGrinderRecipeHandler");
|
||||
|
||||
private static final String TARGET_CLASS_NAME = "appeng/client/gui/AEBaseGui";
|
||||
|
||||
private static final ObfMapping TARGET_METHOD_MAPPING = new ObfMapping(TARGET_CLASS_NAME, "func_146274_d", "()V").toClassloading();
|
||||
private static final ObfMapping TARGET_METHOD_MAPPING =
|
||||
new ObfMapping(TARGET_CLASS_NAME, "func_146274_d", "()V").toClassloading();
|
||||
|
||||
private static final String METHOD_OWNER = "codechicken/nei/recipe/TemplateRecipeHandler";
|
||||
|
||||
private static final String METHOD_NAME_1 = "getOverlayHandler";
|
||||
private static final String METHOD_NAME_2 = "hasOverlay";
|
||||
|
||||
private static final String METHOD_TARGET_1 = "(Lnet/minecraft/client/gui/inventory/GuiContainer;I)Lcodechicken/nei/api/IOverlayHandler;";
|
||||
private static final String METHOD_TARGET_2 = "(Lnet/minecraft/client/gui/inventory/GuiContainer;Lnet/minecraft/inventory/Container;I)Z";
|
||||
|
||||
private static final String METHOD_TARGET_1 =
|
||||
"(Lnet/minecraft/client/gui/inventory/GuiContainer;I)Lcodechicken/nei/api/IOverlayHandler;";
|
||||
private static final String METHOD_TARGET_2 =
|
||||
"(Lnet/minecraft/client/gui/inventory/GuiContainer;Lnet/minecraft/inventory/Container;I)Z";
|
||||
|
||||
@Override
|
||||
public byte[] transform(String name, String transformedName, byte[] basicClass) {
|
||||
|
||||
String internalName = transformedName.replace('.', '/');
|
||||
|
||||
//rewrite ae2's methods to support recipe transfer.
|
||||
// rewrite ae2's methods to support recipe transfer.
|
||||
if (transformedClassNames.contains(internalName)) {
|
||||
ClassNode classNode = createClassNode(basicClass);
|
||||
for (MethodNode methodNode : classNode.methods) {
|
||||
if (METHOD_NAME_1.equals(methodNode.name) && METHOD_TARGET_1.equals(methodNode.desc)) {
|
||||
NotEnoughEnergistics.logger.info("Transforming : " + internalName + methodNode.name + methodNode.desc);
|
||||
NotEnoughEnergistics.logger.info(
|
||||
"Transforming : " + internalName + methodNode.name + methodNode.desc);
|
||||
for (AbstractInsnNode instruction : methodNode.instructions.toArray()) {
|
||||
if (instruction.getOpcode() == ACONST_NULL) {
|
||||
InsnList insnList = new InsnList();
|
||||
insnList.add(new VarInsnNode(ALOAD, 0));
|
||||
insnList.add(new VarInsnNode(ALOAD, 1));
|
||||
insnList.add(new VarInsnNode(ILOAD, 2));
|
||||
insnList.add(new MethodInsnNode(INVOKESPECIAL,
|
||||
METHOD_OWNER,
|
||||
METHOD_NAME_1,
|
||||
METHOD_TARGET_1,
|
||||
false));
|
||||
insnList.add(new MethodInsnNode(
|
||||
INVOKESPECIAL, METHOD_OWNER, METHOD_NAME_1, METHOD_TARGET_1, false));
|
||||
methodNode.instructions.insert(instruction, insnList);
|
||||
methodNode.instructions.remove(instruction);
|
||||
}
|
||||
@@ -66,7 +64,8 @@ public class NEEClassTransformer implements IClassTransformer {
|
||||
}
|
||||
|
||||
if (METHOD_NAME_2.equals(methodNode.name) && METHOD_TARGET_2.equals(methodNode.desc)) {
|
||||
NotEnoughEnergistics.logger.info("Transforming : " + internalName + methodNode.name + methodNode.desc);
|
||||
NotEnoughEnergistics.logger.info(
|
||||
"Transforming : " + internalName + methodNode.name + methodNode.desc);
|
||||
for (AbstractInsnNode instruction : methodNode.instructions.toArray()) {
|
||||
if (instruction.getOpcode() == ICONST_0) {
|
||||
InsnList insnList = new InsnList();
|
||||
@@ -74,11 +73,8 @@ public class NEEClassTransformer implements IClassTransformer {
|
||||
insnList.add(new VarInsnNode(ALOAD, 1));
|
||||
insnList.add(new VarInsnNode(ALOAD, 2));
|
||||
insnList.add(new VarInsnNode(ILOAD, 3));
|
||||
insnList.add(new MethodInsnNode(INVOKESPECIAL,
|
||||
METHOD_OWNER,
|
||||
METHOD_NAME_2,
|
||||
METHOD_TARGET_2,
|
||||
false));
|
||||
insnList.add(new MethodInsnNode(
|
||||
INVOKESPECIAL, METHOD_OWNER, METHOD_NAME_2, METHOD_TARGET_2, false));
|
||||
methodNode.instructions.insert(instruction, insnList);
|
||||
methodNode.instructions.remove(instruction);
|
||||
}
|
||||
@@ -90,22 +86,24 @@ public class NEEClassTransformer implements IClassTransformer {
|
||||
return classWriter.toByteArray();
|
||||
}
|
||||
|
||||
|
||||
if (TARGET_CLASS_NAME.equals(internalName)) {
|
||||
ClassNode classNode = createClassNode(basicClass);
|
||||
for (MethodNode methodNode : classNode.methods) {
|
||||
if (TARGET_METHOD_MAPPING.matches(methodNode)) {
|
||||
NotEnoughEnergistics.logger.info("Transforming : " + internalName + methodNode.name + methodNode.desc);
|
||||
NotEnoughEnergistics.logger.info(
|
||||
"Transforming : " + internalName + methodNode.name + methodNode.desc);
|
||||
AbstractInsnNode aLoad = methodNode.instructions.getFirst();
|
||||
while (aLoad.getOpcode() != ILOAD) {
|
||||
aLoad = aLoad.getNext();
|
||||
}
|
||||
InsnList insnList = new InsnList();
|
||||
insnList.add(new VarInsnNode(ILOAD, 1));
|
||||
insnList.add(new MethodInsnNode(INVOKESTATIC,
|
||||
insnList.add(new MethodInsnNode(
|
||||
INVOKESTATIC,
|
||||
"com/github/vfyjxf/nee/asm/AppengHelper",
|
||||
"handleMouseWheelInput",
|
||||
"(I)Z", false));
|
||||
"(I)Z",
|
||||
false));
|
||||
LabelNode label = new LabelNode();
|
||||
insnList.add(new JumpInsnNode(IFEQ, label));
|
||||
insnList.add(new InsnNode(RETURN));
|
||||
@@ -127,7 +125,4 @@ public class NEEClassTransformer implements IClassTransformer {
|
||||
classReader.accept(classNode, 0);
|
||||
return classNode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.github.vfyjxf.nee.asm;
|
||||
|
||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@IFMLLoadingPlugin.Name("NEELoadingPlugin")
|
||||
@@ -10,9 +9,7 @@ import java.util.Map;
|
||||
public class NEELoadingPlugin implements IFMLLoadingPlugin {
|
||||
@Override
|
||||
public String[] getASMTransformerClass() {
|
||||
return new String[]{
|
||||
"com.github.vfyjxf.nee.asm.NEEClassTransformer"
|
||||
};
|
||||
return new String[] {"com.github.vfyjxf.nee.asm.NEEClassTransformer"};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -26,9 +23,7 @@ public class NEELoadingPlugin implements IFMLLoadingPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectData(Map<String, Object> data) {
|
||||
|
||||
}
|
||||
public void injectData(Map<String, Object> data) {}
|
||||
|
||||
@Override
|
||||
public String getAccessTransformerClass() {
|
||||
|
||||
@@ -6,14 +6,13 @@ import appeng.core.features.AEFeature;
|
||||
import com.github.vfyjxf.nee.NotEnoughEnergistics;
|
||||
import com.github.vfyjxf.nee.block.tile.TilePatternInterface;
|
||||
import com.github.vfyjxf.nee.network.NEEGuiHandler;
|
||||
import java.util.EnumSet;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
@@ -31,7 +30,8 @@ public class BlockPatternInterface extends AEBaseTileBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onActivated(
|
||||
World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if (player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
@@ -46,5 +46,4 @@ public class BlockPatternInterface extends AEBaseTileBlock {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,6 +39,9 @@ import appeng.util.inv.IInventoryDestination;
|
||||
import appeng.util.inv.WrapperInvSlot;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import java.util.*;
|
||||
import java.util.stream.IntStream;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -48,15 +51,11 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.*;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
|
||||
/**
|
||||
* A ME interface for storing temporary patterns.
|
||||
*/
|
||||
public class TilePatternInterface extends AENetworkInvTile implements IGridTickable, ICraftingProvider, IInventoryDestination {
|
||||
public class TilePatternInterface extends AENetworkInvTile
|
||||
implements IGridTickable, ICraftingProvider, IInventoryDestination {
|
||||
|
||||
private final int[] sides = {0, 1, 2, 3, 4, 5, 6, 7, 8};
|
||||
private final AppEngInternalInventory gridInv;
|
||||
@@ -70,7 +69,7 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
private final boolean[] workStarted = new boolean[9];
|
||||
|
||||
public TilePatternInterface() {
|
||||
this.gridInv = new AppEngInternalInventory(this, 9 + 1 );
|
||||
this.gridInv = new AppEngInternalInventory(this, 9 + 1);
|
||||
this.gridInv.setMaxStackSize(1);
|
||||
this.patterns = new AppEngInternalInventory(this, 9);
|
||||
this.ejectInv = new AppEngInternalInventory(this, 9);
|
||||
@@ -94,7 +93,10 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
private void notifyNeighbors() {
|
||||
if (this.getProxy().isActive()) {
|
||||
try {
|
||||
this.getProxy().getGrid().postEvent(new MENetworkCraftingPatternChange(this, this.getProxy().getNode()));
|
||||
this.getProxy()
|
||||
.getGrid()
|
||||
.postEvent(new MENetworkCraftingPatternChange(
|
||||
this, this.getProxy().getNode()));
|
||||
this.getProxy().getTick().wakeDevice(this.getProxy().getNode());
|
||||
} catch (GridAccessException e) {
|
||||
// :P
|
||||
@@ -132,7 +134,6 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
return TickRateModulation.URGENT;
|
||||
}
|
||||
|
||||
|
||||
return TickRateModulation.SLEEP;
|
||||
}
|
||||
|
||||
@@ -171,7 +172,8 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
for (int i = 0; i < patterns.getSizeInventory(); i++) {
|
||||
ItemStack stack = patterns.getStackInSlot(i);
|
||||
if (stack != null && stack.getItem() instanceof ICraftingPatternItem) {
|
||||
ICraftingPatternDetails pattern = ((ICraftingPatternItem) stack.getItem()).getPatternForItem(stack, worldObj);
|
||||
ICraftingPatternDetails pattern =
|
||||
((ICraftingPatternItem) stack.getItem()).getPatternForItem(stack, worldObj);
|
||||
if (pattern != null && pattern.isCraftable()) {
|
||||
craftingList.add(pattern);
|
||||
}
|
||||
@@ -186,10 +188,14 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
|
||||
@Override
|
||||
public boolean pushPattern(ICraftingPatternDetails patternDetails, InventoryCrafting table) {
|
||||
if (!isBusy() && this.getProxy().isActive() && craftingList.contains(patternDetails) && !this.hasItemsToPush()) {
|
||||
if (!isBusy()
|
||||
&& this.getProxy().isActive()
|
||||
&& craftingList.contains(patternDetails)
|
||||
&& !this.hasItemsToPush()) {
|
||||
final EnumSet<ForgeDirection> possibleDirections = EnumSet.complementOf(EnumSet.of(ForgeDirection.UNKNOWN));
|
||||
for (final ForgeDirection direction : possibleDirections) {
|
||||
final TileEntity te = worldObj.getTileEntity(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ);
|
||||
final TileEntity te = worldObj.getTileEntity(
|
||||
xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ);
|
||||
|
||||
if (te instanceof IInterfaceHost) {
|
||||
try {
|
||||
@@ -234,7 +240,6 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isBusy() {
|
||||
return hasItemsToPush();
|
||||
@@ -270,7 +275,6 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
return new DimensionalCoord(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType(ForgeDirection dir) {
|
||||
return AECableType.SMART;
|
||||
@@ -284,7 +288,10 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
}
|
||||
|
||||
try {
|
||||
final IAEItemStack out = this.getProxy().getStorage().getItemInventory().injectItems(AEApi.instance().storage().createItemStack(stack), Actionable.SIMULATE, this.source);
|
||||
final IAEItemStack out = this.getProxy()
|
||||
.getStorage()
|
||||
.getItemInventory()
|
||||
.injectItems(AEApi.instance().storage().createItemStack(stack), Actionable.SIMULATE, this.source);
|
||||
if (out == null) {
|
||||
return true;
|
||||
}
|
||||
@@ -292,8 +299,6 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
} catch (GridAccessException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
@@ -344,16 +349,16 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
ItemStack stack = patterns.getStackInSlot(i);
|
||||
|
||||
if (stack != null && stack.getItem() instanceof ICraftingPatternItem) {
|
||||
ICraftingPatternDetails pattern = ((ICraftingPatternItem) stack.getItem()).getPatternForItem(stack, worldObj);
|
||||
ICraftingPatternDetails pattern =
|
||||
((ICraftingPatternItem) stack.getItem()).getPatternForItem(stack, worldObj);
|
||||
if (result.isItemEqual(pattern.getOutputs()[0].getItemStack())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return IntStream.range(0, this.patterns.getSizeInventory()).anyMatch(slot -> patterns.getStackInSlot(slot) == null);
|
||||
return IntStream.range(0, this.patterns.getSizeInventory())
|
||||
.anyMatch(slot -> patterns.getStackInSlot(slot) == null);
|
||||
}
|
||||
|
||||
public int putPattern(ItemStack pattern) {
|
||||
@@ -403,7 +408,10 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
}
|
||||
|
||||
try {
|
||||
this.getProxy().getGrid().postEvent(new MENetworkCraftingPatternChange(this, this.getProxy().getNode()));
|
||||
this.getProxy()
|
||||
.getGrid()
|
||||
.postEvent(new MENetworkCraftingPatternChange(
|
||||
this, this.getProxy().getNode()));
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
@@ -420,7 +428,8 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
for (ICraftingCPU cpu : cpuSet) {
|
||||
if (cpu instanceof CraftingCPUCluster) {
|
||||
CraftingCPUCluster cluster = (CraftingCPUCluster) cpu;
|
||||
final IItemList<IAEItemStack> pendingList = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEItemStack> pendingList =
|
||||
AEApi.instance().storage().createItemList();
|
||||
cluster.getListOfItem(pendingList, CraftingItemList.PENDING);
|
||||
for (IAEItemStack pendingStack : pendingList) {
|
||||
if (pendingStack.isSameType(result)) {
|
||||
@@ -494,13 +503,13 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
final Iterator<ItemStack> i = this.waitingToSend.iterator();
|
||||
while (i.hasNext()) {
|
||||
ItemStack whatToSend = i.next();
|
||||
|
||||
for (final ForgeDirection s : possibleDirections) {
|
||||
final TileEntity te = worldObj.getTileEntity(this.xCoord + s.offsetX, this.yCoord + s.offsetY, this.zCoord + s.offsetZ);
|
||||
final TileEntity te = worldObj.getTileEntity(
|
||||
this.xCoord + s.offsetX, this.yCoord + s.offsetY, this.zCoord + s.offsetZ);
|
||||
if (te == null) {
|
||||
continue;
|
||||
}
|
||||
@@ -553,7 +562,8 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
if (canExtract != null && canExtract.stackSize == itemCount) {
|
||||
|
||||
try {
|
||||
final IMEMonitor<IAEItemStack> inv = this.getProxy().getStorage().getItemInventory();
|
||||
final IMEMonitor<IAEItemStack> inv =
|
||||
this.getProxy().getStorage().getItemInventory();
|
||||
final IEnergyGrid energy = this.getProxy().getEnergy();
|
||||
final IAEItemStack aeStack = AEApi.instance().storage().createItemStack(stack);
|
||||
if (aeStack != null) {
|
||||
@@ -566,18 +576,17 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
if (itemCount != 0) {
|
||||
final ItemStack removed = adaptor.removeItems(itemCount, null, null);
|
||||
if (removed == null) {
|
||||
throw new IllegalStateException("bad attempt at managing inventory. ( removeItems )");
|
||||
throw new IllegalStateException(
|
||||
"bad attempt at managing inventory. ( removeItems )");
|
||||
} else if (removed.stackSize != itemCount) {
|
||||
throw new IllegalStateException("bad attempt at managing inventory. ( removeItems )");
|
||||
throw new IllegalStateException(
|
||||
"bad attempt at managing inventory. ( removeItems )");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} catch (GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -603,13 +612,13 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
for (int i = 0; i < patterns.getSizeInventory(); i++) {
|
||||
ItemStack stack = patterns.getStackInSlot(i);
|
||||
if (stack != null && stack.getItem() instanceof ICraftingPatternItem) {
|
||||
ICraftingPatternDetails currentPattern = ((ICraftingPatternItem) stack.getItem()).getPatternForItem(stack, worldObj);
|
||||
ICraftingPatternDetails currentPattern =
|
||||
((ICraftingPatternItem) stack.getItem()).getPatternForItem(stack, worldObj);
|
||||
if (currentPattern != null && currentPattern.equals(pattern)) {
|
||||
workStarted[i] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean hasWorkFinished() {
|
||||
@@ -617,16 +626,18 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
for (int i = 0; i < patterns.getSizeInventory(); i++) {
|
||||
ItemStack stack = patterns.getStackInSlot(i);
|
||||
if (stack != null && stack.getItem() instanceof ICraftingPatternItem) {
|
||||
ICraftingPatternDetails currentPattern = ((ICraftingPatternItem) stack.getItem()).getPatternForItem(stack, worldObj);
|
||||
ICraftingPatternDetails currentPattern =
|
||||
((ICraftingPatternItem) stack.getItem()).getPatternForItem(stack, worldObj);
|
||||
|
||||
if (currentPattern != null) {
|
||||
IAEItemStack what = currentPattern.getOutputs().length > 0 ? currentPattern.getOutputs()[0] : null;
|
||||
IAEItemStack what = currentPattern.getOutputs().length > 0
|
||||
? currentPattern.getOutputs()[0]
|
||||
: null;
|
||||
if (isNotRequesting(what) && workStarted[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -643,7 +654,6 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
updateCraftingList();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean isNotRequesting(IAEItemStack stack) {
|
||||
@@ -656,7 +666,8 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
final ICraftingGrid cg = this.getProxy().getCrafting();
|
||||
final ImmutableSet<ICraftingCPU> cpuSet = cg.getCpus();
|
||||
|
||||
final IItemList<IAEItemStack> pendingList = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEItemStack> pendingList =
|
||||
AEApi.instance().storage().createItemList();
|
||||
|
||||
for (ICraftingCPU cpu : cpuSet) {
|
||||
if (cpu instanceof CraftingCPUCluster) {
|
||||
@@ -682,7 +693,8 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
|
||||
ItemStack stack = patterns.getStackInSlot(pattern);
|
||||
if (stack != null && stack.getItem() instanceof ICraftingPatternItem) {
|
||||
ICraftingPatternDetails currentPattern = ((ICraftingPatternItem) stack.getItem()).getPatternForItem(stack, worldObj);
|
||||
ICraftingPatternDetails currentPattern =
|
||||
((ICraftingPatternItem) stack.getItem()).getPatternForItem(stack, worldObj);
|
||||
if (currentPattern != null) {
|
||||
return currentPattern.getOutputs().length > 0 ? currentPattern.getOutputs()[0] : null;
|
||||
}
|
||||
@@ -696,7 +708,6 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
this.notifyNeighbors();
|
||||
}
|
||||
|
||||
|
||||
private boolean sameGrid(final IGrid grid) throws GridAccessException {
|
||||
return grid == this.getProxy().getGrid();
|
||||
}
|
||||
@@ -704,5 +715,4 @@ public class TilePatternInterface extends AENetworkInvTile implements IGridTicka
|
||||
private IGrid getGridFromInterface(DualityInterface iface) {
|
||||
return ReflectionHelper.getPrivateValue(DualityInterface.class, iface, "gridProxy");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package com.github.vfyjxf.nee.client;
|
||||
|
||||
import static com.github.vfyjxf.nee.config.NEEConfig.draggedStackDefaultSize;
|
||||
import static com.github.vfyjxf.nee.config.NEEConfig.useStackSizeFromNEI;
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHelper.tracker;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||
import appeng.client.gui.implementations.GuiPatternTerm;
|
||||
@@ -21,6 +25,8 @@ import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@@ -32,13 +38,6 @@ import net.minecraftforge.client.event.GuiOpenEvent;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.github.vfyjxf.nee.config.NEEConfig.draggedStackDefaultSize;
|
||||
import static com.github.vfyjxf.nee.config.NEEConfig.useStackSizeFromNEI;
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHelper.tracker;
|
||||
|
||||
public class GuiEventHandler implements INEIGuiHandler {
|
||||
|
||||
public static GuiEventHandler instance = new GuiEventHandler();
|
||||
@@ -67,7 +66,6 @@ public class GuiEventHandler implements INEIGuiHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -81,7 +79,8 @@ public class GuiEventHandler implements INEIGuiHandler {
|
||||
|
||||
if (GuiUtils.isWirelessGuiCraftConfirm(event.gui)) {
|
||||
assert event.gui instanceof net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm;
|
||||
if (getCancelButton((net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm) event.gui) == event.button) {
|
||||
if (getCancelButton((net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm) event.gui)
|
||||
== event.button) {
|
||||
tracker = null;
|
||||
}
|
||||
}
|
||||
@@ -94,15 +93,16 @@ public class GuiEventHandler implements INEIGuiHandler {
|
||||
|
||||
@Optional.Method(modid = ModIDs.WCT)
|
||||
private GuiButton getCancelButton(net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm gui) {
|
||||
return ObfuscationReflectionHelper.getPrivateValue(net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm.class, gui, "cancel");
|
||||
return ObfuscationReflectionHelper.getPrivateValue(
|
||||
net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm.class, gui, "cancel");
|
||||
}
|
||||
|
||||
private boolean isContainerCraftConfirm(Container container) {
|
||||
return (container instanceof ContainerCraftConfirm || GuiUtils.isContainerWirelessCraftingConfirm(container)) &&
|
||||
!((container instanceof ContainerCraftingConfirm) || (GuiUtils.isWCTContainerCraftingConfirm(container)));
|
||||
return (container instanceof ContainerCraftConfirm || GuiUtils.isContainerWirelessCraftingConfirm(container))
|
||||
&& !((container instanceof ContainerCraftingConfirm)
|
||||
|| (GuiUtils.isWCTContainerCraftingConfirm(container)));
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SubscribeEvent
|
||||
public void onInitGui(GuiScreenEvent.InitGuiEvent.Post event) {
|
||||
@@ -114,10 +114,15 @@ public class GuiEventHandler implements INEIGuiHandler {
|
||||
hasDoubleBtn = false;
|
||||
}
|
||||
if (hasDoubleBtn) {
|
||||
buttonCombination = new GuiImgButtonEnableCombination(gui.guiLeft + 84, gui.guiTop + gui.ySize - 153, ItemCombination.valueOf(NEEConfig.itemCombinationMode));
|
||||
buttonCombination = new GuiImgButtonEnableCombination(
|
||||
gui.guiLeft + 84,
|
||||
gui.guiTop + gui.ySize - 153,
|
||||
ItemCombination.valueOf(NEEConfig.itemCombinationMode));
|
||||
} else {
|
||||
buttonCombination = new GuiImgButtonEnableCombination(gui.guiLeft + 74, gui.guiTop + gui.ySize - 153, ItemCombination.valueOf(NEEConfig.itemCombinationMode));
|
||||
|
||||
buttonCombination = new GuiImgButtonEnableCombination(
|
||||
gui.guiLeft + 74,
|
||||
gui.guiTop + gui.ySize - 153,
|
||||
ItemCombination.valueOf(NEEConfig.itemCombinationMode));
|
||||
}
|
||||
event.buttonList.add(buttonCombination);
|
||||
}
|
||||
@@ -127,7 +132,9 @@ public class GuiEventHandler implements INEIGuiHandler {
|
||||
public void onActionPerformed(GuiScreenEvent.ActionPerformedEvent.Pre event) {
|
||||
if (event.button == this.buttonCombination) {
|
||||
GuiImgButtonEnableCombination button = (GuiImgButtonEnableCombination) event.button;
|
||||
int ordinal = Mouse.getEventButton() != 2 ? button.getCurrentValue().ordinal() + 1 : button.getCurrentValue().ordinal() - 1;
|
||||
int ordinal = Mouse.getEventButton() != 2
|
||||
? button.getCurrentValue().ordinal() + 1
|
||||
: button.getCurrentValue().ordinal() - 1;
|
||||
|
||||
if (ordinal >= ItemCombination.values().length) {
|
||||
ordinal = 0;
|
||||
@@ -171,7 +178,7 @@ public class GuiEventHandler implements INEIGuiHandler {
|
||||
|
||||
@Override
|
||||
public boolean handleDragNDrop(GuiContainer gui, int mouseX, int mouseY, ItemStack draggedStack, int button) {
|
||||
//When NEIAddons exist, give them to NEIAddons to handle
|
||||
// When NEIAddons exist, give them to NEIAddons to handle
|
||||
if (Loader.isModLoaded("NEIAddons") && NEEConfig.useNEIDragFromNEIAddons) {
|
||||
return false;
|
||||
}
|
||||
@@ -186,11 +193,17 @@ public class GuiEventHandler implements INEIGuiHandler {
|
||||
boolean sendPacket = false;
|
||||
int copySize = useStackSizeFromNEI ? copyStack.stackSize : draggedStackDefaultSize;
|
||||
if (button == 0) {
|
||||
boolean areStackEqual = slotStack != null && slotStack.isItemEqual(copyStack) && ItemStack.areItemStackTagsEqual(slotStack, copyStack);
|
||||
copyStack.stackSize = areStackEqual ? Math.min(slotStack.stackSize + copySize, 127) : Math.min(copySize, 127);
|
||||
boolean areStackEqual = slotStack != null
|
||||
&& slotStack.isItemEqual(copyStack)
|
||||
&& ItemStack.areItemStackTagsEqual(slotStack, copyStack);
|
||||
copyStack.stackSize = areStackEqual
|
||||
? Math.min(slotStack.stackSize + copySize, 127)
|
||||
: Math.min(copySize, 127);
|
||||
sendPacket = true;
|
||||
} else if (button == 1) {
|
||||
boolean areStackEqual = slotStack != null && slotStack.isItemEqual(copyStack) && ItemStack.areItemStackTagsEqual(slotStack, copyStack);
|
||||
boolean areStackEqual = slotStack != null
|
||||
&& slotStack.isItemEqual(copyStack)
|
||||
&& ItemStack.areItemStackTagsEqual(slotStack, copyStack);
|
||||
if (areStackEqual) {
|
||||
copyStack.stackSize = Math.min(slotStack.stackSize + 1, 127);
|
||||
} else {
|
||||
@@ -200,7 +213,9 @@ public class GuiEventHandler implements INEIGuiHandler {
|
||||
}
|
||||
|
||||
if (sendPacket) {
|
||||
NEENetworkHandler.getInstance().sendToServer(new PacketSlotStackChange(copyStack, Collections.singletonList(currentSlot.slotNumber)));
|
||||
NEENetworkHandler.getInstance()
|
||||
.sendToServer(new PacketSlotStackChange(
|
||||
copyStack, Collections.singletonList(currentSlot.slotNumber)));
|
||||
if (!NEEConfig.keepGhostitems) {
|
||||
draggedStack.stackSize = 0;
|
||||
}
|
||||
@@ -221,4 +236,3 @@ public class GuiEventHandler implements INEIGuiHandler {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,12 @@ import com.github.vfyjxf.nee.utils.Ingredient;
|
||||
import com.github.vfyjxf.nee.utils.IngredientTracker;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import java.awt.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -19,13 +25,6 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.awt.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Please note the difference between the GTNH NEI and the official NEI
|
||||
*/
|
||||
@@ -51,7 +50,7 @@ public class NEEContainerDrawHandler {
|
||||
private boolean drawCraftableTooltip;
|
||||
|
||||
public NEEContainerDrawHandler() {
|
||||
//gtnh nei support
|
||||
// gtnh nei support
|
||||
isGtnhNei = true;
|
||||
try {
|
||||
this.overlayButtonsField = GuiRecipe.class.getDeclaredField("overlayButtons");
|
||||
@@ -75,7 +74,6 @@ public class NEEContainerDrawHandler {
|
||||
this.oldType = guiRecipe.recipetype;
|
||||
setOverlayButton(guiRecipe);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,35 +110,45 @@ public class NEEContainerDrawHandler {
|
||||
if (tracker != null) {
|
||||
Point offset = gui.getRecipePosition(tracker.getRecipeIndex());
|
||||
for (int i = 0; i < tracker.getIngredients().size(); i++) {
|
||||
Ingredient ingredient = tracker.getIngredients().get(i);
|
||||
Slot slot = gui.slotcontainer.getSlotWithStack(ingredient.getIngredient(), offset.x, offset.y);
|
||||
Ingredient ingredient =
|
||||
tracker.getIngredients().get(i);
|
||||
Slot slot = gui.slotcontainer.getSlotWithStack(
|
||||
ingredient.getIngredient(), offset.x, offset.y);
|
||||
if (slot != null) {
|
||||
if (this.isCraftingTerm) {
|
||||
|
||||
if (ingredient.isCraftable() && ingredient.requiresToCraft()) {
|
||||
GuiDraw.drawRect(slot.xDisplayPosition + gui.guiLeft, slot.yDisplayPosition + gui.guiTop,
|
||||
16, 16,
|
||||
GuiDraw.drawRect(
|
||||
slot.xDisplayPosition + gui.guiLeft,
|
||||
slot.yDisplayPosition + gui.guiTop,
|
||||
16,
|
||||
16,
|
||||
craftableColor.getRGB());
|
||||
this.drawRequestTooltip = true;
|
||||
}
|
||||
|
||||
if (ingredient.requiresToCraft() && !ingredient.isCraftable()) {
|
||||
GuiDraw.drawRect(slot.xDisplayPosition + gui.guiLeft, slot.yDisplayPosition + gui.guiTop,
|
||||
16, 16,
|
||||
GuiDraw.drawRect(
|
||||
slot.xDisplayPosition + gui.guiLeft,
|
||||
slot.yDisplayPosition + gui.guiTop,
|
||||
16,
|
||||
16,
|
||||
missingColor.getRGB());
|
||||
this.drawMissingTooltip = true;
|
||||
}
|
||||
|
||||
} else if (this.isPatternTerm) {
|
||||
if (ingredient.isCraftable()) {
|
||||
GuiDraw.drawRect(slot.xDisplayPosition + gui.guiLeft, slot.yDisplayPosition + gui.guiTop,
|
||||
16, 16,
|
||||
GuiDraw.drawRect(
|
||||
slot.xDisplayPosition + gui.guiLeft,
|
||||
slot.yDisplayPosition + gui.guiTop,
|
||||
16,
|
||||
16,
|
||||
craftableColor.getRGB());
|
||||
this.drawCraftableTooltip = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
drawCraftingHelperTooltip((GuiRecipe) event.gui, event.mouseX, event.mouseY);
|
||||
@@ -148,22 +156,21 @@ public class NEEContainerDrawHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setOverlayButton(GuiRecipe guiRecipe) {
|
||||
//get all overlay buttons.
|
||||
// get all overlay buttons.
|
||||
overlayButtons.clear();
|
||||
trackerMap.clear();
|
||||
List<GuiButton> overlayButtonList = null;
|
||||
|
||||
if (isGtnhNei) {
|
||||
try {
|
||||
overlayButtonList = new ArrayList<>(Arrays.asList((GuiButton[]) NEEContainerDrawHandler.instance.overlayButtonsField.get(guiRecipe)));
|
||||
overlayButtonList = new ArrayList<>(Arrays.asList(
|
||||
(GuiButton[]) NEEContainerDrawHandler.instance.overlayButtonsField.get(guiRecipe)));
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -187,7 +194,9 @@ public class NEEContainerDrawHandler {
|
||||
if (isGtnhNei) {
|
||||
try {
|
||||
int OVERLAY_BUTTON_ID_START = 4;
|
||||
recipeIndex = gui.page * (int) recipesPerPageMethod.invoke(gui) + overlayButton.id - OVERLAY_BUTTON_ID_START;
|
||||
recipeIndex = gui.page * (int) recipesPerPageMethod.invoke(gui)
|
||||
+ overlayButton.id
|
||||
- OVERLAY_BUTTON_ID_START;
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -196,11 +205,12 @@ public class NEEContainerDrawHandler {
|
||||
}
|
||||
|
||||
if (recipeIndex >= 0 && handler != null && recipeIndex < handler.numRecipes()) {
|
||||
IngredientTracker tracker = this.isCraftingTerm ? new IngredientTracker(gui.firstGui, handler, recipeIndex) : new IngredientTracker(gui, handler, recipeIndex);
|
||||
IngredientTracker tracker = this.isCraftingTerm
|
||||
? new IngredientTracker(gui.firstGui, handler, recipeIndex)
|
||||
: new IngredientTracker(gui, handler, recipeIndex);
|
||||
trackerMap.put(overlayButton.id, tracker);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,13 +219,17 @@ public class NEEContainerDrawHandler {
|
||||
if (this.isCraftingTerm) {
|
||||
if (this.drawRequestTooltip) {
|
||||
if (NEECraftingHelper.isIsPatternInterfaceExists()) {
|
||||
tooltips.add(String.format("%s" + EnumChatFormatting.GRAY + " + " +
|
||||
EnumChatFormatting.BLUE + I18n.format("neenergistics.gui.tooltip.helper.crafting.text2"),
|
||||
EnumChatFormatting.YELLOW + Keyboard.getKeyName(NEIClientConfig.getKeyBinding("nee.preview"))));
|
||||
tooltips.add(String.format(
|
||||
"%s" + EnumChatFormatting.GRAY + " + " + EnumChatFormatting.BLUE
|
||||
+ I18n.format("neenergistics.gui.tooltip.helper.crafting.text2"),
|
||||
EnumChatFormatting.YELLOW
|
||||
+ Keyboard.getKeyName(NEIClientConfig.getKeyBinding("nee.preview"))));
|
||||
} else {
|
||||
tooltips.add(String.format("%s" + EnumChatFormatting.GRAY + " + " +
|
||||
EnumChatFormatting.BLUE + I18n.format("neenergistics.gui.tooltip.helper.crafting.text1"),
|
||||
EnumChatFormatting.YELLOW + Keyboard.getKeyName(NEIClientConfig.getKeyBinding("nee.preview"))));
|
||||
tooltips.add(String.format(
|
||||
"%s" + EnumChatFormatting.GRAY + " + " + EnumChatFormatting.BLUE
|
||||
+ I18n.format("neenergistics.gui.tooltip.helper.crafting.text1"),
|
||||
EnumChatFormatting.YELLOW
|
||||
+ Keyboard.getKeyName(NEIClientConfig.getKeyBinding("nee.preview"))));
|
||||
}
|
||||
}
|
||||
if (this.drawMissingTooltip) {
|
||||
@@ -225,7 +239,7 @@ public class NEEContainerDrawHandler {
|
||||
if (this.drawCraftableTooltip && this.isPatternTerm) {
|
||||
tooltips.add(EnumChatFormatting.BLUE + I18n.format("neenergistics.gui.tooltip.helper.pattern"));
|
||||
}
|
||||
//drawHoveringText
|
||||
// drawHoveringText
|
||||
guiRecipe.func_146283_a(tooltips, mouseX, mouseY);
|
||||
this.drawCraftableTooltip = false;
|
||||
this.drawRequestTooltip = false;
|
||||
@@ -233,10 +247,9 @@ public class NEEContainerDrawHandler {
|
||||
}
|
||||
|
||||
private boolean isMouseOverButton(GuiButton button, int mouseX, int mouseY) {
|
||||
return mouseX >= button.xPosition &&
|
||||
mouseY >= button.yPosition &&
|
||||
mouseX < button.xPosition + button.width &&
|
||||
mouseY < button.yPosition + button.height;
|
||||
return mouseX >= button.xPosition
|
||||
&& mouseY >= button.yPosition
|
||||
&& mouseX < button.xPosition + button.width
|
||||
&& mouseY < button.yPosition + button.height;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,7 +28,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
|
||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||
|
||||
|
||||
public class GuiCraftingAmount extends AEBaseGui {
|
||||
private GuiNumberBox amountToCraft;
|
||||
private GuiTabButton originalGuiBtn;
|
||||
@@ -73,7 +72,8 @@ public class GuiCraftingAmount extends AEBaseGui {
|
||||
this.buttonList.add(this.minus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 75, 32, 20, "-" + c));
|
||||
this.buttonList.add(this.minus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 75, 38, 20, "-" + d));
|
||||
|
||||
this.buttonList.add(this.next = new GuiButton(0, this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.getLocal()));
|
||||
this.buttonList.add(
|
||||
this.next = new GuiButton(0, this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.getLocal()));
|
||||
|
||||
ItemStack myIcon = null;
|
||||
final Object target = ((AEBaseContainer) this.inventorySlots).getTarget();
|
||||
@@ -92,13 +92,23 @@ public class GuiCraftingAmount extends AEBaseGui {
|
||||
}
|
||||
|
||||
if (this.originalGui != null && myIcon != null) {
|
||||
this.buttonList.add(this.originalGuiBtn = new GuiTabButton(this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender));
|
||||
this.buttonList.add(
|
||||
this.originalGuiBtn = new GuiTabButton(
|
||||
this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender));
|
||||
}
|
||||
if (this.isWirelessCrafting && myIcon != null) {
|
||||
this.buttonList.add(this.originalGuiBtn = new GuiTabButton(this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender));
|
||||
this.buttonList.add(
|
||||
this.originalGuiBtn = new GuiTabButton(
|
||||
this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender));
|
||||
}
|
||||
|
||||
this.amountToCraft = new GuiNumberBox(this.fontRendererObj, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRendererObj.FONT_HEIGHT, Integer.class);
|
||||
this.amountToCraft = new GuiNumberBox(
|
||||
this.fontRendererObj,
|
||||
this.guiLeft + 62,
|
||||
this.guiTop + 57,
|
||||
59,
|
||||
this.fontRendererObj.FONT_HEIGHT,
|
||||
Integer.class);
|
||||
this.amountToCraft.setEnableBackgroundDrawing(false);
|
||||
this.amountToCraft.setMaxStringLength(16);
|
||||
this.amountToCraft.setTextColor(0xFFFFFF);
|
||||
@@ -140,7 +150,13 @@ public class GuiCraftingAmount extends AEBaseGui {
|
||||
if (key == 28) {
|
||||
this.actionPerformed(this.next);
|
||||
}
|
||||
if ((key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit(character)) && this.amountToCraft.textboxKeyTyped(character, key)) {
|
||||
if ((key == 211
|
||||
|| key == 205
|
||||
|| key == 203
|
||||
|| key == 14
|
||||
|| character == '-'
|
||||
|| Character.isDigit(character))
|
||||
&& this.amountToCraft.textboxKeyTyped(character, key)) {
|
||||
try {
|
||||
String out = this.amountToCraft.getText();
|
||||
|
||||
@@ -186,7 +202,9 @@ public class GuiCraftingAmount extends AEBaseGui {
|
||||
}
|
||||
|
||||
if (btn == this.next) {
|
||||
NEENetworkHandler.getInstance().sendToServer(new PacketCraftingRequest(Integer.parseInt(this.amountToCraft.getText()), isShiftKeyDown()));
|
||||
NEENetworkHandler.getInstance()
|
||||
.sendToServer(new PacketCraftingRequest(
|
||||
Integer.parseInt(this.amountToCraft.getText()), isShiftKeyDown()));
|
||||
}
|
||||
} catch (final NumberFormatException e) {
|
||||
// nope..
|
||||
@@ -194,7 +212,8 @@ public class GuiCraftingAmount extends AEBaseGui {
|
||||
}
|
||||
|
||||
final boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
|
||||
final boolean isMinus = btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
|
||||
final boolean isMinus =
|
||||
btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
|
||||
|
||||
if (isPlus || isMinus) {
|
||||
this.addQty(this.getQty(btn));
|
||||
@@ -244,6 +263,7 @@ public class GuiCraftingAmount extends AEBaseGui {
|
||||
|
||||
@Optional.Method(modid = ModIDs.WCT)
|
||||
private void openWirelessCraftingGui() {
|
||||
net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler.instance.sendToServer(new net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchGuis(Reference.GUI_WCT));
|
||||
net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler.instance.sendToServer(
|
||||
new net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchGuis(Reference.GUI_WCT));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,6 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
|
||||
public class GuiPatternInterface extends AEBaseGui {
|
||||
|
||||
private final ContainerPatternInterface container;
|
||||
@@ -25,7 +24,6 @@ public class GuiPatternInterface extends AEBaseGui {
|
||||
this.container = (ContainerPatternInterface) this.inventorySlots;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void initGui() {
|
||||
@@ -35,22 +33,19 @@ public class GuiPatternInterface extends AEBaseGui {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
|
||||
}
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
this.mc.getTextureManager().bindTexture(getBackground());
|
||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, 211 - 34, this.ySize);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
super.actionPerformed(button);
|
||||
if (button == this.removeButton) {
|
||||
//We shouldn't delete a null, right?
|
||||
// We shouldn't delete a null, right?
|
||||
if (container.getSelectedSlot() != null) {
|
||||
NEENetworkHandler.getInstance().sendToServer(new PacketValueConfigServer("Gui.PatternInterface"));
|
||||
}
|
||||
@@ -61,7 +56,9 @@ public class GuiPatternInterface extends AEBaseGui {
|
||||
protected void mouseClicked(int mouseX, int mouseY, int btn) {
|
||||
if (btn == 0 && this.theSlot instanceof SlotRestrictedInput) {
|
||||
SlotRestrictedInput slot = (SlotRestrictedInput) this.theSlot;
|
||||
NEENetworkHandler.getInstance().sendToServer(new PacketValueConfigServer("Container.selectedSlot", Integer.toString(slot.slotNumber)));
|
||||
NEENetworkHandler.getInstance()
|
||||
.sendToServer(
|
||||
new PacketValueConfigServer("Container.selectedSlot", Integer.toString(slot.slotNumber)));
|
||||
container.setSelectedSlotIndex(slot.slotNumber);
|
||||
}
|
||||
super.mouseClicked(mouseX, mouseY, btn);
|
||||
|
||||
+6
-4
@@ -33,7 +33,10 @@ public class GuiImgButtonEnableCombination extends GuiButton implements ITooltip
|
||||
GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
}
|
||||
minecraft.renderEngine.bindTexture(new ResourceLocation("neenergistics", "textures/gui/states.png"));
|
||||
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||||
this.field_146123_n = mouseX >= this.xPosition
|
||||
&& mouseY >= this.yPosition
|
||||
&& mouseX < this.xPosition + this.width
|
||||
&& mouseY < this.yPosition + this.height;
|
||||
this.drawTexturedModalRect(0, 0, 0, 0, 16, 16);
|
||||
if (this.currentValue == ItemCombination.ENABLED) {
|
||||
this.drawTexturedModalRect(0, 0, 16, 16, 16, 16);
|
||||
@@ -59,9 +62,8 @@ public class GuiImgButtonEnableCombination extends GuiButton implements ITooltip
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return I18n.format("gui.neenergistics.button.title.combination") +
|
||||
"\n" +
|
||||
I18n.format("gui.neenergistics.button.tooltip.combination", currentValue.getLocalName());
|
||||
return I18n.format("gui.neenergistics.button.title.combination") + "\n"
|
||||
+ I18n.format("gui.neenergistics.button.tooltip.combination", currentValue.getLocalName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,20 +28,22 @@ public class GuiImgButtonRemove extends GuiButton implements ITooltip {
|
||||
GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
}
|
||||
mc.renderEngine.bindTexture(new ResourceLocation("neenergistics", "textures/gui/states.png"));
|
||||
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||||
this.field_146123_n = mouseX >= this.xPosition
|
||||
&& mouseY >= this.yPosition
|
||||
&& mouseX < this.xPosition + this.width
|
||||
&& mouseY < this.yPosition + this.height;
|
||||
this.drawTexturedModalRect(0, 0, 0, 0, 16, 16);
|
||||
this.drawTexturedModalRect(0, 0, 0, 32, 16, 16);
|
||||
this.mouseDragged(mc, mouseX, mouseY);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return I18n.format("gui.neenergistics.button.title.remove") +
|
||||
"\n" +
|
||||
I18n.format("gui.neenergistics.button.tooltip.remove");
|
||||
return I18n.format("gui.neenergistics.button.title.remove") + "\n"
|
||||
+ I18n.format("gui.neenergistics.button.tooltip.remove");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package com.github.vfyjxf.nee.config;
|
||||
|
||||
import java.util.Locale;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public enum ItemCombination {
|
||||
DISABLED, ENABLED, WHITELIST;
|
||||
DISABLED,
|
||||
ENABLED,
|
||||
WHITELIST;
|
||||
|
||||
public String getLocalName() {
|
||||
return I18n.format("gui.neenergistics.button.name" + "." + this.name().toLowerCase(Locale.ROOT));
|
||||
|
||||
@@ -4,9 +4,8 @@ import com.github.vfyjxf.nee.NotEnoughEnergistics;
|
||||
import com.github.vfyjxf.nee.utils.ItemUtils;
|
||||
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import java.io.File;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -40,50 +39,100 @@ public class NEEConfig {
|
||||
config.load();
|
||||
|
||||
{
|
||||
transformBlacklist = config.get(CATEGORY_PATTERN_TRANSFER, "transformItemBlacklist", new String[0],
|
||||
"If item in the blacklist, it will not be transferred.\n" +
|
||||
"the format is \" {modid:modid,name:name,meta:meta,recipeProcessor:recipeProcessorID,identifier:identifier}\"\n" +
|
||||
"example: \"{modid:minecraft,name:iron_ingot,recipeProcessor:EnderIO,identifier:EnderIOAlloySmelter}\"").getStringList();
|
||||
transformPriorityList = config.get(CATEGORY_PATTERN_TRANSFER, "transformItemPriorityList", new String[0],
|
||||
"If item in the priority list, it will be transferred first.").getStringList();
|
||||
transformBlacklist = config.get(
|
||||
CATEGORY_PATTERN_TRANSFER,
|
||||
"transformItemBlacklist",
|
||||
new String[0],
|
||||
"If item in the blacklist, it will not be transferred.\n"
|
||||
+ "the format is \" {modid:modid,name:name,meta:meta,recipeProcessor:recipeProcessorID,identifier:identifier}\"\n"
|
||||
+ "example: \"{modid:minecraft,name:iron_ingot,recipeProcessor:EnderIO,identifier:EnderIOAlloySmelter}\"")
|
||||
.getStringList();
|
||||
transformPriorityList = config.get(
|
||||
CATEGORY_PATTERN_TRANSFER,
|
||||
"transformItemPriorityList",
|
||||
new String[0],
|
||||
"If item in the priority list, it will be transferred first.")
|
||||
.getStringList();
|
||||
|
||||
transformPriorityModList = config.get(CATEGORY_PATTERN_TRANSFER, "transformPriorityModList", new String[0],
|
||||
"if oredict has this mod's item, use it first").getStringList();
|
||||
transformPriorityModList = config.get(
|
||||
CATEGORY_PATTERN_TRANSFER,
|
||||
"transformPriorityModList",
|
||||
new String[0],
|
||||
"if oredict has this mod's item, use it first")
|
||||
.getStringList();
|
||||
|
||||
noShift = config.get(CATEGORY_PATTERN_TRANSFER, "noShift", true,
|
||||
"if true, you don't need to press shift to use NEI's transfer system in CratingTerminal and PatternTerminal").getBoolean();
|
||||
noShift = config.get(
|
||||
CATEGORY_PATTERN_TRANSFER,
|
||||
"noShift",
|
||||
true,
|
||||
"if true, you don't need to press shift to use NEI's transfer system in CratingTerminal and PatternTerminal")
|
||||
.getBoolean();
|
||||
|
||||
itemCombinationMode = config.get(CATEGORY_PATTERN_TRANSFER, "itemCombinationMode", itemCombinationMode,
|
||||
"Item Combination Mode Setting, here are all the modes. \n"
|
||||
+ "\"ENABLED\"" + " " + "\"DISABLED\"" + " " + "WHITELIST").getString();
|
||||
itemCombinationMode = config.get(
|
||||
CATEGORY_PATTERN_TRANSFER,
|
||||
"itemCombinationMode",
|
||||
itemCombinationMode,
|
||||
"Item Combination Mode Setting, here are all the modes. \n" + "\"ENABLED\"" + " "
|
||||
+ "\"DISABLED\"" + " " + "WHITELIST")
|
||||
.getString();
|
||||
|
||||
itemCombinationWhitelist = config.get(CATEGORY_PATTERN_TRANSFER, "itemCombinationWhitelist", itemCombinationWhitelist,
|
||||
"Whitelist for item combination").getStringList();
|
||||
itemCombinationWhitelist = config.get(
|
||||
CATEGORY_PATTERN_TRANSFER,
|
||||
"itemCombinationWhitelist",
|
||||
itemCombinationWhitelist,
|
||||
"Whitelist for item combination")
|
||||
.getStringList();
|
||||
}
|
||||
|
||||
{
|
||||
matchOtherItems = config.get(CATEGORY_CRAFTING_HELPER, "matchOnCraftableItems", true,
|
||||
"If true, Crafting Helper will match other items even they can't auto-crafting").getBoolean();
|
||||
matchOtherItems = config.get(
|
||||
CATEGORY_CRAFTING_HELPER,
|
||||
"matchOnCraftableItems",
|
||||
true,
|
||||
"If true, Crafting Helper will match other items even they can't auto-crafting")
|
||||
.getBoolean();
|
||||
|
||||
drawHighlight = config.get(CATEGORY_CRAFTING_HELPER, "drawHighlight", true,
|
||||
"if true,it will draw highlight for missing items and item which can autocraft in nei").getBoolean();
|
||||
drawHighlight = config.get(
|
||||
CATEGORY_CRAFTING_HELPER,
|
||||
"drawHighlight",
|
||||
true,
|
||||
"if true,it will draw highlight for missing items and item which can autocraft in nei")
|
||||
.getBoolean();
|
||||
}
|
||||
|
||||
{
|
||||
allowSynchronousSwitchIngredient = config.get(CATEGORY_OTHER_SETTINGS, "allowSynchronousSwitchIngredient", true,
|
||||
"If true, it will make all similar ingredient switch at the same time").getBoolean(true);
|
||||
allowSynchronousSwitchIngredient = config.get(
|
||||
CATEGORY_OTHER_SETTINGS,
|
||||
"allowSynchronousSwitchIngredient",
|
||||
true,
|
||||
"If true, it will make all similar ingredient switch at the same time")
|
||||
.getBoolean(true);
|
||||
|
||||
useNEIDragFromNEIAddons = config.get(CATEGORY_OTHER_SETTINGS, "useNEIDragFromNEIAddons", false, "Use the NEI Drag from NEI Addons").getBoolean();
|
||||
useNEIDragFromNEIAddons = config.get(
|
||||
CATEGORY_OTHER_SETTINGS,
|
||||
"useNEIDragFromNEIAddons",
|
||||
false,
|
||||
"Use the NEI Drag from NEI Addons")
|
||||
.getBoolean();
|
||||
|
||||
enableNEIDragDrop = config.get(CATEGORY_OTHER_SETTINGS, "enableNEIDragDrop", true, "").getBoolean();
|
||||
enableNEIDragDrop = config.get(CATEGORY_OTHER_SETTINGS, "enableNEIDragDrop", true, "")
|
||||
.getBoolean();
|
||||
|
||||
useStackSizeFromNEI = config.get(CATEGORY_OTHER_SETTINGS, "useStackSizeFromNEI", true,
|
||||
"Use the StackSize set by NEI").getBoolean();
|
||||
useStackSizeFromNEI = config.get(
|
||||
CATEGORY_OTHER_SETTINGS, "useStackSizeFromNEI", true, "Use the StackSize set by NEI")
|
||||
.getBoolean();
|
||||
|
||||
keepGhostitems = config.get(CATEGORY_OTHER_SETTINGS, "keepGhostitems", true, "keep ghost items after click").getBoolean();
|
||||
keepGhostitems = config.get(CATEGORY_OTHER_SETTINGS, "keepGhostitems", true, "keep ghost items after click")
|
||||
.getBoolean();
|
||||
|
||||
draggedStackDefaultSize = config.get(CATEGORY_OTHER_SETTINGS, "draggedStackDefaultSize", 1,
|
||||
"The default size of the dragged ItemStack when it is put in slot(Used when useStackSizeFromNEI is false)", 1, 64).getInt();
|
||||
draggedStackDefaultSize = config.get(
|
||||
CATEGORY_OTHER_SETTINGS,
|
||||
"draggedStackDefaultSize",
|
||||
1,
|
||||
"The default size of the dragged ItemStack when it is put in slot(Used when useStackSizeFromNEI is false)",
|
||||
1,
|
||||
64)
|
||||
.getInt();
|
||||
}
|
||||
|
||||
if (config.hasChanged()) {
|
||||
@@ -95,48 +144,93 @@ public class NEEConfig {
|
||||
config.load();
|
||||
|
||||
{
|
||||
transformBlacklist = config.get(CATEGORY_PATTERN_TRANSFER, "transformItemBlacklist", new String[0],
|
||||
"If item in the blacklist, it will not be transferred.\n" +
|
||||
"the format is \" {modid:modid,name:name,meta:meta,recipeProcessor:recipeProcessorID,identifier:identifier}\"\n" +
|
||||
"example: \"{modid:minecraft,name:iron_ingot,recipeProcessor:EnderIO,identifier:EnderIOAlloySmelter}\"").getStringList();
|
||||
transformPriorityList = config.get(CATEGORY_PATTERN_TRANSFER, "transformItemPriorityList", new String[0],
|
||||
"If item in the priority list, it will be transferred first.").getStringList();
|
||||
transformBlacklist = config.get(
|
||||
CATEGORY_PATTERN_TRANSFER,
|
||||
"transformItemBlacklist",
|
||||
new String[0],
|
||||
"If item in the blacklist, it will not be transferred.\n"
|
||||
+ "the format is \" {modid:modid,name:name,meta:meta,recipeProcessor:recipeProcessorID,identifier:identifier}\"\n"
|
||||
+ "example: \"{modid:minecraft,name:iron_ingot,recipeProcessor:EnderIO,identifier:EnderIOAlloySmelter}\"")
|
||||
.getStringList();
|
||||
transformPriorityList = config.get(
|
||||
CATEGORY_PATTERN_TRANSFER,
|
||||
"transformItemPriorityList",
|
||||
new String[0],
|
||||
"If item in the priority list, it will be transferred first.")
|
||||
.getStringList();
|
||||
|
||||
transformPriorityModList = config.get(CATEGORY_PATTERN_TRANSFER, "transformPriorityModList", new String[0],
|
||||
"if oredict has this mod's item, use it first").getStringList();
|
||||
transformPriorityModList = config.get(
|
||||
CATEGORY_PATTERN_TRANSFER,
|
||||
"transformPriorityModList",
|
||||
new String[0],
|
||||
"if oredict has this mod's item, use it first")
|
||||
.getStringList();
|
||||
|
||||
noShift = config.get(CATEGORY_PATTERN_TRANSFER, "noShift", true,
|
||||
"if true, you don't need to press shift to use NEI's transfer system in CratingTerminal and PatternTerminal").getBoolean();
|
||||
noShift = config.get(
|
||||
CATEGORY_PATTERN_TRANSFER,
|
||||
"noShift",
|
||||
true,
|
||||
"if true, you don't need to press shift to use NEI's transfer system in CratingTerminal and PatternTerminal")
|
||||
.getBoolean();
|
||||
|
||||
itemCombinationMode = config.get(CATEGORY_PATTERN_TRANSFER, "itemCombinationMode", itemCombinationMode,
|
||||
"Item Combination Mode Setting, here are all the modes. \n"
|
||||
+ "\"ENABLED\"" + " " + "\"DISABLED\"" + " " + "WHITELIST").getString();
|
||||
itemCombinationMode = config.get(
|
||||
CATEGORY_PATTERN_TRANSFER,
|
||||
"itemCombinationMode",
|
||||
itemCombinationMode,
|
||||
"Item Combination Mode Setting, here are all the modes. \n" + "\"ENABLED\"" + " "
|
||||
+ "\"DISABLED\"" + " " + "WHITELIST")
|
||||
.getString();
|
||||
|
||||
itemCombinationWhitelist = config.get(CATEGORY_PATTERN_TRANSFER, "itemCombinationWhitelist", itemCombinationWhitelist,
|
||||
"Whitelist for item combination").getStringList();
|
||||
itemCombinationWhitelist = config.get(
|
||||
CATEGORY_PATTERN_TRANSFER,
|
||||
"itemCombinationWhitelist",
|
||||
itemCombinationWhitelist,
|
||||
"Whitelist for item combination")
|
||||
.getStringList();
|
||||
}
|
||||
|
||||
{
|
||||
matchOtherItems = config.get(CATEGORY_CRAFTING_HELPER, "matchOnCraftableItems", true,
|
||||
"If true, Crafting Helper will match other items even they can't auto-crafting").getBoolean();
|
||||
matchOtherItems = config.get(
|
||||
CATEGORY_CRAFTING_HELPER,
|
||||
"matchOnCraftableItems",
|
||||
true,
|
||||
"If true, Crafting Helper will match other items even they can't auto-crafting")
|
||||
.getBoolean();
|
||||
|
||||
drawHighlight = config.get(CATEGORY_CRAFTING_HELPER, "drawHighlight", true,
|
||||
"if true,it will draw highlight for missing items and item which can autocraft in nei").getBoolean();
|
||||
drawHighlight = config.get(
|
||||
CATEGORY_CRAFTING_HELPER,
|
||||
"drawHighlight",
|
||||
true,
|
||||
"if true,it will draw highlight for missing items and item which can autocraft in nei")
|
||||
.getBoolean();
|
||||
}
|
||||
|
||||
{
|
||||
allowSynchronousSwitchIngredient = config.get(CATEGORY_OTHER_SETTINGS, "allowSynchronousSwitchIngredient", true,
|
||||
"If true, it will make all similar ingredient switch at the same time").getBoolean(true);
|
||||
allowSynchronousSwitchIngredient = config.get(
|
||||
CATEGORY_OTHER_SETTINGS,
|
||||
"allowSynchronousSwitchIngredient",
|
||||
true,
|
||||
"If true, it will make all similar ingredient switch at the same time")
|
||||
.getBoolean(true);
|
||||
|
||||
enableNEIDragDrop = config.get(CATEGORY_OTHER_SETTINGS, "enableNEIDragNDrop", true, "").getBoolean();
|
||||
enableNEIDragDrop = config.get(CATEGORY_OTHER_SETTINGS, "enableNEIDragNDrop", true, "")
|
||||
.getBoolean();
|
||||
|
||||
useStackSizeFromNEI = config.get(CATEGORY_OTHER_SETTINGS, "useStackSizeFromNEI", true,
|
||||
"Use the StackSize set by NEI").getBoolean();
|
||||
useStackSizeFromNEI = config.get(
|
||||
CATEGORY_OTHER_SETTINGS, "useStackSizeFromNEI", true, "Use the StackSize set by NEI")
|
||||
.getBoolean();
|
||||
|
||||
keepGhostitems = config.get(CATEGORY_OTHER_SETTINGS, "keepGhostitems", true, "keep ghost items after click").getBoolean();
|
||||
keepGhostitems = config.get(CATEGORY_OTHER_SETTINGS, "keepGhostitems", true, "keep ghost items after click")
|
||||
.getBoolean();
|
||||
|
||||
draggedStackDefaultSize = config.get(CATEGORY_OTHER_SETTINGS, "draggedStackDefaultSize", 1,
|
||||
"The default size of the dragged ItemStack when it is put in slot(Used when useStackSizeFromNEI is false)", 1, 64).getInt();
|
||||
draggedStackDefaultSize = config.get(
|
||||
CATEGORY_OTHER_SETTINGS,
|
||||
"draggedStackDefaultSize",
|
||||
1,
|
||||
"The default size of the dragged ItemStack when it is put in slot(Used when useStackSizeFromNEI is false)",
|
||||
1,
|
||||
64)
|
||||
.getInt();
|
||||
}
|
||||
|
||||
ItemUtils.reloadConfig();
|
||||
@@ -144,36 +238,51 @@ public class NEEConfig {
|
||||
|
||||
public static void setItemCombinationMode(String itemCombinationMode) {
|
||||
NEEConfig.itemCombinationMode = itemCombinationMode;
|
||||
config.get(CATEGORY_PATTERN_TRANSFER, "itemCombinationMode", itemCombinationMode, "Item Combination Mode Setting, here are all the modes. \n" + "\"ENABLED\"" + " " + "\"DISABLED\"" + " " + "WHITELIST").set(itemCombinationMode);
|
||||
config.get(
|
||||
CATEGORY_PATTERN_TRANSFER,
|
||||
"itemCombinationMode",
|
||||
itemCombinationMode,
|
||||
"Item Combination Mode Setting, here are all the modes. \n" + "\"ENABLED\"" + " "
|
||||
+ "\"DISABLED\"" + " " + "WHITELIST")
|
||||
.set(itemCombinationMode);
|
||||
config.save();
|
||||
}
|
||||
|
||||
public static void setItemCombinationWhitelist(String[] itemCombinationWhitelist) {
|
||||
NEEConfig.itemCombinationWhitelist = itemCombinationWhitelist;
|
||||
config.get(CATEGORY_PATTERN_TRANSFER, "itemCombinationWhitelist", itemCombinationWhitelist, "Whitelist for item combination").set(itemCombinationWhitelist);
|
||||
config.get(
|
||||
CATEGORY_PATTERN_TRANSFER,
|
||||
"itemCombinationWhitelist",
|
||||
itemCombinationWhitelist,
|
||||
"Whitelist for item combination")
|
||||
.set(itemCombinationWhitelist);
|
||||
config.save();
|
||||
}
|
||||
|
||||
public static void setTransformBlacklist(String[] transformBlacklist) {
|
||||
NEEConfig.transformBlacklist = transformBlacklist;
|
||||
config.get("client", "transformItemBlacklist", new String[0],
|
||||
"If item in the blacklist, it will not be transferred.\n" +
|
||||
"the format is \" {modid:modid,name:name,meta:meta,recipeProcessor:recipeProcessorID,identifier:identifier}\"\n" +
|
||||
"example: \"{modid:minecraft,name:iron_ingot,recipeProcessor:EnderIO,identifier:EnderIOAlloySmelter}\"").set(transformBlacklist);
|
||||
config.get(
|
||||
"client",
|
||||
"transformItemBlacklist",
|
||||
new String[0],
|
||||
"If item in the blacklist, it will not be transferred.\n"
|
||||
+ "the format is \" {modid:modid,name:name,meta:meta,recipeProcessor:recipeProcessorID,identifier:identifier}\"\n"
|
||||
+ "example: \"{modid:minecraft,name:iron_ingot,recipeProcessor:EnderIO,identifier:EnderIOAlloySmelter}\"")
|
||||
.set(transformBlacklist);
|
||||
config.save();
|
||||
}
|
||||
|
||||
public static void setTransformPriorityList(String[] transformPriorityList) {
|
||||
NEEConfig.transformPriorityList = transformPriorityList;
|
||||
config.get("client", "transformPriorityModList", new String[0],
|
||||
"if oredict has this mod's item, use it first").set(transformPriorityList);
|
||||
config.get("client", "transformPriorityModList", new String[0], "if oredict has this mod's item, use it first")
|
||||
.set(transformPriorityList);
|
||||
config.save();
|
||||
}
|
||||
|
||||
public static void setTransformPriorityModList(String[] transformPriorityModList) {
|
||||
NEEConfig.transformPriorityModList = transformPriorityModList;
|
||||
config.get("client", "transformPriorityModList", new String[0],
|
||||
"if oredict has this mod's item, use it first").set(transformPriorityModList);
|
||||
config.get("client", "transformPriorityModList", new String[0], "if oredict has this mod's item, use it first")
|
||||
.set(transformPriorityModList);
|
||||
config.save();
|
||||
}
|
||||
|
||||
@@ -184,5 +293,4 @@ public class NEEConfig {
|
||||
NEEConfig.reload();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,11 +3,10 @@ package com.github.vfyjxf.nee.config;
|
||||
import com.github.vfyjxf.nee.NotEnoughEnergistics;
|
||||
import cpw.mods.fml.client.config.GuiConfig;
|
||||
import cpw.mods.fml.client.config.IConfigElement;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
|
||||
public class NEEConfigGui extends GuiConfig {
|
||||
public NEEConfigGui(GuiScreen parentScreen) {
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
package com.github.vfyjxf.nee.config;
|
||||
|
||||
import cpw.mods.fml.client.IModGuiFactory;
|
||||
import java.util.Set;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class NEEConfigGuiFactory implements IModGuiFactory {
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance) {
|
||||
|
||||
}
|
||||
public void initialize(Minecraft minecraftInstance) {}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass() {
|
||||
|
||||
@@ -32,7 +32,6 @@ public class ContainerCraftingAmount extends AEBaseContainer {
|
||||
this.verifyPermissions(SecurityPermissions.CRAFT, false);
|
||||
}
|
||||
|
||||
|
||||
public IGrid getGrid() {
|
||||
final IActionHost h = ((IActionHost) this.getTarget());
|
||||
return h.getActionableNode().getGrid();
|
||||
|
||||
@@ -34,7 +34,6 @@ public class ContainerCraftingConfirm extends ContainerCraftConfirm {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setTile(TilePatternInterface tile) {
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.github.vfyjxf.nee.container;
|
||||
|
||||
import static appeng.container.slot.SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN;
|
||||
|
||||
import appeng.api.implementations.ICraftingPatternItem;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
@@ -21,8 +23,6 @@ import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import static appeng.container.slot.SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN;
|
||||
|
||||
public class ContainerPatternInterface extends AEBaseContainer implements IAEAppEngInventory {
|
||||
|
||||
private final InventoryPlayer playerInventory;
|
||||
@@ -41,22 +41,25 @@ public class ContainerPatternInterface extends AEBaseContainer implements IAEApp
|
||||
this.patterns = tile.getPatternInventory();
|
||||
|
||||
for (int i = 0; i < patterns.getSizeInventory(); i++) {
|
||||
addSlotToContainer(patternSlots[i] = new SlotRestrictedInput(ENCODED_PATTERN, patterns, i, 8 + 18 * i, 90 + 5, playerInventory) {
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack i) {
|
||||
return false;
|
||||
}
|
||||
addSlotToContainer(
|
||||
patternSlots[i] =
|
||||
new SlotRestrictedInput(ENCODED_PATTERN, patterns, i, 8 + 18 * i, 90 + 5, playerInventory) {
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack i) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer par1EntityPlayer) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer par1EntityPlayer) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 3; x++) {
|
||||
this.addSlotToContainer(recipeSlots[x + y * 3] = new SlotDisabled(recipeInv, x + y * 3, 29 + x * 18, 30 + y * 18));
|
||||
this.addSlotToContainer(
|
||||
recipeSlots[x + y * 3] = new SlotDisabled(recipeInv, x + y * 3, 29 + x * 18, 30 + y * 18));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,14 +68,12 @@ public class ContainerPatternInterface extends AEBaseContainer implements IAEApp
|
||||
this.bindPlayerInventory(playerInventory, 0, 184 - 69);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer playerIn) {
|
||||
super.onContainerClosed(playerIn);
|
||||
clearRecipe();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer playerIn) {
|
||||
return isValidContainer();
|
||||
@@ -99,7 +100,8 @@ public class ContainerPatternInterface extends AEBaseContainer implements IAEApp
|
||||
if (slot.getHasStack()) {
|
||||
ItemStack maybePattern = slot.getStack();
|
||||
if (maybePattern.getItem() instanceof ICraftingPatternItem) {
|
||||
ICraftingPatternDetails details = ((ICraftingPatternItem) maybePattern.getItem()).getPatternForItem(maybePattern, getTileEntity().getWorldObj());
|
||||
ICraftingPatternDetails details = ((ICraftingPatternItem) maybePattern.getItem())
|
||||
.getPatternForItem(maybePattern, getTileEntity().getWorldObj());
|
||||
|
||||
if ((details.getInputs().length == 9) && (details.getOutputs().length > 0)) {
|
||||
InventoryCrafting ic = new InventoryCrafting(new ContainerNull(), 3, 3);
|
||||
@@ -118,7 +120,8 @@ public class ContainerPatternInterface extends AEBaseContainer implements IAEApp
|
||||
}
|
||||
Slot outSlot = getSlotFromInventory(this.getRecipeInventory(), 9);
|
||||
if (outSlot != null) {
|
||||
outSlot.putStack(details.getOutput(ic, getTileEntity().getWorldObj()));
|
||||
outSlot.putStack(
|
||||
details.getOutput(ic, getTileEntity().getWorldObj()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,13 +148,9 @@ public class ContainerPatternInterface extends AEBaseContainer implements IAEApp
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveChanges() {
|
||||
|
||||
}
|
||||
public void saveChanges() {}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {
|
||||
|
||||
}
|
||||
|
||||
public void onChangeInventory(
|
||||
IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {}
|
||||
}
|
||||
@@ -41,5 +41,4 @@ public class WCTContainerCraftingConfirm extends ContainerCraftConfirm {
|
||||
public void setPatternIndex(int patternIndex) {
|
||||
this.patternIndex = patternIndex;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.github.vfyjxf.nee.nei;
|
||||
|
||||
import static com.github.vfyjxf.nee.processor.RecipeProcessor.NULL_IDENTIFIER;
|
||||
|
||||
import appeng.client.gui.implementations.GuiPatternTerm;
|
||||
import appeng.util.Platform;
|
||||
import codechicken.nei.PositionedStack;
|
||||
@@ -16,15 +18,12 @@ import com.github.vfyjxf.nee.processor.IRecipeProcessor;
|
||||
import com.github.vfyjxf.nee.processor.RecipeProcessor;
|
||||
import com.github.vfyjxf.nee.utils.GuiUtils;
|
||||
import com.github.vfyjxf.nee.utils.ItemUtils;
|
||||
import java.util.*;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.github.vfyjxf.nee.processor.RecipeProcessor.NULL_IDENTIFIER;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
@@ -67,13 +66,15 @@ public class NEECraftingHandler implements IOverlayHandler {
|
||||
private PacketNEIPatternRecipe packProcessRecipe(IRecipeHandler recipe, int recipeIndex) {
|
||||
final NBTTagCompound recipeInputs = new NBTTagCompound();
|
||||
NBTTagCompound recipeOutputs = new NBTTagCompound();
|
||||
String identifier = recipe instanceof TemplateRecipeHandler ? ((TemplateRecipeHandler) recipe).getOverlayIdentifier() : NULL_IDENTIFIER;
|
||||
if (identifier == null){
|
||||
String identifier = recipe instanceof TemplateRecipeHandler
|
||||
? ((TemplateRecipeHandler) recipe).getOverlayIdentifier()
|
||||
: NULL_IDENTIFIER;
|
||||
if (identifier == null) {
|
||||
identifier = NULL_IDENTIFIER;
|
||||
}
|
||||
int inputIndex = 0;
|
||||
int outputIndex = 0;
|
||||
//get all recipe inputs and other stacks,use first item
|
||||
// get all recipe inputs and other stacks,use first item
|
||||
for (IRecipeProcessor processor : RecipeProcessor.recipeProcessors) {
|
||||
if (processor.getAllOverlayIdentifier().contains(identifier)) {
|
||||
List<PositionedStack> inputs = processor.getRecipeInput(recipe, recipeIndex, identifier);
|
||||
@@ -87,13 +88,19 @@ public class NEECraftingHandler implements IOverlayHandler {
|
||||
ItemStack currentStack = positionedStack.items[0];
|
||||
boolean find = false;
|
||||
ItemCombination currentValue = ItemCombination.valueOf(NEEConfig.itemCombinationMode);
|
||||
if (currentValue != ItemCombination.DISABLED && processor.mergeStacks(recipe, recipeIndex, identifier)) {
|
||||
boolean isWhitelist = currentValue == ItemCombination.WHITELIST && Arrays.asList(NEEConfig.itemCombinationWhitelist).contains(identifier);
|
||||
if (currentValue != ItemCombination.DISABLED
|
||||
&& processor.mergeStacks(recipe, recipeIndex, identifier)) {
|
||||
boolean isWhitelist = currentValue == ItemCombination.WHITELIST
|
||||
&& Arrays.asList(NEEConfig.itemCombinationWhitelist)
|
||||
.contains(identifier);
|
||||
if (currentValue == ItemCombination.ENABLED || isWhitelist) {
|
||||
for (PositionedStack storedStack : mergedInputs) {
|
||||
ItemStack firstStack = storedStack.items[0];
|
||||
boolean areItemStackEqual = firstStack.isItemEqual(currentStack) && ItemStack.areItemStackTagsEqual(firstStack, currentStack);
|
||||
if (areItemStackEqual && (firstStack.stackSize + currentStack.stackSize) <= firstStack.getMaxStackSize()) {
|
||||
boolean areItemStackEqual = firstStack.isItemEqual(currentStack)
|
||||
&& ItemStack.areItemStackTagsEqual(firstStack, currentStack);
|
||||
if (areItemStackEqual
|
||||
&& (firstStack.stackSize + currentStack.stackSize)
|
||||
<= firstStack.getMaxStackSize()) {
|
||||
find = true;
|
||||
storedStack.items[0].stackSize = firstStack.stackSize + currentStack.stackSize;
|
||||
}
|
||||
@@ -114,7 +121,8 @@ public class NEECraftingHandler implements IOverlayHandler {
|
||||
}
|
||||
|
||||
for (ItemStack stack : positionedStack.items) {
|
||||
if (Platform.isRecipePrioritized(stack) || ItemUtils.isPreferItems(stack, recipeProcessorId, identifier)) {
|
||||
if (Platform.isRecipePrioritized(stack)
|
||||
|| ItemUtils.isPreferItems(stack, recipeProcessorId, identifier)) {
|
||||
currentStack = stack.copy();
|
||||
currentStack.stackSize = positionedStack.items[0].stackSize;
|
||||
break;
|
||||
@@ -235,7 +243,8 @@ public class NEECraftingHandler implements IOverlayHandler {
|
||||
private void extremeAutoCrafterHandler(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex) {
|
||||
final Class<?> guiExtremeAutoCrafterClz;
|
||||
try {
|
||||
guiExtremeAutoCrafterClz = Class.forName("wanion.avaritiaddons.block.extremeautocrafter.GuiExtremeAutoCrafter");
|
||||
guiExtremeAutoCrafterClz =
|
||||
Class.forName("wanion.avaritiaddons.block.extremeautocrafter.GuiExtremeAutoCrafter");
|
||||
} catch (ClassNotFoundException e) {
|
||||
return;
|
||||
}
|
||||
@@ -293,5 +302,4 @@ public class NEECraftingHandler implements IOverlayHandler {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.github.vfyjxf.nee.nei;
|
||||
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHandler.INPUT_KEY;
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHandler.OUTPUT_KEY;
|
||||
|
||||
import appeng.client.gui.implementations.GuiCraftingTerm;
|
||||
import appeng.client.gui.implementations.GuiPatternTerm;
|
||||
import appeng.container.slot.SlotCraftingMatrix;
|
||||
@@ -27,6 +30,15 @@ import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
@@ -39,20 +51,6 @@ import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHandler.INPUT_KEY;
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHandler.OUTPUT_KEY;
|
||||
|
||||
|
||||
public class NEECraftingHelper implements IOverlayHandler {
|
||||
public static final NEECraftingHelper INSTANCE = new NEECraftingHelper();
|
||||
public static IngredientTracker tracker = null;
|
||||
@@ -65,12 +63,14 @@ public class NEECraftingHelper implements IOverlayHandler {
|
||||
@Override
|
||||
public void overlayRecipe(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex, boolean shift) {
|
||||
if (GuiUtils.isGuiCraftingTerm(firstGui) && NEECraftingHandler.isCraftingTableRecipe(recipe)) {
|
||||
boolean doCraftingHelp = Keyboard.isKeyDown(NEIClientConfig.getKeyBinding("nee.preview")) || Keyboard.isKeyDown(NEIClientConfig.getKeyBinding("nee.nopreview"));
|
||||
boolean doCraftingHelp = Keyboard.isKeyDown(NEIClientConfig.getKeyBinding("nee.preview"))
|
||||
|| Keyboard.isKeyDown(NEIClientConfig.getKeyBinding("nee.nopreview"));
|
||||
noPreview = Keyboard.isKeyDown(NEIClientConfig.getKeyBinding("nee.nopreview"));
|
||||
if (doCraftingHelp) {
|
||||
|
||||
if (isPatternInterfaceExists) {
|
||||
NEENetworkHandler.getInstance().sendToServer(new PacketOpenCraftAmount(packCraftingRecipe(recipe, recipeIndex)));
|
||||
NEENetworkHandler.getInstance()
|
||||
.sendToServer(new PacketOpenCraftAmount(packCraftingRecipe(recipe, recipeIndex)));
|
||||
isPatternInterfaceExists = false;
|
||||
} else {
|
||||
tracker = new IngredientTracker(firstGui, recipe, recipeIndex);
|
||||
@@ -79,7 +79,6 @@ public class NEECraftingHelper implements IOverlayHandler {
|
||||
} else {
|
||||
moveItems(firstGui, recipe, recipeIndex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -133,10 +132,11 @@ public class NEECraftingHelper implements IOverlayHandler {
|
||||
final List<PositionedStack> ingredients = recipe.getIngredientStacks(recipeIndex);
|
||||
if (firstGui instanceof GuiCraftingTerm) {
|
||||
PacketNEIRecipe packet = new PacketNEIRecipe(packIngredients(firstGui, ingredients, false));
|
||||
//don't use gtnh ae2's method;
|
||||
// don't use gtnh ae2's method;
|
||||
int packetSize = getPacketSize(packet);
|
||||
if (packetSize >= 32 * 1024) {
|
||||
AELog.warn("Recipe for " + recipe.getRecipeName() + " has too many variants, reduced version will be used");
|
||||
AELog.warn("Recipe for " + recipe.getRecipeName()
|
||||
+ " has too many variants, reduced version will be used");
|
||||
packet = new PacketNEIRecipe(packIngredients(firstGui, ingredients, true));
|
||||
}
|
||||
if (packetSize >= 0) {
|
||||
@@ -165,7 +165,8 @@ public class NEECraftingHelper implements IOverlayHandler {
|
||||
* Copied from GTNewHorizons/Applied-Energistics-2-Unofficial
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private NBTTagCompound packIngredients(GuiContainer gui, List<PositionedStack> ingredients, boolean limited) throws IOException {
|
||||
private NBTTagCompound packIngredients(GuiContainer gui, List<PositionedStack> ingredients, boolean limited)
|
||||
throws IOException {
|
||||
final NBTTagCompound recipe = new NBTTagCompound();
|
||||
for (final PositionedStack positionedStack : ingredients) {
|
||||
final int col = (positionedStack.relx - 25) / 18;
|
||||
@@ -213,14 +214,18 @@ public class NEECraftingHelper implements IOverlayHandler {
|
||||
if (gui instanceof GuiCraftingTerm) {
|
||||
return slot instanceof SlotCraftingMatrix || slot instanceof SlotFakeCraftingMatrix;
|
||||
} else if (GuiUtils.isGuiWirelessCrafting(gui)) {
|
||||
return slot instanceof net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotCraftingMatrix || slot instanceof net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotFakeCraftingMatrix;
|
||||
return slot instanceof net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotCraftingMatrix
|
||||
|| slot
|
||||
instanceof
|
||||
net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotFakeCraftingMatrix;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private int getPacketSize(AppEngPacket packet) {
|
||||
try {
|
||||
ByteBuf p = (ByteBuf) ReflectionHelper.findField(AppEngPacket.class, "p").get(packet);
|
||||
ByteBuf p = (ByteBuf)
|
||||
ReflectionHelper.findField(AppEngPacket.class, "p").get(packet);
|
||||
return p.array().length;
|
||||
} catch (IllegalAccessException e) {
|
||||
return -1;
|
||||
@@ -230,7 +235,9 @@ public class NEECraftingHelper implements IOverlayHandler {
|
||||
@Optional.Method(modid = "ae2wct")
|
||||
private void moveItemsForWirelessCrafting(GuiContainer firstGui, List<PositionedStack> ingredients) {
|
||||
try {
|
||||
net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler.instance.sendToServer(new net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketNEIRecipe(packIngredients(firstGui, ingredients, false)));
|
||||
net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler.instance.sendToServer(
|
||||
new net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketNEIRecipe(
|
||||
packIngredients(firstGui, ingredients, false)));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -239,7 +246,7 @@ public class NEECraftingHelper implements IOverlayHandler {
|
||||
@SubscribeEvent
|
||||
public void onActionPerformedEventPre(GuiScreenEvent.ActionPerformedEvent.Pre event) {
|
||||
if (NEEConfig.noShift) {
|
||||
//make nei's transfer system doesn't require presses shift
|
||||
// make nei's transfer system doesn't require presses shift
|
||||
if (event.gui instanceof GuiRecipe) {
|
||||
GuiRecipe guiRecipe = (GuiRecipe) event.gui;
|
||||
List<GuiButton> overlayButtons = null;
|
||||
@@ -259,24 +266,34 @@ public class NEECraftingHelper implements IOverlayHandler {
|
||||
overlayButtons.add(overlay1);
|
||||
overlayButtons.add(overlay2);
|
||||
}
|
||||
if (event.button.id >= OVERLAY_BUTTON_ID_START && event.button.id < OVERLAY_BUTTON_ID_START + overlayButtons.size()) {
|
||||
boolean isPatternTerm = guiRecipe.firstGui instanceof GuiPatternTerm || GuiUtils.isPatternTermExGui(guiRecipe.firstGui);
|
||||
boolean isCraftingTerm = guiRecipe.firstGui instanceof GuiCraftingTerm || GuiUtils.isGuiWirelessCrafting(guiRecipe.firstGui);
|
||||
if (event.button.id >= OVERLAY_BUTTON_ID_START
|
||||
&& event.button.id < OVERLAY_BUTTON_ID_START + overlayButtons.size()) {
|
||||
boolean isPatternTerm = guiRecipe.firstGui instanceof GuiPatternTerm
|
||||
|| GuiUtils.isPatternTermExGui(guiRecipe.firstGui);
|
||||
boolean isCraftingTerm = guiRecipe.firstGui instanceof GuiCraftingTerm
|
||||
|| GuiUtils.isGuiWirelessCrafting(guiRecipe.firstGui);
|
||||
if (isCraftingTerm || isPatternTerm) {
|
||||
int recipesPerPage = 2;
|
||||
IRecipeHandler handler = guiRecipe.currenthandlers.get(guiRecipe.recipetype);
|
||||
if (isGtnhNei) {
|
||||
try {
|
||||
recipesPerPage = (int) ReflectionHelper.findMethod(GuiRecipe.class, guiRecipe, new String[]{"getRecipesPerPage"}).invoke(guiRecipe);
|
||||
recipesPerPage = (int) ReflectionHelper.findMethod(
|
||||
GuiRecipe.class, guiRecipe, new String[] {"getRecipesPerPage"})
|
||||
.invoke(guiRecipe);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (recipesPerPage >= 0 && handler != null) {
|
||||
int recipe = guiRecipe.page * recipesPerPage + event.button.id - OVERLAY_BUTTON_ID_START;
|
||||
final IOverlayHandler overlayHandler = handler.getOverlayHandler(guiRecipe.firstGui, recipe);
|
||||
final IOverlayHandler overlayHandler =
|
||||
handler.getOverlayHandler(guiRecipe.firstGui, recipe);
|
||||
Minecraft.getMinecraft().displayGuiScreen(guiRecipe.firstGui);
|
||||
overlayHandler.overlayRecipe(guiRecipe.firstGui, guiRecipe.currenthandlers.get(guiRecipe.recipetype), recipe, NEIClientUtils.shiftKey());
|
||||
overlayHandler.overlayRecipe(
|
||||
guiRecipe.firstGui,
|
||||
guiRecipe.currenthandlers.get(guiRecipe.recipetype),
|
||||
recipe,
|
||||
NEIClientUtils.shiftKey());
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.github.vfyjxf.nee.network;
|
||||
|
||||
import static com.github.vfyjxf.nee.NotEnoughEnergistics.instance;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.api.parts.IPart;
|
||||
@@ -20,6 +22,7 @@ import com.github.vfyjxf.nee.utils.ModIDs;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
@@ -28,10 +31,6 @@ import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTermHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.github.vfyjxf.nee.NotEnoughEnergistics.instance;
|
||||
|
||||
public class NEEGuiHandler implements IGuiHandler {
|
||||
|
||||
public static final int CRAFTING_AMOUNT_ID = 0;
|
||||
@@ -54,12 +53,26 @@ public class NEEGuiHandler implements IGuiHandler {
|
||||
switch (guiId) {
|
||||
case CRAFTING_AMOUNT_ID:
|
||||
if (part instanceof PartCraftingTerminal) {
|
||||
return updateGui(new ContainerCraftingAmount(player.inventory, part), world, x, y, z, side, part);
|
||||
return updateGui(
|
||||
new ContainerCraftingAmount(player.inventory, part),
|
||||
world,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
side,
|
||||
part);
|
||||
}
|
||||
return null;
|
||||
case CRAFTING_CONFIRM_ID:
|
||||
if (part instanceof PartCraftingTerminal) {
|
||||
return updateGui(new ContainerCraftingConfirm(player.inventory, (ITerminalHost) part), world, x, y, z, side, part);
|
||||
return updateGui(
|
||||
new ContainerCraftingConfirm(player.inventory, (ITerminalHost) part),
|
||||
world,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
side,
|
||||
part);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -89,7 +102,6 @@ public class NEEGuiHandler implements IGuiHandler {
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -108,12 +120,26 @@ public class NEEGuiHandler implements IGuiHandler {
|
||||
switch (guiId) {
|
||||
case CRAFTING_AMOUNT_ID:
|
||||
if (part instanceof PartCraftingTerminal) {
|
||||
return updateGui(new GuiCraftingAmount(player.inventory, (ITerminalHost) part), world, x, y, z, side, part);
|
||||
return updateGui(
|
||||
new GuiCraftingAmount(player.inventory, (ITerminalHost) part),
|
||||
world,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
side,
|
||||
part);
|
||||
}
|
||||
return null;
|
||||
case CRAFTING_CONFIRM_ID:
|
||||
if (part instanceof PartCraftingTerminal) {
|
||||
return updateGui(new GuiCraftConfirm(player.inventory, (ITerminalHost) part), world, x, y, z, side, part);
|
||||
return updateGui(
|
||||
new GuiCraftConfirm(player.inventory, (ITerminalHost) part),
|
||||
world,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
side,
|
||||
part);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -139,7 +165,8 @@ public class NEEGuiHandler implements IGuiHandler {
|
||||
if (guiId == CRAFTING_AMOUNT_WIRELESS_ID) {
|
||||
return new GuiCraftingAmount(player.inventory, wirelessTerminal);
|
||||
} else {
|
||||
return new net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm(player.inventory, wirelessTerminal);
|
||||
return new net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm(
|
||||
player.inventory, wirelessTerminal);
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -149,7 +176,14 @@ public class NEEGuiHandler implements IGuiHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object updateGui(Object newContainer, final World w, final int x, final int y, final int z, final ForgeDirection side, final IPart part) {
|
||||
private Object updateGui(
|
||||
Object newContainer,
|
||||
final World w,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z,
|
||||
final ForgeDirection side,
|
||||
final IPart part) {
|
||||
if (newContainer instanceof AEBaseContainer) {
|
||||
final AEBaseContainer bc = (AEBaseContainer) newContainer;
|
||||
bc.setOpenContext(new ContainerOpenContext(part));
|
||||
@@ -178,11 +212,14 @@ public class NEEGuiHandler implements IGuiHandler {
|
||||
|
||||
@Optional.Method(modid = "ae2wct")
|
||||
private WirelessTerminalGuiObject getWirelessTerminalGui(EntityPlayer player, World world, int x, int y, int z) {
|
||||
final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) AEApi.instance().registries().wireless().getWirelessTerminalHandler(RandomUtils.getWirelessTerm(player.inventory));
|
||||
final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) AEApi.instance()
|
||||
.registries()
|
||||
.wireless()
|
||||
.getWirelessTerminalHandler(RandomUtils.getWirelessTerm(player.inventory));
|
||||
if (wh != null) {
|
||||
return new WirelessTerminalGuiObject(wh, RandomUtils.getWirelessTerm(player.inventory), player, world, x, y, z);
|
||||
return new WirelessTerminalGuiObject(
|
||||
wh, RandomUtils.getWirelessTerm(player.inventory), player, world, x, y, z);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,17 +19,23 @@ public class NEENetworkHandler {
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
INSTANCE.registerMessage(PacketNEIPatternRecipe.Handler.class, PacketNEIPatternRecipe.class, nextId(), Side.SERVER);
|
||||
INSTANCE.registerMessage(
|
||||
PacketNEIPatternRecipe.Handler.class, PacketNEIPatternRecipe.class, nextId(), Side.SERVER);
|
||||
INSTANCE.registerMessage(PacketArcaneRecipe.Handler.class, PacketArcaneRecipe.class, nextId(), Side.SERVER);
|
||||
INSTANCE.registerMessage(PacketExtremeRecipe.Handler.class, PacketExtremeRecipe.class, nextId(), Side.SERVER);
|
||||
INSTANCE.registerMessage(PacketStackCountChange.Handler.class, PacketStackCountChange.class, nextId(), Side.SERVER);
|
||||
INSTANCE.registerMessage(PacketSlotStackChange.Handler.class, PacketSlotStackChange.class, nextId(), Side.SERVER);
|
||||
INSTANCE.registerMessage(PacketCraftingRequest.Handler.class, PacketCraftingRequest.class, nextId(), Side.SERVER);
|
||||
INSTANCE.registerMessage(PacketOpenCraftAmount.Handler.class, PacketOpenCraftAmount.class, nextId(), Side.SERVER);
|
||||
INSTANCE.registerMessage(
|
||||
PacketStackCountChange.Handler.class, PacketStackCountChange.class, nextId(), Side.SERVER);
|
||||
INSTANCE.registerMessage(
|
||||
PacketSlotStackChange.Handler.class, PacketSlotStackChange.class, nextId(), Side.SERVER);
|
||||
INSTANCE.registerMessage(
|
||||
PacketCraftingRequest.Handler.class, PacketCraftingRequest.class, nextId(), Side.SERVER);
|
||||
INSTANCE.registerMessage(
|
||||
PacketOpenCraftAmount.Handler.class, PacketOpenCraftAmount.class, nextId(), Side.SERVER);
|
||||
INSTANCE.registerMessage(PacketOpenGui.Handler.class, PacketOpenGui.class, nextId(), Side.SERVER);
|
||||
INSTANCE.registerMessage(PacketSetRecipe.Handler.class, PacketSetRecipe.class, nextId(), Side.SERVER);
|
||||
INSTANCE.registerMessage(PacketValueConfigServer.Handler.class, PacketValueConfigServer.class, nextId(), Side.SERVER);
|
||||
INSTANCE.registerMessage(PacketValueConfigClient.Handler.class, PacketValueConfigClient.class, nextId(), Side.CLIENT);
|
||||
INSTANCE.registerMessage(
|
||||
PacketValueConfigServer.Handler.class, PacketValueConfigServer.class, nextId(), Side.SERVER);
|
||||
INSTANCE.registerMessage(
|
||||
PacketValueConfigClient.Handler.class, PacketValueConfigClient.class, nextId(), Side.CLIENT);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7,14 +7,13 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.lang.reflect.Field;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import thaumicenergistics.common.container.ContainerKnowledgeInscriber;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
@@ -22,8 +21,7 @@ public class PacketArcaneRecipe implements IMessage {
|
||||
|
||||
NBTTagCompound input;
|
||||
|
||||
public PacketArcaneRecipe() {
|
||||
}
|
||||
public PacketArcaneRecipe() {}
|
||||
|
||||
public PacketArcaneRecipe(NBTTagCompound input) {
|
||||
this.input = input;
|
||||
@@ -39,7 +37,7 @@ public class PacketArcaneRecipe implements IMessage {
|
||||
ByteBufUtils.writeTag(buf, this.input);
|
||||
}
|
||||
|
||||
public static final class Handler implements IMessageHandler<PacketArcaneRecipe, IMessage>{
|
||||
public static final class Handler implements IMessageHandler<PacketArcaneRecipe, IMessage> {
|
||||
@Override
|
||||
public IMessage onMessage(PacketArcaneRecipe message, MessageContext ctx) {
|
||||
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||
@@ -53,7 +51,8 @@ public class PacketArcaneRecipe implements IMessage {
|
||||
}
|
||||
|
||||
Field craftingSlots = ReflectionHelper.findField(ContainerKnowledgeInscriber.class, "craftingSlots");
|
||||
SlotFakeCraftingMatrix[] craftMatrix = this.getCraftingSlots(craftingSlots, (ContainerKnowledgeInscriber) container);
|
||||
SlotFakeCraftingMatrix[] craftMatrix =
|
||||
this.getCraftingSlots(craftingSlots, (ContainerKnowledgeInscriber) container);
|
||||
if (craftMatrix != null && message.input != null) {
|
||||
for (int i = 0; i < recipeInput.length; i++) {
|
||||
ItemStack currentItem = null;
|
||||
@@ -77,6 +76,4 @@ public class PacketArcaneRecipe implements IMessage {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package com.github.vfyjxf.nee.network.packet;
|
||||
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHandler.INPUT_KEY;
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHandler.OUTPUT_KEY;
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHelper.RECIPE_LENGTH;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.IGrid;
|
||||
@@ -34,6 +38,8 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.Future;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
@@ -50,23 +56,13 @@ import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
|
||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHandler.INPUT_KEY;
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHandler.OUTPUT_KEY;
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHelper.RECIPE_LENGTH;
|
||||
|
||||
public class PacketCraftingRequest implements IMessage{
|
||||
|
||||
public class PacketCraftingRequest implements IMessage {
|
||||
|
||||
private IAEItemStack requireToCraftStack;
|
||||
private boolean isAutoStart;
|
||||
private int craftAmount;
|
||||
|
||||
public PacketCraftingRequest() {
|
||||
|
||||
}
|
||||
public PacketCraftingRequest() {}
|
||||
|
||||
public PacketCraftingRequest(IAEItemStack requireToCraftStack, boolean isAutoStart) {
|
||||
this.requireToCraftStack = requireToCraftStack;
|
||||
@@ -86,7 +82,6 @@ public class PacketCraftingRequest implements IMessage{
|
||||
return isAutoStart;
|
||||
}
|
||||
|
||||
|
||||
public int getCraftAmount() {
|
||||
return craftAmount;
|
||||
}
|
||||
@@ -120,7 +115,7 @@ public class PacketCraftingRequest implements IMessage{
|
||||
buf.writeInt(this.craftAmount);
|
||||
}
|
||||
|
||||
public static final class Handler implements IMessageHandler<PacketCraftingRequest, IMessage>{
|
||||
public static final class Handler implements IMessageHandler<PacketCraftingRequest, IMessage> {
|
||||
@Override
|
||||
public IMessage onMessage(PacketCraftingRequest message, MessageContext ctx) {
|
||||
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||
@@ -138,11 +133,13 @@ public class PacketCraftingRequest implements IMessage{
|
||||
final ISecurityGrid security = grid.getCache(ISecurityGrid.class);
|
||||
if (security != null && security.hasPermission(player, SecurityPermissions.CRAFT)) {
|
||||
if (container instanceof ContainerCraftingTerm) {
|
||||
message.handlerCraftingTermRequest((ContainerCraftingTerm) container, message, grid, player);
|
||||
message.handlerCraftingTermRequest(
|
||||
(ContainerCraftingTerm) container, message, grid, player);
|
||||
}
|
||||
|
||||
if (container instanceof ContainerCraftingAmount) {
|
||||
message.handlerCraftingAmountRequest((ContainerCraftingAmount) container, message, grid, player);
|
||||
message.handlerCraftingAmountRequest(
|
||||
(ContainerCraftingAmount) container, message, grid, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,12 +153,14 @@ public class PacketCraftingRequest implements IMessage{
|
||||
}
|
||||
}
|
||||
|
||||
private void handlerCraftingTermRequest(ContainerCraftingTerm container, PacketCraftingRequest message, IGrid grid, EntityPlayerMP player) {
|
||||
private void handlerCraftingTermRequest(
|
||||
ContainerCraftingTerm container, PacketCraftingRequest message, IGrid grid, EntityPlayerMP player) {
|
||||
if (message.getRequireToCraftStack() != null) {
|
||||
Future<ICraftingJob> futureJob = null;
|
||||
try {
|
||||
final ICraftingGrid cg = grid.getCache(ICraftingGrid.class);
|
||||
futureJob = cg.beginCraftingJob(player.worldObj, grid, container.getActionSource(), message.getRequireToCraftStack(), null);
|
||||
futureJob = cg.beginCraftingJob(
|
||||
player.worldObj, grid, container.getActionSource(), message.getRequireToCraftStack(), null);
|
||||
|
||||
final ContainerOpenContext context = container.getOpenContext();
|
||||
if (context != null) {
|
||||
@@ -182,7 +181,8 @@ public class PacketCraftingRequest implements IMessage{
|
||||
}
|
||||
}
|
||||
|
||||
private void handlerCraftingAmountRequest(ContainerCraftingAmount container, PacketCraftingRequest message, IGrid grid, EntityPlayerMP player) {
|
||||
private void handlerCraftingAmountRequest(
|
||||
ContainerCraftingAmount container, PacketCraftingRequest message, IGrid grid, EntityPlayerMP player) {
|
||||
if (container.getResultStack() != null) {
|
||||
|
||||
Pair<TilePatternInterface, Integer> pair = setRecipe(grid, container.getRecipe(), player);
|
||||
@@ -208,7 +208,8 @@ public class PacketCraftingRequest implements IMessage{
|
||||
Future<ICraftingJob> futureJob = null;
|
||||
try {
|
||||
final ICraftingGrid cg = grid.getCache(ICraftingGrid.class);
|
||||
futureJob = cg.beginCraftingJob(player.worldObj, grid, container.getActionSource(), result, null);
|
||||
futureJob =
|
||||
cg.beginCraftingJob(player.worldObj, grid, container.getActionSource(), result, null);
|
||||
|
||||
final ContainerOpenContext context = container.getOpenContext();
|
||||
if (context != null) {
|
||||
@@ -227,7 +228,8 @@ public class PacketCraftingRequest implements IMessage{
|
||||
NEEGuiHandler.openGui(player, NEEGuiHandler.CRAFTING_CONFIRM_WIRELESS_ID, player.worldObj);
|
||||
|
||||
if (player.openContainer instanceof WCTContainerCraftingConfirm) {
|
||||
final WCTContainerCraftingConfirm ccc = (WCTContainerCraftingConfirm) player.openContainer;
|
||||
final WCTContainerCraftingConfirm ccc =
|
||||
(WCTContainerCraftingConfirm) player.openContainer;
|
||||
ccc.setJob(futureJob);
|
||||
ccc.setAutoStart(message.isAutoStart());
|
||||
ccc.setTile(pair.getLeft());
|
||||
@@ -241,23 +243,30 @@ public class PacketCraftingRequest implements IMessage{
|
||||
}
|
||||
AELog.debug(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handlerWirelessCraftingRequest(ContainerWirelessCraftingTerminal container, PacketCraftingRequest message, EntityPlayerMP player) {
|
||||
private void handlerWirelessCraftingRequest(
|
||||
ContainerWirelessCraftingTerminal container, PacketCraftingRequest message, EntityPlayerMP player) {
|
||||
Object target = container.getTarget();
|
||||
if (target instanceof WirelessTerminalGuiObject) {
|
||||
IGrid grid = ((WirelessTerminalGuiObject) target).getTargetGrid();
|
||||
if (grid != null) {
|
||||
final ISecurityGrid security = grid.getCache(ISecurityGrid.class);
|
||||
if (security != null && security.hasPermission(player, SecurityPermissions.CRAFT) && message.getRequireToCraftStack() != null) {
|
||||
if (security != null
|
||||
&& security.hasPermission(player, SecurityPermissions.CRAFT)
|
||||
&& message.getRequireToCraftStack() != null) {
|
||||
Future<ICraftingJob> futureJob = null;
|
||||
try {
|
||||
final ICraftingGrid cg = grid.getCache(ICraftingGrid.class);
|
||||
futureJob = cg.beginCraftingJob(player.worldObj, grid, container.getActionSource(), message.getRequireToCraftStack(), null);
|
||||
futureJob = cg.beginCraftingJob(
|
||||
player.worldObj,
|
||||
grid,
|
||||
container.getActionSource(),
|
||||
message.getRequireToCraftStack(),
|
||||
null);
|
||||
|
||||
int x = (int) player.posX;
|
||||
int y = (int) player.posY;
|
||||
@@ -265,8 +274,12 @@ public class PacketCraftingRequest implements IMessage{
|
||||
|
||||
WCTGuiHandler.launchGui(Reference.GUI_CRAFT_CONFIRM, player, player.worldObj, x, y, z);
|
||||
|
||||
if (player.openContainer instanceof net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftConfirm) {
|
||||
final net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftConfirm ccc = (net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftConfirm) player.openContainer;
|
||||
if (player.openContainer
|
||||
instanceof
|
||||
net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftConfirm) {
|
||||
final net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftConfirm ccc =
|
||||
(net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftConfirm)
|
||||
player.openContainer;
|
||||
ccc.setJob(futureJob);
|
||||
ccc.setAutoStart(message.isAutoStart());
|
||||
}
|
||||
@@ -281,7 +294,6 @@ public class PacketCraftingRequest implements IMessage{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Pair<TilePatternInterface, Integer> setRecipe(IGrid grid, NBTTagCompound recipe, EntityPlayer player) {
|
||||
|
||||
for (IGridNode gridNode : grid.getMachines(TilePatternInterface.class)) {
|
||||
@@ -302,11 +314,8 @@ public class PacketCraftingRequest implements IMessage{
|
||||
if (patternIndex >= 0) {
|
||||
return Pair.of(tpi, patternIndex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -327,7 +336,8 @@ public class PacketCraftingRequest implements IMessage{
|
||||
ItemStack result = CraftingManager.getInstance().findMatchingRecipe(ic, player.worldObj);
|
||||
if (result != null) {
|
||||
ItemStack patternStack = null;
|
||||
Optional<ItemStack> maybePattern = AEApi.instance().definitions().items().encodedPattern().maybeStack(1);
|
||||
Optional<ItemStack> maybePattern =
|
||||
AEApi.instance().definitions().items().encodedPattern().maybeStack(1);
|
||||
if (maybePattern.isPresent()) {
|
||||
patternStack = maybePattern.get();
|
||||
}
|
||||
@@ -357,5 +367,4 @@ public class PacketCraftingRequest implements IMessage{
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.lang.reflect.Field;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
@@ -15,9 +17,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import wanion.avaritiaddons.block.extremeautocrafter.ContainerExtremeAutoCrafter;
|
||||
import wanion.avaritiaddons.block.extremeautocrafter.TileEntityExtremeAutoCrafter;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
@@ -25,8 +24,7 @@ public class PacketExtremeRecipe implements IMessage {
|
||||
|
||||
private NBTTagCompound input;
|
||||
|
||||
public PacketExtremeRecipe() {
|
||||
}
|
||||
public PacketExtremeRecipe() {}
|
||||
|
||||
public PacketExtremeRecipe(@Nonnull NBTTagCompound input) {
|
||||
this.input = input;
|
||||
@@ -74,16 +72,19 @@ public class PacketExtremeRecipe implements IMessage {
|
||||
}
|
||||
|
||||
private InventoryCrafting getCraftingMatrix(ContainerExtremeAutoCrafter container) {
|
||||
Field tileEntityExtremeAutoCrafterField = ReflectionHelper.findField(ContainerExtremeAutoCrafter.class, "tileEntityExtremeAutoCrafter");
|
||||
Field tileEntityExtremeAutoCrafterField =
|
||||
ReflectionHelper.findField(ContainerExtremeAutoCrafter.class, "tileEntityExtremeAutoCrafter");
|
||||
TileEntityExtremeAutoCrafter tileEntityExtremeAutoCrafter = null;
|
||||
|
||||
try {
|
||||
tileEntityExtremeAutoCrafter = (TileEntityExtremeAutoCrafter) tileEntityExtremeAutoCrafterField.get(container);
|
||||
tileEntityExtremeAutoCrafter =
|
||||
(TileEntityExtremeAutoCrafter) tileEntityExtremeAutoCrafterField.get(container);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (tileEntityExtremeAutoCrafter != null) {
|
||||
Field craftingMatrixField = ReflectionHelper.findField(TileEntityExtremeAutoCrafter.class, "craftingMatrix");
|
||||
Field craftingMatrixField =
|
||||
ReflectionHelper.findField(TileEntityExtremeAutoCrafter.class, "craftingMatrix");
|
||||
InventoryCrafting craftingMatrix = null;
|
||||
try {
|
||||
craftingMatrix = (InventoryCrafting) craftingMatrixField.get(tileEntityExtremeAutoCrafter);
|
||||
@@ -94,7 +95,5 @@ public class PacketExtremeRecipe implements IMessage {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.github.vfyjxf.nee.network.packet;
|
||||
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHandler.OUTPUT_KEY;
|
||||
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.ISecurityGrid;
|
||||
@@ -12,31 +14,25 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHandler.OUTPUT_KEY;
|
||||
|
||||
|
||||
public class PacketNEIPatternRecipe implements IMessage{
|
||||
public class PacketNEIPatternRecipe implements IMessage {
|
||||
|
||||
NBTTagCompound input;
|
||||
NBTTagCompound output;
|
||||
|
||||
public PacketNEIPatternRecipe() {
|
||||
}
|
||||
public PacketNEIPatternRecipe() {}
|
||||
|
||||
public PacketNEIPatternRecipe(@Nonnull NBTTagCompound input, NBTTagCompound output) {
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
this.input = ByteBufUtils.readTag(buf);
|
||||
@@ -73,14 +69,12 @@ public class PacketNEIPatternRecipe implements IMessage{
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void craftingTableRecipeHandler(ContainerPatternTerm container, PacketNEIPatternRecipe message) {
|
||||
ItemStack[] recipeInput = new ItemStack[9];
|
||||
NBTTagCompound currentStack;
|
||||
|
||||
|
||||
for (int i = 0; i < recipeInput.length; i++) {
|
||||
currentStack = (NBTTagCompound) message.input.getTag("#" + i);
|
||||
recipeInput[i] = currentStack == null ? null : ItemStack.loadItemStackFromNBT(currentStack);
|
||||
@@ -109,9 +103,7 @@ public class PacketNEIPatternRecipe implements IMessage{
|
||||
}
|
||||
container.onCraftMatrixChanged(craftMatrix);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void processRecipeHandler(ContainerPatternTerm container, PacketNEIPatternRecipe message) {
|
||||
@@ -119,7 +111,6 @@ public class PacketNEIPatternRecipe implements IMessage{
|
||||
ItemStack[] recipeInput = new ItemStack[9];
|
||||
ItemStack[] recipeOutput = new ItemStack[3];
|
||||
|
||||
|
||||
for (int i = 0; i < recipeInput.length; i++) {
|
||||
NBTTagCompound currentStack = (NBTTagCompound) message.input.getTag("#" + i);
|
||||
recipeInput[i] = currentStack == null ? null : ItemStack.loadItemStackFromNBT(currentStack);
|
||||
@@ -169,7 +160,6 @@ public class PacketNEIPatternRecipe implements IMessage{
|
||||
ItemStack[] recipeInput = new ItemStack[16];
|
||||
ItemStack[] recipeOutput = new ItemStack[4];
|
||||
|
||||
|
||||
for (int i = 0; i < recipeInput.length; i++) {
|
||||
NBTTagCompound currentStack = (NBTTagCompound) message.input.getTag("#" + i);
|
||||
recipeInput[i] = currentStack == null ? null : ItemStack.loadItemStackFromNBT(currentStack);
|
||||
@@ -213,6 +203,4 @@ public class PacketNEIPatternRecipe implements IMessage{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package com.github.vfyjxf.nee.network.packet;
|
||||
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHandler.OUTPUT_KEY;
|
||||
import static com.github.vfyjxf.nee.network.NEEGuiHandler.CRAFTING_AMOUNT_ID;
|
||||
import static com.github.vfyjxf.nee.network.NEEGuiHandler.CRAFTING_AMOUNT_WIRELESS_ID;
|
||||
|
||||
import appeng.container.ContainerOpenContext;
|
||||
import appeng.container.implementations.ContainerCraftingTerm;
|
||||
import com.github.vfyjxf.nee.container.ContainerCraftingAmount;
|
||||
@@ -16,17 +20,11 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHandler.OUTPUT_KEY;
|
||||
import static com.github.vfyjxf.nee.network.NEEGuiHandler.CRAFTING_AMOUNT_ID;
|
||||
import static com.github.vfyjxf.nee.network.NEEGuiHandler.CRAFTING_AMOUNT_WIRELESS_ID;
|
||||
|
||||
public class PacketOpenCraftAmount implements IMessage{
|
||||
public class PacketOpenCraftAmount implements IMessage {
|
||||
|
||||
private NBTTagCompound recipe;
|
||||
|
||||
public PacketOpenCraftAmount() {
|
||||
|
||||
}
|
||||
public PacketOpenCraftAmount() {}
|
||||
|
||||
public PacketOpenCraftAmount(NBTTagCompound recipe) {
|
||||
this.recipe = recipe;
|
||||
@@ -42,7 +40,7 @@ public class PacketOpenCraftAmount implements IMessage{
|
||||
ByteBufUtils.writeTag(buf, this.recipe);
|
||||
}
|
||||
|
||||
public static final class Handler implements IMessageHandler<PacketOpenCraftAmount, IMessage>{
|
||||
public static final class Handler implements IMessageHandler<PacketOpenCraftAmount, IMessage> {
|
||||
@Override
|
||||
public IMessage onMessage(PacketOpenCraftAmount message, MessageContext ctx) {
|
||||
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||
@@ -86,7 +84,5 @@ public class PacketOpenCraftAmount implements IMessage{
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,14 +11,11 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
|
||||
public class PacketOpenGui implements IMessage{
|
||||
public class PacketOpenGui implements IMessage {
|
||||
|
||||
private int guiId;
|
||||
|
||||
public PacketOpenGui() {
|
||||
|
||||
}
|
||||
public PacketOpenGui() {}
|
||||
|
||||
public PacketOpenGui(int guiId) {
|
||||
this.guiId = guiId;
|
||||
@@ -34,7 +31,7 @@ public class PacketOpenGui implements IMessage{
|
||||
buf.writeInt(this.guiId);
|
||||
}
|
||||
|
||||
public static final class Handler implements IMessageHandler<PacketOpenGui, IMessage>{
|
||||
public static final class Handler implements IMessageHandler<PacketOpenGui, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketOpenGui message, MessageContext ctx) {
|
||||
@@ -49,7 +46,5 @@ public class PacketOpenGui implements IMessage{
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package com.github.vfyjxf.nee.network.packet;
|
||||
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHandler.INPUT_KEY;
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHandler.OUTPUT_KEY;
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHelper.RECIPE_LENGTH;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -22,17 +26,11 @@ import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHandler.INPUT_KEY;
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHandler.OUTPUT_KEY;
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHelper.RECIPE_LENGTH;
|
||||
|
||||
public class PacketSetRecipe implements IMessage{
|
||||
public class PacketSetRecipe implements IMessage {
|
||||
|
||||
private NBTTagCompound recipe;
|
||||
|
||||
public PacketSetRecipe() {
|
||||
|
||||
}
|
||||
public PacketSetRecipe() {}
|
||||
|
||||
public PacketSetRecipe(NBTTagCompound recipe) {
|
||||
this.recipe = recipe;
|
||||
@@ -48,7 +46,7 @@ public class PacketSetRecipe implements IMessage{
|
||||
ByteBufUtils.writeTag(buf, this.recipe);
|
||||
}
|
||||
|
||||
public static final class Handler implements IMessageHandler<PacketSetRecipe, IMessage>{
|
||||
public static final class Handler implements IMessageHandler<PacketSetRecipe, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketSetRecipe message, MessageContext ctx) {
|
||||
@@ -73,13 +71,11 @@ public class PacketSetRecipe implements IMessage{
|
||||
|
||||
if (patternStack != null) {
|
||||
|
||||
// if (tpi.putPattern(patternStack)) {
|
||||
// return null;
|
||||
// }
|
||||
// if (tpi.putPattern(patternStack)) {
|
||||
// return null;
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,7 +83,6 @@ public class PacketSetRecipe implements IMessage{
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private IGrid getNetwork(AEBaseContainer container) {
|
||||
@@ -114,7 +109,8 @@ public class PacketSetRecipe implements IMessage{
|
||||
ItemStack result = CraftingManager.getInstance().findMatchingRecipe(ic, player.worldObj);
|
||||
if (result != null) {
|
||||
ItemStack patternStack = null;
|
||||
Optional<ItemStack> maybePattern = AEApi.instance().definitions().items().encodedPattern().maybeStack(1);
|
||||
Optional<ItemStack> maybePattern =
|
||||
AEApi.instance().definitions().items().encodedPattern().maybeStack(1);
|
||||
if (maybePattern.isPresent()) {
|
||||
patternStack = maybePattern.get();
|
||||
}
|
||||
@@ -144,5 +140,4 @@ public class PacketSetRecipe implements IMessage{
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,24 +5,21 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
public class PacketSlotStackChange implements IMessage{
|
||||
public class PacketSlotStackChange implements IMessage {
|
||||
|
||||
private ItemStack stack;
|
||||
private List<Integer> craftingSlots;
|
||||
|
||||
public PacketSlotStackChange() {
|
||||
|
||||
}
|
||||
public PacketSlotStackChange() {}
|
||||
|
||||
public PacketSlotStackChange(ItemStack stack, List<Integer> craftingSlots) {
|
||||
this.stack = stack;
|
||||
@@ -57,7 +54,7 @@ public class PacketSlotStackChange implements IMessage{
|
||||
}
|
||||
}
|
||||
|
||||
public static final class Handler implements IMessageHandler<PacketSlotStackChange, IMessage>{
|
||||
public static final class Handler implements IMessageHandler<PacketSlotStackChange, IMessage> {
|
||||
@Override
|
||||
public IMessage onMessage(PacketSlotStackChange message, MessageContext ctx) {
|
||||
Container container = ctx.getServerHandler().playerEntity.openContainer;
|
||||
@@ -73,5 +70,4 @@ public class PacketSlotStackChange implements IMessage{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,9 +19,7 @@ public class PacketStackCountChange implements IMessage {
|
||||
private int slotIndex;
|
||||
private int changeCount;
|
||||
|
||||
public PacketStackCountChange() {
|
||||
|
||||
}
|
||||
public PacketStackCountChange() {}
|
||||
|
||||
public PacketStackCountChange(int slotIndex, int changeCount) {
|
||||
this.slotIndex = slotIndex;
|
||||
@@ -67,7 +65,9 @@ public class PacketStackCountChange implements IMessage {
|
||||
|
||||
Slot currentSlot = container.getSlot(message.getSlotIndex());
|
||||
for (int i = 0; i < Math.abs(message.getChangeCount()); i++) {
|
||||
int currentStackSize = message.getChangeCount() > 0 ? currentSlot.getStack().stackSize + 1 : currentSlot.getStack().stackSize - 1;
|
||||
int currentStackSize = message.getChangeCount() > 0
|
||||
? currentSlot.getStack().stackSize + 1
|
||||
: currentSlot.getStack().stackSize - 1;
|
||||
if (currentStackSize <= currentSlot.getStack().getMaxStackSize() && currentStackSize > 0) {
|
||||
ItemStack nextStack = currentSlot.getStack().copy();
|
||||
nextStack.stackSize = currentStackSize;
|
||||
@@ -78,5 +78,4 @@ public class PacketStackCountChange implements IMessage {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,13 +19,10 @@ import net.minecraft.client.gui.GuiScreen;
|
||||
*/
|
||||
public class PacketValueConfigClient implements IMessage {
|
||||
|
||||
|
||||
private String name;
|
||||
private String value;
|
||||
|
||||
public PacketValueConfigClient() {
|
||||
|
||||
}
|
||||
public PacketValueConfigClient() {}
|
||||
|
||||
public PacketValueConfigClient(String name, String value) {
|
||||
this.name = name;
|
||||
@@ -72,5 +69,4 @@ public class PacketValueConfigClient implements IMessage {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,14 +20,12 @@ import net.minecraft.inventory.Slot;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
|
||||
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
|
||||
|
||||
public class PacketValueConfigServer implements IMessage{
|
||||
public class PacketValueConfigServer implements IMessage {
|
||||
|
||||
private String name;
|
||||
private String value;
|
||||
|
||||
public PacketValueConfigServer() {
|
||||
|
||||
}
|
||||
public PacketValueConfigServer() {}
|
||||
|
||||
public PacketValueConfigServer(String name, String value) {
|
||||
this.name = name;
|
||||
@@ -76,20 +74,22 @@ public class PacketValueConfigServer implements IMessage{
|
||||
}
|
||||
} else if ("PatternInterface.check".equals(message.name)) {
|
||||
if (container instanceof AEBaseContainer || GuiUtils.isWirelessCraftingTermContainer(container)) {
|
||||
IGrid grid = container instanceof AEBaseContainer ? message.getNetwork((AEBaseContainer) container) : message.getNetwork((ContainerWirelessCraftingTerminal) container);
|
||||
IGrid grid = container instanceof AEBaseContainer
|
||||
? message.getNetwork((AEBaseContainer) container)
|
||||
: message.getNetwork((ContainerWirelessCraftingTerminal) container);
|
||||
if (grid != null) {
|
||||
|
||||
for (IGridNode gridNode : grid.getMachines(TilePatternInterface.class)) {
|
||||
|
||||
if (gridNode.getMachine() instanceof TilePatternInterface) {
|
||||
NEENetworkHandler.getInstance().sendTo(new PacketValueConfigClient("PatternInterface.check", "true"), player);
|
||||
NEENetworkHandler.getInstance()
|
||||
.sendTo(new PacketValueConfigClient("PatternInterface.check", "true"), player);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NEENetworkHandler.getInstance().sendTo(new PacketValueConfigClient("PatternInterface.check", "false"), player);
|
||||
|
||||
NEENetworkHandler.getInstance()
|
||||
.sendTo(new PacketValueConfigClient("PatternInterface.check", "false"), player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,5 +115,4 @@ public class PacketValueConfigServer implements IMessage{
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,17 +2,14 @@ package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class AppengRecipeProcessor implements IRecipeProcessor {
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"inscriber", "grindstone"
|
||||
));
|
||||
return new HashSet<>(Arrays.asList("inscriber", "grindstone"));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -2,17 +2,14 @@ package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class AvaritiaRecipeProcessor implements IRecipeProcessor {
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"extreme", "extreme_compression"
|
||||
));
|
||||
return new HashSet<>(Arrays.asList("extreme", "extreme_compression"));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -2,9 +2,8 @@ package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -13,12 +12,8 @@ public class BloodMagicRecipeProcessor implements IRecipeProcessor {
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"altarrecipes",
|
||||
"alchemicalwizardry.alchemy",
|
||||
"alchemicalwizardry.bindingritual"
|
||||
|
||||
));
|
||||
return new HashSet<>(
|
||||
Arrays.asList("altarrecipes", "alchemicalwizardry.alchemy", "alchemicalwizardry.bindingritual"));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -4,11 +4,10 @@ import buildcraft.compat.nei.RecipeHandlerAssemblyTable;
|
||||
import buildcraft.compat.nei.RecipeHandlerIntegrationTable;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -43,12 +42,17 @@ public class BuildCraftRecipeProcessor implements IRecipeProcessor {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
private List<PositionedStack> handlerAssemblyTableRecipe(RecipeHandlerAssemblyTable recipe, int recipeIndex, boolean getInput) {
|
||||
return getInput ? recipe.getIngredientStacks(recipeIndex) : Collections.singletonList(recipe.getResultStack(recipeIndex));
|
||||
private List<PositionedStack> handlerAssemblyTableRecipe(
|
||||
RecipeHandlerAssemblyTable recipe, int recipeIndex, boolean getInput) {
|
||||
return getInput
|
||||
? recipe.getIngredientStacks(recipeIndex)
|
||||
: Collections.singletonList(recipe.getResultStack(recipeIndex));
|
||||
}
|
||||
|
||||
private List<PositionedStack> handlerIntegrationTableRecipe(RecipeHandlerIntegrationTable recipe, int recipeIndex, boolean getInput) {
|
||||
return getInput ? recipe.getIngredientStacks(recipeIndex) : Collections.singletonList(recipe.getResultStack(recipeIndex));
|
||||
private List<PositionedStack> handlerIntegrationTableRecipe(
|
||||
RecipeHandlerIntegrationTable recipe, int recipeIndex, boolean getInput) {
|
||||
return getInput
|
||||
? recipe.getIngredientStacks(recipeIndex)
|
||||
: Collections.singletonList(recipe.getResultStack(recipeIndex));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,18 +3,20 @@ package com.github.vfyjxf.nee.processor;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import crazypants.enderio.nei.SagMillRecipeHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class EnderIORecipeProcessor implements IRecipeProcessor {
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"EnderIOAlloySmelter", "EIOEnchanter", "EnderIOSagMill",
|
||||
"EnderIOSliceAndSplice", "EnderIOSoulBinder", "EnderIOVat"
|
||||
));
|
||||
"EnderIOAlloySmelter",
|
||||
"EIOEnchanter",
|
||||
"EnderIOSagMill",
|
||||
"EnderIOSliceAndSplice",
|
||||
"EnderIOSoulBinder",
|
||||
"EnderIOVat"));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -42,10 +44,12 @@ public class EnderIORecipeProcessor implements IRecipeProcessor {
|
||||
if (this.getAllOverlayIdentifier().contains(identifier)) {
|
||||
recipeOutputs.add(recipe.getResultStack(recipeIndex));
|
||||
recipeOutputs.addAll(recipe.getOtherStacks(recipeIndex));
|
||||
//remove output if it's chance != 1
|
||||
// remove output if it's chance != 1
|
||||
if (recipe instanceof SagMillRecipeHandler) {
|
||||
SagMillRecipeHandler.MillRecipe millRecipe = (SagMillRecipeHandler.MillRecipe) ((SagMillRecipeHandler) recipe).arecipes.get(recipeIndex);
|
||||
recipeOutputs.removeIf(positionedStack -> millRecipe.getChanceForOutput(positionedStack.item) != 1.0F);
|
||||
SagMillRecipeHandler.MillRecipe millRecipe =
|
||||
(SagMillRecipeHandler.MillRecipe) ((SagMillRecipeHandler) recipe).arecipes.get(recipeIndex);
|
||||
recipeOutputs.removeIf(
|
||||
positionedStack -> millRecipe.getChanceForOutput(positionedStack.item) != 1.0F);
|
||||
}
|
||||
return recipeOutputs;
|
||||
}
|
||||
|
||||
@@ -2,11 +2,8 @@ package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class ForestryRecipeProcessor implements IRecipeProcessor {
|
||||
|
||||
@@ -14,8 +11,15 @@ public class ForestryRecipeProcessor implements IRecipeProcessor {
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"forestry.bottler", "forestry.carpenter", "forestry.centrifuge", "forestry.fabricator", "forestry.fermenter", "forestry.moistener", "forestry.squeezer", "forestry.still",RecipeProcessor.NULL_IDENTIFIER
|
||||
));
|
||||
"forestry.bottler",
|
||||
"forestry.carpenter",
|
||||
"forestry.centrifuge",
|
||||
"forestry.fabricator",
|
||||
"forestry.fermenter",
|
||||
"forestry.moistener",
|
||||
"forestry.squeezer",
|
||||
"forestry.still",
|
||||
RecipeProcessor.NULL_IDENTIFIER));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -43,5 +47,4 @@ public class ForestryRecipeProcessor implements IRecipeProcessor {
|
||||
}
|
||||
return recipeOutput;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,9 +3,8 @@ package com.github.vfyjxf.nee.processor;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import gregtech.api.util.GTPP_Recipe;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -37,7 +36,9 @@ public class GTPPRecipeProcessor implements IRecipeProcessor {
|
||||
List<PositionedStack> recipeInputs = new ArrayList<>();
|
||||
if (this.getAllOverlayIdentifier().contains(identifier)) {
|
||||
recipeInputs.addAll(recipe.getIngredientStacks(recipeIndex));
|
||||
recipeInputs.removeIf(positionedStack -> GregTech5RecipeProcessor.getFluidFromDisplayStack(positionedStack.items[0]) != null || positionedStack.item.stackSize == 0);
|
||||
recipeInputs.removeIf(positionedStack ->
|
||||
GregTech5RecipeProcessor.getFluidFromDisplayStack(positionedStack.items[0]) != null
|
||||
|| positionedStack.item.stackSize == 0);
|
||||
return recipeInputs;
|
||||
}
|
||||
return recipeInputs;
|
||||
@@ -49,7 +50,8 @@ public class GTPPRecipeProcessor implements IRecipeProcessor {
|
||||
List<PositionedStack> recipeOutputs = new ArrayList<>();
|
||||
if (this.getAllOverlayIdentifier().contains(identifier)) {
|
||||
recipeOutputs.addAll(recipe.getOtherStacks(recipeIndex));
|
||||
recipeOutputs.removeIf(positionedStack -> GregTech5RecipeProcessor.getFluidFromDisplayStack(positionedStack.items[0]) != null);
|
||||
recipeOutputs.removeIf(positionedStack ->
|
||||
GregTech5RecipeProcessor.getFluidFromDisplayStack(positionedStack.items[0]) != null);
|
||||
return recipeOutputs;
|
||||
}
|
||||
return recipeOutputs;
|
||||
|
||||
@@ -2,24 +2,19 @@ package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class GoodGeneratorRecipeProcessor implements IRecipeProcessor {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"gg.recipe.neutron_activator",
|
||||
"gg.recipe.precise_assembler"
|
||||
|
||||
));
|
||||
return new HashSet<>(Arrays.asList("gg.recipe.neutron_activator", "gg.recipe.precise_assembler"));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -34,7 +29,9 @@ public class GoodGeneratorRecipeProcessor implements IRecipeProcessor {
|
||||
List<PositionedStack> recipeInputs = new ArrayList<>();
|
||||
if (this.getAllOverlayIdentifier().contains(identifier)) {
|
||||
recipeInputs.addAll(recipe.getIngredientStacks(recipeIndex));
|
||||
recipeInputs.removeIf(positionedStack -> GregTech5RecipeProcessor.getFluidFromDisplayStack(positionedStack.items[0]) != null || positionedStack.item.stackSize == 0);
|
||||
recipeInputs.removeIf(positionedStack ->
|
||||
GregTech5RecipeProcessor.getFluidFromDisplayStack(positionedStack.items[0]) != null
|
||||
|| positionedStack.item.stackSize == 0);
|
||||
return recipeInputs;
|
||||
}
|
||||
return recipeInputs;
|
||||
@@ -46,7 +43,8 @@ public class GoodGeneratorRecipeProcessor implements IRecipeProcessor {
|
||||
List<PositionedStack> recipeOutputs = new ArrayList<>();
|
||||
if (this.getAllOverlayIdentifier().contains(identifier)) {
|
||||
recipeOutputs.addAll(recipe.getOtherStacks(recipeIndex));
|
||||
recipeOutputs.removeIf(positionedStack -> GregTech5RecipeProcessor.getFluidFromDisplayStack(positionedStack.items[0]) != null);
|
||||
recipeOutputs.removeIf(positionedStack ->
|
||||
GregTech5RecipeProcessor.getFluidFromDisplayStack(positionedStack.items[0]) != null);
|
||||
return recipeOutputs;
|
||||
}
|
||||
return recipeOutputs;
|
||||
|
||||
@@ -5,16 +5,15 @@ import codechicken.nei.recipe.IRecipeHandler;
|
||||
import gregtech.api.enums.ItemList;
|
||||
import gregtech.api.util.GT_Recipe;
|
||||
import gregtech.nei.GT_NEI_DefaultHandler.FixedPositionedStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -41,9 +40,9 @@ public class GregTech5RecipeProcessor implements IRecipeProcessor {
|
||||
* Copied from GTNewHorizons/GT5-Unofficial.
|
||||
*/
|
||||
public static FluidStack getFluidFromDisplayStack(ItemStack aDisplayStack) {
|
||||
if (!isStackValid(aDisplayStack) ||
|
||||
aDisplayStack.getItem() != ItemList.Display_Fluid.getItem() ||
|
||||
!aDisplayStack.hasTagCompound()) {
|
||||
if (!isStackValid(aDisplayStack)
|
||||
|| aDisplayStack.getItem() != ItemList.Display_Fluid.getItem()
|
||||
|| !aDisplayStack.hasTagCompound()) {
|
||||
return null;
|
||||
}
|
||||
Fluid tFluid = FluidRegistry.getFluid(ItemList.Display_Fluid.getItem().getDamage(aDisplayStack));
|
||||
@@ -51,7 +50,9 @@ public class GregTech5RecipeProcessor implements IRecipeProcessor {
|
||||
}
|
||||
|
||||
public static boolean isStackValid(Object aStack) {
|
||||
return (aStack instanceof ItemStack) && ((ItemStack) aStack).getItem() != null && ((ItemStack) aStack).stackSize >= 0;
|
||||
return (aStack instanceof ItemStack)
|
||||
&& ((ItemStack) aStack).getItem() != null
|
||||
&& ((ItemStack) aStack).stackSize >= 0;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -80,16 +81,19 @@ public class GregTech5RecipeProcessor implements IRecipeProcessor {
|
||||
List<PositionedStack> recipeInputs = new ArrayList<>();
|
||||
if (gtDefaultClz.isInstance(recipe) || gtAssLineClz.isInstance(recipe)) {
|
||||
recipeInputs.addAll(recipe.getIngredientStacks(recipeIndex));
|
||||
recipeInputs.removeIf(positionedStack -> getFluidFromDisplayStack(positionedStack.items[0]) != null || positionedStack.item.stackSize == 0);
|
||||
recipeInputs.removeIf(positionedStack ->
|
||||
getFluidFromDisplayStack(positionedStack.items[0]) != null || positionedStack.item.stackSize == 0);
|
||||
if (!recipeInputs.isEmpty()) {
|
||||
ItemStack specialItem = recipeInputs.get(recipeInputs.size() - 1).items[0];
|
||||
if ((specialItem.isItemEqual(ItemList.Tool_DataStick.get(1)) || specialItem.isItemEqual(ItemList.Tool_DataOrb.get(1)) && (recipe.getRecipeName().equals("gt.recipe.scanner") || recipe.getRecipeName().equals("gt.recipe.fakeAssemblylineProcess"))))
|
||||
if ((specialItem.isItemEqual(ItemList.Tool_DataStick.get(1))
|
||||
|| specialItem.isItemEqual(ItemList.Tool_DataOrb.get(1))
|
||||
&& (recipe.getRecipeName().equals("gt.recipe.scanner")
|
||||
|| recipe.getRecipeName().equals("gt.recipe.fakeAssemblylineProcess"))))
|
||||
recipeInputs.remove(recipeInputs.size() - 1);
|
||||
}
|
||||
return recipeInputs;
|
||||
}
|
||||
return recipeInputs;
|
||||
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -99,8 +103,10 @@ public class GregTech5RecipeProcessor implements IRecipeProcessor {
|
||||
if (gtDefaultClz.isInstance(recipe) || gtAssLineClz.isInstance(recipe)) {
|
||||
recipeOutputs.addAll(recipe.getOtherStacks(recipeIndex));
|
||||
recipeOutputs.removeIf(positionedStack -> getFluidFromDisplayStack(positionedStack.items[0]) != null);
|
||||
//remove output if it's chance != 10000
|
||||
recipeOutputs.removeIf(stack -> stack instanceof FixedPositionedStack && !(((FixedPositionedStack) stack).mChance == 10000 || ((FixedPositionedStack) stack).mChance <= 0));
|
||||
// remove output if it's chance != 10000
|
||||
recipeOutputs.removeIf(stack -> stack instanceof FixedPositionedStack
|
||||
&& !(((FixedPositionedStack) stack).mChance == 10000
|
||||
|| ((FixedPositionedStack) stack).mChance <= 0));
|
||||
return recipeOutputs;
|
||||
}
|
||||
return recipeOutputs;
|
||||
|
||||
@@ -7,14 +7,13 @@ import gregapi.NEI_RecipeMap;
|
||||
import gregapi.NEI_RecipeMap.FixedPositionedStack;
|
||||
import gregapi.data.FL;
|
||||
import gregapi.recipes.Recipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -44,9 +43,10 @@ public class GregTech6RecipeProcessor implements IRecipeProcessor {
|
||||
List<PositionedStack> recipeInputs = new ArrayList<>();
|
||||
if (this.getAllOverlayIdentifier().contains(identifier)) {
|
||||
recipeInputs.addAll(recipe.getIngredientStacks(recipeIndex));
|
||||
//remove fluid
|
||||
recipeInputs.removeIf(positionedStack -> FL.getFluid(positionedStack.item, true) != null || positionedStack.item.stackSize == 0);
|
||||
//try to remove machine
|
||||
// remove fluid
|
||||
recipeInputs.removeIf(positionedStack ->
|
||||
FL.getFluid(positionedStack.item, true) != null || positionedStack.item.stackSize == 0);
|
||||
// try to remove machine
|
||||
if (recipe instanceof NEI_RecipeMap) {
|
||||
Field mRecipeMapField = ReflectionHelper.findField(NEI_RecipeMap.class, "mRecipeMap");
|
||||
Recipe.RecipeMap mRecipeMap = null;
|
||||
@@ -76,9 +76,13 @@ public class GregTech6RecipeProcessor implements IRecipeProcessor {
|
||||
List<PositionedStack> recipeOutput = new ArrayList<>();
|
||||
if (this.getAllOverlayIdentifier().contains(identifier)) {
|
||||
recipeOutput.addAll(recipe.getOtherStacks(recipeIndex));
|
||||
recipeOutput.removeIf(positionedStack -> FL.getFluid(positionedStack.item, true) != null || positionedStack.item.stackSize == 0);
|
||||
//try to remove item output if it's chance != 100%
|
||||
recipeOutput.removeIf(positionedStack -> positionedStack instanceof FixedPositionedStack && ((FixedPositionedStack) positionedStack).mChance > 0 && ((FixedPositionedStack) positionedStack).mChance != ((FixedPositionedStack) positionedStack).mMaxChance);
|
||||
recipeOutput.removeIf(positionedStack ->
|
||||
FL.getFluid(positionedStack.item, true) != null || positionedStack.item.stackSize == 0);
|
||||
// try to remove item output if it's chance != 100%
|
||||
recipeOutput.removeIf(positionedStack -> positionedStack instanceof FixedPositionedStack
|
||||
&& ((FixedPositionedStack) positionedStack).mChance > 0
|
||||
&& ((FixedPositionedStack) positionedStack).mChance
|
||||
!= ((FixedPositionedStack) positionedStack).mMaxChance);
|
||||
return recipeOutput;
|
||||
}
|
||||
return recipeOutput;
|
||||
|
||||
@@ -2,9 +2,8 @@ package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -14,10 +13,16 @@ public class ICRecipeProcessor implements IRecipeProcessor {
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"blastfurnace", "BlockCutter", "centrifuge", "compressor",
|
||||
"extractor", "fluidcanner", "macerator",
|
||||
"metalformer", "oreWashing", "solidcanner"
|
||||
));
|
||||
"blastfurnace",
|
||||
"BlockCutter",
|
||||
"centrifuge",
|
||||
"compressor",
|
||||
"extractor",
|
||||
"fluidcanner",
|
||||
"macerator",
|
||||
"metalformer",
|
||||
"oreWashing",
|
||||
"solidcanner"));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -48,6 +53,4 @@ public class ICRecipeProcessor implements IRecipeProcessor {
|
||||
}
|
||||
return recipeOutputs;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -2,11 +2,10 @@ package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -30,5 +29,4 @@ public interface IRecipeProcessor {
|
||||
default boolean mergeStacks(IRecipeHandler recipe, int recipeIndex, String identifier) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+16
-8
@@ -2,9 +2,8 @@ package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -14,11 +13,18 @@ public class ImmersiveEngineeringRecipeProcessor implements IRecipeProcessor {
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"ieArcFurnace", "ieBlastFurnace", "ieBlueprintCrafting",
|
||||
"ieBottlingMachine", "ieCokeOven", "ieCrusher",
|
||||
"ieFermenter", "ieHammerCrushing", "ieMetalPress",
|
||||
"ieRefinery", "ieShaderBag", "ieSqueezer"
|
||||
));
|
||||
"ieArcFurnace",
|
||||
"ieBlastFurnace",
|
||||
"ieBlueprintCrafting",
|
||||
"ieBottlingMachine",
|
||||
"ieCokeOven",
|
||||
"ieCrusher",
|
||||
"ieFermenter",
|
||||
"ieHammerCrushing",
|
||||
"ieMetalPress",
|
||||
"ieRefinery",
|
||||
"ieShaderBag",
|
||||
"ieSqueezer"));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -33,7 +39,9 @@ public class ImmersiveEngineeringRecipeProcessor implements IRecipeProcessor {
|
||||
List<PositionedStack> recipeInputs = new ArrayList<>();
|
||||
if (this.getAllOverlayIdentifier().contains(identifier)) {
|
||||
recipeInputs.addAll(recipe.getIngredientStacks(recipeIndex));
|
||||
if (!("ieArcFurnace".equals(identifier) || "ieCrusher".equals(identifier) || "ieBlastFurnace".equals(identifier))) {
|
||||
if (!("ieArcFurnace".equals(identifier)
|
||||
|| "ieCrusher".equals(identifier)
|
||||
|| "ieBlastFurnace".equals(identifier))) {
|
||||
recipeInputs.addAll(recipe.getOtherStacks(recipeIndex));
|
||||
}
|
||||
return recipeInputs;
|
||||
|
||||
@@ -2,9 +2,8 @@ package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -14,11 +13,22 @@ public class MekanismRecipeProcessor implements IRecipeProcessor {
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"chemicalinfuser", "chemicalinjectionchamber",
|
||||
"chemicaloxidizer", "chemicalwasher", "combiner", "crusher", "electrolyticseparator",
|
||||
"chamber", "infuser", "compressor", "prc", "precisionsawmill", "purificationchamber",
|
||||
"rotarycondensentrator", "solarneutron", "thermalevaporation"
|
||||
));
|
||||
"chemicalinfuser",
|
||||
"chemicalinjectionchamber",
|
||||
"chemicaloxidizer",
|
||||
"chemicalwasher",
|
||||
"combiner",
|
||||
"crusher",
|
||||
"electrolyticseparator",
|
||||
"chamber",
|
||||
"infuser",
|
||||
"compressor",
|
||||
"prc",
|
||||
"precisionsawmill",
|
||||
"purificationchamber",
|
||||
"rotarycondensentrator",
|
||||
"solarneutron",
|
||||
"thermalevaporation"));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import com.github.vfyjxf.nee.NotEnoughEnergistics;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -16,7 +15,6 @@ public class RecipeProcessor {
|
||||
NotEnoughEnergistics.logger.info("Install Vanilla Support");
|
||||
recipeProcessors.add(new VanillaRecipeProcessor());
|
||||
|
||||
|
||||
if (Loader.isModLoaded("appliedenergistics2")) {
|
||||
NotEnoughEnergistics.logger.info("Found Applied Energistics 2,install Applied Energistics 2 support");
|
||||
recipeProcessors.add(new AppengRecipeProcessor());
|
||||
@@ -81,5 +79,4 @@ public class RecipeProcessor {
|
||||
|
||||
NotEnoughEnergistics.logger.info("-----Not Enough Energistics Init Finished-----");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,9 +3,8 @@ package com.github.vfyjxf.nee.processor;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import com.djgiannuzz.thaumcraftneiplugin.items.ItemAspect;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -16,9 +15,11 @@ public class TCNEIPluginRecipeProcessor implements IRecipeProcessor {
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"arcaneshapedrecipes", "arcaneshapelessrecipes", "aspectsRecipe",
|
||||
"cruciblerecipe", "infusionCrafting"
|
||||
));
|
||||
"arcaneshapedrecipes",
|
||||
"arcaneshapelessrecipes",
|
||||
"aspectsRecipe",
|
||||
"cruciblerecipe",
|
||||
"infusionCrafting"));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
+21
-12
@@ -4,11 +4,9 @@ import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import cofh.thermalexpansion.plugins.nei.handlers.RecipeHandlerBase;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class ThermalExpansionRecipeProcessor implements IRecipeProcessor {
|
||||
|
||||
@@ -16,9 +14,14 @@ public class ThermalExpansionRecipeProcessor implements IRecipeProcessor {
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"thermalexpansion.charger", "thermalexpansion.crucible", "thermalexpansion.furnace", "thermalexpansion.insolator",
|
||||
"thermalexpansion.pulverizer", "thermalexpansion.sawmill", "thermalexpansion.smelter", "thermalexpansion.transposer"
|
||||
));
|
||||
"thermalexpansion.charger",
|
||||
"thermalexpansion.crucible",
|
||||
"thermalexpansion.furnace",
|
||||
"thermalexpansion.insolator",
|
||||
"thermalexpansion.pulverizer",
|
||||
"thermalexpansion.sawmill",
|
||||
"thermalexpansion.smelter",
|
||||
"thermalexpansion.transposer"));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -36,7 +39,8 @@ public class ThermalExpansionRecipeProcessor implements IRecipeProcessor {
|
||||
if (recipe instanceof RecipeHandlerBase) {
|
||||
Class<?> NEIRecipeBase = null;
|
||||
try {
|
||||
NEIRecipeBase = Class.forName("cofh.thermalexpansion.plugins.nei.handlers.RecipeHandlerBase$NEIRecipeBase");
|
||||
NEIRecipeBase =
|
||||
Class.forName("cofh.thermalexpansion.plugins.nei.handlers.RecipeHandlerBase$NEIRecipeBase");
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -44,7 +48,8 @@ public class ThermalExpansionRecipeProcessor implements IRecipeProcessor {
|
||||
Field secondaryInputField = ReflectionHelper.findField(NEIRecipeBase, "secondaryInput");
|
||||
PositionedStack secondaryInput = null;
|
||||
try {
|
||||
secondaryInput = (PositionedStack) secondaryInputField.get(((RecipeHandlerBase) recipe).arecipes.get(recipeIndex));
|
||||
secondaryInput = (PositionedStack)
|
||||
secondaryInputField.get(((RecipeHandlerBase) recipe).arecipes.get(recipeIndex));
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -68,18 +73,22 @@ public class ThermalExpansionRecipeProcessor implements IRecipeProcessor {
|
||||
if (recipe instanceof RecipeHandlerBase) {
|
||||
Class<?> NEIRecipeBase = null;
|
||||
try {
|
||||
NEIRecipeBase = Class.forName("cofh.thermalexpansion.plugins.nei.handlers.RecipeHandlerBase$NEIRecipeBase");
|
||||
NEIRecipeBase =
|
||||
Class.forName("cofh.thermalexpansion.plugins.nei.handlers.RecipeHandlerBase$NEIRecipeBase");
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (NEIRecipeBase != null) {
|
||||
Field secondaryOutputField = ReflectionHelper.findField(NEIRecipeBase, "secondaryOutput");
|
||||
Field secondaryOutputChanceField = ReflectionHelper.findField(NEIRecipeBase, "secondaryOutputChance");
|
||||
Field secondaryOutputChanceField =
|
||||
ReflectionHelper.findField(NEIRecipeBase, "secondaryOutputChance");
|
||||
PositionedStack secondaryOutput = null;
|
||||
int secondaryOutputChance = 0;
|
||||
try {
|
||||
secondaryOutput = (PositionedStack) secondaryOutputField.get(((RecipeHandlerBase) recipe).arecipes.get(recipeIndex));
|
||||
secondaryOutputChance = (int) secondaryOutputChanceField.get(((RecipeHandlerBase) recipe).arecipes.get(recipeIndex));
|
||||
secondaryOutput = (PositionedStack)
|
||||
secondaryOutputField.get(((RecipeHandlerBase) recipe).arecipes.get(recipeIndex));
|
||||
secondaryOutputChance = (int)
|
||||
secondaryOutputChanceField.get(((RecipeHandlerBase) recipe).arecipes.get(recipeIndex));
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -2,9 +2,8 @@ package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -43,5 +42,4 @@ public class VanillaRecipeProcessor implements IRecipeProcessor {
|
||||
}
|
||||
return recipeOutput;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.client.ClientCommandHandler;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.github.vfyjxf.nee.proxy;
|
||||
|
||||
import static com.github.vfyjxf.nee.block.BlockPatternInterface.BLOCK_INSTANCE;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
@@ -18,13 +20,11 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
import static com.github.vfyjxf.nee.block.BlockPatternInterface.BLOCK_INSTANCE;
|
||||
|
||||
public class CommonProxy {
|
||||
|
||||
public void init(FMLInitializationEvent event) {
|
||||
AEBaseTile.registerTileItem(TilePatternInterface.class,
|
||||
new BlockStackSrc(BLOCK_INSTANCE, 0, ActivityState.Enabled));
|
||||
AEBaseTile.registerTileItem(
|
||||
TilePatternInterface.class, new BlockStackSrc(BLOCK_INSTANCE, 0, ActivityState.Enabled));
|
||||
registerRecipe();
|
||||
}
|
||||
|
||||
@@ -43,7 +43,8 @@ public class CommonProxy {
|
||||
}
|
||||
|
||||
public void registerTileEntities() {
|
||||
GameRegistry.registerTileEntity(TilePatternInterface.class, NotEnoughEnergistics.MODID + "." + "tile.pattern_interface");
|
||||
GameRegistry.registerTileEntity(
|
||||
TilePatternInterface.class, NotEnoughEnergistics.MODID + "." + "tile.pattern_interface");
|
||||
}
|
||||
|
||||
public void registerRecipe() {
|
||||
@@ -70,15 +71,20 @@ public class CommonProxy {
|
||||
monitor = blocks.craftingMonitor().maybeStack(1).get();
|
||||
}
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(BLOCK_INSTANCE,
|
||||
"aba", "cdc", "eee",
|
||||
'a', blankPattern,
|
||||
'b', patternTerm,
|
||||
'c', meInterface,
|
||||
'd', monitor,
|
||||
'e', cableSmart
|
||||
));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
BLOCK_INSTANCE,
|
||||
"aba",
|
||||
"cdc",
|
||||
"eee",
|
||||
'a',
|
||||
blankPattern,
|
||||
'b',
|
||||
patternTerm,
|
||||
'c',
|
||||
meInterface,
|
||||
'd',
|
||||
monitor,
|
||||
'e',
|
||||
cableSmart));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import appeng.client.gui.implementations.GuiPatternTerm;
|
||||
import appeng.container.implementations.ContainerPatternTerm;
|
||||
import appeng.helpers.IContainerCraftingPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -53,17 +52,18 @@ public class GuiUtils {
|
||||
public static boolean isGuiWirelessCrafting(GuiScreen gui) {
|
||||
|
||||
try {
|
||||
Class<?> guiWirelessCraftingClass = Class.forName("net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal");
|
||||
Class<?> guiWirelessCraftingClass =
|
||||
Class.forName("net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal");
|
||||
return guiWirelessCraftingClass.isInstance(gui);
|
||||
} catch (ClassNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean isWirelessCraftingTermContainer(Container container) {
|
||||
try {
|
||||
Class<?> wirelessCraftingTermContainerClass = Class.forName("net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal");
|
||||
Class<?> wirelessCraftingTermContainerClass = Class.forName(
|
||||
"net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal");
|
||||
return wirelessCraftingTermContainerClass.isInstance(container);
|
||||
} catch (ClassNotFoundException e) {
|
||||
return false;
|
||||
@@ -72,7 +72,8 @@ public class GuiUtils {
|
||||
|
||||
public static boolean isWirelessGuiCraftConfirm(GuiScreen gui) {
|
||||
try {
|
||||
Class<?> wirelessGuiCraftConfirmClass = Class.forName("net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm");
|
||||
Class<?> wirelessGuiCraftConfirmClass =
|
||||
Class.forName("net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm");
|
||||
return wirelessGuiCraftConfirmClass.isInstance(gui);
|
||||
} catch (ClassNotFoundException e) {
|
||||
return false;
|
||||
@@ -81,7 +82,8 @@ public class GuiUtils {
|
||||
|
||||
public static boolean isContainerWirelessCraftingConfirm(Container container) {
|
||||
try {
|
||||
Class<?> wirelessCraftingConfirmClass = Class.forName("net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftConfirm");
|
||||
Class<?> wirelessCraftingConfirmClass =
|
||||
Class.forName("net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftConfirm");
|
||||
return wirelessCraftingConfirmClass.isInstance(container);
|
||||
} catch (ClassNotFoundException e) {
|
||||
return false;
|
||||
@@ -90,7 +92,8 @@ public class GuiUtils {
|
||||
|
||||
public static boolean isWCTContainerCraftingConfirm(Container container) {
|
||||
try {
|
||||
Class<?> wctCraftingConfirmClass = Class.forName("com.github.vfyjxf.nee.container.WCTContainerCraftingConfirm");
|
||||
Class<?> wctCraftingConfirmClass =
|
||||
Class.forName("com.github.vfyjxf.nee.container.WCTContainerCraftingConfirm");
|
||||
return wctCraftingConfirmClass.isInstance(container);
|
||||
} catch (ClassNotFoundException e) {
|
||||
return false;
|
||||
@@ -99,7 +102,8 @@ public class GuiUtils {
|
||||
|
||||
public static boolean isWirelessTerminalGuiObject(Object guiObj) {
|
||||
try {
|
||||
Class<?> wirelessTerminalGuiObjClass = Class.forName("net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject");
|
||||
Class<?> wirelessTerminalGuiObjClass =
|
||||
Class.forName("net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject");
|
||||
return wirelessTerminalGuiObjClass.isInstance(guiObj);
|
||||
} catch (ClassNotFoundException e) {
|
||||
return false;
|
||||
@@ -117,5 +121,4 @@ public class GuiUtils {
|
||||
public static boolean isGuiCraftConfirm(GuiScreen gui) {
|
||||
return gui instanceof GuiCraftConfirm || isWirelessGuiCraftConfirm(gui);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -64,5 +64,4 @@ public class Ingredient {
|
||||
currentCount = requireCount;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.github.vfyjxf.nee.utils;
|
||||
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHelper.noPreview;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.implementations.GuiMEMonitorable;
|
||||
@@ -12,17 +14,14 @@ import com.github.vfyjxf.nee.config.NEEConfig;
|
||||
import com.github.vfyjxf.nee.network.NEENetworkHandler;
|
||||
import com.github.vfyjxf.nee.network.packet.PacketCraftingRequest;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHelper.noPreview;
|
||||
|
||||
public class IngredientTracker {
|
||||
|
||||
private final List<Ingredient> ingredients = new ArrayList<>();
|
||||
@@ -74,7 +73,6 @@ public class IngredientTracker {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -84,13 +82,19 @@ public class IngredientTracker {
|
||||
IItemList<IAEItemStack> list = null;
|
||||
try {
|
||||
if (!GuiUtils.isGuiWirelessCrafting(termGui)) {
|
||||
ItemRepo repo = (ItemRepo) ReflectionHelper.findField(GuiMEMonitorable.class, "repo").get(termGui);
|
||||
list = (IItemList<IAEItemStack>) ReflectionHelper.findField(ItemRepo.class, "list").get(repo);
|
||||
ItemRepo repo = (ItemRepo) ReflectionHelper.findField(GuiMEMonitorable.class, "repo")
|
||||
.get(termGui);
|
||||
list = (IItemList<IAEItemStack>)
|
||||
ReflectionHelper.findField(ItemRepo.class, "list").get(repo);
|
||||
} else {
|
||||
//wireless crafting terminal support
|
||||
net.p455w0rd.wirelesscraftingterminal.client.me.ItemRepo repo = (net.p455w0rd.wirelesscraftingterminal.client.me.ItemRepo) ReflectionHelper.findField(GuiWirelessCraftingTerminal.class, "repo").get(termGui);
|
||||
list = (IItemList<IAEItemStack>) ReflectionHelper.findField(net.p455w0rd.wirelesscraftingterminal.client.me.ItemRepo.class,
|
||||
"list").get(repo);
|
||||
// wireless crafting terminal support
|
||||
net.p455w0rd.wirelesscraftingterminal.client.me.ItemRepo repo =
|
||||
(net.p455w0rd.wirelesscraftingterminal.client.me.ItemRepo)
|
||||
ReflectionHelper.findField(GuiWirelessCraftingTerminal.class, "repo")
|
||||
.get(termGui);
|
||||
list = (IItemList<IAEItemStack>) ReflectionHelper.findField(
|
||||
net.p455w0rd.wirelesscraftingterminal.client.me.ItemRepo.class, "list")
|
||||
.get(repo);
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
@@ -112,15 +116,21 @@ public class IngredientTracker {
|
||||
if (termGui != null) {
|
||||
try {
|
||||
if (!GuiUtils.isGuiWirelessCrafting(termGui)) {
|
||||
ItemRepo repo = (ItemRepo) ReflectionHelper.findField(GuiMEMonitorable.class, "repo").get(termGui);
|
||||
for (IAEItemStack stack : (IItemList<IAEItemStack>) ReflectionHelper.findField(ItemRepo.class, "list").get(repo)) {
|
||||
ItemRepo repo = (ItemRepo) ReflectionHelper.findField(GuiMEMonitorable.class, "repo")
|
||||
.get(termGui);
|
||||
for (IAEItemStack stack : (IItemList<IAEItemStack>)
|
||||
ReflectionHelper.findField(ItemRepo.class, "list").get(repo)) {
|
||||
list.add(stack.copy());
|
||||
}
|
||||
} else {
|
||||
//wireless crafting terminal support
|
||||
net.p455w0rd.wirelesscraftingterminal.client.me.ItemRepo repo = (net.p455w0rd.wirelesscraftingterminal.client.me.ItemRepo) ReflectionHelper.findField(GuiWirelessCraftingTerminal.class, "repo").get(termGui);
|
||||
for (IAEItemStack stack : (IItemList<IAEItemStack>) ReflectionHelper.findField(net.p455w0rd.wirelesscraftingterminal.client.me.ItemRepo.class,
|
||||
"list").get(repo)) {
|
||||
// wireless crafting terminal support
|
||||
net.p455w0rd.wirelesscraftingterminal.client.me.ItemRepo repo =
|
||||
(net.p455w0rd.wirelesscraftingterminal.client.me.ItemRepo)
|
||||
ReflectionHelper.findField(GuiWirelessCraftingTerminal.class, "repo")
|
||||
.get(termGui);
|
||||
for (IAEItemStack stack : (IItemList<IAEItemStack>) ReflectionHelper.findField(
|
||||
net.p455w0rd.wirelesscraftingterminal.client.me.ItemRepo.class, "list")
|
||||
.get(repo)) {
|
||||
list.add(stack.copy());
|
||||
}
|
||||
}
|
||||
@@ -141,12 +151,12 @@ public class IngredientTracker {
|
||||
boolean find = false;
|
||||
if (ingredient.isCraftable() && ingredient.requiresToCraft()) {
|
||||
for (ItemStack stack : requireToCraftStacks) {
|
||||
boolean areStackEqual = stack.isItemEqual(ingredient.getCraftableIngredient()) && ItemStack.areItemStackTagsEqual(stack, ingredient.getCraftableIngredient());
|
||||
boolean areStackEqual = stack.isItemEqual(ingredient.getCraftableIngredient())
|
||||
&& ItemStack.areItemStackTagsEqual(stack, ingredient.getCraftableIngredient());
|
||||
if (areStackEqual) {
|
||||
stack.stackSize = (int) (stack.stackSize + ingredient.getMissingCount());
|
||||
find = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!find) {
|
||||
@@ -199,7 +209,10 @@ public class IngredientTracker {
|
||||
}
|
||||
} else {
|
||||
ItemStack craftableStack = ingredient.getCraftableIngredient();
|
||||
if (craftableStack != null && craftableStack.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(craftableStack, stack) && stack.stackSize > 0) {
|
||||
if (craftableStack != null
|
||||
&& craftableStack.isItemEqual(stack)
|
||||
&& ItemStack.areItemStackTagsEqual(craftableStack, stack)
|
||||
&& stack.stackSize > 0) {
|
||||
int missingCount = (int) ingredient.getMissingCount();
|
||||
ingredient.addCount(stack.stackSize);
|
||||
if (ingredient.requiresToCraft()) {
|
||||
@@ -236,11 +249,11 @@ public class IngredientTracker {
|
||||
List<ItemStack> inventoryStacks = new ArrayList<>();
|
||||
|
||||
for (Slot slot : (List<Slot>) termGui.inventorySlots.inventorySlots) {
|
||||
boolean canGetStack = slot != null &&
|
||||
slot.getHasStack() &&
|
||||
slot.getStack().stackSize > 0 &&
|
||||
slot.isItemValid(slot.getStack()) &&
|
||||
slot.canTakeStack(Minecraft.getMinecraft().thePlayer);
|
||||
boolean canGetStack = slot != null
|
||||
&& slot.getHasStack()
|
||||
&& slot.getStack().stackSize > 0
|
||||
&& slot.isItemValid(slot.getStack())
|
||||
&& slot.canTakeStack(Minecraft.getMinecraft().thePlayer);
|
||||
if (canGetStack) {
|
||||
inventoryStacks.add(slot.getStack().copy());
|
||||
}
|
||||
@@ -254,5 +267,4 @@ public class IngredientTracker {
|
||||
|
||||
this.requireStacks = this.getRequireToCraftStacks();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.github.vfyjxf.nee.utils;
|
||||
|
||||
import static com.github.vfyjxf.nee.config.NEEConfig.*;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import com.github.vfyjxf.nee.NotEnoughEnergistics;
|
||||
import com.github.vfyjxf.nee.processor.IRecipeProcessor;
|
||||
@@ -8,17 +10,14 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.JsonToNBT;
|
||||
import net.minecraft.nbt.NBTException;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.github.vfyjxf.nee.config.NEEConfig.*;
|
||||
|
||||
public final class ItemUtils {
|
||||
|
||||
public static Gson gson = new Gson();
|
||||
@@ -43,7 +42,9 @@ public final class ItemUtils {
|
||||
if (processor != null) {
|
||||
Item currentItem = GameRegistry.findItem(processor.modid, processor.name);
|
||||
if (currentItem != null) {
|
||||
ItemStack currentStack = processor.meta != null ? new ItemStack(currentItem, 1, Integer.parseInt(processor.meta)) : new ItemStack(currentItem);
|
||||
ItemStack currentStack = processor.meta != null
|
||||
? new ItemStack(currentItem, 1, Integer.parseInt(processor.meta))
|
||||
: new ItemStack(currentItem);
|
||||
if (processor.nbt != null) {
|
||||
NBTTagCompound nbt = null;
|
||||
try {
|
||||
@@ -55,7 +56,8 @@ public final class ItemUtils {
|
||||
currentStack.setTagCompound(nbt);
|
||||
}
|
||||
}
|
||||
transformItemBlacklist.add(new StackProcessor(currentStack, currentItem, processor.recipeProcessor, processor.identifier));
|
||||
transformItemBlacklist.add(new StackProcessor(
|
||||
currentStack, currentItem, processor.recipeProcessor, processor.identifier));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,7 +78,9 @@ public final class ItemUtils {
|
||||
if (processor != null) {
|
||||
Item currentItem = GameRegistry.findItem(processor.modid, processor.name);
|
||||
if (currentItem != null) {
|
||||
ItemStack currentStack = processor.meta != null ? new ItemStack(currentItem, 1, Integer.parseInt(processor.meta)) : new ItemStack(currentItem);
|
||||
ItemStack currentStack = processor.meta != null
|
||||
? new ItemStack(currentItem, 1, Integer.parseInt(processor.meta))
|
||||
: new ItemStack(currentItem);
|
||||
if (processor.nbt != null) {
|
||||
NBTTagCompound nbt = null;
|
||||
try {
|
||||
@@ -88,7 +92,8 @@ public final class ItemUtils {
|
||||
currentStack.setTagCompound(nbt);
|
||||
}
|
||||
}
|
||||
transformItemPriorityList.add(new StackProcessor(currentStack, currentItem, processor.recipeProcessor, processor.identifier));
|
||||
transformItemPriorityList.add(new StackProcessor(
|
||||
currentStack, currentItem, processor.recipeProcessor, processor.identifier));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,7 +101,6 @@ public final class ItemUtils {
|
||||
return transformItemPriorityList;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isPreferItems(ItemStack itemStack, String recipeProcessor, String identifier) {
|
||||
for (StackProcessor processor : ItemUtils.transformItemPriorityList) {
|
||||
ItemStack copyStack = itemStack.copy();
|
||||
@@ -173,9 +177,11 @@ public final class ItemUtils {
|
||||
|
||||
public static String toItemJsonString(ItemStack stack) {
|
||||
GameRegistry.UniqueIdentifier identifier = GameRegistry.findUniqueIdentifierFor(stack.getItem());
|
||||
String nbtString = stack.hasTagCompound() ? ",\"nbt\":" + stack.getTagCompound().toString() : "";
|
||||
String nbtString =
|
||||
stack.hasTagCompound() ? ",\"nbt\":" + stack.getTagCompound().toString() : "";
|
||||
int meta = stack.getItemDamage();
|
||||
return "{" + "\"modid\":" + identifier.modId + "," + "\"name\":" + identifier.name + "," + "\"meta\":" + meta + nbtString + "}";
|
||||
return "{" + "\"modid\":" + identifier.modId + "," + "\"name\":" + identifier.name + "," + "\"meta\":" + meta
|
||||
+ nbtString + "}";
|
||||
}
|
||||
|
||||
public static boolean hasRecipeProcessor(String processorId) {
|
||||
@@ -223,7 +229,7 @@ public final class ItemUtils {
|
||||
stack.setTagCompound(NBT);
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException ignored) {}
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,4 @@ package com.github.vfyjxf.nee.utils;
|
||||
public class ModIDs {
|
||||
|
||||
public static final String WCT = "ae2wct";
|
||||
|
||||
|
||||
}
|
||||
@@ -37,5 +37,4 @@ public class StackProcessor {
|
||||
this.recipeProcessor = recipeProcessor;
|
||||
this.identifier = identifier;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user