mirror of
https://github.com/GTNewHorizons/NotEnoughEnergistics.git
synced 2026-11-17 02:45:29 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
9bdeaa9708
commit
42e704a5d8
66 files changed
+1059
-828
No files matched your search
@@ -2,6 +2,17 @@ package com.github.vfyjxf.nee;
|
||||
|
||||
import static com.github.vfyjxf.nee.NotEnoughEnergistics.logger;
|
||||
|
||||
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;
|
||||
import net.minecraft.command.WrongUsageException;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
|
||||
import com.github.vfyjxf.nee.config.NEEConfig;
|
||||
import com.github.vfyjxf.nee.processor.IRecipeProcessor;
|
||||
import com.github.vfyjxf.nee.processor.RecipeProcessor;
|
||||
@@ -9,17 +20,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;
|
||||
import net.minecraft.command.WrongUsageException;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
|
||||
public class NEECommands extends CommandBase {
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "nee";
|
||||
@@ -50,8 +53,7 @@ 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]);
|
||||
@@ -73,8 +75,7 @@ public class NEECommands extends CommandBase {
|
||||
}
|
||||
}
|
||||
String newJsonString = new Gson().toJson(itemJsonObject);
|
||||
String[] oldList = "blacklist".equalsIgnoreCase(args[1])
|
||||
? NEEConfig.transformBlacklist
|
||||
String[] oldList = "blacklist".equalsIgnoreCase(args[1]) ? NEEConfig.transformBlacklist
|
||||
: NEEConfig.transformPriorityList;
|
||||
List<String> newList = new ArrayList<>(Arrays.asList(oldList));
|
||||
for (String currentJsonString : oldList) {
|
||||
@@ -120,10 +121,12 @@ public class NEECommands extends CommandBase {
|
||||
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;
|
||||
: args.length == 2 ? CommandBase.getListOfStringsMatchingLastWord(
|
||||
args,
|
||||
"blacklist",
|
||||
"priorityItem",
|
||||
"priorityMod",
|
||||
"itemCombination") : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
package com.github.vfyjxf.nee;
|
||||
|
||||
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 appeng.client.gui.implementations.GuiCraftingTerm;
|
||||
import appeng.client.gui.implementations.GuiInterface;
|
||||
import appeng.client.gui.implementations.GuiPatternTerm;
|
||||
@@ -9,6 +18,7 @@ import codechicken.nei.api.API;
|
||||
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.nei.NEECraftingHandler;
|
||||
import com.github.vfyjxf.nee.nei.NEECraftingHelper;
|
||||
@@ -18,17 +28,11 @@ import com.github.vfyjxf.nee.utils.ModIDs;
|
||||
import com.glodblock.github.client.gui.GuiFluidPatternTerminal;
|
||||
import com.glodblock.github.client.gui.GuiFluidPatternTerminalEx;
|
||||
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;
|
||||
|
||||
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() {
|
||||
@@ -39,12 +43,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()
|
||||
.map(IRecipeProcessor::getAllOverlayIdentifier)
|
||||
RecipeProcessor.recipeProcessors.stream().map(IRecipeProcessor::getAllOverlayIdentifier)
|
||||
.forEach(identifiers::addAll);
|
||||
|
||||
for (String ident : identifiers) {
|
||||
@@ -121,6 +124,7 @@ 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())) {
|
||||
@@ -159,7 +163,9 @@ public class NEINeeConfig implements IConfigureNEI {
|
||||
API.registerGuiOverlay(GuiKnowledgeInscriber.class, "arcaneshapelessrecipes");
|
||||
API.registerGuiOverlayHandler(GuiKnowledgeInscriber.class, new NEECraftingHandler(), "arcaneshapedrecipes");
|
||||
API.registerGuiOverlayHandler(
|
||||
GuiKnowledgeInscriber.class, new NEECraftingHandler(), "arcaneshapelessrecipes");
|
||||
GuiKnowledgeInscriber.class,
|
||||
new NEECraftingHandler(),
|
||||
"arcaneshapelessrecipes");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
package com.github.vfyjxf.nee;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraft.launchwrapper.Launch;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.github.vfyjxf.nee.config.NEEConfig;
|
||||
import com.github.vfyjxf.nee.network.NEEGuiHandler;
|
||||
import com.github.vfyjxf.nee.network.NEENetworkHandler;
|
||||
import com.github.vfyjxf.nee.proxy.CommonProxy;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
@@ -12,10 +20,6 @@ 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;
|
||||
|
||||
@Mod(
|
||||
modid = NotEnoughEnergistics.MODID,
|
||||
@@ -25,11 +29,11 @@ import org.apache.logging.log4j.Logger;
|
||||
guiFactory = NotEnoughEnergistics.GUI_FACTORY,
|
||||
useMetadata = true)
|
||||
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@[rv3.beta.22,),[rv3.beta-22,),[rv3-beta.22,),[rv3-beta-22,);after:ae2wct;after:ae2fc";
|
||||
public static final String DEPENDENCIES = "required-after:NotEnoughItems;required-after:appliedenergistics2@[rv3.beta.22,),[rv3.beta-22,),[rv3-beta.22,),[rv3-beta-22,);after:ae2wct;after:ae2fc";
|
||||
public static final String GUI_FACTORY = "com.github.vfyjxf.nee.config.NEEConfigGuiFactory";
|
||||
public static final Logger logger = LogManager.getLogger("NotEnoughEnergistics");
|
||||
|
||||
|
||||
@@ -3,10 +3,22 @@ package com.github.vfyjxf.nee.asm;
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHandler.INPUT_KEY;
|
||||
import static com.github.vfyjxf.nee.utils.GuiUtils.isPatternTerm;
|
||||
|
||||
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 org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import appeng.client.gui.implementations.GuiInterface;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.PositionedStack;
|
||||
|
||||
import com.github.vfyjxf.nee.config.NEEConfig;
|
||||
import com.github.vfyjxf.nee.nei.NEECraftingHandler;
|
||||
import com.github.vfyjxf.nee.network.NEENetworkHandler;
|
||||
@@ -14,21 +26,12 @@ 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;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
public class AppengHelper {
|
||||
|
||||
/**
|
||||
* Prevent the scroll bar from being triggered when modifying the number of items
|
||||
* This method is not intended to be called by NEE.
|
||||
* Do not use this method for any reason.
|
||||
* Prevent the scroll bar from being triggered when modifying the number of items This method is not intended to be
|
||||
* called by NEE. Do not use this method for any reason.
|
||||
*/
|
||||
public static boolean handleMouseWheelInput(int dWheel) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
@@ -79,16 +82,15 @@ 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()
|
||||
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);
|
||||
|
||||
@@ -2,16 +2,20 @@ 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 codechicken.lib.asm.ASMInit;
|
||||
import codechicken.lib.asm.ObfMapping;
|
||||
|
||||
import com.github.vfyjxf.nee.NotEnoughEnergistics;
|
||||
|
||||
public class NEEClassTransformer implements IClassTransformer {
|
||||
|
||||
static {
|
||||
@@ -24,18 +28,16 @@ public class NEEClassTransformer implements IClassTransformer {
|
||||
|
||||
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) {
|
||||
@@ -47,16 +49,21 @@ public class NEEClassTransformer implements IClassTransformer {
|
||||
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);
|
||||
}
|
||||
@@ -64,8 +71,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();
|
||||
@@ -73,8 +80,13 @@ 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,20 +102,21 @@ public class NEEClassTransformer implements IClassTransformer {
|
||||
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,
|
||||
"com/github/vfyjxf/nee/asm/AppengHelper",
|
||||
"handleMouseWheelInput",
|
||||
"(I)Z",
|
||||
false));
|
||||
insnList.add(
|
||||
new MethodInsnNode(
|
||||
INVOKESTATIC,
|
||||
"com/github/vfyjxf/nee/asm/AppengHelper",
|
||||
"handleMouseWheelInput",
|
||||
"(I)Z",
|
||||
false));
|
||||
LabelNode label = new LabelNode();
|
||||
insnList.add(new JumpInsnNode(IFEQ, label));
|
||||
insnList.add(new InsnNode(RETURN));
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
package com.github.vfyjxf.nee.asm;
|
||||
|
||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
||||
import java.util.Map;
|
||||
|
||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
||||
|
||||
@IFMLLoadingPlugin.Name("NEELoadingPlugin")
|
||||
@IFMLLoadingPlugin.MCVersion("1.7.10")
|
||||
@IFMLLoadingPlugin.TransformerExclusions("com.github.vfyjxf.nee.asm")
|
||||
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
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
package com.github.vfyjxf.nee.block;
|
||||
|
||||
import appeng.block.AEBaseItemBlock;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
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 appeng.block.AEBaseItemBlock;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
@@ -30,8 +33,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;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
package com.github.vfyjxf.nee.block.tile;
|
||||
|
||||
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;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.implementations.ICraftingPatternItem;
|
||||
@@ -37,19 +51,9 @@ import appeng.util.Platform;
|
||||
import appeng.util.inv.AdaptorIInventory;
|
||||
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;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* A ME interface for storing temporary patterns.
|
||||
@@ -57,7 +61,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
public class TilePatternInterface extends AENetworkInvTile
|
||||
implements IGridTickable, ICraftingProvider, IInventoryDestination {
|
||||
|
||||
private final int[] sides = {0, 1, 2, 3, 4, 5, 6, 7, 8};
|
||||
private final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||
private final AppEngInternalInventory gridInv;
|
||||
private final AppEngInternalInventory patterns;
|
||||
private final AppEngInternalInventory ejectInv;
|
||||
@@ -93,10 +97,8 @@ public class TilePatternInterface extends AENetworkInvTile
|
||||
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
|
||||
@@ -172,8 +174,8 @@ public class TilePatternInterface extends AENetworkInvTile
|
||||
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);
|
||||
}
|
||||
@@ -188,14 +190,15 @@ public class TilePatternInterface extends AENetworkInvTile
|
||||
|
||||
@Override
|
||||
public boolean pushPattern(ICraftingPatternDetails patternDetails, InventoryCrafting table) {
|
||||
if (!isBusy()
|
||||
&& this.getProxy().isActive()
|
||||
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);
|
||||
xCoord + direction.offsetX,
|
||||
yCoord + direction.offsetY,
|
||||
zCoord + direction.offsetZ);
|
||||
|
||||
if (te instanceof IInterfaceHost) {
|
||||
try {
|
||||
@@ -288,9 +291,7 @@ public class TilePatternInterface extends AENetworkInvTile
|
||||
}
|
||||
|
||||
try {
|
||||
final IAEItemStack out = this.getProxy()
|
||||
.getStorage()
|
||||
.getItemInventory()
|
||||
final IAEItemStack out = this.getProxy().getStorage().getItemInventory()
|
||||
.injectItems(AEApi.instance().storage().createItemStack(stack), Actionable.SIMULATE, this.source);
|
||||
if (out == null) {
|
||||
return true;
|
||||
@@ -349,8 +350,8 @@ public class TilePatternInterface extends AENetworkInvTile
|
||||
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;
|
||||
}
|
||||
@@ -374,7 +375,7 @@ public class TilePatternInterface extends AENetworkInvTile
|
||||
}
|
||||
|
||||
public void updateCraftingList() {
|
||||
final Boolean[] accountedFor = {false, false, false, false, false, false, false, false, false};
|
||||
final Boolean[] accountedFor = { false, false, false, false, false, false, false, false, false };
|
||||
|
||||
assert (accountedFor.length == this.patterns.getSizeInventory());
|
||||
|
||||
@@ -408,10 +409,7 @@ public class TilePatternInterface extends AENetworkInvTile
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
@@ -428,8 +426,7 @@ public class TilePatternInterface extends AENetworkInvTile
|
||||
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)) {
|
||||
@@ -508,8 +505,8 @@ public class TilePatternInterface extends AENetworkInvTile
|
||||
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;
|
||||
}
|
||||
@@ -562,8 +559,7 @@ public class TilePatternInterface extends AENetworkInvTile
|
||||
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) {
|
||||
@@ -612,8 +608,8 @@ public class TilePatternInterface extends AENetworkInvTile
|
||||
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;
|
||||
}
|
||||
@@ -626,13 +622,11 @@ public class TilePatternInterface extends AENetworkInvTile
|
||||
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;
|
||||
}
|
||||
@@ -666,8 +660,7 @@ public class TilePatternInterface extends AENetworkInvTile
|
||||
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) {
|
||||
@@ -693,8 +686,8 @@ public class TilePatternInterface extends AENetworkInvTile
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,21 @@ 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 java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.event.GuiOpenEvent;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||
import appeng.client.gui.implementations.GuiPatternTerm;
|
||||
@@ -13,6 +28,7 @@ import appeng.container.slot.SlotFake;
|
||||
import codechicken.nei.VisiblityData;
|
||||
import codechicken.nei.api.INEIGuiHandler;
|
||||
import codechicken.nei.api.TaggedInventoryArea;
|
||||
|
||||
import com.github.vfyjxf.nee.client.gui.widgets.GuiImgButtonEnableCombination;
|
||||
import com.github.vfyjxf.nee.config.ItemCombination;
|
||||
import com.github.vfyjxf.nee.config.NEEConfig;
|
||||
@@ -20,21 +36,10 @@ import com.github.vfyjxf.nee.container.ContainerCraftingConfirm;
|
||||
import com.github.vfyjxf.nee.network.NEENetworkHandler;
|
||||
import com.github.vfyjxf.nee.network.packet.PacketSlotStackChange;
|
||||
import com.github.vfyjxf.nee.utils.GuiUtils;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
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;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.event.GuiOpenEvent;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
public class GuiEventHandler implements INEIGuiHandler {
|
||||
|
||||
@@ -115,8 +120,10 @@ public class GuiEventHandler implements INEIGuiHandler {
|
||||
x = gui.guiLeft + 74;
|
||||
y = gui.guiTop + gui.ySize - 153;
|
||||
}
|
||||
buttonCombination =
|
||||
new GuiImgButtonEnableCombination(x, y, ItemCombination.valueOf(NEEConfig.itemCombinationMode));
|
||||
buttonCombination = new GuiImgButtonEnableCombination(
|
||||
x,
|
||||
y,
|
||||
ItemCombination.valueOf(NEEConfig.itemCombinationMode));
|
||||
event.buttonList.add(buttonCombination);
|
||||
}
|
||||
}
|
||||
@@ -125,8 +132,7 @@ 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
|
||||
int ordinal = Mouse.getEventButton() != 2 ? button.getCurrentValue().ordinal() + 1
|
||||
: button.getCurrentValue().ordinal() - 1;
|
||||
|
||||
if (ordinal >= ItemCombination.values().length) {
|
||||
@@ -186,16 +192,13 @@ public class GuiEventHandler implements INEIGuiHandler {
|
||||
boolean sendPacket = false;
|
||||
int copySize = useStackSizeFromNEI ? copyStack.stackSize : draggedStackDefaultSize;
|
||||
if (button == 0) {
|
||||
boolean areStackEqual = slotStack != null
|
||||
&& slotStack.isItemEqual(copyStack)
|
||||
boolean areStackEqual = slotStack != null && slotStack.isItemEqual(copyStack)
|
||||
&& ItemStack.areItemStackTagsEqual(slotStack, copyStack);
|
||||
copyStack.stackSize = areStackEqual
|
||||
? Math.min(slotStack.stackSize + copySize, 127)
|
||||
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)
|
||||
boolean areStackEqual = slotStack != null && slotStack.isItemEqual(copyStack)
|
||||
&& ItemStack.areItemStackTagsEqual(slotStack, copyStack);
|
||||
if (areStackEqual) {
|
||||
copyStack.stackSize = Math.min(slotStack.stackSize + 1, 127);
|
||||
@@ -206,9 +209,10 @@ 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;
|
||||
}
|
||||
|
||||
@@ -1,30 +1,35 @@
|
||||
package com.github.vfyjxf.nee.client;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
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.utils.GuiUtils;
|
||||
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;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
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.utils.GuiUtils;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Please note the difference between the GTNH NEI and the official NEI
|
||||
*/
|
||||
@@ -110,10 +115,9 @@ 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) {
|
||||
|
||||
@@ -169,8 +173,9 @@ public class NEEContainerDrawHandler {
|
||||
|
||||
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();
|
||||
}
|
||||
@@ -194,8 +199,7 @@ public class NEEContainerDrawHandler {
|
||||
if (isGtnhNei) {
|
||||
try {
|
||||
int OVERLAY_BUTTON_ID_START = 4;
|
||||
recipeIndex = gui.page * (int) recipesPerPageMethod.invoke(gui)
|
||||
+ overlayButton.id
|
||||
recipeIndex = gui.page * (int) recipesPerPageMethod.invoke(gui) + overlayButton.id
|
||||
- OVERLAY_BUTTON_ID_START;
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
@@ -219,17 +223,23 @@ 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) {
|
||||
@@ -247,8 +257,7 @@ public class NEEContainerDrawHandler {
|
||||
}
|
||||
|
||||
private boolean isMouseOverButton(GuiButton button, int mouseX, int mouseY) {
|
||||
return mouseX >= button.xPosition
|
||||
&& mouseY >= button.yPosition
|
||||
return mouseX >= button.xPosition && mouseY >= button.yPosition
|
||||
&& mouseX < button.xPosition + button.width
|
||||
&& mouseY < button.yPosition + button.height;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
package com.github.vfyjxf.nee.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
|
||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.definitions.IParts;
|
||||
@@ -15,20 +21,18 @@ import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.parts.reporting.PartCraftingTerminal;
|
||||
|
||||
import com.github.vfyjxf.nee.container.ContainerCraftingAmount;
|
||||
import com.github.vfyjxf.nee.network.NEENetworkHandler;
|
||||
import com.github.vfyjxf.nee.network.packet.PacketCraftingRequest;
|
||||
import com.github.vfyjxf.nee.utils.GuiUtils;
|
||||
import com.github.vfyjxf.nee.utils.ModIDs;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
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;
|
||||
|
||||
@@ -94,12 +98,20 @@ 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.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.guiLeft + 154,
|
||||
this.guiTop,
|
||||
myIcon,
|
||||
myIcon.getDisplayName(),
|
||||
itemRender));
|
||||
}
|
||||
|
||||
this.amountToCraft = new GuiNumberBox(
|
||||
@@ -150,13 +162,11 @@ 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();
|
||||
|
||||
@@ -202,9 +212,8 @@ 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..
|
||||
@@ -212,8 +221,9 @@ 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));
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
package com.github.vfyjxf.nee.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
|
||||
import com.github.vfyjxf.nee.NotEnoughEnergistics;
|
||||
import com.github.vfyjxf.nee.block.tile.TilePatternInterface;
|
||||
import com.github.vfyjxf.nee.client.gui.widgets.GuiImgButtonRemove;
|
||||
import com.github.vfyjxf.nee.container.ContainerPatternInterface;
|
||||
import com.github.vfyjxf.nee.network.NEENetworkHandler;
|
||||
import com.github.vfyjxf.nee.network.packet.PacketValueConfigServer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GuiPatternInterface extends AEBaseGui {
|
||||
|
||||
@@ -56,9 +58,8 @@ 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
@@ -1,13 +1,16 @@
|
||||
package com.github.vfyjxf.nee.client.gui.widgets;
|
||||
|
||||
import appeng.client.gui.widgets.ITooltip;
|
||||
import com.github.vfyjxf.nee.config.ItemCombination;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.client.gui.widgets.ITooltip;
|
||||
|
||||
import com.github.vfyjxf.nee.config.ItemCombination;
|
||||
|
||||
public class GuiImgButtonEnableCombination extends GuiButton implements ITooltip {
|
||||
|
||||
private ItemCombination currentValue;
|
||||
@@ -33,8 +36,7 @@ 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
|
||||
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);
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package com.github.vfyjxf.nee.client.gui.widgets;
|
||||
|
||||
import appeng.client.gui.widgets.ITooltip;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.client.gui.widgets.ITooltip;
|
||||
|
||||
public class GuiImgButtonRemove extends GuiButton implements ITooltip {
|
||||
|
||||
public GuiImgButtonRemove(int x, int y) {
|
||||
@@ -28,8 +30,7 @@ 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
|
||||
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);
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.github.vfyjxf.nee.config;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
|
||||
public enum ItemCombination {
|
||||
|
||||
DISABLED,
|
||||
ENABLED,
|
||||
WHITELIST;
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.github.vfyjxf.nee.config;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
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 java.io.File;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -40,59 +43,61 @@ public class NEEConfig {
|
||||
|
||||
{
|
||||
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}\"")
|
||||
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();
|
||||
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();
|
||||
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")
|
||||
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")
|
||||
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();
|
||||
CATEGORY_PATTERN_TRANSFER,
|
||||
"itemCombinationWhitelist",
|
||||
itemCombinationWhitelist,
|
||||
"Whitelist for item combination").getStringList();
|
||||
}
|
||||
|
||||
{
|
||||
matchOtherItems = config.get(
|
||||
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(
|
||||
drawHighlight = config
|
||||
.get(
|
||||
CATEGORY_CRAFTING_HELPER,
|
||||
"drawHighlight",
|
||||
true,
|
||||
@@ -102,37 +107,31 @@ public class NEEConfig {
|
||||
|
||||
{
|
||||
allowSynchronousSwitchIngredient = config.get(
|
||||
CATEGORY_OTHER_SETTINGS,
|
||||
"allowSynchronousSwitchIngredient",
|
||||
true,
|
||||
"If true, it will make all similar ingredient switch at the same time")
|
||||
.getBoolean(true);
|
||||
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")
|
||||
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")
|
||||
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();
|
||||
|
||||
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();
|
||||
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()) {
|
||||
@@ -145,59 +144,61 @@ public class NEEConfig {
|
||||
|
||||
{
|
||||
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}\"")
|
||||
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();
|
||||
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();
|
||||
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")
|
||||
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")
|
||||
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();
|
||||
CATEGORY_PATTERN_TRANSFER,
|
||||
"itemCombinationWhitelist",
|
||||
itemCombinationWhitelist,
|
||||
"Whitelist for item combination").getStringList();
|
||||
}
|
||||
|
||||
{
|
||||
matchOtherItems = config.get(
|
||||
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(
|
||||
drawHighlight = config
|
||||
.get(
|
||||
CATEGORY_CRAFTING_HELPER,
|
||||
"drawHighlight",
|
||||
true,
|
||||
@@ -207,30 +208,27 @@ public class NEEConfig {
|
||||
|
||||
{
|
||||
allowSynchronousSwitchIngredient = config.get(
|
||||
CATEGORY_OTHER_SETTINGS,
|
||||
"allowSynchronousSwitchIngredient",
|
||||
true,
|
||||
"If true, it will make all similar ingredient switch at the same time")
|
||||
.getBoolean(true);
|
||||
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")
|
||||
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();
|
||||
|
||||
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();
|
||||
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();
|
||||
@@ -239,11 +237,14 @@ 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")
|
||||
CATEGORY_PATTERN_TRANSFER,
|
||||
"itemCombinationMode",
|
||||
itemCombinationMode,
|
||||
"Item Combination Mode Setting, here are all the modes. \n" + "\"ENABLED\""
|
||||
+ " "
|
||||
+ "\"DISABLED\""
|
||||
+ " "
|
||||
+ "WHITELIST")
|
||||
.set(itemCombinationMode);
|
||||
config.save();
|
||||
}
|
||||
@@ -251,23 +252,22 @@ public class NEEConfig {
|
||||
public static void setItemCombinationWhitelist(String[] itemCombinationWhitelist) {
|
||||
NEEConfig.itemCombinationWhitelist = itemCombinationWhitelist;
|
||||
config.get(
|
||||
CATEGORY_PATTERN_TRANSFER,
|
||||
"itemCombinationWhitelist",
|
||||
itemCombinationWhitelist,
|
||||
"Whitelist for item combination")
|
||||
.set(itemCombinationWhitelist);
|
||||
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}\"")
|
||||
"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();
|
||||
}
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
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 java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
|
||||
import com.github.vfyjxf.nee.NotEnoughEnergistics;
|
||||
|
||||
import cpw.mods.fml.client.config.GuiConfig;
|
||||
import cpw.mods.fml.client.config.IConfigElement;
|
||||
|
||||
public class NEEConfigGui extends GuiConfig {
|
||||
|
||||
public NEEConfigGui(GuiScreen parentScreen) {
|
||||
super(parentScreen, getConfigElements(), NotEnoughEnergistics.MODID, false, false, NotEnoughEnergistics.NAME);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
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 cpw.mods.fml.client.IModGuiFactory;
|
||||
|
||||
public class NEEConfigGuiFactory implements IModGuiFactory {
|
||||
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance) {}
|
||||
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
package com.github.vfyjxf.nee.container;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
@@ -8,11 +14,6 @@ import appeng.api.networking.security.PlayerSource;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotInaccessible;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ContainerCraftingAmount extends AEBaseContainer {
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.github.vfyjxf.nee.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.container.implementations.ContainerCraftConfirm;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.github.vfyjxf.nee.block.tile.TilePatternInterface;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class ContainerCraftingConfirm extends ContainerCraftConfirm {
|
||||
|
||||
|
||||
@@ -2,6 +2,13 @@ package com.github.vfyjxf.nee.container;
|
||||
|
||||
import static appeng.container.slot.SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.implementations.ICraftingPatternItem;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
@@ -15,13 +22,8 @@ import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.inventory.IAEAppEngInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.github.vfyjxf.nee.block.tile.TilePatternInterface;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerPatternInterface extends AEBaseContainer implements IAEAppEngInventory {
|
||||
|
||||
@@ -42,18 +44,24 @@ public class ContainerPatternInterface extends AEBaseContainer implements IAEApp
|
||||
|
||||
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;
|
||||
}
|
||||
patternSlots[i] = new SlotRestrictedInput(
|
||||
ENCODED_PATTERN,
|
||||
patterns,
|
||||
i,
|
||||
8 + 18 * i,
|
||||
90 + 5,
|
||||
playerInventory) {
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer par1EntityPlayer) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack i) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer par1EntityPlayer) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for (int y = 0; y < 3; y++) {
|
||||
@@ -120,8 +128,7 @@ 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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,6 +158,6 @@ public class ContainerPatternInterface extends AEBaseContainer implements IAEApp
|
||||
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) {}
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.github.vfyjxf.nee.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.container.implementations.ContainerCraftConfirm;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.github.vfyjxf.nee.block.tile.TilePatternInterface;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class WCTContainerCraftingConfirm extends ContainerCraftConfirm {
|
||||
|
||||
|
||||
@@ -3,11 +3,19 @@ package com.github.vfyjxf.nee.nei;
|
||||
import static com.github.vfyjxf.nee.processor.RecipeProcessor.NULL_IDENTIFIER;
|
||||
import static com.github.vfyjxf.nee.utils.GuiUtils.isPatternTerm;
|
||||
|
||||
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 appeng.util.Platform;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.IOverlayHandler;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
import com.github.vfyjxf.nee.config.ItemCombination;
|
||||
import com.github.vfyjxf.nee.config.NEEConfig;
|
||||
import com.github.vfyjxf.nee.network.NEENetworkHandler;
|
||||
@@ -19,13 +27,9 @@ import com.github.vfyjxf.nee.processor.RecipeProcessor;
|
||||
import com.github.vfyjxf.nee.utils.ItemUtils;
|
||||
import com.github.vfyjxf.nee.utils.ModIDs;
|
||||
import com.glodblock.github.nei.FluidPatternTerminalRecipeTransferHandler;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -44,17 +48,14 @@ public class NEECraftingHandler implements IOverlayHandler {
|
||||
static {
|
||||
try {
|
||||
knowledgeInscriberClz = Class.forName("thaumicenergistics.client.gui.GuiKnowledgeInscriber");
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
}
|
||||
} catch (ClassNotFoundException ignored) {}
|
||||
try {
|
||||
itemAspectClz = Class.forName("com.djgiannuzz.thaumcraftneiplugin.items.ItemAspect");
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
}
|
||||
} catch (ClassNotFoundException ignored) {}
|
||||
try {
|
||||
guiExtremeAutoCrafterClz =
|
||||
Class.forName("wanion.avaritiaddons.block.extremeautocrafter.GuiExtremeAutoCrafter");
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
}
|
||||
guiExtremeAutoCrafterClz = Class
|
||||
.forName("wanion.avaritiaddons.block.extremeautocrafter.GuiExtremeAutoCrafter");
|
||||
} catch (ClassNotFoundException ignored) {}
|
||||
}
|
||||
|
||||
public static boolean isCraftingTableRecipe(IRecipeHandler recipe) {
|
||||
@@ -117,16 +118,14 @@ public class NEECraftingHandler implements IOverlayHandler {
|
||||
if (currentValue != ItemCombination.DISABLED
|
||||
&& processor.mergeStacks(recipe, recipeIndex, identifier)) {
|
||||
boolean isWhitelist = currentValue == ItemCombination.WHITELIST
|
||||
&& Arrays.asList(NEEConfig.itemCombinationWhitelist)
|
||||
.contains(identifier);
|
||||
&& 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()) {
|
||||
if (areItemStackEqual && (firstStack.stackSize + currentStack.stackSize)
|
||||
<= firstStack.getMaxStackSize()) {
|
||||
find = true;
|
||||
storedStack.items[0].stackSize = firstStack.stackSize + currentStack.stackSize;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,29 @@ import static com.github.vfyjxf.nee.nei.NEECraftingHandler.OUTPUT_KEY;
|
||||
import static com.github.vfyjxf.nee.utils.GuiUtils.isGuiCraftingTerm;
|
||||
import static com.github.vfyjxf.nee.utils.GuiUtils.isPatternTerm;
|
||||
|
||||
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;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import appeng.client.gui.implementations.GuiCraftingTerm;
|
||||
import appeng.container.slot.SlotCraftingMatrix;
|
||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||
@@ -19,6 +42,7 @@ import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.IOverlayHandler;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import com.github.vfyjxf.nee.NotEnoughEnergistics;
|
||||
import com.github.vfyjxf.nee.config.NEEConfig;
|
||||
import com.github.vfyjxf.nee.network.NEENetworkHandler;
|
||||
@@ -28,32 +52,14 @@ import com.github.vfyjxf.nee.utils.GuiUtils;
|
||||
import com.github.vfyjxf.nee.utils.IngredientTracker;
|
||||
import com.github.vfyjxf.nee.utils.ItemUtils;
|
||||
import com.github.vfyjxf.nee.utils.ModIDs;
|
||||
|
||||
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;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
public class NEECraftingHelper implements IOverlayHandler {
|
||||
|
||||
public static final NEECraftingHelper INSTANCE = new NEECraftingHelper();
|
||||
public static IngredientTracker tracker = null;
|
||||
public static boolean noPreview = false;
|
||||
@@ -137,8 +143,9 @@ public class NEECraftingHelper implements IOverlayHandler {
|
||||
// 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) {
|
||||
@@ -149,8 +156,7 @@ public class NEECraftingHelper implements IOverlayHandler {
|
||||
} else if (GuiUtils.isGuiWirelessCrafting(firstGui)) {
|
||||
moveItemsForWirelessCrafting(firstGui, ingredients);
|
||||
}
|
||||
} catch (final Exception | Error ignored) {
|
||||
}
|
||||
} catch (final Exception | Error ignored) {}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -223,8 +229,7 @@ public class NEECraftingHelper implements IOverlayHandler {
|
||||
|
||||
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;
|
||||
@@ -274,8 +279,8 @@ public class NEECraftingHelper implements IOverlayHandler {
|
||||
IRecipeHandler handler = (IRecipeHandler) guiRecipe.currenthandlers.get(guiRecipe.recipetype);
|
||||
if (isGtnhNei) {
|
||||
try {
|
||||
recipesPerPage = (int) ReflectionHelper.findMethod(
|
||||
GuiRecipe.class, guiRecipe, new String[] {"getRecipesPerPage"})
|
||||
recipesPerPage = (int) ReflectionHelper
|
||||
.findMethod(GuiRecipe.class, guiRecipe, new String[] { "getRecipesPerPage" })
|
||||
.invoke(guiRecipe);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
@@ -283,8 +288,8 @@ public class NEECraftingHelper implements IOverlayHandler {
|
||||
}
|
||||
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,
|
||||
|
||||
@@ -2,6 +2,16 @@ package com.github.vfyjxf.nee.network;
|
||||
|
||||
import static com.github.vfyjxf.nee.NotEnoughEnergistics.instance;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTermHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.api.parts.IPart;
|
||||
@@ -11,6 +21,7 @@ import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerOpenContext;
|
||||
import appeng.parts.reporting.PartCraftingTerminal;
|
||||
|
||||
import com.github.vfyjxf.nee.block.tile.TilePatternInterface;
|
||||
import com.github.vfyjxf.nee.client.gui.GuiCraftingAmount;
|
||||
import com.github.vfyjxf.nee.client.gui.GuiPatternInterface;
|
||||
@@ -19,17 +30,10 @@ import com.github.vfyjxf.nee.container.ContainerCraftingConfirm;
|
||||
import com.github.vfyjxf.nee.container.ContainerPatternInterface;
|
||||
import com.github.vfyjxf.nee.container.WCTContainerCraftingConfirm;
|
||||
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;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTermHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
|
||||
|
||||
public class NEEGuiHandler implements IGuiHandler {
|
||||
|
||||
@@ -166,7 +170,8 @@ public class NEEGuiHandler implements IGuiHandler {
|
||||
return new GuiCraftingAmount(player.inventory, wirelessTerminal);
|
||||
} else {
|
||||
return new net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm(
|
||||
player.inventory, wirelessTerminal);
|
||||
player.inventory,
|
||||
wirelessTerminal);
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -176,14 +181,8 @@ 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));
|
||||
@@ -212,13 +211,17 @@ public class NEEGuiHandler implements IGuiHandler {
|
||||
|
||||
@Optional.Method(modid = ModIDs.WCT)
|
||||
private WirelessTerminalGuiObject getWirelessTerminalGui(EntityPlayer player, World world, int x, int y, int z) {
|
||||
final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) AEApi.instance()
|
||||
.registries()
|
||||
.wireless()
|
||||
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);
|
||||
wh,
|
||||
RandomUtils.getWirelessTerm(player.inventory),
|
||||
player,
|
||||
world,
|
||||
x,
|
||||
y,
|
||||
z);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.github.vfyjxf.nee.network;
|
||||
|
||||
import com.github.vfyjxf.nee.NotEnoughEnergistics;
|
||||
import com.github.vfyjxf.nee.network.packet.*;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
@@ -20,22 +21,43 @@ public class NEENetworkHandler {
|
||||
|
||||
public static void init() {
|
||||
INSTANCE.registerMessage(
|
||||
PacketNEIPatternRecipe.Handler.class, PacketNEIPatternRecipe.class, nextId(), Side.SERVER);
|
||||
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);
|
||||
PacketStackCountChange.Handler.class,
|
||||
PacketStackCountChange.class,
|
||||
nextId(),
|
||||
Side.SERVER);
|
||||
INSTANCE.registerMessage(
|
||||
PacketSlotStackChange.Handler.class, PacketSlotStackChange.class, nextId(), Side.SERVER);
|
||||
PacketSlotStackChange.Handler.class,
|
||||
PacketSlotStackChange.class,
|
||||
nextId(),
|
||||
Side.SERVER);
|
||||
INSTANCE.registerMessage(
|
||||
PacketCraftingRequest.Handler.class, PacketCraftingRequest.class, nextId(), Side.SERVER);
|
||||
PacketCraftingRequest.Handler.class,
|
||||
PacketCraftingRequest.class,
|
||||
nextId(),
|
||||
Side.SERVER);
|
||||
INSTANCE.registerMessage(
|
||||
PacketOpenCraftAmount.Handler.class, PacketOpenCraftAmount.class, nextId(), Side.SERVER);
|
||||
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);
|
||||
PacketValueConfigServer.Handler.class,
|
||||
PacketValueConfigServer.class,
|
||||
nextId(),
|
||||
Side.SERVER);
|
||||
INSTANCE.registerMessage(
|
||||
PacketValueConfigClient.Handler.class, PacketValueConfigClient.class, nextId(), Side.CLIENT);
|
||||
PacketValueConfigClient.Handler.class,
|
||||
PacketValueConfigClient.class,
|
||||
nextId(),
|
||||
Side.CLIENT);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,13 @@
|
||||
package com.github.vfyjxf.nee.network.packet;
|
||||
|
||||
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 appeng.container.slot.SlotFakeCraftingMatrix;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
@@ -7,12 +15,6 @@ 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;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -38,6 +40,7 @@ public class PacketArcaneRecipe implements IMessage {
|
||||
}
|
||||
|
||||
public static final class Handler implements IMessageHandler<PacketArcaneRecipe, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketArcaneRecipe message, MessageContext ctx) {
|
||||
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||
@@ -51,8 +54,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;
|
||||
|
||||
@@ -4,6 +4,26 @@ 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 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;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
|
||||
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
|
||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.IGrid;
|
||||
@@ -25,6 +45,7 @@ import appeng.core.AELog;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
import com.github.vfyjxf.nee.block.tile.TilePatternInterface;
|
||||
import com.github.vfyjxf.nee.container.ContainerCraftingAmount;
|
||||
import com.github.vfyjxf.nee.container.ContainerCraftingConfirm;
|
||||
@@ -33,28 +54,12 @@ import com.github.vfyjxf.nee.network.NEEGuiHandler;
|
||||
import com.github.vfyjxf.nee.utils.GuiUtils;
|
||||
import com.github.vfyjxf.nee.utils.ModIDs;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
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;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
|
||||
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
|
||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
public class PacketCraftingRequest implements IMessage {
|
||||
|
||||
@@ -116,6 +121,7 @@ public class PacketCraftingRequest implements IMessage {
|
||||
}
|
||||
|
||||
public static final class Handler implements IMessageHandler<PacketCraftingRequest, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketCraftingRequest message, MessageContext ctx) {
|
||||
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||
@@ -136,12 +142,18 @@ public class PacketCraftingRequest implements IMessage {
|
||||
if (security != null && security.hasPermission(player, SecurityPermissions.CRAFT)) {
|
||||
if (container instanceof ContainerCraftingTerm) {
|
||||
message.handlerCraftingTermRequest(
|
||||
(ContainerCraftingTerm) container, message, grid, player);
|
||||
(ContainerCraftingTerm) container,
|
||||
message,
|
||||
grid,
|
||||
player);
|
||||
}
|
||||
|
||||
if (container instanceof ContainerCraftingAmount) {
|
||||
message.handlerCraftingAmountRequest(
|
||||
(ContainerCraftingAmount) container, message, grid, player);
|
||||
(ContainerCraftingAmount) container,
|
||||
message,
|
||||
grid,
|
||||
player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -153,14 +165,18 @@ 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);
|
||||
player.worldObj,
|
||||
grid,
|
||||
container.getActionSource(),
|
||||
message.getRequireToCraftStack(),
|
||||
null);
|
||||
|
||||
final ContainerOpenContext context = container.getOpenContext();
|
||||
if (context != null) {
|
||||
@@ -181,8 +197,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);
|
||||
@@ -193,8 +209,8 @@ public class PacketCraftingRequest implements IMessage {
|
||||
ItemStack resultStack = container.getResultStack().copy();
|
||||
IAEItemStack result = null;
|
||||
/*
|
||||
*For some reason,the output from jei is different from the actual one,
|
||||
*so apply ItemStack.isItemEqual to match.
|
||||
* For some reason,the output from jei is different from the actual one, so apply ItemStack.isItemEqual
|
||||
* to match.
|
||||
*/
|
||||
for (IAEItemStack aeStack : all) {
|
||||
if (resultStack.isItemEqual(aeStack.getItemStack()) && aeStack.isCraftable()) {
|
||||
@@ -208,8 +224,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) {
|
||||
@@ -228,8 +244,7 @@ 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());
|
||||
@@ -248,15 +263,14 @@ public class PacketCraftingRequest implements IMessage {
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
if (security != null && security.hasPermission(player, SecurityPermissions.CRAFT)
|
||||
&& message.getRequireToCraftStack() != null) {
|
||||
Future<ICraftingJob> futureJob = null;
|
||||
try {
|
||||
@@ -274,12 +288,8 @@ 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());
|
||||
}
|
||||
@@ -336,8 +346,7 @@ 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();
|
||||
}
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
package com.github.vfyjxf.nee.network.packet;
|
||||
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import 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;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import wanion.avaritiaddons.block.extremeautocrafter.ContainerExtremeAutoCrafter;
|
||||
import wanion.avaritiaddons.block.extremeautocrafter.TileEntityExtremeAutoCrafter;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -45,6 +48,7 @@ public class PacketExtremeRecipe implements IMessage {
|
||||
}
|
||||
|
||||
public static final class Handler implements IMessageHandler<PacketExtremeRecipe, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketExtremeRecipe message, MessageContext ctx) {
|
||||
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||
@@ -72,19 +76,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);
|
||||
|
||||
@@ -2,6 +2,14 @@ package com.github.vfyjxf.nee.network.packet;
|
||||
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHandler.OUTPUT_KEY;
|
||||
|
||||
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 appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.ISecurityGrid;
|
||||
@@ -10,9 +18,11 @@ import appeng.container.AEBaseContainer;
|
||||
import appeng.container.implementations.ContainerPatternTerm;
|
||||
import appeng.container.implementations.ContainerPatternTermEx;
|
||||
import appeng.helpers.IContainerCraftingPacket;
|
||||
|
||||
import com.github.vfyjxf.nee.utils.ModIDs;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminal;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminalEx;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
@@ -20,12 +30,6 @@ 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;
|
||||
|
||||
public class PacketNEIPatternRecipe implements IMessage {
|
||||
|
||||
@@ -59,6 +63,7 @@ public class PacketNEIPatternRecipe implements IMessage {
|
||||
}
|
||||
|
||||
public static final class Handler implements IMessageHandler<PacketNEIPatternRecipe, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketNEIPatternRecipe message, MessageContext ctx) {
|
||||
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||
|
||||
@@ -4,22 +4,25 @@ 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;
|
||||
import com.github.vfyjxf.nee.network.NEEGuiHandler;
|
||||
import com.github.vfyjxf.nee.utils.GuiUtils;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.container.ContainerOpenContext;
|
||||
import appeng.container.implementations.ContainerCraftingTerm;
|
||||
|
||||
import com.github.vfyjxf.nee.container.ContainerCraftingAmount;
|
||||
import com.github.vfyjxf.nee.network.NEEGuiHandler;
|
||||
import com.github.vfyjxf.nee.utils.GuiUtils;
|
||||
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PacketOpenCraftAmount implements IMessage {
|
||||
|
||||
private NBTTagCompound recipe;
|
||||
@@ -41,6 +44,7 @@ public class PacketOpenCraftAmount implements IMessage {
|
||||
}
|
||||
|
||||
public static final class Handler implements IMessageHandler<PacketOpenCraftAmount, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketOpenCraftAmount message, MessageContext ctx) {
|
||||
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
package com.github.vfyjxf.nee.network.packet;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerOpenContext;
|
||||
|
||||
import com.github.vfyjxf.nee.network.NEEGuiHandler;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class PacketOpenGui implements IMessage {
|
||||
|
||||
|
||||
@@ -4,19 +4,6 @@ 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;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerNull;
|
||||
import com.github.vfyjxf.nee.block.tile.TilePatternInterface;
|
||||
import com.google.common.base.Optional;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
@@ -26,6 +13,22 @@ import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerNull;
|
||||
|
||||
import com.github.vfyjxf.nee.block.tile.TilePatternInterface;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PacketSetRecipe implements IMessage {
|
||||
|
||||
private NBTTagCompound recipe;
|
||||
@@ -71,9 +74,9 @@ public class PacketSetRecipe implements IMessage {
|
||||
|
||||
if (patternStack != null) {
|
||||
|
||||
// if (tpi.putPattern(patternStack)) {
|
||||
// return null;
|
||||
// }
|
||||
// if (tpi.putPattern(patternStack)) {
|
||||
// return null;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,8 +112,7 @@ 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();
|
||||
}
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
package com.github.vfyjxf.nee.network.packet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import 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;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -55,6 +57,7 @@ public class PacketSlotStackChange implements IMessage {
|
||||
}
|
||||
|
||||
public static final class Handler implements IMessageHandler<PacketSlotStackChange, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketSlotStackChange message, MessageContext ctx) {
|
||||
Container container = ctx.getServerHandler().playerEntity.openContainer;
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
package com.github.vfyjxf.nee.network.packet;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.implementations.ContainerPatternTerm;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -47,6 +48,7 @@ public class PacketStackCountChange implements IMessage {
|
||||
}
|
||||
|
||||
public static final class Handler implements IMessageHandler<PacketStackCountChange, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketStackCountChange message, MessageContext ctx) {
|
||||
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||
@@ -65,8 +67,7 @@ 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
|
||||
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();
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
package com.github.vfyjxf.nee.network.packet;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
|
||||
import com.github.vfyjxf.nee.nei.NEECraftingHelper;
|
||||
import com.github.vfyjxf.nee.utils.GuiUtils;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
@@ -11,8 +16,6 @@ import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -47,6 +50,7 @@ public class PacketValueConfigClient implements IMessage {
|
||||
}
|
||||
|
||||
public static final class Handler implements IMessageHandler<PacketValueConfigClient, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketValueConfigClient message, MessageContext ctx) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
|
||||
@@ -1,23 +1,26 @@
|
||||
package com.github.vfyjxf.nee.network.packet;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
|
||||
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
|
||||
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
|
||||
import com.github.vfyjxf.nee.block.tile.TilePatternInterface;
|
||||
import com.github.vfyjxf.nee.container.ContainerPatternInterface;
|
||||
import com.github.vfyjxf.nee.network.NEENetworkHandler;
|
||||
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
|
||||
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
|
||||
|
||||
public class PacketValueConfigServer implements IMessage {
|
||||
|
||||
@@ -49,6 +52,7 @@ public class PacketValueConfigServer implements IMessage {
|
||||
}
|
||||
|
||||
public static final class Handler implements IMessageHandler<PacketValueConfigServer, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketValueConfigServer message, MessageContext ctx) {
|
||||
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class AppengRecipeProcessor implements IRecipeProcessor {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class AvaritiaRecipeProcessor implements IRecipeProcessor {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
public class BloodMagicRecipeProcessor implements IRecipeProcessor {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import vazkii.botania.client.integration.nei.recipe.RecipeHandlerLexicaBotania;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
public class BotaniaRecipeProcessor implements IRecipeProcessor {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import buildcraft.compat.nei.RecipeHandlerAssemblyTable;
|
||||
import buildcraft.compat.nei.RecipeHandlerIntegrationTable;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -42,17 +44,15 @@ public class BuildCraftRecipeProcessor implements IRecipeProcessor {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
private List<PositionedStack> handlerAssemblyTableRecipe(
|
||||
RecipeHandlerAssemblyTable recipe, int recipeIndex, boolean getInput) {
|
||||
return getInput
|
||||
? recipe.getIngredientStacks(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)
|
||||
private List<PositionedStack> handlerIntegrationTableRecipe(RecipeHandlerIntegrationTable recipe, int recipeIndex,
|
||||
boolean getInput) {
|
||||
return getInput ? recipe.getIngredientStacks(recipeIndex)
|
||||
: Collections.singletonList(recipe.getResultStack(recipeIndex));
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,26 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import crazypants.enderio.nei.SagMillRecipeHandler;
|
||||
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"));
|
||||
return new HashSet<>(
|
||||
Arrays.asList(
|
||||
"EnderIOAlloySmelter",
|
||||
"EIOEnchanter",
|
||||
"EnderIOSagMill",
|
||||
"EnderIOSliceAndSplice",
|
||||
"EnderIOSoulBinder",
|
||||
"EnderIOVat"));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -46,10 +50,10 @@ public class EnderIORecipeProcessor implements IRecipeProcessor {
|
||||
recipeOutputs.addAll(recipe.getOtherStacks(recipeIndex));
|
||||
// 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;
|
||||
}
|
||||
|
||||
@@ -1,25 +1,28 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class ForestryRecipeProcessor implements IRecipeProcessor {
|
||||
|
||||
@Nonnull
|
||||
@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));
|
||||
return new HashSet<>(
|
||||
Arrays.asList(
|
||||
"forestry.bottler",
|
||||
"forestry.carpenter",
|
||||
"forestry.centrifuge",
|
||||
"forestry.fabricator",
|
||||
"forestry.fermenter",
|
||||
"forestry.moistener",
|
||||
"forestry.squeezer",
|
||||
"forestry.still",
|
||||
RecipeProcessor.NULL_IDENTIFIER));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import gregtech.api.util.GTPP_Recipe;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
public class GTPPRecipeProcessor implements IRecipeProcessor {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
@@ -36,9 +39,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;
|
||||
@@ -50,8 +53,9 @@ 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;
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
public class GoodGeneratorRecipeProcessor implements IRecipeProcessor {
|
||||
|
||||
@Nonnull
|
||||
@@ -29,9 +31,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;
|
||||
@@ -43,8 +45,9 @@ 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;
|
||||
|
||||
@@ -1,23 +1,28 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import com.github.vfyjxf.nee.utils.GuiUtils;
|
||||
import com.glodblock.github.client.gui.GuiFluidPatternTerminalEx;
|
||||
import gregtech.api.enums.ItemList;
|
||||
import gregtech.api.util.GT_Recipe;
|
||||
import gregtech.nei.GT_NEI_DefaultHandler.FixedPositionedStack;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import com.github.vfyjxf.nee.utils.GuiUtils;
|
||||
import com.glodblock.github.client.gui.GuiFluidPatternTerminalEx;
|
||||
|
||||
import gregtech.api.enums.ItemList;
|
||||
import gregtech.api.util.GT_Recipe;
|
||||
import gregtech.nei.GT_NEI_DefaultHandler.FixedPositionedStack;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
@@ -39,12 +44,10 @@ public class GregTech5RecipeProcessor implements IRecipeProcessor {
|
||||
}
|
||||
|
||||
/**
|
||||
* For resolving NoSuchMethodError
|
||||
* Copied from GTNewHorizons/GT5-Unofficial.
|
||||
* For resolving NoSuchMethodError Copied from GTNewHorizons/GT5-Unofficial.
|
||||
*/
|
||||
public static FluidStack getFluidFromDisplayStack(ItemStack aDisplayStack) {
|
||||
if (!isStackValid(aDisplayStack)
|
||||
|| aDisplayStack.getItem() != ItemList.Display_Fluid.getItem()
|
||||
if (!isStackValid(aDisplayStack) || aDisplayStack.getItem() != ItemList.Display_Fluid.getItem()
|
||||
|| !aDisplayStack.hasTagCompound()) {
|
||||
return null;
|
||||
}
|
||||
@@ -53,8 +56,7 @@ public class GregTech5RecipeProcessor implements IRecipeProcessor {
|
||||
}
|
||||
|
||||
public static boolean isStackValid(Object aStack) {
|
||||
return (aStack instanceof ItemStack)
|
||||
&& ((ItemStack) aStack).getItem() != null
|
||||
return (aStack instanceof ItemStack) && ((ItemStack) aStack).getItem() != null
|
||||
&& ((ItemStack) aStack).stackSize >= 0;
|
||||
}
|
||||
|
||||
@@ -84,8 +86,8 @@ public class GregTech5RecipeProcessor implements IRecipeProcessor {
|
||||
List<PositionedStack> recipeInputs = new ArrayList<>();
|
||||
if (gtDefaultClz.isInstance(recipe) || gtAssLineClz.isInstance(recipe)) {
|
||||
if (GuiUtils.isFluidCraftPatternTermEx(Minecraft.getMinecraft().currentScreen)) {
|
||||
boolean priority =
|
||||
((GuiFluidPatternTerminalEx) Minecraft.getMinecraft().currentScreen).container.prioritize;
|
||||
boolean priority = ((GuiFluidPatternTerminalEx) Minecraft
|
||||
.getMinecraft().currentScreen).container.prioritize;
|
||||
if (priority) {
|
||||
for (PositionedStack ps : recipe.getIngredientStacks(recipeIndex)) {
|
||||
if (ps != null && getFluidFromDisplayStack(ps.item) != null) {
|
||||
@@ -102,8 +104,9 @@ public class GregTech5RecipeProcessor implements IRecipeProcessor {
|
||||
}
|
||||
} else {
|
||||
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];
|
||||
@@ -126,8 +129,8 @@ public class GregTech5RecipeProcessor implements IRecipeProcessor {
|
||||
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
|
||||
recipeOutputs.removeIf(
|
||||
stack -> stack instanceof FixedPositionedStack && !(((FixedPositionedStack) stack).mChance == 10000
|
||||
|| ((FixedPositionedStack) stack).mChance <= 0));
|
||||
return recipeOutputs;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
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;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
@@ -7,18 +17,12 @@ import gregapi.NEI_RecipeMap;
|
||||
import gregapi.NEI_RecipeMap.FixedPositionedStack;
|
||||
import gregapi.data.FL;
|
||||
import gregapi.recipes.Recipe;
|
||||
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
|
||||
*/
|
||||
public class GregTech6RecipeProcessor implements IRecipeProcessor {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
@@ -44,8 +48,9 @@ public class GregTech6RecipeProcessor implements IRecipeProcessor {
|
||||
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);
|
||||
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");
|
||||
@@ -76,13 +81,15 @@ 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);
|
||||
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 -> positionedStack instanceof FixedPositionedStack
|
||||
&& ((FixedPositionedStack) positionedStack).mChance > 0
|
||||
&& ((FixedPositionedStack) positionedStack).mChance
|
||||
!= ((FixedPositionedStack) positionedStack).mMaxChance);
|
||||
return recipeOutput;
|
||||
}
|
||||
return recipeOutput;
|
||||
|
||||
@@ -1,28 +1,32 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
public class ICRecipeProcessor implements IRecipeProcessor {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"blastfurnace",
|
||||
"BlockCutter",
|
||||
"centrifuge",
|
||||
"compressor",
|
||||
"extractor",
|
||||
"fluidcanner",
|
||||
"macerator",
|
||||
"metalformer",
|
||||
"oreWashing",
|
||||
"solidcanner"));
|
||||
return new HashSet<>(
|
||||
Arrays.asList(
|
||||
"blastfurnace",
|
||||
"BlockCutter",
|
||||
"centrifuge",
|
||||
"compressor",
|
||||
"extractor",
|
||||
"fluidcanner",
|
||||
"macerator",
|
||||
"metalformer",
|
||||
"oreWashing",
|
||||
"solidcanner"));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
|
||||
+20
-17
@@ -1,30 +1,34 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
public class ImmersiveEngineeringRecipeProcessor implements IRecipeProcessor {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"ieArcFurnace",
|
||||
"ieBlastFurnace",
|
||||
"ieBlueprintCrafting",
|
||||
"ieBottlingMachine",
|
||||
"ieCokeOven",
|
||||
"ieCrusher",
|
||||
"ieFermenter",
|
||||
"ieHammerCrushing",
|
||||
"ieMetalPress",
|
||||
"ieRefinery",
|
||||
"ieShaderBag",
|
||||
"ieSqueezer"));
|
||||
return new HashSet<>(
|
||||
Arrays.asList(
|
||||
"ieArcFurnace",
|
||||
"ieBlastFurnace",
|
||||
"ieBlueprintCrafting",
|
||||
"ieBottlingMachine",
|
||||
"ieCokeOven",
|
||||
"ieCrusher",
|
||||
"ieFermenter",
|
||||
"ieHammerCrushing",
|
||||
"ieMetalPress",
|
||||
"ieRefinery",
|
||||
"ieShaderBag",
|
||||
"ieSqueezer"));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -39,8 +43,7 @@ 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)
|
||||
if (!("ieArcFurnace".equals(identifier) || "ieCrusher".equals(identifier)
|
||||
|| "ieBlastFurnace".equals(identifier))) {
|
||||
recipeInputs.addAll(recipe.getOtherStacks(recipeIndex));
|
||||
}
|
||||
|
||||
@@ -1,34 +1,38 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
public class MekanismRecipeProcessor implements IRecipeProcessor {
|
||||
|
||||
@Nonnull
|
||||
@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"));
|
||||
return new HashSet<>(
|
||||
Arrays.asList(
|
||||
"chemicalinfuser",
|
||||
"chemicalinjectionchamber",
|
||||
"chemicaloxidizer",
|
||||
"chemicalwasher",
|
||||
"combiner",
|
||||
"crusher",
|
||||
"electrolyticseparator",
|
||||
"chamber",
|
||||
"infuser",
|
||||
"compressor",
|
||||
"prc",
|
||||
"precisionsawmill",
|
||||
"purificationchamber",
|
||||
"rotarycondensentrator",
|
||||
"solarneutron",
|
||||
"thermalevaporation"));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.github.vfyjxf.nee.NotEnoughEnergistics;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RecipeProcessor {
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import com.djgiannuzz.thaumcraftneiplugin.items.ItemAspect;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -14,12 +17,13 @@ public class TCNEIPluginRecipeProcessor implements IRecipeProcessor {
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"arcaneshapedrecipes",
|
||||
"arcaneshapelessrecipes",
|
||||
"aspectsRecipe",
|
||||
"cruciblerecipe",
|
||||
"infusionCrafting"));
|
||||
return new HashSet<>(
|
||||
Arrays.asList(
|
||||
"arcaneshapedrecipes",
|
||||
"arcaneshapelessrecipes",
|
||||
"aspectsRecipe",
|
||||
"cruciblerecipe",
|
||||
"infusionCrafting"));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
+27
-24
@@ -1,12 +1,14 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import cofh.thermalexpansion.plugins.nei.handlers.RecipeHandlerBase;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class ThermalExpansionRecipeProcessor implements IRecipeProcessor {
|
||||
|
||||
@@ -14,8 +16,8 @@ public class ThermalExpansionRecipeProcessor implements IRecipeProcessor {
|
||||
|
||||
static {
|
||||
try {
|
||||
thermalNeiRecipeBaseClass =
|
||||
Class.forName("cofh.thermalexpansion.plugins.nei.handlers.RecipeHandlerBase$NEIRecipeBase");
|
||||
thermalNeiRecipeBaseClass = Class
|
||||
.forName("cofh.thermalexpansion.plugins.nei.handlers.RecipeHandlerBase$NEIRecipeBase");
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -24,15 +26,16 @@ public class ThermalExpansionRecipeProcessor implements IRecipeProcessor {
|
||||
@Nonnull
|
||||
@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"));
|
||||
return new HashSet<>(
|
||||
Arrays.asList(
|
||||
"thermalexpansion.charger",
|
||||
"thermalexpansion.crucible",
|
||||
"thermalexpansion.furnace",
|
||||
"thermalexpansion.insolator",
|
||||
"thermalexpansion.pulverizer",
|
||||
"thermalexpansion.sawmill",
|
||||
"thermalexpansion.smelter",
|
||||
"thermalexpansion.transposer"));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -52,8 +55,8 @@ public class ThermalExpansionRecipeProcessor implements IRecipeProcessor {
|
||||
Field secondaryInputField = ReflectionHelper.findField(thermalNeiRecipeBaseClass, "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();
|
||||
}
|
||||
@@ -76,17 +79,17 @@ public class ThermalExpansionRecipeProcessor implements IRecipeProcessor {
|
||||
recipeOutputs.add(recipe.getResultStack(recipeIndex));
|
||||
if (recipe instanceof RecipeHandlerBase) {
|
||||
if (thermalNeiRecipeBaseClass != null) {
|
||||
Field secondaryOutputField =
|
||||
ReflectionHelper.findField(thermalNeiRecipeBaseClass, "secondaryOutput");
|
||||
Field secondaryOutputChanceField =
|
||||
ReflectionHelper.findField(thermalNeiRecipeBaseClass, "secondaryOutputChance");
|
||||
Field secondaryOutputField = ReflectionHelper
|
||||
.findField(thermalNeiRecipeBaseClass, "secondaryOutput");
|
||||
Field secondaryOutputChanceField = ReflectionHelper
|
||||
.findField(thermalNeiRecipeBaseClass, "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();
|
||||
}
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
public class VanillaRecipeProcessor implements IRecipeProcessor {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
package com.github.vfyjxf.nee.proxy;
|
||||
|
||||
import net.minecraftforge.client.ClientCommandHandler;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import com.github.vfyjxf.nee.NEECommands;
|
||||
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.NEECraftingHelper;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
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) {
|
||||
super.init(event);
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.github.vfyjxf.nee.proxy;
|
||||
|
||||
import static com.github.vfyjxf.nee.block.BlockPatternInterface.BLOCK_INSTANCE;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
@@ -11,20 +14,21 @@ import appeng.api.util.AEColor;
|
||||
import appeng.core.features.ActivityState;
|
||||
import appeng.core.features.BlockStackSrc;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
import com.github.vfyjxf.nee.NotEnoughEnergistics;
|
||||
import com.github.vfyjxf.nee.block.BlockPatternInterface;
|
||||
import com.github.vfyjxf.nee.block.tile.TilePatternInterface;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
public class CommonProxy {
|
||||
|
||||
public void init(FMLInitializationEvent event) {
|
||||
AEBaseTile.registerTileItem(
|
||||
TilePatternInterface.class, new BlockStackSrc(BLOCK_INSTANCE, 0, ActivityState.Enabled));
|
||||
TilePatternInterface.class,
|
||||
new BlockStackSrc(BLOCK_INSTANCE, 0, ActivityState.Enabled));
|
||||
registerRecipe();
|
||||
}
|
||||
|
||||
@@ -44,7 +48,8 @@ public class CommonProxy {
|
||||
|
||||
public void registerTileEntities() {
|
||||
GameRegistry.registerTileEntity(
|
||||
TilePatternInterface.class, NotEnoughEnergistics.MODID + "." + "tile.pattern_interface");
|
||||
TilePatternInterface.class,
|
||||
NotEnoughEnergistics.MODID + "." + "tile.pattern_interface");
|
||||
}
|
||||
|
||||
public void registerRecipe() {
|
||||
@@ -71,20 +76,21 @@ 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));
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.github.vfyjxf.nee.proxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
|
||||
public class ServerProxy extends CommonProxy {
|
||||
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event) {
|
||||
super.init(event);
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
package com.github.vfyjxf.nee.utils;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||
import appeng.client.gui.implementations.GuiCraftingTerm;
|
||||
import appeng.client.gui.implementations.GuiPatternTerm;
|
||||
@@ -7,17 +13,13 @@ import appeng.client.gui.implementations.GuiPatternTermEx;
|
||||
import appeng.container.implementations.ContainerPatternTerm;
|
||||
import appeng.container.implementations.ContainerPatternTermEx;
|
||||
import appeng.helpers.IContainerCraftingPacket;
|
||||
|
||||
import com.github.vfyjxf.nee.container.WCTContainerCraftingConfirm;
|
||||
import com.glodblock.github.client.gui.GuiFluidPatternTerminal;
|
||||
import com.glodblock.github.client.gui.GuiFluidPatternTerminalEx;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminal;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminalEx;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
@@ -34,8 +36,7 @@ public class GuiUtils {
|
||||
|
||||
public static boolean isWirelessCraftingTermContainer(Container container) {
|
||||
if (!isWirelessCraftingTerminalModLoaded) return false;
|
||||
return container
|
||||
instanceof net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
|
||||
return container instanceof net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
|
||||
}
|
||||
|
||||
public static boolean isContainerWirelessCraftingConfirm(Container container) {
|
||||
@@ -72,8 +73,7 @@ public class GuiUtils {
|
||||
|
||||
public static boolean isPatternContainer(Container container) {
|
||||
if (isFluidCraftModloaded) {
|
||||
return container instanceof ContainerPatternTerm
|
||||
|| container instanceof ContainerPatternTermEx
|
||||
return container instanceof ContainerPatternTerm || container instanceof ContainerPatternTermEx
|
||||
|| container instanceof ContainerFluidPatternTerminal
|
||||
|| container instanceof ContainerFluidPatternTerminalEx;
|
||||
} else {
|
||||
@@ -96,8 +96,7 @@ public class GuiUtils {
|
||||
|
||||
public static boolean isPatternTerm(GuiScreen guiScreen) {
|
||||
if (isFluidCraftModloaded) {
|
||||
return guiScreen instanceof GuiPatternTerm
|
||||
|| guiScreen instanceof GuiPatternTermEx
|
||||
return guiScreen instanceof GuiPatternTerm || guiScreen instanceof GuiPatternTermEx
|
||||
|| guiScreen instanceof GuiFluidPatternTerminal
|
||||
|| guiScreen instanceof GuiFluidPatternTerminalEx;
|
||||
} else {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.github.vfyjxf.nee.utils;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
|
||||
public class Ingredient {
|
||||
|
||||
private long requireCount;
|
||||
|
||||
@@ -3,6 +3,15 @@ package com.github.vfyjxf.nee.utils;
|
||||
import static com.github.vfyjxf.nee.nei.NEECraftingHelper.noPreview;
|
||||
import static com.github.vfyjxf.nee.utils.GuiUtils.isFluidCraftPatternTerm;
|
||||
|
||||
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 appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.implementations.GuiMEMonitorable;
|
||||
@@ -11,18 +20,12 @@ import appeng.util.item.AEItemStack;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import com.github.vfyjxf.nee.config.NEEConfig;
|
||||
import com.github.vfyjxf.nee.network.NEENetworkHandler;
|
||||
import com.github.vfyjxf.nee.network.packet.PacketCraftingRequest;
|
||||
import com.glodblock.github.client.gui.base.FCGuiMonitor;
|
||||
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;
|
||||
|
||||
public class IngredientTracker {
|
||||
|
||||
@@ -79,11 +82,9 @@ public class IngredientTracker {
|
||||
|
||||
private ItemRepo getRepo() throws IllegalAccessException {
|
||||
if (isFluidCraftPatternTerm(termGui)) {
|
||||
return (ItemRepo)
|
||||
ReflectionHelper.findField(FCGuiMonitor.class, "repo").get(termGui);
|
||||
return (ItemRepo) ReflectionHelper.findField(FCGuiMonitor.class, "repo").get(termGui);
|
||||
} else {
|
||||
return (ItemRepo)
|
||||
ReflectionHelper.findField(GuiMEMonitorable.class, "repo").get(termGui);
|
||||
return (ItemRepo) ReflectionHelper.findField(GuiMEMonitorable.class, "repo").get(termGui);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,14 +96,12 @@ public class IngredientTracker {
|
||||
try {
|
||||
if (!GuiUtils.isGuiWirelessCrafting(termGui)) {
|
||||
ItemRepo repo = getRepo();
|
||||
list = (IItemList<IAEItemStack>)
|
||||
ReflectionHelper.findField(ItemRepo.class, "list").get(repo);
|
||||
list = (IItemList<IAEItemStack>) ReflectionHelper.findField(ItemRepo.class, "list").get(repo);
|
||||
} else {
|
||||
// wireless crafting terminal support
|
||||
ItemRepo repo = (ItemRepo) ReflectionHelper.findField(GuiWirelessCraftingTerminal.class, "repo")
|
||||
.get(termGui);
|
||||
list = (IItemList<IAEItemStack>)
|
||||
ReflectionHelper.findField(ItemRepo.class, "list").get(repo);
|
||||
list = (IItemList<IAEItemStack>) ReflectionHelper.findField(ItemRepo.class, "list").get(repo);
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
@@ -124,18 +123,17 @@ 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
|
||||
ItemRepo repo = (ItemRepo) ReflectionHelper.findField(GuiWirelessCraftingTerminal.class, "repo")
|
||||
.get(termGui);
|
||||
for (IAEItemStack stack : (IItemList<IAEItemStack>)
|
||||
ReflectionHelper.findField(ItemRepo.class, "list").get(repo)) {
|
||||
for (IAEItemStack stack : (IItemList<IAEItemStack>) ReflectionHelper
|
||||
.findField(ItemRepo.class, "list").get(repo)) {
|
||||
list.add(stack.copy());
|
||||
}
|
||||
}
|
||||
@@ -214,8 +212,7 @@ public class IngredientTracker {
|
||||
}
|
||||
} else {
|
||||
ItemStack craftableStack = ingredient.getCraftableIngredient();
|
||||
if (craftableStack != null
|
||||
&& craftableStack.isItemEqual(stack)
|
||||
if (craftableStack != null && craftableStack.isItemEqual(stack)
|
||||
&& ItemStack.areItemStackTagsEqual(craftableStack, stack)
|
||||
&& stack.stackSize > 0) {
|
||||
int missingCount = (int) ingredient.getMissingCount();
|
||||
@@ -254,8 +251,7 @@ public class IngredientTracker {
|
||||
List<ItemStack> inventoryStacks = new ArrayList<>();
|
||||
|
||||
for (Slot slot : (List<Slot>) termGui.inventorySlots.inventorySlots) {
|
||||
boolean canGetStack = slot != null
|
||||
&& slot.getHasStack()
|
||||
boolean canGetStack = slot != null && slot.getHasStack()
|
||||
&& slot.getStack().stackSize > 0
|
||||
&& slot.isItemValid(slot.getStack())
|
||||
&& slot.canTakeStack(Minecraft.getMinecraft().thePlayer);
|
||||
|
||||
@@ -2,22 +2,26 @@ 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;
|
||||
import com.github.vfyjxf.nee.processor.RecipeProcessor;
|
||||
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 codechicken.nei.PositionedStack;
|
||||
|
||||
import com.github.vfyjxf.nee.NotEnoughEnergistics;
|
||||
import com.github.vfyjxf.nee.processor.IRecipeProcessor;
|
||||
import com.github.vfyjxf.nee.processor.RecipeProcessor;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public final class ItemUtils {
|
||||
|
||||
public static Gson gson = new Gson();
|
||||
@@ -29,8 +33,7 @@ public final class ItemUtils {
|
||||
static {
|
||||
try {
|
||||
GT_MetaGenerated_ToolClass = Class.forName("gregtech.api.items.GT_MetaGenerated_Tool");
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
}
|
||||
} catch (ClassNotFoundException ignored) {}
|
||||
}
|
||||
|
||||
public static void reloadConfig() {
|
||||
@@ -65,8 +68,12 @@ 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,8 +108,12 @@ 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,11 +197,18 @@ 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) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.github.vfyjxf.nee.utils;
|
||||
|
||||
public class ModIDs {
|
||||
|
||||
public static final String WCT = "ae2wct";
|
||||
public static final String FC = "ae2fc";
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class StackProcessor {
|
||||
|
||||
public String modid;
|
||||
public String name;
|
||||
public String meta;
|
||||
|
||||
Reference in new issue
Block a user