mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-17 02:45:08 +00:00
spotless apply
This commit is contained in:
1 parent
6acf2bace1
commit
5e31096c7e
191 files changed
+5046
-5165
No files matched your search
+4
-6
@@ -7,18 +7,17 @@ import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.GuiBaseFluidPatternTerminalEx;
|
||||
import com.glodblock.github.client.gui.GuiFluidPatternTerminal;
|
||||
import com.glodblock.github.client.gui.GuiFluidPatternTerminalEx;
|
||||
import com.glodblock.github.client.gui.container.FluidPrioritization;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
import com.glodblock.github.nei.recipes.FluidRecipe;
|
||||
import com.glodblock.github.network.CPacketTransferRecipe;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
|
||||
public class FluidPatternTerminalRecipeTransferHandler implements IOverlayHandler {
|
||||
|
||||
public static final FluidPatternTerminalRecipeTransferHandler INSTANCE = new FluidPatternTerminalRecipeTransferHandler();
|
||||
public static final FluidPatternTerminalRecipeTransferHandler INSTANCE =
|
||||
new FluidPatternTerminalRecipeTransferHandler();
|
||||
public static final HashSet<String> notOtherSet = new HashSet<>();
|
||||
public static final HashSet<String> craftSet = new HashSet<>();
|
||||
|
||||
@@ -34,7 +33,7 @@ public class FluidPatternTerminalRecipeTransferHandler implements IOverlayHandle
|
||||
if (isCorrectGui(firstGui)) {
|
||||
boolean priority = false;
|
||||
if (firstGui instanceof GuiBaseFluidPatternTerminalEx) {
|
||||
priority = ((GuiBaseFluidPatternTerminalEx)firstGui).container.prioritize;
|
||||
priority = ((GuiBaseFluidPatternTerminalEx) firstGui).container.prioritize;
|
||||
}
|
||||
List<OrderStack<?>> in = FluidRecipe.getPackageInputs(recipe, recipeIndex, priority);
|
||||
List<OrderStack<?>> out = FluidRecipe.getPackageOutputs(recipe, recipeIndex, !notUseOther(recipe));
|
||||
@@ -56,5 +55,4 @@ public class FluidPatternTerminalRecipeTransferHandler implements IOverlayHandle
|
||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipeHandler;
|
||||
return craftSet.contains(tRecipe.getOverlayIdentifier());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,5 +16,4 @@ public class NEIGuiHandler extends INEIGuiAdapter {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +1,13 @@
|
||||
package com.glodblock.github.nei;
|
||||
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class NEIUtils {
|
||||
|
||||
@@ -26,8 +25,10 @@ public class NEIUtils {
|
||||
for (OrderStack<?> storedStack : comp) {
|
||||
if (storedStack == null || !(storedStack.getStack() instanceof ItemStack)) continue;
|
||||
ItemStack firstStack = (ItemStack) storedStack.getStack();
|
||||
boolean areItemStackEqual = firstStack.isItemEqual(currentStack) && ItemStack.areItemStackTagsEqual(firstStack, currentStack);
|
||||
if (areItemStackEqual && (firstStack.stackSize + currentStack.stackSize) <= firstStack.getMaxStackSize()) {
|
||||
boolean areItemStackEqual = firstStack.isItemEqual(currentStack)
|
||||
&& ItemStack.areItemStackTagsEqual(firstStack, currentStack);
|
||||
if (areItemStackEqual
|
||||
&& (firstStack.stackSize + currentStack.stackSize) <= firstStack.getMaxStackSize()) {
|
||||
find = true;
|
||||
((ItemStack) storedStack.getStack()).stackSize = firstStack.stackSize + currentStack.stackSize;
|
||||
}
|
||||
@@ -52,13 +53,12 @@ public class NEIUtils {
|
||||
}
|
||||
}
|
||||
int id = 0;
|
||||
for (int i = 0; i <= upper; i ++) {
|
||||
for (int i = 0; i <= upper; i++) {
|
||||
if (map.containsKey(i)) {
|
||||
cleared.add(new OrderStack<>(map.get(i), id));
|
||||
id ++;
|
||||
id++;
|
||||
}
|
||||
}
|
||||
return cleared;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,8 +14,10 @@ public class NEI_FC_Config implements IConfigureNEI {
|
||||
API.registerNEIGuiHandler(new NEIGuiHandler());
|
||||
|
||||
for (String identifier : FluidRecipe.getSupportRecipes()) {
|
||||
API.registerGuiOverlayHandler(GuiFluidPatternTerminal.class, FluidPatternTerminalRecipeTransferHandler.INSTANCE, identifier);
|
||||
API.registerGuiOverlayHandler(GuiFluidPatternTerminalEx.class, FluidPatternTerminalRecipeTransferHandler.INSTANCE, identifier);
|
||||
API.registerGuiOverlayHandler(
|
||||
GuiFluidPatternTerminal.class, FluidPatternTerminalRecipeTransferHandler.INSTANCE, identifier);
|
||||
API.registerGuiOverlayHandler(
|
||||
GuiFluidPatternTerminalEx.class, FluidPatternTerminalRecipeTransferHandler.INSTANCE, identifier);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,5 +5,4 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
public interface IFluidDummy {
|
||||
|
||||
FluidStack getFluidStack();
|
||||
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package com.glodblock.github.nei.object;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IRecipeExtractor {
|
||||
@@ -15,8 +14,8 @@ public interface IRecipeExtractor {
|
||||
return getInputIngredients(rawInputs);
|
||||
}
|
||||
|
||||
default List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs, IRecipeHandler recipe, int index) {
|
||||
default List<OrderStack<?>> getOutputIngredients(
|
||||
List<PositionedStack> rawOutputs, IRecipeHandler recipe, int index) {
|
||||
return getOutputIngredients(rawOutputs);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,5 +3,4 @@ package com.glodblock.github.nei.object;
|
||||
public interface IRecipeExtractorLegacy extends IRecipeExtractor {
|
||||
|
||||
String getClassName();
|
||||
|
||||
}
|
||||
@@ -5,5 +5,4 @@ public class IllegalOrderStackID extends RuntimeException {
|
||||
public IllegalOrderStackID(int id) {
|
||||
super("Illegal type id: " + id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,22 +2,21 @@ package com.glodblock.github.nei.object;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import com.glodblock.github.util.Util;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class OrderStack<T> {
|
||||
|
||||
private final T RealStack;
|
||||
private final int index;
|
||||
|
||||
public final static int ITEM = 1;
|
||||
public final static int FLUID = 2;
|
||||
public final static int CUSTOM = 3;
|
||||
public static final int ITEM = 1;
|
||||
public static final int FLUID = 2;
|
||||
public static final int CUSTOM = 3;
|
||||
|
||||
public OrderStack(T stack, int order) {
|
||||
if (stack == null || order < 0)
|
||||
@@ -40,8 +39,7 @@ public class OrderStack<T> {
|
||||
ItemStack tmp = stack.items[0].copy();
|
||||
tmp.setItemDamage(0);
|
||||
return new OrderStack<>(tmp, index);
|
||||
}
|
||||
else return new OrderStack<>(stack.items[0].copy(), index);
|
||||
} else return new OrderStack<>(stack.items[0].copy(), index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -55,8 +53,7 @@ public class OrderStack<T> {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void customNBTWriter(NBTTagCompound buf) {
|
||||
}
|
||||
protected void customNBTWriter(NBTTagCompound buf) {}
|
||||
|
||||
protected T customNBTReader(NBTTagCompound buf) {
|
||||
return null;
|
||||
@@ -68,14 +65,12 @@ public class OrderStack<T> {
|
||||
tmp.setByte("t", (byte) ITEM);
|
||||
((ItemStack) RealStack).writeToNBT(tmp);
|
||||
buf.setTag(index + ":", tmp);
|
||||
}
|
||||
else if (RealStack instanceof FluidStack) {
|
||||
} else if (RealStack instanceof FluidStack) {
|
||||
NBTTagCompound tmp = new NBTTagCompound();
|
||||
tmp.setByte("t", (byte) FLUID);
|
||||
((FluidStack) RealStack).writeToNBT(tmp);
|
||||
buf.setTag(index + ":", tmp);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
NBTTagCompound tmp = new NBTTagCompound();
|
||||
tmp.setByte("t", (byte) CUSTOM);
|
||||
customNBTWriter(tmp);
|
||||
@@ -99,5 +94,4 @@ public class OrderStack<T> {
|
||||
throw new IllegalOrderStackID(id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,7 +18,10 @@ public class DefaultExtractorLoader implements Runnable {
|
||||
|
||||
if (ModAndClassUtil.GT5) {
|
||||
for (GT_Recipe.GT_Recipe_Map tMap : GT_Recipe.GT_Recipe_Map.sMappings) {
|
||||
FluidRecipe.addRecipeMap(tMap.mNEIName, new GregTech5RecipeExtractor(tMap.mNEIName.equals("gt.recipe.scanner") || tMap.mNEIName.equals("gt.recipe.fakeAssemblylineProcess")));
|
||||
FluidRecipe.addRecipeMap(
|
||||
tMap.mNEIName,
|
||||
new GregTech5RecipeExtractor(tMap.mNEIName.equals("gt.recipe.scanner")
|
||||
|| tMap.mNEIName.equals("gt.recipe.fakeAssemblylineProcess")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +82,5 @@ public class DefaultExtractorLoader implements Runnable {
|
||||
FluidRecipe.addRecipeMap("oreWashing", new IndustrialCraftRecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("solidcanner", new IndustrialCraftRecipeExtractor());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,16 +6,12 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import com.glodblock.github.nei.object.IRecipeExtractor;
|
||||
import com.glodblock.github.nei.object.IRecipeExtractorLegacy;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
import gregtech.common.items.GT_FluidDisplayItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public final class FluidRecipe {
|
||||
|
||||
@@ -86,6 +82,4 @@ public final class FluidRecipe {
|
||||
if (useOther) tmp.addAll(recipe.getOtherStacks(index));
|
||||
return extractor.getOutputIngredients(tmp, recipe, index);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+13
-18
@@ -8,22 +8,20 @@ import com.glodblock.github.nei.object.OrderStack;
|
||||
import com.glodblock.github.util.Ae2Reflect;
|
||||
import crazypants.enderio.machine.crusher.CrusherRecipeManager;
|
||||
import crazypants.enderio.nei.VatRecipeHandler;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class EnderIORecipeExtractor implements IRecipeExtractor {
|
||||
|
||||
public EnderIORecipeExtractor() {
|
||||
}
|
||||
public EnderIORecipeExtractor() {}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||
for (int i = 0; i < rawInputs.size(); i ++) {
|
||||
for (int i = 0; i < rawInputs.size(); i++) {
|
||||
if (rawInputs.get(i) == null) continue;
|
||||
OrderStack<?> stack = OrderStack.pack(rawInputs.get(i), i);
|
||||
if (stack != null) tmp.add(stack);
|
||||
@@ -34,7 +32,7 @@ public class EnderIORecipeExtractor implements IRecipeExtractor {
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||
for (int i = 0; i < rawOutputs.size(); i ++) {
|
||||
for (int i = 0; i < rawOutputs.size(); i++) {
|
||||
if (rawOutputs.get(i) == null) continue;
|
||||
OrderStack<?> stack = OrderStack.pack(rawOutputs.get(i), i);
|
||||
if (stack != null) tmp.add(stack);
|
||||
@@ -49,7 +47,7 @@ public class EnderIORecipeExtractor implements IRecipeExtractor {
|
||||
if (tRecipe.arecipes.get(index) instanceof VatRecipeHandler.InnerVatRecipe) {
|
||||
VatRecipeHandler.InnerVatRecipe vatRecipe = (VatRecipeHandler.InnerVatRecipe) tRecipe.arecipes.get(index);
|
||||
ArrayList<PositionedStack> inputs = ReflectEIO.getInputs(vatRecipe);
|
||||
for (int i = 0; i < inputs.size(); i ++) {
|
||||
for (int i = 0; i < inputs.size(); i++) {
|
||||
if (inputs.get(i) == null) continue;
|
||||
OrderStack<?> stack = OrderStack.pack(rawInputs.get(i), i);
|
||||
if (stack != null) tmp.add(stack);
|
||||
@@ -60,7 +58,7 @@ public class EnderIORecipeExtractor implements IRecipeExtractor {
|
||||
}
|
||||
return tmp;
|
||||
} else if (tRecipe.getOverlayIdentifier().equals("EnderIOSagMill")) {
|
||||
for (int i = rawInputs.size() - 1; i >= 0; i --) {
|
||||
for (int i = rawInputs.size() - 1; i >= 0; i--) {
|
||||
PositionedStack stack = rawInputs.get(i);
|
||||
if (stack != null && CrusherRecipeManager.getInstance().isValidSagBall(stack.items[0])) {
|
||||
rawInputs.remove(i);
|
||||
@@ -68,14 +66,14 @@ public class EnderIORecipeExtractor implements IRecipeExtractor {
|
||||
}
|
||||
}
|
||||
return getInputIngredients(rawInputs);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return getInputIngredients(rawInputs);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs, IRecipeHandler recipe, int index) {
|
||||
public List<OrderStack<?>> getOutputIngredients(
|
||||
List<PositionedStack> rawOutputs, IRecipeHandler recipe, int index) {
|
||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||
if (tRecipe.arecipes.get(index) instanceof VatRecipeHandler.InnerVatRecipe) {
|
||||
@@ -85,17 +83,16 @@ public class EnderIORecipeExtractor implements IRecipeExtractor {
|
||||
tmp.add(new OrderStack<>(result, 0));
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return getOutputIngredients(rawOutputs);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ReflectEIO {
|
||||
|
||||
private final static Field inputsF;
|
||||
private final static Field resultF;
|
||||
private final static Field inFluidF;
|
||||
private static final Field inputsF;
|
||||
private static final Field resultF;
|
||||
private static final Field inFluidF;
|
||||
|
||||
static {
|
||||
try {
|
||||
@@ -118,7 +115,5 @@ public class EnderIORecipeExtractor implements IRecipeExtractor {
|
||||
private static FluidStack getInputFluid(VatRecipeHandler.InnerVatRecipe vat) {
|
||||
return Ae2Reflect.readField(vat, inFluidF);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+10
-10
@@ -9,11 +9,10 @@ import forestry.core.recipes.nei.PositionedFluidTank;
|
||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||
import forestry.factory.recipes.nei.NEIHandlerFabricator;
|
||||
import forestry.factory.recipes.nei.NEIHandlerSqueezer;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class ForestryRecipeExtractor implements IRecipeExtractorLegacy {
|
||||
|
||||
@@ -31,7 +30,7 @@ public class ForestryRecipeExtractor implements IRecipeExtractorLegacy {
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||
for (int i = 0; i < rawInputs.size(); i ++) {
|
||||
for (int i = 0; i < rawInputs.size(); i++) {
|
||||
if (rawInputs.get(i) == null) continue;
|
||||
OrderStack<?> stack = OrderStack.pack(rawInputs.get(i), i);
|
||||
if (stack != null) tmp.add(stack);
|
||||
@@ -42,7 +41,7 @@ public class ForestryRecipeExtractor implements IRecipeExtractorLegacy {
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||
for (int i = 0; i < rawOutputs.size(); i ++) {
|
||||
for (int i = 0; i < rawOutputs.size(); i++) {
|
||||
if (rawOutputs.get(i) == null) continue;
|
||||
OrderStack<?> stack = OrderStack.pack(rawOutputs.get(i), i);
|
||||
if (stack != null) tmp.add(stack);
|
||||
@@ -56,7 +55,8 @@ public class ForestryRecipeExtractor implements IRecipeExtractorLegacy {
|
||||
List<OrderStack<?>> tmp = new ArrayList<>();
|
||||
if (tRecipe.arecipes.get(index) instanceof RecipeHandlerBase.CachedBaseRecipe) {
|
||||
tmp = getInputIngredients(rawInputs);
|
||||
List<PositionedFluidTank> tanks = ((RecipeHandlerBase.CachedBaseRecipe) tRecipe.arecipes.get(index)).getFluidTanks();
|
||||
List<PositionedFluidTank> tanks =
|
||||
((RecipeHandlerBase.CachedBaseRecipe) tRecipe.arecipes.get(index)).getFluidTanks();
|
||||
if (tanks.size() > 0 && !(handler instanceof NEIHandlerSqueezer)) {
|
||||
FluidStack fluid = tanks.get(0).tank.getFluid();
|
||||
if (fluid != null) {
|
||||
@@ -68,20 +68,21 @@ public class ForestryRecipeExtractor implements IRecipeExtractorLegacy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs, IRecipeHandler recipe, int index) {
|
||||
public List<OrderStack<?>> getOutputIngredients(
|
||||
List<PositionedStack> rawOutputs, IRecipeHandler recipe, int index) {
|
||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
||||
removeGlass(rawOutputs);
|
||||
List<OrderStack<?>> tmp = new ArrayList<>();
|
||||
if (tRecipe.arecipes.get(index) instanceof RecipeHandlerBase.CachedBaseRecipe) {
|
||||
tmp = getOutputIngredients(rawOutputs);
|
||||
List<PositionedFluidTank> tanks = ((RecipeHandlerBase.CachedBaseRecipe) tRecipe.arecipes.get(index)).getFluidTanks();
|
||||
List<PositionedFluidTank> tanks =
|
||||
((RecipeHandlerBase.CachedBaseRecipe) tRecipe.arecipes.get(index)).getFluidTanks();
|
||||
if (tanks.size() > 0 && handler instanceof NEIHandlerSqueezer) {
|
||||
FluidStack fluid = tanks.get(0).tank.getFluid();
|
||||
if (fluid != null) {
|
||||
tmp.add(new OrderStack<>(fluid, rawOutputs.size()));
|
||||
}
|
||||
}
|
||||
else if (tanks.size() > 1) {
|
||||
} else if (tanks.size() > 1) {
|
||||
FluidStack fluid = tanks.get(1).tank.getFluid();
|
||||
if (fluid != null) {
|
||||
tmp.add(new OrderStack<>(fluid, rawOutputs.size()));
|
||||
@@ -96,5 +97,4 @@ public class ForestryRecipeExtractor implements IRecipeExtractorLegacy {
|
||||
list.remove(list.size() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,5 +9,4 @@ public class GTPPRecipeExtractor extends GregTech5RecipeExtractor {
|
||||
public GTPPRecipeExtractor(boolean removeSpecial) {
|
||||
super(removeSpecial);
|
||||
}
|
||||
|
||||
}
|
||||
+8
-9
@@ -5,14 +5,13 @@ import com.glodblock.github.nei.object.IRecipeExtractor;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
import gregtech.api.enums.ItemList;
|
||||
import gregtech.common.items.GT_FluidDisplayItem;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class GregTech5RecipeExtractor implements IRecipeExtractor {
|
||||
|
||||
boolean removeSpecial;
|
||||
@@ -25,7 +24,7 @@ public class GregTech5RecipeExtractor implements IRecipeExtractor {
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||
if (removeSpecial) removeSpecial(rawInputs);
|
||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||
for (int i = 0; i < rawInputs.size(); i ++) {
|
||||
for (int i = 0; i < rawInputs.size(); i++) {
|
||||
if (rawInputs.get(i) == null) continue;
|
||||
ItemStack item = rawInputs.get(i).items[0].copy();
|
||||
OrderStack<?> stack;
|
||||
@@ -46,7 +45,7 @@ public class GregTech5RecipeExtractor implements IRecipeExtractor {
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||
for (int i = 0; i < rawOutputs.size(); i ++) {
|
||||
for (int i = 0; i < rawOutputs.size(); i++) {
|
||||
if (rawOutputs.get(i) == null) continue;
|
||||
ItemStack item = rawOutputs.get(i).items[0].copy();
|
||||
OrderStack<?> stack;
|
||||
@@ -65,14 +64,14 @@ public class GregTech5RecipeExtractor implements IRecipeExtractor {
|
||||
}
|
||||
|
||||
private void removeSpecial(List<PositionedStack> list) {
|
||||
for (int i = list.size() - 1; i >= 0; i --) {
|
||||
for (int i = list.size() - 1; i >= 0; i--) {
|
||||
PositionedStack positionedStack = list.get(i);
|
||||
if (positionedStack != null &&
|
||||
(positionedStack.items[0].isItemEqual(ItemList.Tool_DataStick.get(1)) || positionedStack.items[0].isItemEqual(ItemList.Tool_DataOrb.get(1)))) {
|
||||
if (positionedStack != null
|
||||
&& (positionedStack.items[0].isItemEqual(ItemList.Tool_DataStick.get(1))
|
||||
|| positionedStack.items[0].isItemEqual(ItemList.Tool_DataOrb.get(1)))) {
|
||||
list.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+5
-7
@@ -5,11 +5,10 @@ import com.glodblock.github.nei.object.IRecipeExtractor;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
import gregapi.item.ItemFluidDisplay;
|
||||
import gregapi.recipes.Recipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class GregTech6RecipeExtractor implements IRecipeExtractor {
|
||||
|
||||
@@ -23,7 +22,7 @@ public class GregTech6RecipeExtractor implements IRecipeExtractor {
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||
this.removeMachine(rawInputs);
|
||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||
for (int i = 0; i < rawInputs.size(); i ++) {
|
||||
for (int i = 0; i < rawInputs.size(); i++) {
|
||||
if (rawInputs.get(i) == null) continue;
|
||||
ItemStack item = rawInputs.get(i).items[0].copy();
|
||||
OrderStack<?> stack;
|
||||
@@ -43,7 +42,7 @@ public class GregTech6RecipeExtractor implements IRecipeExtractor {
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||
for (int i = 0; i < rawOutputs.size(); i ++) {
|
||||
for (int i = 0; i < rawOutputs.size(); i++) {
|
||||
if (rawOutputs.get(i) == null) continue;
|
||||
ItemStack item = rawOutputs.get(i).items[0].copy();
|
||||
OrderStack<?> stack;
|
||||
@@ -61,7 +60,7 @@ public class GregTech6RecipeExtractor implements IRecipeExtractor {
|
||||
}
|
||||
|
||||
private void removeMachine(List<PositionedStack> list) {
|
||||
for (int i = list.size() - 1; i >= 0; i --) {
|
||||
for (int i = list.size() - 1; i >= 0; i--) {
|
||||
PositionedStack positionedStack = list.get(i);
|
||||
if (positionedStack != null) {
|
||||
for (ItemStack machine : this.Recipes.mRecipeMachineList) {
|
||||
@@ -73,5 +72,4 @@ public class GregTech6RecipeExtractor implements IRecipeExtractor {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+18
-16
@@ -7,22 +7,21 @@ import com.glodblock.github.nei.object.OrderStack;
|
||||
import com.glodblock.github.util.Ae2Reflect;
|
||||
import ic2.neiIntegration.core.recipehandler.FluidCannerRecipeHandler;
|
||||
import ic2.neiIntegration.core.recipehandler.OreWashingRecipeHandler;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class IndustrialCraftRecipeExtractor implements IRecipeExtractor {
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||
for (int i = 0; i < rawInputs.size(); i ++) {
|
||||
for (int i = 0; i < rawInputs.size(); i++) {
|
||||
if (rawInputs.get(i) == null) continue;
|
||||
tmp.add(OrderStack.pack(rawInputs.get(i), i));
|
||||
}
|
||||
@@ -32,7 +31,7 @@ public class IndustrialCraftRecipeExtractor implements IRecipeExtractor {
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||
for (int i = 0; i < rawOutputs.size(); i ++) {
|
||||
for (int i = 0; i < rawOutputs.size(); i++) {
|
||||
if (rawOutputs.get(i) == null) continue;
|
||||
tmp.add(OrderStack.pack(rawOutputs.get(i), i));
|
||||
}
|
||||
@@ -44,13 +43,14 @@ public class IndustrialCraftRecipeExtractor implements IRecipeExtractor {
|
||||
List<OrderStack<?>> stacks = new LinkedList<>();
|
||||
|
||||
if (recipe instanceof FluidCannerRecipeHandler) {
|
||||
FluidCannerRecipeHandler.CachedFluidCannerRecipe cachedRecipe = (FluidCannerRecipeHandler.CachedFluidCannerRecipe) ((FluidCannerRecipeHandler) recipe).arecipes.get(index);
|
||||
FluidCannerRecipeHandler.CachedFluidCannerRecipe cachedRecipe =
|
||||
(FluidCannerRecipeHandler.CachedFluidCannerRecipe)
|
||||
((FluidCannerRecipeHandler) recipe).arecipes.get(index);
|
||||
FluidStack input = ReflectIC2.getInputFluid(cachedRecipe);
|
||||
PositionedStack add = rawInputs.size() > 1 ? rawInputs.get(1) : null;
|
||||
stacks.add(OrderStack.pack(add, 0));
|
||||
stacks.add(new OrderStack<>(input, 1));
|
||||
}
|
||||
else if (recipe instanceof OreWashingRecipeHandler) {
|
||||
} else if (recipe instanceof OreWashingRecipeHandler) {
|
||||
stacks = getInputIngredients(rawInputs);
|
||||
int water = ReflectIC2.getOreWasherWater((OreWashingRecipeHandler) recipe, index);
|
||||
stacks.add(new OrderStack<>(new FluidStack(FluidRegistry.WATER, water), stacks.size()));
|
||||
@@ -62,11 +62,14 @@ public class IndustrialCraftRecipeExtractor implements IRecipeExtractor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs, IRecipeHandler recipe, int index) {
|
||||
public List<OrderStack<?>> getOutputIngredients(
|
||||
List<PositionedStack> rawOutputs, IRecipeHandler recipe, int index) {
|
||||
List<OrderStack<?>> stacks = new LinkedList<>();
|
||||
|
||||
if (recipe instanceof FluidCannerRecipeHandler) {
|
||||
FluidCannerRecipeHandler.CachedFluidCannerRecipe cachedRecipe = (FluidCannerRecipeHandler.CachedFluidCannerRecipe) ((FluidCannerRecipeHandler) recipe).arecipes.get(index);
|
||||
FluidCannerRecipeHandler.CachedFluidCannerRecipe cachedRecipe =
|
||||
(FluidCannerRecipeHandler.CachedFluidCannerRecipe)
|
||||
((FluidCannerRecipeHandler) recipe).arecipes.get(index);
|
||||
FluidStack output = ReflectIC2.getOutputFluid(cachedRecipe);
|
||||
stacks.add(new OrderStack<>(output, 0));
|
||||
} else {
|
||||
@@ -78,15 +81,16 @@ public class IndustrialCraftRecipeExtractor implements IRecipeExtractor {
|
||||
|
||||
private static class ReflectIC2 {
|
||||
|
||||
private final static Field inputsF;
|
||||
private final static Field resultF;
|
||||
private static final Field inputsF;
|
||||
private static final Field resultF;
|
||||
|
||||
private final static Method oreWasherWater;
|
||||
private static final Method oreWasherWater;
|
||||
|
||||
static {
|
||||
try {
|
||||
inputsF = Ae2Reflect.reflectField(FluidCannerRecipeHandler.CachedFluidCannerRecipe.class, "fluidInput");
|
||||
resultF = Ae2Reflect.reflectField(FluidCannerRecipeHandler.CachedFluidCannerRecipe.class, "fluidOutput");
|
||||
resultF =
|
||||
Ae2Reflect.reflectField(FluidCannerRecipeHandler.CachedFluidCannerRecipe.class, "fluidOutput");
|
||||
oreWasherWater = Ae2Reflect.reflectMethod(OreWashingRecipeHandler.class, "getreqWater", int.class);
|
||||
} catch (NoSuchFieldException | NoSuchMethodException e) {
|
||||
throw new IllegalStateException("Failed to initialize IC2 reflection hacks!", e);
|
||||
@@ -108,7 +112,5 @@ public class IndustrialCraftRecipeExtractor implements IRecipeExtractor {
|
||||
throw new IllegalStateException("Failed to invoke method: " + oreWasherWater, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+2
-4
@@ -3,7 +3,6 @@ package com.glodblock.github.nei.recipes.extractor;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import com.glodblock.github.nei.object.IRecipeExtractor;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -18,7 +17,7 @@ public class VanillaRecipeExtractor implements IRecipeExtractor {
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||
for (int i = 0; i < rawInputs.size(); i ++) {
|
||||
for (int i = 0; i < rawInputs.size(); i++) {
|
||||
if (rawInputs.get(i) == null) continue;
|
||||
final int col = (rawInputs.get(i).relx - 25) / 18;
|
||||
final int row = (rawInputs.get(i).rely - 6) / 18;
|
||||
@@ -32,7 +31,7 @@ public class VanillaRecipeExtractor implements IRecipeExtractor {
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||
for (int i = 0; i < rawOutputs.size(); i ++) {
|
||||
for (int i = 0; i < rawOutputs.size(); i++) {
|
||||
if (rawOutputs.get(i) == null) continue;
|
||||
final int col = (rawOutputs.get(i).relx - 25) / 18;
|
||||
final int row = (rawOutputs.get(i).rely - 6) / 18;
|
||||
@@ -42,5 +41,4 @@ public class VanillaRecipeExtractor implements IRecipeExtractor {
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user