Updata EnderIO support and Forestry support

This commit is contained in:
vfyjxf committed 2021-08-07 19:34:52 +08:00
1 parent a69878864f
commit 1449d88915
14 files changed
+209 -40

No files matched your search

+2 -2
View File
@@ -26,7 +26,7 @@ This mod removes that functionality and allows the player to use NEI's transfer
- [x] EnderIO
- [x] Forestry(Doesn't support Fermenter and Still,because they don't have an item output)
If you want other Mod support,see [RecipeProcessor](./src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java) and [Mod support](https://github.com/vfyjxf/NotEnoughEnergistics/issues/1)
If you want other Mod support,see [RecipeProcessor](./src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java) and [Mod support Issue](https://github.com/vfyjxf/NotEnoughEnergistics/issues/1)
## TODO
@@ -36,4 +36,4 @@ If you want other Mod support,see [RecipeProcessor](./src/main/java/com/github/v
~~Combine like stacks in processing patterns.~~
## Credits
Thanks TheRealp455w0rd and his [Just Enough Energistics](https://www.curseforge.com/minecraft/mc-mods/just-enough-energistics-jee)
Thanks TheRealp455w0rd and his [Just Enough Energistics](https://www.curseforge.com/minecraft/mc-mods/just-enough-energistics-jee)
+12 -2
View File
@@ -4,20 +4,30 @@ NotEnoughEnergistics 是[Just Enough Energistics](https://www.curseforge.com/min
它替换了AE2默认的NEI集成, 默认情况下ae只能识别玩家身上或者网络里的存储物品。
本MOD允许你直接从nei获取配方并写入样板终端(shift点击[?]按钮)
并且会自动帮你切换样板模式。
## Features
- 根据配方自动切换样板终端的模式
- 如果一个物品输出为概率输出,那么NEE不会将它写入样板终端
- 在处理模式中合并同类物品
## 当前支持的Mod列表:
- [ ] AppliedEnergistics2(我们将不会支持AE2,因为AE2没有注册对应的OverlayHandler)
- [x] Vanilla
- [x] GregTech
- [x] IndustrialCraft2
- [x] Avaritia
- [x] EnderIO
- [x] Forestry(不支持发酵机和蒸馏器,因为它们没有物品输出)
如果你想要别的Mod的支持,请看[RecipeProcessor](./src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java) 或者[模组支持处理区](https://github.com/vfyjxf/NotEnoughEnergistics/issues/1)
## TODO
- 添加转换黑名单,使在黑名单里的物品不会被转移到样板终端
- 添加优先转换列表,在优先转换列表的物品会替换配方里的同类物品
- 在有多个同类物品的情况下,合并同类物品
~~在有多个同类物品的情况下,合并同类物品~~
## Credits
感谢 TheRealp455w0rd 和他的 [Just Enough Energistics](https://www.curseforge.com/minecraft/mc-mods/just-enough-energistics-jee)
+4 -7
View File
@@ -8,13 +8,12 @@ buildscript {
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-1.4.0-SNAPSHOT'
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-1.4.4-SNAPSHOT'
}
}
apply plugin: 'java'
apply plugin: 'forge'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
@@ -44,9 +43,6 @@ dependencies {
compile "codechicken:CodeChickenLib:1.7.10-1.1.3.138:dev"
compile "codechicken:CodeChickenCore:1.7.10-1.0.7.+:dev"
// https://mvnrepository.com/artifact/com.alibaba/fastjson
implementation group: 'com.alibaba', name: 'fastjson', version: '1.2.76'
}
processResources {
@@ -59,7 +55,8 @@ processResources {
'mod_author': mod_author,
'mod_description': mod_description,
'mc_version': mc_version,
'mod_version': mod_version
'mod_version': mod_version,
'mod_credits': mod_credits
}
from(sourceSets.main.resources.srcDirs) {
@@ -85,4 +82,4 @@ jar{
artifacts {
archives devJar
archives sourcesJar
}
}
+1 -1
View File
@@ -6,7 +6,7 @@ org.gradle.daemon=false
mc_version=1.7.10
nei_version=2.1.6-GTNH
ae2_version=rv3-beta-52-GTNH
mod_version=1.0.0
mod_version=1.1.0
forge_version=10.13.4.1614
mod_group=com.github.vfyjxf.neenergistics
mod_id=neenergistics
@@ -8,9 +8,7 @@ import com.github.vfyjxf.nee.nei.NEECraftingHandler;
import com.github.vfyjxf.nee.processor.IRecipeProcessor;
import com.github.vfyjxf.nee.processor.RecipeProcessor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.*;
public class NEINeeConfig implements IConfigureNEI {
@@ -20,8 +18,10 @@ public class NEINeeConfig implements IConfigureNEI {
RecipeProcessor.init();
List<String> defaultIdentifiers= Arrays.asList("crafting", "crafting2x2","brewing","smelting","fuel");
List<String> identifiers = new ArrayList<>(defaultIdentifiers);
Set<String> defaultIdentifiers= new HashSet<>(
Arrays.asList("crafting", "crafting2x2","brewing","smelting","fuel",null)
);
Set<String> identifiers = new HashSet<>(defaultIdentifiers);
for(IRecipeProcessor processor : RecipeProcessor.recipeProcessors){
identifiers.addAll(processor.getAllOverlayIdentifier());
@@ -84,7 +84,7 @@ public class NEECraftingHandler implements IOverlayHandler {
}
for (PositionedStack positionedStack : outputs) {
if (outputIndex >= 4 || positionedStack.item == null) {
if (outputIndex >= 4 ||positionedStack == null || positionedStack.item == null) {
continue;
}
recipeOutputs.setTag(OUTPUT_KEY + outputIndex, positionedStack.item.writeToNBT(new NBTTagCompound()));
@@ -5,18 +5,18 @@ import codechicken.nei.recipe.IRecipeHandler;
import java.util.*;
public class AvaritiaRecipeProcessor implements IRecipeProcessor{
public class AvaritiaRecipeProcessor implements IRecipeProcessor {
@Override
public Set<String> getAllOverlayIdentifier() {
return new HashSet<>(Arrays.asList(
"extreme","extreme_compression"
"extreme", "extreme_compression"
));
}
@Override
public List<PositionedStack> getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) {
for(String ident : getAllOverlayIdentifier()){
if(ident.equals(identifier)){
for (String ident : getAllOverlayIdentifier()) {
if (ident.equals(identifier)) {
return new ArrayList<>(recipe.getIngredientStacks(recipeIndex));
}
}
@@ -25,8 +25,8 @@ public class AvaritiaRecipeProcessor implements IRecipeProcessor{
@Override
public List<PositionedStack> getRecipeOutput(IRecipeHandler recipe, int recipeIndex, String identifier) {
for(String ident : getAllOverlayIdentifier()){
if(ident.equals(identifier)){
for (String ident : getAllOverlayIdentifier()) {
if (ident.equals(identifier)) {
List<PositionedStack> recipeOutput = new ArrayList<>();
recipeOutput.add(recipe.getResultStack(recipeIndex));
return recipeOutput;
@@ -0,0 +1,47 @@
package com.github.vfyjxf.nee.processor;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.IRecipeHandler;
import crazypants.enderio.nei.SagMillRecipeHandler;
import java.util.*;
public class EnderIORecipeProcessor implements IRecipeProcessor {
@Override
public Set<String> getAllOverlayIdentifier() {
return new HashSet<>(Arrays.asList(
"EnderIOAlloySmelter", "EIOEnchanter", "EnderIOSagMill",
"EnderIOSliceAndSplice", "EnderIOSoulBinder", "EnderIOVat"
));
}
@Override
public List<PositionedStack> getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) {
for (String ident : getAllOverlayIdentifier()) {
if (ident.equals(identifier)) {
return new ArrayList<>(recipe.getIngredientStacks(recipeIndex));
}
}
return null;
}
@Override
public List<PositionedStack> getRecipeOutput(IRecipeHandler recipe, int recipeIndex, String identifier) {
if(identifier!=null) {
for (String ident : getAllOverlayIdentifier()) {
if (ident.equals(identifier)) {
List<PositionedStack> recipeOutputs = new ArrayList<>();
recipeOutputs.add(recipe.getResultStack(recipeIndex));
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);
}
return recipeOutputs;
}
}
}
return null;
}
}
@@ -0,0 +1,104 @@
package com.github.vfyjxf.nee.processor;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.IRecipeHandler;
import forestry.factory.recipes.nei.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class ForestryRecipeProcessor implements IRecipeProcessor {
@Override
public List<PositionedStack> getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) {
if (recipe instanceof NEIHandlerBottler) {
return bottlerHandler((NEIHandlerBottler) recipe, recipeIndex, true);
} else if (recipe instanceof NEIHandlerCarpenter) {
return carpenterHandler((NEIHandlerCarpenter) recipe, recipeIndex, true);
} else if (recipe instanceof NEIHandlerCentrifuge) {
return centrifugeHandler((NEIHandlerCentrifuge) recipe, recipeIndex, true);
} else if (recipe instanceof NEIHandlerFabricator) {
return fabricatorHandler((NEIHandlerFabricator) recipe, recipeIndex, true);
} else if (recipe instanceof NEIHandlerMoistener) {
return moistenerHandler((NEIHandlerMoistener) recipe, recipeIndex, true);
} else if (recipe instanceof NEIHandlerSqueezer) {
return squeezerHandler((NEIHandlerSqueezer) recipe, recipeIndex, true);
}
return null;
}
@Override
public List<PositionedStack> getRecipeOutput(IRecipeHandler recipe, int recipeIndex, String identifier) {
if (recipe instanceof NEIHandlerBottler) {
return bottlerHandler((NEIHandlerBottler) recipe, recipeIndex, false);
} else if (recipe instanceof NEIHandlerCarpenter) {
return carpenterHandler((NEIHandlerCarpenter) recipe, recipeIndex, false);
} else if (recipe instanceof NEIHandlerCentrifuge) {
return centrifugeHandler((NEIHandlerCentrifuge) recipe, recipeIndex, false);
} else if (recipe instanceof NEIHandlerFabricator) {
return fabricatorHandler((NEIHandlerFabricator) recipe, recipeIndex, false);
} else if (recipe instanceof NEIHandlerMoistener) {
return moistenerHandler((NEIHandlerMoistener) recipe, recipeIndex, false);
} else if (recipe instanceof NEIHandlerSqueezer) {
return squeezerHandler((NEIHandlerSqueezer) recipe, recipeIndex, false);
}
return null;
}
private List<PositionedStack> bottlerHandler(NEIHandlerBottler base, int recipeIndex, boolean getInput) {
return getInput ? base.getIngredientStacks(recipeIndex) : Collections.singletonList(base.getResultStack(recipeIndex));
}
private List<PositionedStack> carpenterHandler(NEIHandlerCarpenter base, int recipeIndex, boolean getInput) {
return getInput ? base.getIngredientStacks(recipeIndex) : Collections.singletonList(base.getResultStack(recipeIndex));
}
private List<PositionedStack> centrifugeHandler(NEIHandlerCentrifuge base, int recipeIndex, boolean getInput) {
return getInput ? base.getIngredientStacks(recipeIndex) : base.getOtherStacks(recipeIndex);
}
private List<PositionedStack> fabricatorHandler(NEIHandlerFabricator base, int recipeIndex, boolean getInput) {
List<PositionedStack> recipeInput = new ArrayList<>(base.getIngredientStacks(recipeIndex));
recipeInput.addAll(base.getOtherStacks(recipeIndex));
return getInput ? recipeInput : Collections.singletonList(base.getResultStack(recipeIndex));
}
//Fermenter doesn't support, because it doesn't has a item output
private List<PositionedStack> moistenerHandler(NEIHandlerMoistener base, int recipeIndex, boolean getInput) {
List<PositionedStack> recipeInput = new ArrayList<>(base.getIngredientStacks(recipeIndex));
recipeInput.addAll(base.getOtherStacks(recipeIndex));
return getInput ? recipeInput : Collections.singletonList(base.getResultStack(recipeIndex));
}
private List<PositionedStack> squeezerHandler(NEIHandlerSqueezer base, int recipeIndex, boolean getInput) {
return getInput ? base.getIngredientStacks(recipeIndex) : Collections.singletonList(base.getResultStack(recipeIndex));
}
//Still doesn't need support
}
@@ -2,13 +2,9 @@ package com.github.vfyjxf.nee.processor;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.IRecipeHandler;
import gregtech.api.enums.ItemList;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import gregtech.nei.GT_NEI_DefaultHandler.FixedPositionedStack;
import java.util.ArrayList;
import java.util.HashSet;
@@ -50,12 +46,14 @@ public class GregTechRecipeProcessor implements IRecipeProcessor {
@Override
public List<PositionedStack> getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) {
if (gtDefaultClz.isInstance(recipe) || gtAssLineClz.isInstance(recipe)) {
List<PositionedStack> recipeInputs = new ArrayList<>(recipe.getIngredientStacks(recipeIndex));
recipeInputs.removeIf(positionedStack -> GT_Utility.getFluidFromDisplayStack(positionedStack.items[0]) != null || positionedStack.item.stackSize == 0);
return recipeInputs;
}
return null;
}
@Override
@@ -63,6 +61,8 @@ public class GregTechRecipeProcessor implements IRecipeProcessor {
if (gtDefaultClz.isInstance(recipe) || gtAssLineClz.isInstance(recipe)) {
List<PositionedStack> recipeOutputs = new ArrayList<>(recipe.getOtherStacks(recipeIndex));
recipeOutputs.removeIf(positionedStack -> GT_Utility.getFluidFromDisplayStack(positionedStack.items[0]) != null);
//remove output if it's chance != 1
recipeOutputs.removeIf(stack -> stack instanceof FixedPositionedStack && !(((FixedPositionedStack) stack).mChance == 10000 || ((FixedPositionedStack) stack).mChance <= 0));
return recipeOutputs;
}
return null;
@@ -20,7 +20,7 @@ public class ICRecipeProcessor implements IRecipeProcessor {
@Override
public List<PositionedStack> getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) {
for (String ident : getAllOverlayIdentifier()) {
if (identifier.equals(ident)) {
if (ident.equals(identifier)) {
return new ArrayList<>(recipe.getIngredientStacks(recipeIndex));
}
}
@@ -30,7 +30,7 @@ public class ICRecipeProcessor implements IRecipeProcessor {
@Override
public List<PositionedStack> getRecipeOutput(IRecipeHandler recipe, int recipeIndex, String identifier) {
for (String ident : getAllOverlayIdentifier()) {
if (identifier.equals(ident)) {
if (ident.equals(identifier)) {
List<PositionedStack> recipeOutputs = new ArrayList<>();
recipeOutputs.add(recipe.getResultStack(recipeIndex));
recipeOutputs.addAll(recipe.getOtherStacks(recipeIndex));
@@ -9,22 +9,34 @@ import java.util.List;
public class RecipeProcessor {
public static List<IRecipeProcessor> recipeProcessors = new ArrayList<>();
public static void init(){
public static void init() {
NotEnoughEnergistics.logger.info("-----Not Enough Energistics Init Start-----");
NotEnoughEnergistics.logger.info("Install Vanilla Support");
recipeProcessors.add(new VanillaRecipeProcessor());
if(Loader.isModLoaded("gregtech")){
NotEnoughEnergistics.logger.info("Found GregTech,install GregTech Support");
if (Loader.isModLoaded("gregtech")) {
NotEnoughEnergistics.logger.info("Found GregTech,install GregTech support");
recipeProcessors.add(new GregTechRecipeProcessor());
}
if(Loader.isModLoaded("IC2")){
if (Loader.isModLoaded("IC2")) {
NotEnoughEnergistics.logger.info("Found IC2,install IC2 Support");
recipeProcessors.add(new ICRecipeProcessor());
}
if(Loader.isModLoaded("Avaritia")){
NotEnoughEnergistics.logger.info("Found Avaritia, install Avaritia Support");
if (Loader.isModLoaded("Avaritia")) {
NotEnoughEnergistics.logger.info("Found Avaritia, install Avaritia support");
recipeProcessors.add(new AvaritiaRecipeProcessor());
}
if(Loader.isModLoaded("EnderIO")){
NotEnoughEnergistics.logger.info("Found EnderIO, install EnderIO support");
recipeProcessors.add(new EnderIORecipeProcessor());
}
if(Loader.isModLoaded("Forestry")){
NotEnoughEnergistics.logger.info("Found Forestry, install Forestry support");
recipeProcessors.add(new ForestryRecipeProcessor());
}
if (Loader.isModLoaded("appliedenergistics2")) {
NotEnoughEnergistics.logger.info("Applied Energistics 2 will not be supported");
}
NotEnoughEnergistics.logger.info("-----Not Enough Energistics Init Finished-----");
}
@@ -34,5 +34,4 @@ public class VanillaRecipeProcessor implements IRecipeProcessor {
return null;
}
}
+2 -2
View File
@@ -7,7 +7,7 @@
"url": "",
"updateUrl": "",
"authorList": ["${mod_author}"],
"credits": "",
"credits": "${mod_credits}",
"screenshots": [],
"dependencies": []
}]
}]