Fix the bug that Forestry recipes cannot be processed correctly. (#13)

Co-authored-by: vfyjxf <2331007009@qq.com>
Co-authored-by: vfyjxf <42764413+vfyjxf@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2022-06-07 06:41:56 +02:00
1 parent 83fbd443da
commit bc56551056
6 files changed
+16 -7

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@ modName = NotEnoughEnergistics
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = neenergistics
modVersion=1.4.1
modVersion=1.4.2
modGroup = com.github.vfyjxf.nee
@@ -176,7 +176,7 @@ public class GuiEventHandler implements INEIGuiHandler {
return false;
}
if (NEEConfig.enableNEIDragNDrop) {
if (NEEConfig.enableNEIDragDrop) {
if (gui instanceof AEBaseGui) {
if (draggedStack != null) {
Slot currentSlot = gui.getSlotAtPosition(mouseX, mouseY);
@@ -29,7 +29,7 @@ public class NEEConfig {
public static boolean drawHighlight = true;
public static boolean allowSynchronousSwitchIngredient = true;
public static boolean useNEIDragFromNEIAddons = false;
public static boolean enableNEIDragNDrop = true;
public static boolean enableNEIDragDrop = true;
public static boolean useStackSizeFromNEI = true;
public static boolean keepGhostitems = true;
@@ -75,7 +75,7 @@ public class NEEConfig {
useNEIDragFromNEIAddons = config.get(CATEGORY_OTHER_SETTINGS, "useNEIDragFromNEIAddons", false, "Use the NEI Drag from NEI Addons").getBoolean();
enableNEIDragNDrop = config.get(CATEGORY_OTHER_SETTINGS, "enableNEIDragNDrop", true, "").getBoolean();
enableNEIDragDrop = config.get(CATEGORY_OTHER_SETTINGS, "enableNEIDragDrop", true, "").getBoolean();
useStackSizeFromNEI = config.get(CATEGORY_OTHER_SETTINGS, "useStackSizeFromNEI", true,
"Use the StackSize set by NEI").getBoolean();
@@ -128,7 +128,7 @@ public class NEEConfig {
allowSynchronousSwitchIngredient = config.get(CATEGORY_OTHER_SETTINGS, "allowSynchronousSwitchIngredient", true,
"If true, it will make all similar ingredient switch at the same time").getBoolean(true);
enableNEIDragNDrop = config.get(CATEGORY_OTHER_SETTINGS, "enableNEIDragNDrop", true, "").getBoolean();
enableNEIDragDrop = config.get(CATEGORY_OTHER_SETTINGS, "enableNEIDragNDrop", true, "").getBoolean();
useStackSizeFromNEI = config.get(CATEGORY_OTHER_SETTINGS, "useStackSizeFromNEI", true,
"Use the StackSize set by NEI").getBoolean();
@@ -23,6 +23,8 @@ import net.minecraftforge.oredict.OreDictionary;
import java.util.*;
import static com.github.vfyjxf.nee.processor.RecipeProcessor.NULL_IDENTIFIER;
/**
* @author vfyjxf
*/
@@ -65,7 +67,10 @@ public class NEECraftingHandler implements IOverlayHandler {
private PacketNEIPatternRecipe packProcessRecipe(IRecipeHandler recipe, int recipeIndex) {
final NBTTagCompound recipeInputs = new NBTTagCompound();
NBTTagCompound recipeOutputs = new NBTTagCompound();
String identifier = recipe instanceof TemplateRecipeHandler ? ((TemplateRecipeHandler) recipe).getOverlayIdentifier() : "";
String identifier = recipe instanceof TemplateRecipeHandler ? ((TemplateRecipeHandler) recipe).getOverlayIdentifier() : NULL_IDENTIFIER;
if (identifier == null){
identifier = NULL_IDENTIFIER;
}
int inputIndex = 0;
int outputIndex = 0;
//get all recipe inputs and other stacks,use first item
@@ -4,15 +4,17 @@ import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.IRecipeHandler;
import javax.annotation.Nonnull;
import java.util.*;
public class ForestryRecipeProcessor implements IRecipeProcessor {
@Nonnull
@Override
public Set<String> getAllOverlayIdentifier() {
return new HashSet<>(Arrays.asList(
"forestry.bottler", "forestry.carpenter", "forestry.centrifuge", "forestry.fabricator", "forestry.fermenter", "forestry.moistener", "forestry.squeezer", "forestry.still"
"forestry.bottler", "forestry.carpenter", "forestry.centrifuge", "forestry.fabricator", "forestry.fermenter", "forestry.moistener", "forestry.squeezer", "forestry.still",RecipeProcessor.NULL_IDENTIFIER
));
}
@@ -7,6 +7,8 @@ import java.util.ArrayList;
import java.util.List;
public class RecipeProcessor {
public static final String NULL_IDENTIFIER = "null";
public static List<IRecipeProcessor> recipeProcessors = new ArrayList<>();
public static void init() {