mirror of
https://github.com/GTNewHorizons/NotEnoughEnergistics.git
synced 2026-10-25 20:32:19 +00:00
add mod priority list
This commit is contained in:
1 parent
807e8cbdb9
commit
ae0e23eac5
6 files changed
+41
-8
No files matched your search
@@ -16,7 +16,8 @@ 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)
|
||||
- Allow you to add 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)
|
||||
- Allow you to add mod priority list,if it's the mod's item,it will be use first.
|
||||
|
||||
## Compatible Modslist as followed:
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ NotEnoughEnergistics 是[Just Enough Energistics](https://www.curseforge.com/min
|
||||
- 在处理模式中合并同类物品
|
||||
- 支持增广样板终端(16 -> 4模式)
|
||||
- 允许你设置转换黑名单和转换优先名单,如对应物品在里面,那么他们将不会被转移/优先被转移
|
||||
- 允许你设置mod优先级列表,优先使用该mod的物品
|
||||
|
||||
## 当前支持的Mod列表:
|
||||
|
||||
- [ ] AppliedEnergistics2(我们将不会支持AE2,因为AE2没有注册对应的OverlayHandler)
|
||||
|
||||
+1
-1
@@ -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.2.3
|
||||
mod_version=1.2.4
|
||||
forge_version=10.13.4.1614
|
||||
mod_group=com.github.vfyjxf.neenergistics
|
||||
mod_id=neenergistics
|
||||
|
||||
@@ -12,6 +12,7 @@ public class NEEConfig {
|
||||
|
||||
public static String[] transformBlacklist = new String[0];
|
||||
public static String[] transformPriorityList = new String[0];
|
||||
public static String[] transformPriorityModList = new String[0];
|
||||
|
||||
public static void loadConfig(File configFile) {
|
||||
Configuration config = new Configuration(configFile);
|
||||
@@ -23,6 +24,10 @@ public class NEEConfig {
|
||||
"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();
|
||||
|
||||
transformPriorityModList = config.get("client","transformPriorityModList",new String[0],
|
||||
"if oredict has this mod's item, use it first").getStringList();
|
||||
|
||||
if (config.hasChanged()) config.save();
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,14 @@ public class NEECraftingHandler implements IOverlayHandler {
|
||||
}
|
||||
|
||||
for (PositionedStack positionedStack : tInputs) {
|
||||
ItemStack currentStack = positionedStack.items[0];
|
||||
ItemStack currentStack = positionedStack.item;
|
||||
currentStack.stackSize = positionedStack.items[0].stackSize;
|
||||
|
||||
ItemStack preferModItem = ItemUtils.getPreferModItem(positionedStack.items);
|
||||
if (preferModItem != null) {
|
||||
currentStack = preferModItem;
|
||||
}
|
||||
|
||||
for (ItemStack stack : positionedStack.items) {
|
||||
if (Platform.isRecipePrioritized(stack) || ItemUtils.isPreferItems(stack, recipeProcessorId, identifier)) {
|
||||
currentStack = stack.copy();
|
||||
@@ -112,11 +119,18 @@ public class NEECraftingHandler implements IOverlayHandler {
|
||||
if (positionedStack.items != null && positionedStack.items.length > 0) {
|
||||
final ItemStack[] currentStackList = positionedStack.items;
|
||||
ItemStack stack = positionedStack.items[0];
|
||||
|
||||
ItemStack preferModItem = ItemUtils.getPreferModItem(positionedStack.items);
|
||||
if (preferModItem != null) {
|
||||
stack = preferModItem;
|
||||
}
|
||||
|
||||
for (ItemStack currentStack : currentStackList) {
|
||||
if (Platform.isRecipePrioritized(currentStack) || ItemUtils.isPreferItems(currentStack)) {
|
||||
stack = currentStack.copy();
|
||||
}
|
||||
}
|
||||
|
||||
recipeInputs.setTag("#" + slotIndex, stack.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
@@ -146,8 +160,9 @@ public class NEECraftingHandler implements IOverlayHandler {
|
||||
itemAspectClz = iA;
|
||||
final NBTTagCompound recipeInputs = new NBTTagCompound();
|
||||
List<PositionedStack> ingredients = recipe.getIngredientStacks(recipeIndex);
|
||||
ingredients.removeIf(positionedStack -> itemAspectClz.isInstance(positionedStack.item.getItem()));
|
||||
|
||||
if (itemAspectClz != null) {
|
||||
ingredients.removeIf(positionedStack -> itemAspectClz.isInstance(positionedStack.item.getItem()));
|
||||
}
|
||||
for (PositionedStack positionedStack : ingredients) {
|
||||
|
||||
if (positionedStack.items != null && positionedStack.items.length > 0) {
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
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;
|
||||
@@ -16,6 +13,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.github.vfyjxf.nee.NEEConfig.*;
|
||||
|
||||
public final class ItemUtils {
|
||||
|
||||
public static Gson gson = new Gson();
|
||||
@@ -124,4 +123,15 @@ public final class ItemUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ItemStack getPreferModItem(ItemStack[] items) {
|
||||
for (String currentId : transformPriorityModList) {
|
||||
for(ItemStack stack : items){
|
||||
GameRegistry.UniqueIdentifier itemId = GameRegistry.findUniqueIdentifierFor(stack.getItem());
|
||||
if(currentId.equals(itemId.modId)){
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user