mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-26 23:02:59 +00:00
Merge pull request #2 from DianeXD/master
Adapt to gtnh version and add gtpp support
This commit is contained in:
8 files changed
+86
-88
No files matched your search
+2
-1
@@ -5,7 +5,7 @@ dependencies {
|
|||||||
compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-87-GTNH:dev')
|
compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-87-GTNH:dev')
|
||||||
compile('curse.maven:cofh-core-69162:2388751')
|
compile('curse.maven:cofh-core-69162:2388751')
|
||||||
compile('com.github.GTNewHorizons:ExtraCells2:2.5.9:dev') {transitive = false}
|
compile('com.github.GTNewHorizons:ExtraCells2:2.5.9:dev') {transitive = false}
|
||||||
compile("com.github.GTNewHorizons:ForestryMC:4.4.4:dev")
|
compile("com.github.GTNewHorizons:ForestryMC:4.4.7:dev")
|
||||||
|
|
||||||
compileOnly("com.github.GTNewHorizons:EnderIO:2.3.1.27:dev")
|
compileOnly("com.github.GTNewHorizons:EnderIO:2.3.1.27:dev")
|
||||||
compileOnly("com.github.GTNewHorizons:EnderCore:0.2.6:dev")
|
compileOnly("com.github.GTNewHorizons:EnderCore:0.2.6:dev")
|
||||||
@@ -15,4 +15,5 @@ dependencies {
|
|||||||
compileOnly('com.github.GTNewHorizons:AppleCore:3.1.9:dev') {transitive = false}
|
compileOnly('com.github.GTNewHorizons:AppleCore:3.1.9:dev') {transitive = false}
|
||||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.27:dev') {transitive = false}
|
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.27:dev') {transitive = false}
|
||||||
compileOnly("com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev") {transitive = false}
|
compileOnly("com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev") {transitive = false}
|
||||||
|
compileOnly("com.github.GTNewHorizons:GTplusplus:1.7.49:dev") {transitive = false}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ import com.glodblock.github.nei.recipes.extractor.*;
|
|||||||
import com.glodblock.github.util.ModAndClassUtil;
|
import com.glodblock.github.util.ModAndClassUtil;
|
||||||
import forestry.factory.recipes.nei.*;
|
import forestry.factory.recipes.nei.*;
|
||||||
import gregapi.recipes.Recipe;
|
import gregapi.recipes.Recipe;
|
||||||
|
import gregtech.api.util.GTPP_Recipe;
|
||||||
import gregtech.api.util.GT_Recipe;
|
import gregtech.api.util.GT_Recipe;
|
||||||
|
|
||||||
public class DefaultExtractorLoader implements Runnable {
|
public class DefaultExtractorLoader implements Runnable {
|
||||||
@@ -27,6 +28,14 @@ public class DefaultExtractorLoader implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ModAndClassUtil.GTPP) {
|
||||||
|
for (GTPP_Recipe.GTPP_Recipe_Map_Internal gtppMap : GTPP_Recipe.GTPP_Recipe_Map_Internal.sMappingsEx) {
|
||||||
|
if (gtppMap.mNEIAllowed) {
|
||||||
|
FluidRecipe.addRecipeMap(gtppMap.mNEIName, new GTPPRecipeExtractor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ModAndClassUtil.EIO) {
|
if (ModAndClassUtil.EIO) {
|
||||||
FluidRecipe.addRecipeMap("EIOEnchanter", new EnderIORecipeExtractor());
|
FluidRecipe.addRecipeMap("EIOEnchanter", new EnderIORecipeExtractor());
|
||||||
FluidRecipe.addRecipeMap("EnderIOAlloySmelter", new EnderIORecipeExtractor());
|
FluidRecipe.addRecipeMap("EnderIOAlloySmelter", new EnderIORecipeExtractor());
|
||||||
@@ -37,6 +46,17 @@ public class DefaultExtractorLoader implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ModAndClassUtil.FTR) {
|
if (ModAndClassUtil.FTR) {
|
||||||
|
// GTNH
|
||||||
|
FluidRecipe.addRecipeMap("forestry.bottler", new ForestryRecipeExtractor(new NEIHandlerBottler()));
|
||||||
|
FluidRecipe.addRecipeMap("forestry.carpenter", new ForestryRecipeExtractor(new NEIHandlerCarpenter()));
|
||||||
|
FluidRecipe.addRecipeMap("forestry.centrifuge", new ForestryRecipeExtractor(new NEIHandlerCentrifuge()));
|
||||||
|
FluidRecipe.addRecipeMap("forestry.fabricator", new ForestryRecipeExtractor(new NEIHandlerFabricator()));
|
||||||
|
FluidRecipe.addRecipeMap("forestry.fermenter", new ForestryRecipeExtractor(new NEIHandlerFermenter()));
|
||||||
|
FluidRecipe.addRecipeMap("forestry.moistener", new ForestryRecipeExtractor(new NEIHandlerMoistener()));
|
||||||
|
FluidRecipe.addRecipeMap("forestry.squeezer", new ForestryRecipeExtractor(new NEIHandlerSqueezer()));
|
||||||
|
FluidRecipe.addRecipeMap("forestry.still", new ForestryRecipeExtractor(new NEIHandlerStill()));
|
||||||
|
|
||||||
|
// LEGACY
|
||||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerBottler()));
|
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerBottler()));
|
||||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerCarpenter()));
|
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerCarpenter()));
|
||||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerCentrifuge()));
|
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerCentrifuge()));
|
||||||
|
|||||||
+3
-29
@@ -5,19 +5,16 @@ import codechicken.nei.recipe.IRecipeHandler;
|
|||||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||||
import com.glodblock.github.nei.object.IRecipeExtractorLegacy;
|
import com.glodblock.github.nei.object.IRecipeExtractorLegacy;
|
||||||
import com.glodblock.github.nei.object.OrderStack;
|
import com.glodblock.github.nei.object.OrderStack;
|
||||||
import crazypants.enderio.nei.VatRecipeHandler;
|
import com.glodblock.github.util.NEIUtil;
|
||||||
import forestry.core.recipes.nei.PositionedFluidTank;
|
import forestry.core.recipes.nei.PositionedFluidTank;
|
||||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||||
import forestry.factory.recipes.nei.NEIHandlerFabricator;
|
import forestry.factory.recipes.nei.NEIHandlerFabricator;
|
||||||
import forestry.factory.recipes.nei.NEIHandlerSqueezer;
|
import forestry.factory.recipes.nei.NEIHandlerSqueezer;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class ForestryRecipeExtractor implements IRecipeExtractorLegacy {
|
public class ForestryRecipeExtractor implements IRecipeExtractorLegacy {
|
||||||
|
|
||||||
@@ -58,7 +55,7 @@ public class ForestryRecipeExtractor implements IRecipeExtractorLegacy {
|
|||||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs, IRecipeHandler recipe, int index) {
|
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs, IRecipeHandler recipe, int index) {
|
||||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
||||||
List<OrderStack<?>> tmp = new ArrayList<>();
|
List<OrderStack<?>> tmp = new ArrayList<>();
|
||||||
List<PositionedStack> compressed = compress(rawInputs);
|
List<PositionedStack> compressed = NEIUtil.compress(rawInputs);
|
||||||
if (tRecipe.arecipes.get(index) instanceof RecipeHandlerBase.CachedBaseRecipe) {
|
if (tRecipe.arecipes.get(index) instanceof RecipeHandlerBase.CachedBaseRecipe) {
|
||||||
tmp = getInputIngredients(compressed);
|
tmp = getInputIngredients(compressed);
|
||||||
List<PositionedFluidTank> tanks = ((RecipeHandlerBase.CachedBaseRecipe) tRecipe.arecipes.get(index)).getFluidTanks();
|
List<PositionedFluidTank> tanks = ((RecipeHandlerBase.CachedBaseRecipe) tRecipe.arecipes.get(index)).getFluidTanks();
|
||||||
@@ -77,7 +74,7 @@ public class ForestryRecipeExtractor implements IRecipeExtractorLegacy {
|
|||||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
||||||
removeGlass(rawOutputs);
|
removeGlass(rawOutputs);
|
||||||
List<OrderStack<?>> tmp = new ArrayList<>();
|
List<OrderStack<?>> tmp = new ArrayList<>();
|
||||||
List<PositionedStack> compressed = compress(rawOutputs);
|
List<PositionedStack> compressed = NEIUtil.compress(rawOutputs);
|
||||||
if (tRecipe.arecipes.get(index) instanceof RecipeHandlerBase.CachedBaseRecipe) {
|
if (tRecipe.arecipes.get(index) instanceof RecipeHandlerBase.CachedBaseRecipe) {
|
||||||
tmp = getOutputIngredients(compressed);
|
tmp = getOutputIngredients(compressed);
|
||||||
List<PositionedFluidTank> tanks = ((RecipeHandlerBase.CachedBaseRecipe) tRecipe.arecipes.get(index)).getFluidTanks();
|
List<PositionedFluidTank> tanks = ((RecipeHandlerBase.CachedBaseRecipe) tRecipe.arecipes.get(index)).getFluidTanks();
|
||||||
@@ -97,29 +94,6 @@ public class ForestryRecipeExtractor implements IRecipeExtractorLegacy {
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<PositionedStack> compress(List<PositionedStack> list) {
|
|
||||||
List<PositionedStack> comp = new LinkedList<>();
|
|
||||||
for (PositionedStack positionedStack : list) {
|
|
||||||
if (positionedStack == null) continue;
|
|
||||||
ItemStack currentStack = positionedStack.items[0].copy();
|
|
||||||
if (currentStack.stackSize == 0) continue;
|
|
||||||
boolean find = false;
|
|
||||||
for (PositionedStack storedStack : comp) {
|
|
||||||
if (storedStack == null) continue;
|
|
||||||
ItemStack firstStack = storedStack.items[0].copy();
|
|
||||||
boolean areItemStackEqual = firstStack.isItemEqual(currentStack) && ItemStack.areItemStackTagsEqual(firstStack, currentStack);
|
|
||||||
if (areItemStackEqual && (firstStack.stackSize + currentStack.stackSize) <= firstStack.getMaxStackSize()) {
|
|
||||||
find = true;
|
|
||||||
storedStack.items[0].stackSize = firstStack.stackSize + currentStack.stackSize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!find) {
|
|
||||||
comp.add(positionedStack.copy());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return comp.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void removeGlass(List<PositionedStack> list) {
|
private void removeGlass(List<PositionedStack> list) {
|
||||||
if (handler instanceof NEIHandlerFabricator) {
|
if (handler instanceof NEIHandlerFabricator) {
|
||||||
list.remove(list.size() - 1);
|
list.remove(list.size() - 1);
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.glodblock.github.nei.recipes.extractor;
|
||||||
|
|
||||||
|
public class GTPPRecipeExtractor extends GregTech5RecipeExtractor {
|
||||||
|
|
||||||
|
public GTPPRecipeExtractor() {
|
||||||
|
super(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GTPPRecipeExtractor(boolean removeSpecial) {
|
||||||
|
super(removeSpecial);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+6
-30
@@ -3,6 +3,7 @@ package com.glodblock.github.nei.recipes.extractor;
|
|||||||
import codechicken.nei.PositionedStack;
|
import codechicken.nei.PositionedStack;
|
||||||
import com.glodblock.github.nei.object.IRecipeExtractor;
|
import com.glodblock.github.nei.object.IRecipeExtractor;
|
||||||
import com.glodblock.github.nei.object.OrderStack;
|
import com.glodblock.github.nei.object.OrderStack;
|
||||||
|
import com.glodblock.github.util.NEIUtil;
|
||||||
import gregtech.api.enums.ItemList;
|
import gregtech.api.enums.ItemList;
|
||||||
import gregtech.common.items.GT_FluidDisplayItem;
|
import gregtech.common.items.GT_FluidDisplayItem;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -12,21 +13,19 @@ import net.minecraftforge.fluids.FluidStack;
|
|||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class GregTech5RecipeExtractor implements IRecipeExtractor {
|
public class GregTech5RecipeExtractor implements IRecipeExtractor {
|
||||||
|
|
||||||
boolean r;
|
boolean removeSpecial;
|
||||||
|
|
||||||
public GregTech5RecipeExtractor(boolean removeSpecial) {
|
public GregTech5RecipeExtractor(boolean removeSpecial) {
|
||||||
r = removeSpecial;
|
this.removeSpecial = removeSpecial;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||||
if (r) removeSpecial(rawInputs);
|
if (removeSpecial) removeSpecial(rawInputs);
|
||||||
List<PositionedStack> compressed = compress(rawInputs);
|
List<PositionedStack> compressed = NEIUtil.compress(rawInputs);
|
||||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||||
for (int i = 0; i < compressed.size(); i ++) {
|
for (int i = 0; i < compressed.size(); i ++) {
|
||||||
if (compressed.get(i) == null) continue;
|
if (compressed.get(i) == null) continue;
|
||||||
@@ -48,7 +47,7 @@ public class GregTech5RecipeExtractor implements IRecipeExtractor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||||
List<PositionedStack> compressed = compress(rawOutputs);
|
List<PositionedStack> compressed = NEIUtil.compress(rawOutputs);
|
||||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||||
for (int i = 0; i < compressed.size(); i ++) {
|
for (int i = 0; i < compressed.size(); i ++) {
|
||||||
if (compressed.get(i) == null) continue;
|
if (compressed.get(i) == null) continue;
|
||||||
@@ -79,27 +78,4 @@ public class GregTech5RecipeExtractor implements IRecipeExtractor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<PositionedStack> compress(List<PositionedStack> list) {
|
|
||||||
List<PositionedStack> comp = new LinkedList<>();
|
|
||||||
for (PositionedStack positionedStack : list) {
|
|
||||||
if (positionedStack == null) continue;
|
|
||||||
ItemStack currentStack = positionedStack.items[0].copy();
|
|
||||||
if (currentStack.stackSize == 0) continue;
|
|
||||||
boolean find = false;
|
|
||||||
for (PositionedStack storedStack : comp) {
|
|
||||||
if (storedStack == null) continue;
|
|
||||||
ItemStack firstStack = storedStack.items[0].copy();
|
|
||||||
boolean areItemStackEqual = firstStack.isItemEqual(currentStack) && ItemStack.areItemStackTagsEqual(firstStack, currentStack);
|
|
||||||
if (areItemStackEqual && (firstStack.stackSize + currentStack.stackSize) <= firstStack.getMaxStackSize()) {
|
|
||||||
find = true;
|
|
||||||
storedStack.items[0].stackSize = firstStack.stackSize + currentStack.stackSize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!find) {
|
|
||||||
comp.add(positionedStack.copy());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return comp.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+3
-27
@@ -3,6 +3,7 @@ package com.glodblock.github.nei.recipes.extractor;
|
|||||||
import codechicken.nei.PositionedStack;
|
import codechicken.nei.PositionedStack;
|
||||||
import com.glodblock.github.nei.object.IRecipeExtractor;
|
import com.glodblock.github.nei.object.IRecipeExtractor;
|
||||||
import com.glodblock.github.nei.object.OrderStack;
|
import com.glodblock.github.nei.object.OrderStack;
|
||||||
|
import com.glodblock.github.util.NEIUtil;
|
||||||
import gregapi.item.ItemFluidDisplay;
|
import gregapi.item.ItemFluidDisplay;
|
||||||
import gregapi.recipes.Recipe;
|
import gregapi.recipes.Recipe;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -10,8 +11,6 @@ import net.minecraftforge.fluids.FluidStack;
|
|||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class GregTech6RecipeExtractor implements IRecipeExtractor {
|
public class GregTech6RecipeExtractor implements IRecipeExtractor {
|
||||||
|
|
||||||
@@ -24,7 +23,7 @@ public class GregTech6RecipeExtractor implements IRecipeExtractor {
|
|||||||
@Override
|
@Override
|
||||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||||
this.removeMachine(rawInputs);
|
this.removeMachine(rawInputs);
|
||||||
List<PositionedStack> compressed = compress(rawInputs);
|
List<PositionedStack> compressed = NEIUtil.compress(rawInputs);
|
||||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||||
for (int i = 0; i < compressed.size(); i ++) {
|
for (int i = 0; i < compressed.size(); i ++) {
|
||||||
if (compressed.get(i) == null) continue;
|
if (compressed.get(i) == null) continue;
|
||||||
@@ -45,7 +44,7 @@ public class GregTech6RecipeExtractor implements IRecipeExtractor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||||
List<PositionedStack> compressed = compress(rawOutputs);
|
List<PositionedStack> compressed = NEIUtil.compress(rawOutputs);
|
||||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||||
for (int i = 0; i < compressed.size(); i ++) {
|
for (int i = 0; i < compressed.size(); i ++) {
|
||||||
if (compressed.get(i) == null) continue;
|
if (compressed.get(i) == null) continue;
|
||||||
@@ -78,27 +77,4 @@ public class GregTech6RecipeExtractor implements IRecipeExtractor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<PositionedStack> compress(List<PositionedStack> list) {
|
|
||||||
List<PositionedStack> comp = new LinkedList<>();
|
|
||||||
for (PositionedStack positionedStack : list) {
|
|
||||||
if (positionedStack == null) continue;
|
|
||||||
ItemStack currentStack = positionedStack.items[0].copy();
|
|
||||||
if (currentStack.stackSize == 0) continue;
|
|
||||||
boolean find = false;
|
|
||||||
for (PositionedStack storedStack : comp) {
|
|
||||||
if (storedStack == null) continue;
|
|
||||||
ItemStack firstStack = storedStack.items[0].copy();
|
|
||||||
boolean areItemStackEqual = firstStack.isItemEqual(currentStack) && ItemStack.areItemStackTagsEqual(firstStack, currentStack);
|
|
||||||
if (areItemStackEqual && (firstStack.stackSize + currentStack.stackSize) <= firstStack.getMaxStackSize()) {
|
|
||||||
find = true;
|
|
||||||
storedStack.items[0].stackSize = firstStack.stackSize + currentStack.stackSize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!find) {
|
|
||||||
comp.add(positionedStack.copy());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return comp.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,7 @@ public final class ModAndClassUtil {
|
|||||||
public static boolean EC2 = false;
|
public static boolean EC2 = false;
|
||||||
public static boolean EIO = false;
|
public static boolean EIO = false;
|
||||||
public static boolean FTR = false;
|
public static boolean FTR = false;
|
||||||
|
public static boolean GTPP = false;
|
||||||
|
|
||||||
public static boolean isDoubleButton;
|
public static boolean isDoubleButton;
|
||||||
public static boolean isSaveText;
|
public static boolean isSaveText;
|
||||||
@@ -95,7 +96,8 @@ public final class ModAndClassUtil {
|
|||||||
EIO = true;
|
EIO = true;
|
||||||
if (Loader.isModLoaded("Forestry"))
|
if (Loader.isModLoaded("Forestry"))
|
||||||
FTR = true;
|
FTR = true;
|
||||||
|
if (Loader.isModLoaded("miscutils"))
|
||||||
|
GTPP = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.glodblock.github.util;
|
||||||
|
|
||||||
|
import codechicken.nei.PositionedStack;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class NEIUtil {
|
||||||
|
|
||||||
|
public static List<PositionedStack> compress(List<PositionedStack> list) {
|
||||||
|
List<PositionedStack> comp = new LinkedList<>();
|
||||||
|
for (PositionedStack positionedStack : list) {
|
||||||
|
if (positionedStack == null) continue;
|
||||||
|
ItemStack currentStack = positionedStack.items[0].copy();
|
||||||
|
if (currentStack.stackSize == 0) continue;
|
||||||
|
boolean find = false;
|
||||||
|
for (PositionedStack storedStack : comp) {
|
||||||
|
if (storedStack == null) continue;
|
||||||
|
ItemStack firstStack = storedStack.items[0].copy();
|
||||||
|
boolean areItemStackEqual = firstStack.isItemEqual(currentStack) && ItemStack.areItemStackTagsEqual(firstStack, currentStack);
|
||||||
|
if (areItemStackEqual && (firstStack.stackSize + currentStack.stackSize) <= firstStack.getMaxStackSize()) {
|
||||||
|
find = true;
|
||||||
|
storedStack.items[0].stackSize = firstStack.stackSize + currentStack.stackSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!find) {
|
||||||
|
comp.add(positionedStack.copy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return comp.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in new issue
Block a user