From a8197e0026c29bfaca35b239729b3d957acca7c0 Mon Sep 17 00:00:00 2001 From: "Nikolay S." Date: Sun, 20 Sep 2026 06:33:30 -0500 Subject: [PATCH 1/2] Remove broken NBT-matching logic (#268) --- .../machine/AbstractPoweredTaskEntity.java | 6 +- .../machine/painter/TileEntityPainter.java | 77 +++++++------------ 2 files changed, 32 insertions(+), 51 deletions(-) diff --git a/src/main/java/crazypants/enderio/machine/AbstractPoweredTaskEntity.java b/src/main/java/crazypants/enderio/machine/AbstractPoweredTaskEntity.java index 25b2d0f8..24771c8e 100644 --- a/src/main/java/crazypants/enderio/machine/AbstractPoweredTaskEntity.java +++ b/src/main/java/crazypants/enderio/machine/AbstractPoweredTaskEntity.java @@ -52,7 +52,7 @@ public abstract class AbstractPoweredTaskEntity extends AbstractPowerConsumerEnt @Override public boolean isActive() { - return currentTask == null ? false : currentTask.getProgress() >= 0 && hasPower() && redstoneCheckPassed; + return currentTask != null && currentTask.getProgress() >= 0 && hasPower() && redstoneCheckPassed; } @Override @@ -224,7 +224,7 @@ public abstract class AbstractPoweredTaskEntity extends AbstractPowerConsumerEnt ItemStack copy = item.copy(); // try to add it to existing stacks first for (ItemStack outStack : outputStacks) { - if (outStack != null && copy != null) { + if (outStack != null) { int num = getNumCanMerge(outStack, copy); outStack.stackSize += num; copy.stackSize -= num; @@ -322,7 +322,7 @@ public abstract class AbstractPoweredTaskEntity extends AbstractPowerConsumerEnt } protected int getNumCanMerge(ItemStack itemStack, ItemStack result) { - if (!itemStack.isItemEqual(result)) { + if (!itemStack.isItemEqual(result) || !ItemStack.areItemStackTagsEqual(itemStack, result)) { return 0; } return Math.min(itemStack.getMaxStackSize() - itemStack.stackSize, result.stackSize); diff --git a/src/main/java/crazypants/enderio/machine/painter/TileEntityPainter.java b/src/main/java/crazypants/enderio/machine/painter/TileEntityPainter.java index 8580e437..69d6f849 100644 --- a/src/main/java/crazypants/enderio/machine/painter/TileEntityPainter.java +++ b/src/main/java/crazypants/enderio/machine/painter/TileEntityPainter.java @@ -15,7 +15,9 @@ import crazypants.enderio.machine.SlotDefinition; public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISidedInventory { - // private static final short MAX_POWER_USE_PER_TICK = 6; + private static final int SLOT_INPUT = 0; + private static final int SLOT_PAINT_SOURCE = 1; + private static final int SLOT_OUTPUT = 2; public TileEntityPainter() { // 0 = input slot, 1 = paint source, 2 = output slot @@ -24,7 +26,8 @@ public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISid @Override public boolean canExtractItem(int i, ItemStack itemstack, int j) { - return super.canExtractItem(i, itemstack, j) && PainterUtil.isMetadataEquivelent(itemstack, inventory[2]); + return super.canExtractItem(i, itemstack, j) + && PainterUtil.isMetadataEquivelent(itemstack, inventory[SLOT_OUTPUT]); } @Override @@ -32,49 +35,44 @@ public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISid return "Auto Painter"; } - @Override - public boolean hasCustomInventoryName() { - return false; - } - @Override public boolean isMachineItemValidForSlot(int i, ItemStack itemStack) { - if (i > 1) { - return false; - } - if (i == 0) { + if (i == SLOT_INPUT) { List recipes = MachineRecipeRegistry.instance .getRecipesForInput(getMachineName(), MachineRecipeInput.create(i, itemStack)); - if (inventory[1] == null) { + if (inventory[SLOT_PAINT_SOURCE] == null) { return !recipes.isEmpty(); } else { for (IMachineRecipe rec : recipes) { - if (rec instanceof BasicPainterTemplate) { - BasicPainterTemplate temp = (BasicPainterTemplate) rec; - if (temp.isValidPaintSource(inventory[1])) { + if (rec instanceof BasicPainterTemplate temp) { + if (temp.isValidPaintSource(inventory[SLOT_PAINT_SOURCE])) { return true; } } } + return false; } - return false; - } - if (inventory[0] == null) { - Map recipes = MachineRecipeRegistry.instance.getRecipesForMachine(getMachineName()); - for (IMachineRecipe rec : recipes.values()) { - if (rec instanceof BasicPainterTemplate) { - BasicPainterTemplate temp = (BasicPainterTemplate) rec; - if (temp.isValidPaintSource(itemStack)) { - return true; + } else if (i == SLOT_PAINT_SOURCE) { + if (inventory[SLOT_INPUT] == null) { + Map recipes = MachineRecipeRegistry.instance + .getRecipesForMachine(getMachineName()); + for (IMachineRecipe rec : recipes.values()) { + if (rec instanceof BasicPainterTemplate temp) { + if (temp.isValidPaintSource(itemStack)) { + return true; + } } } + return PaintSourceValidator.instance.isValidSourceDefault(itemStack); + } else { + return MachineRecipeRegistry.instance.getRecipeForInputs( + getMachineName(), + targetInput(), + MachineRecipeInput.create(SLOT_PAINT_SOURCE, itemStack)) != null; } - return PaintSourceValidator.instance.isValidSourceDefault(itemStack); + } else { + return false; } - return MachineRecipeRegistry.instance.getRecipeForInputs( - getMachineName(), - i == 0 ? MachineRecipeInput.create(0, itemStack) : targetInput(), - i == 1 ? MachineRecipeInput.create(1, itemStack) : paintSource()) != null; } @Override @@ -83,27 +81,10 @@ public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISid } private MachineRecipeInput targetInput() { - return MachineRecipeInput.create(0, inventory[0]); + return MachineRecipeInput.create(SLOT_INPUT, inventory[SLOT_INPUT]); } private MachineRecipeInput paintSource() { - return MachineRecipeInput.create(1, inventory[1]); - } - - @Override - protected int getNumCanMerge(ItemStack itemStack, ItemStack result) { - if (result == null || !result.isItemEqual(inventory[2])) { - // next result is a different item type - return 0; - } else if (result.hasTagCompound() && inventory[2].hasTagCompound()) { - if (inventory[2].getTagCompound().hasKey("Items")) return 0; // presence of internal items - String cookedId = result.getTagCompound().getString(BlockPainter.KEY_SOURCE_BLOCK_ID); - String invId = inventory[2].getTagCompound().getString(BlockPainter.KEY_SOURCE_BLOCK_ID); - if (!cookedId.equals(invId)) { - // next result has a different source item than the current one - return 0; - } - } - return Math.min(itemStack.getMaxStackSize() - itemStack.stackSize, result.stackSize); + return MachineRecipeInput.create(SLOT_PAINT_SOURCE, inventory[SLOT_PAINT_SOURCE]); } } From e337597a3c7944229954c8a1c15d9c6ae27dd7dc Mon Sep 17 00:00:00 2001 From: fehling135 <3552245891@qq.com> Date: Fri, 25 Sep 2026 23:46:29 +0800 Subject: [PATCH 2/2] Make specialmobs really availale for soul binder (#270) --- .../machine/soul/SoulBinderEnderCystalRecipe.java | 10 ++++++++-- .../machine/soul/SoulBinderPrecientCystalRecipe.java | 10 ++++++++-- .../machine/soul/SoulBinderReanimationRecipe.java | 7 ++++++- .../enderio/machine/soul/SoulBinderSentientRecipe.java | 8 +++++++- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/main/java/crazypants/enderio/machine/soul/SoulBinderEnderCystalRecipe.java b/src/main/java/crazypants/enderio/machine/soul/SoulBinderEnderCystalRecipe.java index 0ca33713..27142e5e 100644 --- a/src/main/java/crazypants/enderio/machine/soul/SoulBinderEnderCystalRecipe.java +++ b/src/main/java/crazypants/enderio/machine/soul/SoulBinderEnderCystalRecipe.java @@ -15,8 +15,14 @@ public class SoulBinderEnderCystalRecipe extends AbstractSoulBinderRecipe { Config.soulBinderEnderCystalRF, Config.soulBinderEnderCystalLevels, "SoulBinderEnderCystalRecipe", - "SpecialMobs.SpecialEnderman", - "Enderman"); + "Enderman", + "SpecialMobs.BlindingEnderman", + "SpecialMobs.CursedEnderman", + "SpecialMobs.IcyEnderman", + "SpecialMobs.LightningEnderman", + "SpecialMobs.MiniEnderman", + "SpecialMobs.MirageEnderman", + "SpecialMobs.ThiefEnderman"); } @Override diff --git a/src/main/java/crazypants/enderio/machine/soul/SoulBinderPrecientCystalRecipe.java b/src/main/java/crazypants/enderio/machine/soul/SoulBinderPrecientCystalRecipe.java index 0cea0f2e..e392f0c1 100644 --- a/src/main/java/crazypants/enderio/machine/soul/SoulBinderPrecientCystalRecipe.java +++ b/src/main/java/crazypants/enderio/machine/soul/SoulBinderPrecientCystalRecipe.java @@ -15,8 +15,14 @@ public class SoulBinderPrecientCystalRecipe extends AbstractSoulBinderRecipe { Config.soulBinderPrecientCystalRF, Config.soulBinderPrecientCystalLevels, "SoulBinderPrecientCystalRecipe", - "SpecialMobs.SpecialEnderman", - "Enderman"); + "Enderman", + "SpecialMobs.BlindingEnderman", + "SpecialMobs.CursedEnderman", + "SpecialMobs.IcyEnderman", + "SpecialMobs.LightningEnderman", + "SpecialMobs.MiniEnderman", + "SpecialMobs.MirageEnderman", + "SpecialMobs.ThiefEnderman"); } @Override diff --git a/src/main/java/crazypants/enderio/machine/soul/SoulBinderReanimationRecipe.java b/src/main/java/crazypants/enderio/machine/soul/SoulBinderReanimationRecipe.java index 5b6af817..cb8c7494 100644 --- a/src/main/java/crazypants/enderio/machine/soul/SoulBinderReanimationRecipe.java +++ b/src/main/java/crazypants/enderio/machine/soul/SoulBinderReanimationRecipe.java @@ -16,7 +16,12 @@ public class SoulBinderReanimationRecipe extends AbstractSoulBinderRecipe { Config.soulBinderReanimationLevels, "SoulBinderReanimationRecipe", "Zombie", - "SpecialMobs.SpecialZombie"); + "SpecialMobs.BrutishZombie", + "SpecialMobs.FireZombie", + "SpecialMobs.FishingZombie", + "SpecialMobs.GiantZombie", + "SpecialMobs.HungryZombie", + "SpecialMobs.PlagueZombie"); } @Override diff --git a/src/main/java/crazypants/enderio/machine/soul/SoulBinderSentientRecipe.java b/src/main/java/crazypants/enderio/machine/soul/SoulBinderSentientRecipe.java index 665d7eef..95b5a384 100644 --- a/src/main/java/crazypants/enderio/machine/soul/SoulBinderSentientRecipe.java +++ b/src/main/java/crazypants/enderio/machine/soul/SoulBinderSentientRecipe.java @@ -16,7 +16,13 @@ public class SoulBinderSentientRecipe extends AbstractSoulBinderRecipe { Config.soulBinderReanimationLevels, "SoulBinderSentientRecipe", "Witch", - "enderzoo.WitherWitch"); + "enderzoo.WitherWitch", + "SpecialMobs.DominationWitch", + "SpecialMobs.RageWitch", + "SpecialMobs.ShadowsWitch", + "SpecialMobs.UndeadWitch", + "SpecialMobs.WildsWitch", + "SpecialMobs.WindWitch"); } @Override