diff --git a/README.md b/README.md index 32b680a..4876e87 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ This mod removes that functionality and allows the player to use NEI's transfer - If an item is a probability output, then nee will not transfer it. - Combine like stacks in processing patterns. - Support Processing Pattern Terminal(16 -> 4 mode). +- Allow you item blackList and item priority list, if item in them, it will not be transferred / transfer it first.(use /nee RecipeProcessor to get RecipeProcessor and identifier in log) ## Compatible Modslist as followed: @@ -27,16 +28,15 @@ 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) - [x] Thaumcraft NEI Plugin -- [x] Thaumic Energistics(Allows you transform ArcaneRecipe from NEI, it requires Thaumcraft NEI Plugin) +- [x] Thaumic Energistics(Allows you to transfer ArcaneRecipe from NEI to Knowledge Inscriber, it requires Thaumcraft NEI Plugin) 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 -- Add item blackList ,if item in the blacklist, it will not be transferred. -- Add item priority list, if item in tne priority list, it will be transferred first - -~~Combine like stacks in processing patterns.~~ +-[x] Add item blackList ,if item in the blacklist, it will not be transferred. +-[x] Add item priority list, if item in tne priority list, it will be transferred first. +-[x] 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) \ No newline at end of file diff --git a/READNE_CN.md b/READNE_CN.md index 1209cff..329e8bc 100644 --- a/READNE_CN.md +++ b/READNE_CN.md @@ -11,7 +11,7 @@ NotEnoughEnergistics 是[Just Enough Energistics](https://www.curseforge.com/min - 如果一个物品输出为概率输出,那么NEE不会将它写入样板终端 - 在处理模式中合并同类物品 - 支持增广样板终端(16 -> 4模式) - +- 允许你设置转换黑名单和转换优先名单,如对应物品在里面,那么他们将不会被转移/优先被转移 ## 当前支持的Mod列表: - [ ] AppliedEnergistics2(我们将不会支持AE2,因为AE2没有注册对应的OverlayHandler) @@ -22,15 +22,14 @@ NotEnoughEnergistics 是[Just Enough Energistics](https://www.curseforge.com/min - [x] EnderIO - [x] Forestry(不支持发酵机和蒸馏器,因为它们没有物品输出) - [x] Thaumcraft NEI Plugin -- [x] Thaumic Energistics(允许你从NEI转移奥术合成台配方,需要Thaumcraft NEI Plugin) +- [x] Thaumic Energistics(允许你从NEI转移奥术合成台配方到知识记录仪,需要Thaumcraft NEI Plugin) 如果你想要别的Mod的支持,请看[RecipeProcessor](./src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java) 或者[模组支持处理区](https://github.com/vfyjxf/NotEnoughEnergistics/issues/1) ## TODO - - 添加转换黑名单,使在黑名单里的物品不会被转移到样板终端 - - 添加优先转换列表,在优先转换列表的物品会替换配方里的同类物品 - - ~~在有多个同类物品的情况下,合并同类物品~~ +- [x] 添加转换黑名单,使在黑名单里的物品不会被转移到样板终端 +- [x] 添加优先转换列表,在优先转换列表的物品会替换配方里的同类物品 +- [x] 在有多个同类物品的情况下,合并同类物品 ## Credits 感谢 TheRealp455w0rd 和他的 [Just Enough Energistics](https://www.curseforge.com/minecraft/mc-mods/just-enough-energistics-jee) diff --git a/build.gradle b/build.gradle index 4a79878..1d1ed58 100644 --- a/build.gradle +++ b/build.gradle @@ -1,23 +1,23 @@ buildscript { - repositories { - mavenCentral() - jcenter() + repositories { + mavenCentral() + jcenter() maven { name = "github" url = "https://github.com/juanmuscaria/maven/raw/master" } - maven { - name = "gt" - url = "https://gregtech.overminddl1.com/" - } - maven { - name = "jitpack" - url = "https://jitpack.io" - } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-1.4.4-SNAPSHOT' - } + maven { + name = "gt" + url = "https://gregtech.overminddl1.com/" + } + maven { + name = "jitpack" + url = "https://jitpack.io" + } + } + dependencies { + classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-1.4.4-SNAPSHOT' + } } apply plugin: 'java' @@ -30,32 +30,32 @@ group = mod_group archivesBaseName = mod_archives_name minecraft { - version = "1.7.10-10.13.4.1614-1.7.10" - runDir = "eclipse" - replace "@VERSION@", project.version + version = "1.7.10-10.13.4.1614-1.7.10" + runDir = "eclipse" + replace "@VERSION@", project.version } repositories { - maven { - name 'chickenbones' - url 'http://chickenbones.net/maven' - } - maven { - name = "gt" - url = "http://gregtech.overminddl1.com/" - } - flatDir { - dirs 'libs' - } + maven { + name 'chickenbones' + url 'http://chickenbones.net/maven' + } + maven { + name = "gt" + url = "http://gregtech.overminddl1.com/" + } + flatDir { + dirs 'libs' + } } dependencies { - compile "codechicken:NotEnoughItems:${mc_version}-${nei_version}:universal" - compile "codechicken:CodeChickenLib:1.7.10-1.1.3.138:dev" - compile "codechicken:CodeChickenCore:1.7.10-1.0.7.+:dev" + compile "codechicken:NotEnoughItems:${mc_version}-${nei_version}:universal" + compile "codechicken:CodeChickenLib:1.7.10-1.1.3.138:dev" + compile "codechicken:CodeChickenCore:1.7.10-1.0.7.+:dev" - runtime "thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev" + runtime "thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev" } @@ -64,13 +64,14 @@ processResources { from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' expand 'version': project.version, - 'mod_id': mod_id, - 'mod_name': mod_name, - 'mod_author': mod_author, - 'mod_description': mod_description, - 'mc_version': mc_version, - 'mod_version': mod_version, - 'mod_credits': mod_credits + 'mod_id': mod_id, + 'mod_name': mod_name, + 'mod_author': mod_author, + 'mod_description': mod_description, + 'mc_version': mc_version, + 'mod_version': mod_version, + 'mod_logo': mod_logo, + 'mod_credits': mod_credits } from(sourceSets.main.resources.srcDirs) { @@ -79,21 +80,21 @@ processResources { } task devJar(type: Jar) { - classifier = 'dev' - from sourceSets.main.output + classifier = 'dev' + from sourceSets.main.output } task sourcesJar(type: Jar) { - classifier = 'sources' - from sourceSets.main.allSource + classifier = 'sources' + from sourceSets.main.allSource } -jar{ - appendix project.minecraft.version +jar { + appendix project.minecraft.version } artifacts { - archives devJar - archives sourcesJar + archives devJar + archives sourcesJar } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 6e41bbc..00ef3c6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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.1.2 +mod_version=1.2.0 forge_version=10.13.4.1614 mod_group=com.github.vfyjxf.neenergistics mod_id=neenergistics @@ -14,4 +14,5 @@ mod_name=NotEnoughEnergistics mod_archives_name=NotEnoughEnergistics mod_author=vfyxf mod_description= +mod_logo=assets/neenergistics/meta/logo.png mod_credits=Thanks TheRealp455w0rd diff --git a/src/main/java/com/github/vfyjxf/nee/NEECommands.java b/src/main/java/com/github/vfyjxf/nee/NEECommands.java new file mode 100644 index 0000000..f1b48db --- /dev/null +++ b/src/main/java/com/github/vfyjxf/nee/NEECommands.java @@ -0,0 +1,44 @@ +package com.github.vfyjxf.nee; + +import com.github.vfyjxf.nee.processor.IRecipeProcessor; +import com.github.vfyjxf.nee.processor.RecipeProcessor; +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; + +import java.util.List; + +import static com.github.vfyjxf.nee.NotEnoughEnergistics.logger; + +public class NEECommands extends CommandBase { + @Override + public String getCommandName() { + return "nee"; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return "use /nee RecipeProcessor to get RecipeProcessor and identifier,see them in log"; + } + + @Override + public void processCommand(ICommandSender sender, String[] args) { + if (args.length != 0) { + if ("RecipeProcessor".equals(args[0])) { + for (IRecipeProcessor processor : RecipeProcessor.recipeProcessors) { + logger.info("RecipeProcessor:" + processor.getRecipeProcessorId() + " identifier:"); + for (String ident : processor.getAllOverlayIdentifier()) { + logger.info(ident); + } + } + } + }else { + throw new WrongUsageException("use /nee RecipeProcessor to get RecipeProcessor and identifier,see them in log"); + } + } + + @Override + public List addTabCompletionOptions(ICommandSender sender, String[] args) { + return CommandBase.getListOfStringsMatchingLastWord(args, "RecipeProcessor"); + } +} diff --git a/src/main/java/com/github/vfyjxf/nee/NEEConfig.java b/src/main/java/com/github/vfyjxf/nee/NEEConfig.java new file mode 100644 index 0000000..aae1ffc --- /dev/null +++ b/src/main/java/com/github/vfyjxf/nee/NEEConfig.java @@ -0,0 +1,29 @@ +package com.github.vfyjxf.nee; + +import net.minecraftforge.common.config.Configuration; + +import java.io.File; + +/** + * @author vfyjxf + */ +public class NEEConfig { + + + public static String[] transformBlacklist = new String[0]; + public static String[] transformPriorityList = new String[0]; + + public static void loadConfig(File configFile) { + Configuration config = new Configuration(configFile); + config.load(); + + 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}\"").getStringList(); + transformPriorityList = config.get("client", "transformItemPriorityList", new String[0], + "If item in tne priority list, it will be transferred first.").getStringList(); + if (config.hasChanged()) config.save(); + } + +} diff --git a/src/main/java/com/github/vfyjxf/nee/NEINeeConfig.java b/src/main/java/com/github/vfyjxf/nee/NEINeeConfig.java index a9f81a6..92a1be6 100644 --- a/src/main/java/com/github/vfyjxf/nee/NEINeeConfig.java +++ b/src/main/java/com/github/vfyjxf/nee/NEINeeConfig.java @@ -74,7 +74,7 @@ private void installPatternTerminalExSupport(Set identifiers) { return; } identifiers.remove("crafting"); - identifiers.remove( "crafting2x2"); + identifiers.remove("crafting2x2"); //PatternTermEx Support for (String ident : identifiers) { API.registerGuiOverlay(GuiPatternTermEx.class, ident); diff --git a/src/main/java/com/github/vfyjxf/nee/NotEnoughEnergistics.java b/src/main/java/com/github/vfyjxf/nee/NotEnoughEnergistics.java index 7c0cc8f..eb38132 100644 --- a/src/main/java/com/github/vfyjxf/nee/NotEnoughEnergistics.java +++ b/src/main/java/com/github/vfyjxf/nee/NotEnoughEnergistics.java @@ -3,11 +3,19 @@ import com.github.vfyjxf.nee.network.NEENetworkHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerStartingEvent; +import net.minecraft.launchwrapper.Launch; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import java.io.File; -@Mod(modid = NotEnoughEnergistics.MODID, version = NotEnoughEnergistics.VERSION, name = NotEnoughEnergistics.NAME, dependencies = NotEnoughEnergistics.DEPENDENCIES) + +@Mod(modid = NotEnoughEnergistics.MODID, + version = NotEnoughEnergistics.VERSION, + name = NotEnoughEnergistics.NAME, + dependencies = NotEnoughEnergistics.DEPENDENCIES, + useMetadata = true) public class NotEnoughEnergistics { public static final String MODID = "neenergistics"; public static final String NAME = "NotEnoughEnergistics"; @@ -18,5 +26,12 @@ public class NotEnoughEnergistics { @Mod.EventHandler public void preInit(FMLPreInitializationEvent e) { NEENetworkHandler.init(); + NEEConfig.loadConfig(new File(Launch.minecraftHome, "config/NotEnoughEnergistics.cfg")); } + + @Mod.EventHandler + private void serverStarting(FMLServerStartingEvent event) { + event.registerServerCommand(new NEECommands()); + } + } diff --git a/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java b/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java index 5d124d0..cb88ca9 100644 --- a/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java +++ b/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java @@ -12,6 +12,7 @@ import com.github.vfyjxf.nee.network.packet.PacketNEIPatternRecipe; import com.github.vfyjxf.nee.processor.IRecipeProcessor; import com.github.vfyjxf.nee.processor.RecipeProcessor; +import com.github.vfyjxf.nee.utils.ItemUtils; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -53,7 +54,7 @@ private PacketNEIPatternRecipe packProcessRecipe(IRecipeHandler recipe, int reci for (IRecipeProcessor processor : RecipeProcessor.recipeProcessors) { List inputs = processor.getRecipeInput(recipe, recipeIndex, identifier); List outputs = processor.getRecipeOutput(recipe, recipeIndex, identifier); - + String recipeProcessorId = processor.getRecipeProcessorId(); List tInputs = new ArrayList<>(); if (inputs != null && outputs != null) { @@ -76,11 +77,14 @@ private PacketNEIPatternRecipe packProcessRecipe(IRecipeHandler recipe, int reci for (PositionedStack positionedStack : tInputs) { ItemStack currentStack = positionedStack.items[0]; for (ItemStack stack : positionedStack.items) { - if (Platform.isRecipePrioritized(stack)) { + if (Platform.isRecipePrioritized(stack) || ItemUtils.isPreferItems(stack, recipeProcessorId, identifier)) { currentStack = stack.copy(); break; } } + if (ItemUtils.isInBlackList(currentStack, recipeProcessorId, identifier)) { + continue; + } recipeInputs.setTag("#" + inputIndex, currentStack.writeToNBT(new NBTTagCompound())); inputIndex++; } @@ -94,7 +98,6 @@ private PacketNEIPatternRecipe packProcessRecipe(IRecipeHandler recipe, int reci } } } - return new PacketNEIPatternRecipe(recipeInputs, recipeOutputs); } @@ -109,7 +112,7 @@ private PacketNEIPatternRecipe packCraftingTableRecipe(IRecipeHandler recipe, in final ItemStack[] currentStackList = positionedStack.items; ItemStack stack = positionedStack.items[0]; for (ItemStack currentStack : currentStackList) { - if (Platform.isRecipePrioritized(currentStack)) { + if (Platform.isRecipePrioritized(currentStack) || ItemUtils.isPreferItems(currentStack)) { stack = currentStack.copy(); } } diff --git a/src/main/java/com/github/vfyjxf/nee/processor/AvaritiaRecipeProcessor.java b/src/main/java/com/github/vfyjxf/nee/processor/AvaritiaRecipeProcessor.java index ef23451..47b253b 100644 --- a/src/main/java/com/github/vfyjxf/nee/processor/AvaritiaRecipeProcessor.java +++ b/src/main/java/com/github/vfyjxf/nee/processor/AvaritiaRecipeProcessor.java @@ -13,6 +13,11 @@ public Set getAllOverlayIdentifier() { )); } + @Override + public String getRecipeProcessorId() { + return "Avaritia"; + } + @Override public List getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) { for (String ident : getAllOverlayIdentifier()) { diff --git a/src/main/java/com/github/vfyjxf/nee/processor/EnderIORecipeProcessor.java b/src/main/java/com/github/vfyjxf/nee/processor/EnderIORecipeProcessor.java index 0cb667d..744e150 100644 --- a/src/main/java/com/github/vfyjxf/nee/processor/EnderIORecipeProcessor.java +++ b/src/main/java/com/github/vfyjxf/nee/processor/EnderIORecipeProcessor.java @@ -15,6 +15,11 @@ public Set getAllOverlayIdentifier() { )); } + @Override + public String getRecipeProcessorId() { + return "EnderIO"; + } + @Override public List getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) { for (String ident : getAllOverlayIdentifier()) { diff --git a/src/main/java/com/github/vfyjxf/nee/processor/ForestryRecipeProcessor.java b/src/main/java/com/github/vfyjxf/nee/processor/ForestryRecipeProcessor.java index 26305d7..e016912 100644 --- a/src/main/java/com/github/vfyjxf/nee/processor/ForestryRecipeProcessor.java +++ b/src/main/java/com/github/vfyjxf/nee/processor/ForestryRecipeProcessor.java @@ -10,6 +10,11 @@ public class ForestryRecipeProcessor implements IRecipeProcessor { + @Override + public String getRecipeProcessorId() { + return "Forestry"; + } + @Override public List getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) { if (recipe instanceof NEIHandlerBottler) { diff --git a/src/main/java/com/github/vfyjxf/nee/processor/GregTechRecipeProcessor.java b/src/main/java/com/github/vfyjxf/nee/processor/GregTechRecipeProcessor.java index 016f0f5..e260b4e 100644 --- a/src/main/java/com/github/vfyjxf/nee/processor/GregTechRecipeProcessor.java +++ b/src/main/java/com/github/vfyjxf/nee/processor/GregTechRecipeProcessor.java @@ -49,6 +49,11 @@ public Set getAllOverlayIdentifier() { return identifiers; } + @Override + public String getRecipeProcessorId() { + return "GregTech5"; + } + @Override public List getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) { diff --git a/src/main/java/com/github/vfyjxf/nee/processor/ICRecipeProcessor.java b/src/main/java/com/github/vfyjxf/nee/processor/ICRecipeProcessor.java index 3ffaf14..b5f5976 100644 --- a/src/main/java/com/github/vfyjxf/nee/processor/ICRecipeProcessor.java +++ b/src/main/java/com/github/vfyjxf/nee/processor/ICRecipeProcessor.java @@ -18,6 +18,11 @@ public Set getAllOverlayIdentifier() { )); } + @Override + public String getRecipeProcessorId() { + return "IC2"; + } + @Override public List getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) { for (String ident : getAllOverlayIdentifier()) { diff --git a/src/main/java/com/github/vfyjxf/nee/processor/IRecipeProcessor.java b/src/main/java/com/github/vfyjxf/nee/processor/IRecipeProcessor.java index 51e4ce2..4c30689 100644 --- a/src/main/java/com/github/vfyjxf/nee/processor/IRecipeProcessor.java +++ b/src/main/java/com/github/vfyjxf/nee/processor/IRecipeProcessor.java @@ -18,6 +18,8 @@ default Set getAllOverlayIdentifier(){ return Collections.emptySet(); } + String getRecipeProcessorId(); + List getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier); List getRecipeOutput(IRecipeHandler recipe, int recipeIndex, String identifier); diff --git a/src/main/java/com/github/vfyjxf/nee/processor/TCNEIPluginRecipeProcessor.java b/src/main/java/com/github/vfyjxf/nee/processor/TCNEIPluginRecipeProcessor.java index 2e732f1..3c40681 100644 --- a/src/main/java/com/github/vfyjxf/nee/processor/TCNEIPluginRecipeProcessor.java +++ b/src/main/java/com/github/vfyjxf/nee/processor/TCNEIPluginRecipeProcessor.java @@ -19,6 +19,11 @@ public Set getAllOverlayIdentifier() { )); } + @Override + public String getRecipeProcessorId() { + return "TCNEIPlugin"; + } + @Override public List getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) { for(String ident : getAllOverlayIdentifier()){ diff --git a/src/main/java/com/github/vfyjxf/nee/processor/VanillaRecipeProcessor.java b/src/main/java/com/github/vfyjxf/nee/processor/VanillaRecipeProcessor.java index b083459..4c1c75b 100644 --- a/src/main/java/com/github/vfyjxf/nee/processor/VanillaRecipeProcessor.java +++ b/src/main/java/com/github/vfyjxf/nee/processor/VanillaRecipeProcessor.java @@ -14,6 +14,11 @@ public Set getAllOverlayIdentifier() { return new HashSet<>(Arrays.asList("brewing", "smelting", "fuel")); } + @Override + public String getRecipeProcessorId() { + return "Vanilla"; + } + @Override public List getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) { List recipeInputs = new ArrayList<>(); diff --git a/src/main/java/com/github/vfyjxf/nee/utils/ItemUtils.java b/src/main/java/com/github/vfyjxf/nee/utils/ItemUtils.java new file mode 100644 index 0000000..9ee4835 --- /dev/null +++ b/src/main/java/com/github/vfyjxf/nee/utils/ItemUtils.java @@ -0,0 +1,127 @@ +package com.github.vfyjxf.nee.utils; + +import static com.github.vfyjxf.nee.NEEConfig.transformBlacklist; +import static com.github.vfyjxf.nee.NEEConfig.transformPriorityList; + +import com.github.vfyjxf.nee.NotEnoughEnergistics; +import com.google.gson.Gson; +import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.JsonToNBT; +import net.minecraft.nbt.NBTException; +import net.minecraft.nbt.NBTTagCompound; + + +import java.util.ArrayList; +import java.util.List; + +public final class ItemUtils { + + public static Gson gson = new Gson(); + + public static List getTransformItemBlacklist() { + List transformItemBlacklist = new ArrayList<>(); + for (String itemJsonString : transformBlacklist) { + StackProcessor processor = gson.fromJson(itemJsonString, StackProcessor.class); + if (processor != null) { + Item currentItem = GameRegistry.findItem(processor.modid, processor.name); + if (currentItem != null) { + ItemStack currentStack = processor.meta != null ? new ItemStack(currentItem, 1, Integer.parseInt(processor.meta)) : new ItemStack(currentItem); + if (processor.nbt != null) { + NBTTagCompound nbt = null; + try { + nbt = (NBTTagCompound) JsonToNBT.func_150315_a(processor.nbt); + } catch (NBTException e) { + e.printStackTrace(); + } + if (nbt != null) { + currentStack.setTagCompound(nbt); + } + } + transformItemBlacklist.add(new StackProcessor(currentStack, currentItem, processor.recipeProcessor, processor.identifier)); + } + } + } + + return transformItemBlacklist; + } + + public static List getTransformItemPriorityList() { + List transformItemPriorityList = new ArrayList<>(); + for (String itemJsonString : transformPriorityList) { + StackProcessor processor = gson.fromJson(itemJsonString, StackProcessor.class); + if (processor != null) { + Item currentItem = GameRegistry.findItem(processor.modid, processor.name); + if (currentItem != null) { + ItemStack currentStack = processor.meta != null ? new ItemStack(currentItem, 1, Integer.parseInt(processor.meta)) : new ItemStack(currentItem); + if (processor.nbt != null) { + NBTTagCompound nbt = null; + try { + nbt = (NBTTagCompound) JsonToNBT.func_150315_a(processor.nbt); + } catch (NBTException e) { + e.printStackTrace(); + } + if (nbt != null) { + currentStack.setTagCompound(nbt); + } + } + transformItemPriorityList.add(new StackProcessor(currentStack, currentItem, processor.recipeProcessor, processor.identifier)); + } + } + } + + return transformItemPriorityList; + } + + + public static boolean isPreferItems(ItemStack itemStack, String recipeProcessor, String identifier) { + for (StackProcessor processor : getTransformItemPriorityList()) { + ItemStack copyStack = itemStack.copy(); + copyStack.stackSize = 1; + if (ItemStack.areItemStacksEqual(copyStack, processor.itemStack)) { + if (processor.recipeProcessor == null && processor.identifier == null) { + return true; + } else if (processor.recipeProcessor == null) { + return identifier.equals(processor.identifier); + } else if (processor.identifier == null) { + return recipeProcessor.equals(processor.recipeProcessor); + } else { + return recipeProcessor.equals(processor.recipeProcessor) && identifier.equals(processor.identifier); + } + } + } + return false; + } + + public static boolean isPreferItems(ItemStack itemStack) { + for (StackProcessor processor : getTransformItemPriorityList()) { + ItemStack copyStack = itemStack.copy(); + copyStack.stackSize = 1; + if (ItemStack.areItemStacksEqual(copyStack, processor.itemStack)) { + return true; + } + } + return false; + } + + public static boolean isInBlackList(ItemStack itemStack, String recipeProcessor, String identifier) { + for (StackProcessor processor : getTransformItemBlacklist()) { + ItemStack copyStack = itemStack.copy(); + copyStack.stackSize = 1; + if (ItemStack.areItemStacksEqual(copyStack, processor.itemStack)) { + if (processor.recipeProcessor == null && processor.identifier == null) { + return true; + } else if (processor.recipeProcessor == null) { + return identifier.equals(processor.identifier); + } else if (processor.identifier == null) { + return recipeProcessor.equals(processor.recipeProcessor); + } else { + return recipeProcessor.equals(processor.recipeProcessor) && identifier.equals(processor.identifier); + } + } + } + return false; + } + +} diff --git a/src/main/java/com/github/vfyjxf/nee/utils/StackProcessor.java b/src/main/java/com/github/vfyjxf/nee/utils/StackProcessor.java new file mode 100644 index 0000000..58bb93f --- /dev/null +++ b/src/main/java/com/github/vfyjxf/nee/utils/StackProcessor.java @@ -0,0 +1,39 @@ +package com.github.vfyjxf.nee.utils; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class StackProcessor { + public String modid; + public String name; + public String meta; + public String nbt; + public ItemStack itemStack; + public Item item; + public String recipeProcessor; + public String identifier; + + public StackProcessor(String modid, String name, String meta, String nbt){ + this.modid = modid; + this.name = name; + this.meta = meta; + this.nbt = nbt; + } + public StackProcessor(String modid, String name, String meta){ + this.modid = modid; + this.name = name; + this.meta = meta; + } + public StackProcessor(String modid, String name){ + this.modid = modid; + this.name = name; + } + + public StackProcessor(ItemStack itemStack, Item item, String recipeProcessor, String identifier){ + this.itemStack = itemStack; + this.item = item; + this.recipeProcessor = recipeProcessor; + this.identifier = identifier; + } + +} diff --git a/src/main/resources/assets/neenergistics/meta/logo.png b/src/main/resources/assets/neenergistics/meta/logo.png new file mode 100644 index 0000000..5b2feec Binary files /dev/null and b/src/main/resources/assets/neenergistics/meta/logo.png differ diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 89e0fa7..8847af2 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -8,6 +8,7 @@ "updateUrl": "", "authorList": ["${mod_author}"], "credits": "${mod_credits}", + "logoFile":"${mod_logo}", "screenshots": [], "dependencies": [] }]