Skip to content

Commit 23da96e

Browse files
committed
Add config
Add item blacklist and item priority list
1 parent 0a29733 commit 23da96e

21 files changed

+362
-66
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ This mod removes that functionality and allows the player to use NEI's transfer
1616
- If an item is a probability output, then nee will not transfer it.
1717
- Combine like stacks in processing patterns.
1818
- Support Processing Pattern Terminal(16 -> 4 mode).
19+
- 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)
1920

2021
## Compatible Modslist as followed:
2122

@@ -27,16 +28,15 @@ This mod removes that functionality and allows the player to use NEI's transfer
2728
- [x] EnderIO
2829
- [x] Forestry(Doesn't support Fermenter and Still,because they don't have an item output)
2930
- [x] Thaumcraft NEI Plugin
30-
- [x] Thaumic Energistics(Allows you transform ArcaneRecipe from NEI, it requires Thaumcraft NEI Plugin)
31+
- [x] Thaumic Energistics(Allows you to transfer ArcaneRecipe from NEI to Knowledge Inscriber, it requires Thaumcraft NEI Plugin)
3132

3233
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)
3334

3435
## TODO
3536

36-
- Add item blackList ,if item in the blacklist, it will not be transferred.
37-
- Add item priority list, if item in tne priority list, it will be transferred first
38-
39-
~~Combine like stacks in processing patterns.~~
37+
-[x] Add item blackList ,if item in the blacklist, it will not be transferred.
38+
-[x] Add item priority list, if item in tne priority list, it will be transferred first.
39+
-[x] Combine like stacks in processing patterns.
4040

4141
## Credits
4242
Thanks TheRealp455w0rd and his [Just Enough Energistics](https://www.curseforge.com/minecraft/mc-mods/just-enough-energistics-jee)

READNE_CN.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ NotEnoughEnergistics 是[Just Enough Energistics](https://www.curseforge.com/min
1111
- 如果一个物品输出为概率输出,那么NEE不会将它写入样板终端
1212
- 在处理模式中合并同类物品
1313
- 支持增广样板终端(16 -> 4模式)
14-
14+
- 允许你设置转换黑名单和转换优先名单,如对应物品在里面,那么他们将不会被转移/优先被转移
1515
## 当前支持的Mod列表:
1616

1717
- [ ] AppliedEnergistics2(我们将不会支持AE2,因为AE2没有注册对应的OverlayHandler)
@@ -22,15 +22,14 @@ NotEnoughEnergistics 是[Just Enough Energistics](https://www.curseforge.com/min
2222
- [x] EnderIO
2323
- [x] Forestry(不支持发酵机和蒸馏器,因为它们没有物品输出)
2424
- [x] Thaumcraft NEI Plugin
25-
- [x] Thaumic Energistics(允许你从NEI转移奥术合成台配方,需要Thaumcraft NEI Plugin)
25+
- [x] Thaumic Energistics(允许你从NEI转移奥术合成台配方到知识记录仪,需要Thaumcraft NEI Plugin)
2626

2727
如果你想要别的Mod的支持,请看[RecipeProcessor](./src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java) 或者[模组支持处理区](https://github.com/vfyjxf/NotEnoughEnergistics/issues/1)
2828

2929
## TODO
30-
- 添加转换黑名单,使在黑名单里的物品不会被转移到样板终端
31-
- 添加优先转换列表,在优先转换列表的物品会替换配方里的同类物品
32-
33-
~~在有多个同类物品的情况下,合并同类物品~~
30+
- [x] 添加转换黑名单,使在黑名单里的物品不会被转移到样板终端
31+
- [x] 添加优先转换列表,在优先转换列表的物品会替换配方里的同类物品
32+
- [x] 在有多个同类物品的情况下,合并同类物品
3433

3534
## Credits
3635
感谢 TheRealp455w0rd 和他的 [Just Enough Energistics](https://www.curseforge.com/minecraft/mc-mods/just-enough-energistics-jee)

build.gradle

Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
buildscript {
2-
repositories {
3-
mavenCentral()
4-
jcenter()
2+
repositories {
3+
mavenCentral()
4+
jcenter()
55
maven {
66
name = "github"
77
url = "https://github.com/juanmuscaria/maven/raw/master"
88
}
9-
maven {
10-
name = "gt"
11-
url = "https://gregtech.overminddl1.com/"
12-
}
13-
maven {
14-
name = "jitpack"
15-
url = "https://jitpack.io"
16-
}
17-
}
18-
dependencies {
19-
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-1.4.4-SNAPSHOT'
20-
}
9+
maven {
10+
name = "gt"
11+
url = "https://gregtech.overminddl1.com/"
12+
}
13+
maven {
14+
name = "jitpack"
15+
url = "https://jitpack.io"
16+
}
17+
}
18+
dependencies {
19+
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-1.4.4-SNAPSHOT'
20+
}
2121
}
2222

2323
apply plugin: 'java'
@@ -30,32 +30,32 @@ group = mod_group
3030
archivesBaseName = mod_archives_name
3131

3232
minecraft {
33-
version = "1.7.10-10.13.4.1614-1.7.10"
34-
runDir = "eclipse"
35-
replace "@VERSION@", project.version
33+
version = "1.7.10-10.13.4.1614-1.7.10"
34+
runDir = "eclipse"
35+
replace "@VERSION@", project.version
3636
}
3737

3838
repositories {
39-
maven {
40-
name 'chickenbones'
41-
url 'http://chickenbones.net/maven'
42-
}
43-
maven {
44-
name = "gt"
45-
url = "http://gregtech.overminddl1.com/"
46-
}
47-
flatDir {
48-
dirs 'libs'
49-
}
39+
maven {
40+
name 'chickenbones'
41+
url 'http://chickenbones.net/maven'
42+
}
43+
maven {
44+
name = "gt"
45+
url = "http://gregtech.overminddl1.com/"
46+
}
47+
flatDir {
48+
dirs 'libs'
49+
}
5050
}
5151

5252
dependencies {
5353

54-
compile "codechicken:NotEnoughItems:${mc_version}-${nei_version}:universal"
55-
compile "codechicken:CodeChickenLib:1.7.10-1.1.3.138:dev"
56-
compile "codechicken:CodeChickenCore:1.7.10-1.0.7.+:dev"
54+
compile "codechicken:NotEnoughItems:${mc_version}-${nei_version}:universal"
55+
compile "codechicken:CodeChickenLib:1.7.10-1.1.3.138:dev"
56+
compile "codechicken:CodeChickenCore:1.7.10-1.0.7.+:dev"
5757

58-
runtime "thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev"
58+
runtime "thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev"
5959

6060
}
6161

@@ -64,13 +64,14 @@ processResources {
6464
from(sourceSets.main.resources.srcDirs) {
6565
include 'mcmod.info'
6666
expand 'version': project.version,
67-
'mod_id': mod_id,
68-
'mod_name': mod_name,
69-
'mod_author': mod_author,
70-
'mod_description': mod_description,
71-
'mc_version': mc_version,
72-
'mod_version': mod_version,
73-
'mod_credits': mod_credits
67+
'mod_id': mod_id,
68+
'mod_name': mod_name,
69+
'mod_author': mod_author,
70+
'mod_description': mod_description,
71+
'mc_version': mc_version,
72+
'mod_version': mod_version,
73+
'mod_logo': mod_logo,
74+
'mod_credits': mod_credits
7475
}
7576

7677
from(sourceSets.main.resources.srcDirs) {
@@ -79,21 +80,21 @@ processResources {
7980
}
8081

8182
task devJar(type: Jar) {
82-
classifier = 'dev'
83-
from sourceSets.main.output
83+
classifier = 'dev'
84+
from sourceSets.main.output
8485
}
8586

8687
task sourcesJar(type: Jar) {
87-
classifier = 'sources'
88-
from sourceSets.main.allSource
88+
classifier = 'sources'
89+
from sourceSets.main.allSource
8990
}
9091

91-
jar{
92-
appendix project.minecraft.version
92+
jar {
93+
appendix project.minecraft.version
9394
}
9495

9596

9697
artifacts {
97-
archives devJar
98-
archives sourcesJar
98+
archives devJar
99+
archives sourcesJar
99100
}

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ org.gradle.daemon=false
66
mc_version=1.7.10
77
nei_version=2.1.6-GTNH
88
ae2_version=rv3-beta-52-GTNH
9-
mod_version=1.1.2
9+
mod_version=1.2.0
1010
forge_version=10.13.4.1614
1111
mod_group=com.github.vfyjxf.neenergistics
1212
mod_id=neenergistics
1313
mod_name=NotEnoughEnergistics
1414
mod_archives_name=NotEnoughEnergistics
1515
mod_author=vfyxf
1616
mod_description=
17+
mod_logo=assets/neenergistics/meta/logo.png
1718
mod_credits=Thanks TheRealp455w0rd
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.github.vfyjxf.nee;
2+
3+
import com.github.vfyjxf.nee.processor.IRecipeProcessor;
4+
import com.github.vfyjxf.nee.processor.RecipeProcessor;
5+
import net.minecraft.command.CommandBase;
6+
import net.minecraft.command.ICommandSender;
7+
import net.minecraft.command.WrongUsageException;
8+
9+
import java.util.List;
10+
11+
import static com.github.vfyjxf.nee.NotEnoughEnergistics.logger;
12+
13+
public class NEECommands extends CommandBase {
14+
@Override
15+
public String getCommandName() {
16+
return "nee";
17+
}
18+
19+
@Override
20+
public String getCommandUsage(ICommandSender sender) {
21+
return "use /nee RecipeProcessor to get RecipeProcessor and identifier,see them in log";
22+
}
23+
24+
@Override
25+
public void processCommand(ICommandSender sender, String[] args) {
26+
if (args.length != 0) {
27+
if ("RecipeProcessor".equals(args[0])) {
28+
for (IRecipeProcessor processor : RecipeProcessor.recipeProcessors) {
29+
logger.info("RecipeProcessor:" + processor.getRecipeProcessorId() + " identifier:");
30+
for (String ident : processor.getAllOverlayIdentifier()) {
31+
logger.info(ident);
32+
}
33+
}
34+
}
35+
}else {
36+
throw new WrongUsageException("use /nee RecipeProcessor to get RecipeProcessor and identifier,see them in log");
37+
}
38+
}
39+
40+
@Override
41+
public List addTabCompletionOptions(ICommandSender sender, String[] args) {
42+
return CommandBase.getListOfStringsMatchingLastWord(args, "RecipeProcessor");
43+
}
44+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.github.vfyjxf.nee;
2+
3+
import net.minecraftforge.common.config.Configuration;
4+
5+
import java.io.File;
6+
7+
/**
8+
* @author vfyjxf
9+
*/
10+
public class NEEConfig {
11+
12+
13+
public static String[] transformBlacklist = new String[0];
14+
public static String[] transformPriorityList = new String[0];
15+
16+
public static void loadConfig(File configFile) {
17+
Configuration config = new Configuration(configFile);
18+
config.load();
19+
20+
transformBlacklist = config.get("client", "transformItemBlacklist", new String[0],
21+
"If item in the blacklist, it will not be transferred.\n" +
22+
"the format is \" {modid:modid,name:name,meta:meta,recipeProcessor:recipeProcessorID,identifier:identifier}\"\n"+
23+
"example: \"{modid:minecraft,name:iron_ingot,recipeProcessor:EnderIO,identifier:EnderIOAlloySmelter}\"").getStringList();
24+
transformPriorityList = config.get("client", "transformItemPriorityList", new String[0],
25+
"If item in tne priority list, it will be transferred first.").getStringList();
26+
if (config.hasChanged()) config.save();
27+
}
28+
29+
}

src/main/java/com/github/vfyjxf/nee/NEINeeConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private void installPatternTerminalExSupport(Set<String> identifiers) {
7474
return;
7575
}
7676
identifiers.remove("crafting");
77-
identifiers.remove( "crafting2x2");
77+
identifiers.remove("crafting2x2");
7878
//PatternTermEx Support
7979
for (String ident : identifiers) {
8080
API.registerGuiOverlay(GuiPatternTermEx.class, ident);

src/main/java/com/github/vfyjxf/nee/NotEnoughEnergistics.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,19 @@
33
import com.github.vfyjxf.nee.network.NEENetworkHandler;
44
import cpw.mods.fml.common.Mod;
55
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
6+
import cpw.mods.fml.common.event.FMLServerStartingEvent;
7+
import net.minecraft.launchwrapper.Launch;
68
import org.apache.logging.log4j.LogManager;
79
import org.apache.logging.log4j.Logger;
810

11+
import java.io.File;
912

10-
@Mod(modid = NotEnoughEnergistics.MODID, version = NotEnoughEnergistics.VERSION, name = NotEnoughEnergistics.NAME, dependencies = NotEnoughEnergistics.DEPENDENCIES)
13+
14+
@Mod(modid = NotEnoughEnergistics.MODID,
15+
version = NotEnoughEnergistics.VERSION,
16+
name = NotEnoughEnergistics.NAME,
17+
dependencies = NotEnoughEnergistics.DEPENDENCIES,
18+
useMetadata = true)
1119
public class NotEnoughEnergistics {
1220
public static final String MODID = "neenergistics";
1321
public static final String NAME = "NotEnoughEnergistics";
@@ -18,5 +26,12 @@ public class NotEnoughEnergistics {
1826
@Mod.EventHandler
1927
public void preInit(FMLPreInitializationEvent e) {
2028
NEENetworkHandler.init();
29+
NEEConfig.loadConfig(new File(Launch.minecraftHome, "config/NotEnoughEnergistics.cfg"));
2130
}
31+
32+
@Mod.EventHandler
33+
private void serverStarting(FMLServerStartingEvent event) {
34+
event.registerServerCommand(new NEECommands());
35+
}
36+
2237
}

src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.github.vfyjxf.nee.network.packet.PacketNEIPatternRecipe;
1313
import com.github.vfyjxf.nee.processor.IRecipeProcessor;
1414
import com.github.vfyjxf.nee.processor.RecipeProcessor;
15+
import com.github.vfyjxf.nee.utils.ItemUtils;
1516
import net.minecraft.client.gui.inventory.GuiContainer;
1617
import net.minecraft.item.ItemStack;
1718
import net.minecraft.nbt.NBTTagCompound;
@@ -53,7 +54,7 @@ private PacketNEIPatternRecipe packProcessRecipe(IRecipeHandler recipe, int reci
5354
for (IRecipeProcessor processor : RecipeProcessor.recipeProcessors) {
5455
List<PositionedStack> inputs = processor.getRecipeInput(recipe, recipeIndex, identifier);
5556
List<PositionedStack> outputs = processor.getRecipeOutput(recipe, recipeIndex, identifier);
56-
57+
String recipeProcessorId = processor.getRecipeProcessorId();
5758
List<PositionedStack> tInputs = new ArrayList<>();
5859

5960
if (inputs != null && outputs != null) {
@@ -76,11 +77,14 @@ private PacketNEIPatternRecipe packProcessRecipe(IRecipeHandler recipe, int reci
7677
for (PositionedStack positionedStack : tInputs) {
7778
ItemStack currentStack = positionedStack.items[0];
7879
for (ItemStack stack : positionedStack.items) {
79-
if (Platform.isRecipePrioritized(stack)) {
80+
if (Platform.isRecipePrioritized(stack) || ItemUtils.isPreferItems(stack, recipeProcessorId, identifier)) {
8081
currentStack = stack.copy();
8182
break;
8283
}
8384
}
85+
if (ItemUtils.isInBlackList(currentStack, recipeProcessorId, identifier)) {
86+
continue;
87+
}
8488
recipeInputs.setTag("#" + inputIndex, currentStack.writeToNBT(new NBTTagCompound()));
8589
inputIndex++;
8690
}
@@ -94,7 +98,6 @@ private PacketNEIPatternRecipe packProcessRecipe(IRecipeHandler recipe, int reci
9498
}
9599
}
96100
}
97-
98101
return new PacketNEIPatternRecipe(recipeInputs, recipeOutputs);
99102
}
100103

@@ -109,7 +112,7 @@ private PacketNEIPatternRecipe packCraftingTableRecipe(IRecipeHandler recipe, in
109112
final ItemStack[] currentStackList = positionedStack.items;
110113
ItemStack stack = positionedStack.items[0];
111114
for (ItemStack currentStack : currentStackList) {
112-
if (Platform.isRecipePrioritized(currentStack)) {
115+
if (Platform.isRecipePrioritized(currentStack) || ItemUtils.isPreferItems(currentStack)) {
113116
stack = currentStack.copy();
114117
}
115118
}

src/main/java/com/github/vfyjxf/nee/processor/AvaritiaRecipeProcessor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ public Set<String> getAllOverlayIdentifier() {
1313
));
1414
}
1515

16+
@Override
17+
public String getRecipeProcessorId() {
18+
return "Avaritia";
19+
}
20+
1621
@Override
1722
public List<PositionedStack> getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) {
1823
for (String ident : getAllOverlayIdentifier()) {

0 commit comments

Comments
 (0)