From c0e508ecb7c17b6546949d09cf5d7aef599d0d59 Mon Sep 17 00:00:00 2001 From: Shiver211 <2863677073@qq.com> Date: Mon, 1 Sep 2025 12:54:14 +0800 Subject: [PATCH 01/16] fix translation --- src/main/resources/assets/crazyae/lang/zh_cn.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/assets/crazyae/lang/zh_cn.lang b/src/main/resources/assets/crazyae/lang/zh_cn.lang index 8d1910c..4efedd7 100644 --- a/src/main/resources/assets/crazyae/lang/zh_cn.lang +++ b/src/main/resources/assets/crazyae/lang/zh_cn.lang @@ -139,8 +139,8 @@ tooltip.crazyae.mana_connector_lets_connect_to_bus.name=Shift+右键 ME魔力输 item.crazyae.part.improved_import_bus.name=增强型ME输入总线 item.crazyae.part.improved_export_bus.name=增强型ME输出总线 -item.crazyae.part.improved_export_fluid_bus.name=增强型ME流体输入总线 -item.crazyae.part.improved_import_fluid_bus.name=增强型ME流体输出总线 +item.crazyae.part.improved_export_fluid_bus.name=增强型ME流体输出总线 +item.crazyae.part.improved_import_fluid_bus.name=增强型ME流体输入总线 item.crazyae.part.mana_import_bus.name=ME魔力输入总线 item.crazyae.part.mana_export_bus.name=ME魔力输出总线 From 1a5caae1f48690360bc558472094b94fe2235cca Mon Sep 17 00:00:00 2001 From: Shiver211 <2863677073@qq.com> Date: Tue, 3 Feb 2026 09:50:51 +0800 Subject: [PATCH 02/16] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=AF=B9ME=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E7=BB=88=E7=AB=AF=E7=9A=84mixin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -修复拼音搜索 -修复支持显示机械样板供应器 --- build.gradle | 16 +- .../MixinContainerInterfaceTerminal.java | 433 ------------------ .../MixinGuiInterfaceTerminal.java | 414 ----------------- .../mixins.crazyae.patterns.interface.json | 14 - 4 files changed, 10 insertions(+), 867 deletions(-) delete mode 100644 src/main/java/dev/beecube31/crazyae2/mixins/features/interfaceterm/MixinContainerInterfaceTerminal.java delete mode 100644 src/main/java/dev/beecube31/crazyae2/mixins/features/interfaceterm/MixinGuiInterfaceTerminal.java delete mode 100644 src/main/resources/mixins.crazyae.patterns.interface.json diff --git a/build.gradle b/build.gradle index 5e4447c..2b27b91 100644 --- a/build.gradle +++ b/build.gradle @@ -1092,13 +1092,17 @@ boolean performBuildScriptUpdate() { boolean isNewBuildScriptVersionAvailable() { Map parameters = ["connectTimeout": 10000, "readTimeout": 10000] - String currentBuildScript = getFile("build.gradle").getText() - String currentBuildScriptHash = getVersionHash(currentBuildScript) - String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() - String availableBuildScriptHash = getVersionHash(availableBuildScript) + try { + String currentBuildScript = getFile("build.gradle").getText() + String currentBuildScriptHash = getVersionHash(currentBuildScript) + String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() + String availableBuildScriptHash = getVersionHash(availableBuildScript) - boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash - return !isUpToDate + boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash + return !isUpToDate + } catch (Exception ignored) { + return false + } } static String getVersionHash(String buildScriptContent) { diff --git a/src/main/java/dev/beecube31/crazyae2/mixins/features/interfaceterm/MixinContainerInterfaceTerminal.java b/src/main/java/dev/beecube31/crazyae2/mixins/features/interfaceterm/MixinContainerInterfaceTerminal.java deleted file mode 100644 index 40d9b07..0000000 --- a/src/main/java/dev/beecube31/crazyae2/mixins/features/interfaceterm/MixinContainerInterfaceTerminal.java +++ /dev/null @@ -1,433 +0,0 @@ -package dev.beecube31.crazyae2.mixins.features.interfaceterm; - -import appeng.api.config.Settings; -import appeng.api.config.YesNo; -import appeng.api.networking.IGrid; -import appeng.api.networking.IGridNode; -import appeng.api.networking.security.IActionHost; -import appeng.api.parts.IPart; -import appeng.container.AEBaseContainer; -import appeng.container.implementations.ContainerInterfaceTerminal; -import appeng.core.sync.network.NetworkHandler; -import appeng.core.sync.packets.PacketCompressedNBT; -import appeng.helpers.DualityInterface; -import appeng.helpers.IInterfaceHost; -import appeng.helpers.InventoryAction; -import appeng.helpers.ItemStackHelper; -import appeng.items.misc.ItemEncodedPattern; -import appeng.parts.misc.PartInterface; -import appeng.tile.misc.TileInterface; -import appeng.util.InventoryAdaptor; -import appeng.util.Platform; -import appeng.util.helpers.ItemHandlerUtil; -import appeng.util.inv.AdaptorItemHandler; -import appeng.util.inv.WrapperCursorItemHandler; -import appeng.util.inv.WrapperFilteredItemHandler; -import appeng.util.inv.WrapperRangeItemHandler; -import appeng.util.inv.filter.IAEItemFilter; -import dev.beecube31.crazyae2.common.interfaces.IGridHostMonitorable; -import dev.beecube31.crazyae2.common.interfaces.gui.IPriHostExtender; -import dev.beecube31.crazyae2.common.parts.implementations.PartPatternsInterface; -import dev.beecube31.crazyae2.common.tile.crafting.TileImprovedMAC; -import dev.beecube31.crazyae2.common.tile.networking.TilePatternsInterface; -import dev.beecube31.crazyae2.common.util.InvTracker; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTUtil; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.items.IItemHandler; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -@Mixin(value = ContainerInterfaceTerminal.class, remap = false, priority = 990) -public abstract class MixinContainerInterfaceTerminal extends AEBaseContainer { - @Shadow private IGrid grid; - - @Shadow private NBTTagCompound data; - - public MixinContainerInterfaceTerminal(InventoryPlayer ip, TileEntity myTile, IPart myPart) { - super(ip, myTile, myPart); - } - - @Shadow protected abstract boolean isDifferent(ItemStack a, ItemStack b); - - @Unique private final Map crazyae$diList = new HashMap<>(); - - @Unique private final Map crazyae$macDiList = new HashMap<>(); - - @Unique private final Map crazyae$byId = new HashMap<>(); - - /** - * @author Beecube31 - * @reason Support Patterns interface - */ - @Overwrite - @Override - public void detectAndSendChanges() { - - if (Platform.isClient()) { - return; - } - - super.detectAndSendChanges(); - - if (this.grid == null) { - return; - } - - int total = 0; - boolean missing = false; - - final IActionHost host = this.getActionHost(); - if (host != null) { - final IGridNode agn = host.getActionableNode(); - if (agn.isActive()) { - for (final IGridNode gn : this.grid.getMachines(TileInterface.class)) { - if (gn.isActive()) { - final IInterfaceHost ih = (IInterfaceHost) gn.getMachine(); - if (ih.getInterfaceDuality().getConfigManager().getSetting(Settings.INTERFACE_TERMINAL) == YesNo.NO) { - continue; - } - - final InvTracker t = this.crazyae$diList.get(ih); - - if (t == null) { - missing = true; - } else { - final DualityInterface dual = ih.getInterfaceDuality(); - if (!t.unlocalizedName.equals(dual.getTermName())) { - missing = true; - } - } - - total++; - } - } - - for (final IGridNode gn : this.grid.getMachines(PartInterface.class)) { - if (gn.isActive()) { - final IInterfaceHost ih = (IInterfaceHost) gn.getMachine(); - if (ih.getInterfaceDuality().getConfigManager().getSetting(Settings.INTERFACE_TERMINAL) == YesNo.NO) { - continue; - } - - final InvTracker t = this.crazyae$diList.get(ih); - - if (t == null) { - missing = true; - } else { - final DualityInterface dual = ih.getInterfaceDuality(); - if (!t.unlocalizedName.equals(dual.getTermName())) { - missing = true; - } - } - - total++; - } - } - - for (final IGridNode gn : this.grid.getMachines(TilePatternsInterface.class)) { - if (gn.isActive()) { - final IInterfaceHost ih = (IInterfaceHost) gn.getMachine(); - if (ih.getInterfaceDuality().getConfigManager().getSetting(Settings.INTERFACE_TERMINAL) == YesNo.NO) { - continue; - } - - final InvTracker t = this.crazyae$diList.get(ih); - - if (t == null) { - missing = true; - } else { - final DualityInterface dual = ih.getInterfaceDuality(); - if (!t.unlocalizedName.equals(dual.getTermName())) { - missing = true; - } - } - - total++; - } - } - - for (final IGridNode gn : this.grid.getMachines(PartPatternsInterface.class)) { - if (gn.isActive()) { - final IInterfaceHost ih = (IInterfaceHost) gn.getMachine(); - if (ih.getInterfaceDuality().getConfigManager().getSetting(Settings.INTERFACE_TERMINAL) == YesNo.NO) { - continue; - } - - final InvTracker t = this.crazyae$diList.get(ih); - - if (t == null) { - missing = true; - } else { - final DualityInterface dual = ih.getInterfaceDuality(); - if (!t.unlocalizedName.equals(dual.getTermName())) { - missing = true; - } - } - - total++; - } - } - - for (final IGridNode gn : this.grid.getMachines(TileImprovedMAC.class)) { - if (gn.isActive()) { - final IGridHostMonitorable node = (IGridHostMonitorable) gn.getMachine(); - final InvTracker t = this.crazyae$macDiList.get(node); - - missing = t == null; - - total++; - } - } - } - } - - - if (total != this.crazyae$diList.size() + this.crazyae$macDiList.size() || missing) { - this.regenList(this.data); - } else { - for (final Map.Entry en : this.crazyae$diList.entrySet()) { - final InvTracker inv = en.getValue(); - for (int x = 0; x < inv.server.getSlots(); x++) { - if (this.isDifferent(inv.server.getStackInSlot(x), inv.client.getStackInSlot(x))) { - this.crazyae$addItems(this.data, inv, x, inv.server.getSlots(), false); - } - } - } - - for (final Map.Entry en : this.crazyae$macDiList.entrySet()) { - final InvTracker inv = en.getValue(); - for (int x = 0; x < inv.server.getSlots(); x++) { - if (this.isDifferent(inv.server.getStackInSlot(x), inv.client.getStackInSlot(x))) { - this.crazyae$addItems(this.data, inv, x, inv.server.getSlots(), true); - } - } - } - } - - if (!data.isEmpty()) { - try { - NetworkHandler.instance().sendTo(new PacketCompressedNBT(this.data), (EntityPlayerMP) this.getPlayerInv().player); - } catch (final IOException e) { - // :P - } - this.data = new NBTTagCompound(); - } - } - - /** - * @author Beecube31 - * @reason Support Patterns interface - */ - @Override - @Overwrite - public void doAction(EntityPlayerMP player, InventoryAction action, int slot, long id) { - final InvTracker inv = this.crazyae$byId.get(id); - if (inv != null) { - final ItemStack is = inv.server.getStackInSlot(slot); - final boolean hasItemInHand = !player.inventory.getItemStack().isEmpty(); - - final InventoryAdaptor playerHand = new AdaptorItemHandler(new WrapperCursorItemHandler(player.inventory)); - - final IItemHandler theSlot = new WrapperFilteredItemHandler(new WrapperRangeItemHandler(inv.server, slot, slot + 1), - new IAEItemFilter() { - @Override - public boolean allowExtract(IItemHandler inv, int slot, int amount) { - return true; - } - - @Override - public boolean allowInsert(IItemHandler inv, int slot, ItemStack stack) { - return !stack.isEmpty() && stack.getItem() instanceof ItemEncodedPattern; - } - }); - final InventoryAdaptor interfaceSlot = new AdaptorItemHandler(theSlot); - - switch (action) { - case PICKUP_OR_SET_DOWN: - - if (hasItemInHand) { - ItemStack inSlot = theSlot.getStackInSlot(0); - if (inSlot.isEmpty()) { - player.inventory.setItemStack(interfaceSlot.addItems(player.inventory.getItemStack())); - } else { - inSlot = inSlot.copy(); - final ItemStack inHand = player.inventory.getItemStack().copy(); - - ItemHandlerUtil.setStackInSlot(theSlot, 0, ItemStack.EMPTY); - player.inventory.setItemStack(ItemStack.EMPTY); - - player.inventory.setItemStack(interfaceSlot.addItems(inHand.copy())); - - if (player.inventory.getItemStack().isEmpty()) { - player.inventory.setItemStack(inSlot); - } else { - player.inventory.setItemStack(inHand); - ItemHandlerUtil.setStackInSlot(theSlot, 0, inSlot); - } - } - } else { - ItemHandlerUtil.setStackInSlot(theSlot, 0, playerHand.addItems(theSlot.getStackInSlot(0))); - } - - break; - case SPLIT_OR_PLACE_SINGLE: - - if (hasItemInHand) { - ItemStack extra = playerHand.removeItems(1, ItemStack.EMPTY, null); - if (!extra.isEmpty()) { - extra = interfaceSlot.addItems(extra); - } - if (!extra.isEmpty()) { - playerHand.addItems(extra); - } - } else if (!is.isEmpty()) { - ItemStack extra = interfaceSlot.removeItems((is.getCount() + 1) / 2, ItemStack.EMPTY, null); - if (!extra.isEmpty()) { - extra = playerHand.addItems(extra); - } - if (!extra.isEmpty()) { - interfaceSlot.addItems(extra); - } - } - - break; - case SHIFT_CLICK: - - final InventoryAdaptor playerInv = InventoryAdaptor.getAdaptor(player); - - ItemHandlerUtil.setStackInSlot(theSlot, 0, playerInv.addItems(theSlot.getStackInSlot(0))); - - break; - case MOVE_REGION: - - final InventoryAdaptor playerInvAd = InventoryAdaptor.getAdaptor(player); - for (int x = 0; x < inv.server.getSlots(); x++) { - ItemHandlerUtil.setStackInSlot(inv.server, x, playerInvAd.addItems(inv.server.getStackInSlot(x))); - } - - break; - case CREATIVE_DUPLICATE: - - if (player.capabilities.isCreativeMode && !hasItemInHand) { - player.inventory.setItemStack(is.isEmpty() ? ItemStack.EMPTY : is.copy()); - } - - break; - default: - return; - } - - this.updateHeld(player); - } - } - - /** - * @author Beecube31 - * @reason Support Patterns interface - */ - @Overwrite - private void regenList(final NBTTagCompound data) { - this.crazyae$byId.clear(); - this.crazyae$diList.clear(); - this.crazyae$macDiList.clear(); - - - final IActionHost host = this.getActionHost(); - if (host != null) { - final IGridNode agn = host.getActionableNode(); - if (agn.isActive()) { - for (final IGridNode gn : this.grid.getMachines(TileInterface.class)) { - final IInterfaceHost ih = (IInterfaceHost) gn.getMachine(); - final DualityInterface dual = ih.getInterfaceDuality(); - if (gn.isActive() && dual.getConfigManager().getSetting(Settings.INTERFACE_TERMINAL) == YesNo.YES) { - this.crazyae$diList.put(ih, new InvTracker(dual, dual.getPatterns(), dual.getTermName())); - } - } - - for (final IGridNode gn : this.grid.getMachines(PartInterface.class)) { - final IInterfaceHost ih = (IInterfaceHost) gn.getMachine(); - final DualityInterface dual = ih.getInterfaceDuality(); - if (gn.isActive() && dual.getConfigManager().getSetting(Settings.INTERFACE_TERMINAL) == YesNo.YES) { - this.crazyae$diList.put(ih, new InvTracker(dual, dual.getPatterns(), dual.getTermName())); - } - } - - for (final IGridNode gn : this.grid.getMachines(TilePatternsInterface.class)) { - final IInterfaceHost ih = (IInterfaceHost) gn.getMachine(); - final DualityInterface dual = ih.getInterfaceDuality(); - if (gn.isActive() && dual.getConfigManager().getSetting(Settings.INTERFACE_TERMINAL) == YesNo.YES) { - this.crazyae$diList.put(ih, new InvTracker(dual, dual.getPatterns(), dual.getTermName())); - } - } - - for (final IGridNode gn : this.grid.getMachines(PartPatternsInterface.class)) { - final IPriHostExtender ih = (IPriHostExtender) gn.getMachine(); - final DualityInterface dual = ih.getInterfaceDuality(); - if (gn.isActive() && dual.getConfigManager().getSetting(Settings.INTERFACE_TERMINAL) == YesNo.YES) { - this.crazyae$diList.put(ih, new InvTracker(dual, dual.getPatterns(), dual.getTermName())); - } - } - - for (final IGridNode gn : this.grid.getMachines(TileImprovedMAC.class)) { - final IGridHostMonitorable ih = (IGridHostMonitorable) gn.getMachine(); - if (gn.isActive()) { - this.crazyae$macDiList.put(ih, new InvTracker(ih, ih.getPatternsInv(), ih.getName())); - } - } - } - } - - data.setBoolean("clear", true); - - for (final Map.Entry en : this.crazyae$diList.entrySet()) { - final InvTracker inv = en.getValue(); - this.crazyae$byId.put(inv.which, inv); - this.crazyae$addItems(data, inv, 0, inv.server.getSlots(), false); - } - - for (final Map.Entry en : this.crazyae$macDiList.entrySet()) { - final InvTracker inv = en.getValue(); - this.crazyae$byId.put(inv.which, inv); - this.crazyae$addItems(data, inv, 0, inv.server.getSlots(), true); - } - } - - @Unique - private void crazyae$addItems(NBTTagCompound data, InvTracker inv, int offset, int length, boolean mac) { - String name = '=' + Long.toString(inv.which, 36); - NBTTagCompound tag = data.getCompoundTag(name); - if (tag.isEmpty()) { - tag.setLong("sortBy", inv.sortBy); - tag.setString("un", inv.unlocalizedName); - tag.setTag("pos", NBTUtil.createPosTag(inv.pos)); - tag.setInteger("dim", inv.dim); - tag.setInteger("numUpgrades", inv.numUpgrades); - tag.setBoolean("isMAC", mac); - tag.setInteger("patternsNum", length); - } - - for (int x = 0; x < length; ++x) { - if (x + offset >= length) break; - NBTTagCompound itemNBT = new NBTTagCompound(); - ItemStack is = inv.server.getStackInSlot(x + offset); - ItemHandlerUtil.setStackInSlot(inv.client, x + offset, is.isEmpty() ? ItemStack.EMPTY : is.copy()); - if (!is.isEmpty()) { - ItemStackHelper.stackWriteToNBT(is, itemNBT); - } - - tag.setTag(Integer.toString(x + offset), itemNBT); - } - - data.setTag(name, tag); - } -} diff --git a/src/main/java/dev/beecube31/crazyae2/mixins/features/interfaceterm/MixinGuiInterfaceTerminal.java b/src/main/java/dev/beecube31/crazyae2/mixins/features/interfaceterm/MixinGuiInterfaceTerminal.java deleted file mode 100644 index 93a249a..0000000 --- a/src/main/java/dev/beecube31/crazyae2/mixins/features/interfaceterm/MixinGuiInterfaceTerminal.java +++ /dev/null @@ -1,414 +0,0 @@ -package dev.beecube31.crazyae2.mixins.features.interfaceterm; - -import appeng.api.config.ActionItems; -import appeng.api.config.Settings; -import appeng.api.config.TerminalStyle; -import appeng.client.gui.AEBaseGui; -import appeng.client.gui.implementations.GuiInterfaceTerminal; -import appeng.client.gui.widgets.GuiImgButton; -import appeng.client.gui.widgets.MEGuiTooltipTextField; -import appeng.client.me.ClientDCInternalInv; -import appeng.client.me.SlotDisconnected; -import appeng.core.AEConfig; -import appeng.core.localization.GuiText; -import com.google.common.collect.HashMultimap; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.inventory.Container; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTUtil; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import org.spongepowered.asm.mixin.*; - -import java.util.*; - -@Mixin(value = GuiInterfaceTerminal.class, remap = false, priority = 990) -@SideOnly(Side.CLIENT) -public abstract class MixinGuiInterfaceTerminal extends AEBaseGui { - - @Shadow @Final private HashMap byId; - - @Shadow private boolean refreshList; - - @Shadow @Final private Map> cachedSearches; - - @Shadow @Final private HashMultimap byName; - - @Shadow @Final private ArrayList names; - - @Shadow @Final private MEGuiTooltipTextField searchFieldInputs; - - @Shadow @Final private MEGuiTooltipTextField searchFieldOutputs; - - @Shadow private int rows; - - @Shadow @Final private ArrayList lines; - - @Shadow @Final private Map numUpgradesMap; - - @Shadow @Final private HashMap blockPosHashMap; - - @Shadow @Final private Map dimHashMap; - - @Shadow @Final private Set matchedStacks; - - @Shadow @Final private MEGuiTooltipTextField searchFieldNames; - - @Shadow @Final private HashMap guiButtonHashMap; - - @Shadow @Final private GuiImgButton guiButtonAssemblersOnly; - - @Shadow private boolean onlyMolecularAssemblers; - - @Shadow @Final private GuiImgButton guiButtonHideFull; - - @Shadow private boolean onlyShowWithSpace; - - @Shadow private boolean onlyBrokenRecipes; - - @Shadow @Final private GuiImgButton guiButtonBrokenRecipes; - - @Shadow @Final private GuiImgButton terminalStyleBox; - - @Shadow protected abstract boolean recipeIsBroken(ItemStack stack); - - @Shadow protected abstract boolean itemStackMatchesSearchTerm(ItemStack itemStack, String searchTerm, int pass); - - @Shadow @Final private static String MOLECULAR_ASSEMBLER; - - @Shadow protected abstract void setScrollBar(); - - @Shadow protected abstract Set getCacheForSearchTerm(String searchTerm); - - @Unique @Final private final Map crazyae$patterns = new HashMap<>(); - - @Unique @Final private final Map crazyae$macs = new HashMap<>(); - - public MixinGuiInterfaceTerminal(Container container) { - super(container); - } - - /** - * @author Beecube31 - * @reason Support Patterns interface - */ - @Overwrite - private int getMaxRows() { - return AEConfig.instance().getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.TALL ? 8 : Integer.MAX_VALUE; - } - - /** - * @author Beecube31 - * @reason Support Patterns interface - */ - @Override - @Overwrite - public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) { - - this.fontRenderer.drawString(this.getGuiDisplayName(GuiText.InterfaceTerminal.getLocal()), 8, 6, 4210752); - this.fontRenderer.drawString(GuiText.inventory.getLocal(), 24, this.ySize - 96, 4210752); - - final int currentScroll = this.getScrollBar().getCurrentScroll(); - - int offset = 51; - int linesDraw = 0; - - for (int x = 0; x < rows && linesDraw < rows && currentScroll + x < this.lines.size(); x++) { - final Object lineObj = this.lines.get(currentScroll + x); - if (lineObj instanceof ClientDCInternalInv inv) { - - final int extraLines = numUpgradesMap.get(inv); - boolean isPatternTile = crazyae$patterns.get(inv); - boolean isMAC = crazyae$macs.get(inv); - for (int row = 0; row < 1 + (isPatternTile ? 7 : isMAC ? 4 : extraLines) && linesDraw < rows; ++row) { - for (int z = 0; z < 9; z++) { - if (this.matchedStacks.contains(inv.getInventory().getStackInSlot(z + (row * 9)))) { - drawRect(z * 18 + 22, 1 + offset, z * 18 + 22 + 16, 1 + offset + 16, 0x2A00FF00); - } - } - linesDraw++; - offset += 18; - } - } else if (lineObj instanceof String name) { - final int rows = this.byName.get(name).size(); - if (rows > 1) { - name = name + " (" + rows + ')'; - } - - while (name.length() > 2 && this.fontRenderer.getStringWidth(name) > 158) { - name = name.substring(0, name.length() - 1); - } - this.fontRenderer.drawString(name, 24, 6 + offset, 4210752); - linesDraw++; - offset += 18; - } - } - } - - /** - * @author Beecube31 - * @reason Support Patterns interface - */ - @Overwrite - @Override - public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) { - this.bindTexture("guis/newinterfaceterminal.png"); - - // draw the top portion of the background, above the interface list - this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, 53); - - for (int x = 0; x < this.rows; x++) { - // draw the background of the rows in the interface list - this.drawTexturedModalRect(offsetX, offsetY + 53 + x * 18, 0, 52, this.xSize, 18); - } - - int offset = 51; - final int ex = this.getScrollBar().getCurrentScroll(); - int linesDraw = 0; - for (int x = 0; x < rows && linesDraw < rows && ex + x < this.lines.size(); x++) { - final Object lineObj = this.lines.get(ex + x); - if (lineObj instanceof ClientDCInternalInv) { - GlStateManager.color(1, 1, 1, 1); - final int width = 9 * 18; - - int extraLines = numUpgradesMap.get(lineObj); - boolean isPatternTile = crazyae$patterns.get(lineObj); - boolean isMAC = crazyae$macs.get(lineObj); - - for (int row = 0; row < 1 + (isPatternTile ? 7 : isMAC ? 4 : extraLines) && linesDraw < rows; ++row) { - this.drawTexturedModalRect(offsetX + 20, offsetY + offset, 20, 173, width, 18); - - offset += 18; - linesDraw++; - } - } else { - offset += 18; - linesDraw++; - } - } - - // draw the background below the interface list - this.drawTexturedModalRect(offsetX, offsetY + 50 + this.rows * 18, 0, 158, this.xSize, 99); - - // draw the text boxes - this.searchFieldInputs.drawTextBox(); - this.searchFieldOutputs.drawTextBox(); - this.searchFieldNames.drawTextBox(); - } - - /** - * @author Beecube31 - * @reason Support Patterns interface - */ - @Overwrite - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - buttonList.clear(); - guiButtonHashMap.clear(); - inventorySlots.inventorySlots.removeIf(slot -> slot instanceof SlotDisconnected); - - guiButtonAssemblersOnly.set(onlyMolecularAssemblers ? ActionItems.MOLECULAR_ASSEMBLERS_ON : ActionItems.MOLECULAR_ASSEMBLERS_OFF); - guiButtonHideFull.set(onlyShowWithSpace ? ActionItems.TOGGLE_SHOW_FULL_INTERFACES_OFF : ActionItems.TOGGLE_SHOW_FULL_INTERFACES_ON); - guiButtonBrokenRecipes.set(onlyBrokenRecipes ? ActionItems.TOGGLE_SHOW_ONLY_INVALID_PATTERNS_ON : ActionItems.TOGGLE_SHOW_ONLY_INVALID_PATTERNS_OFF); - terminalStyleBox.set(AEConfig.instance().getConfigManager().getSetting(Settings.TERMINAL_STYLE)); - - buttonList.add(guiButtonAssemblersOnly); - buttonList.add(guiButtonHideFull); - buttonList.add(guiButtonBrokenRecipes); - buttonList.add(terminalStyleBox); - - int offset = 51; - final int currentScroll = this.getScrollBar().getCurrentScroll(); - int linesDraw = 0; - - for (int x = 0; x < rows && linesDraw < rows && currentScroll + x < this.lines.size(); x++) { - final Object lineObj = this.lines.get(currentScroll + x); - if (lineObj instanceof ClientDCInternalInv inv) { - - GuiButton guiButton = new GuiImgButton(guiLeft + 4, guiTop + offset + 1, Settings.ACTIONS, ActionItems.HIGHLIGHT_INTERFACE); - guiButtonHashMap.put(guiButton, inv); - this.buttonList.add(guiButton); - - int extraLines = numUpgradesMap.get(lineObj); - boolean isPatternTile = crazyae$patterns.get(lineObj); - boolean isMAC = crazyae$macs.get(lineObj); - - for (int row = 0; row < 1 + (isPatternTile ? 7 : isMAC ? 4 : extraLines) && linesDraw < rows; ++row) { - for (int z = 0; z < 9; z++) { - this.inventorySlots.inventorySlots.add(new SlotDisconnected(inv, z + (row * 9), z * 18 + 22, 1 + offset)); - } - linesDraw++; - offset += 18; - } - } else if (lineObj instanceof String) { - linesDraw++; - offset += 18; - } - } - - super.drawScreen(mouseX, mouseY, partialTicks); - - drawTooltip(searchFieldInputs, mouseX, mouseY); - drawTooltip(searchFieldOutputs, mouseX, mouseY); - drawTooltip(searchFieldNames, mouseX, mouseY); - } - - /** - * @author Beecube31 - * @reason Support Patterns interface - */ - @Overwrite - public void postUpdate(final NBTTagCompound in) { - - if (in.getBoolean("clear")) { - this.byId.clear(); - this.refreshList = true; - } - - for (final String oKey : in.getKeySet()) { - if (oKey.startsWith("=")) { - try { - final long id = Long.parseLong(oKey.substring(1), Character.MAX_RADIX); - final NBTTagCompound invData = in.getCompoundTag(oKey); - final ClientDCInternalInv current = this.crazyae$getById(invData.getInteger("patternsNum"), id, invData.getLong("sortBy"), invData.getString("un")); - - blockPosHashMap.put(current, NBTUtil.getPosFromTag(invData.getCompoundTag("pos"))); - dimHashMap.put(current, invData.getInteger("dim")); - numUpgradesMap.put(current, invData.getInteger("numUpgrades")); - crazyae$patterns.put(current, (!invData.getBoolean("isMAC") && invData.getInteger("patternsNum") == 72)); - crazyae$macs.put(current, (invData.getBoolean("isMAC") && invData.getInteger("patternsNum") == 45)); - - for (int x = 0; x < current.getInventory().getSlots(); x++) { - final String which = Integer.toString(x); - if (invData.hasKey(which)) { - current.getInventory().setStackInSlot(x, new ItemStack(invData.getCompoundTag(which))); - } - } - } catch (final NumberFormatException ignored) {} - } - } - - if (this.refreshList) { - this.refreshList = false; - this.cachedSearches.clear(); - this.refreshList(); - } - } - - /** - * @author Beecube31 - * @reason Support Patterns interface - */ - @Overwrite - private void refreshList() { - this.byName.clear(); - this.buttonList.clear(); - this.matchedStacks.clear(); - - final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase(); - final String searchFieldOutputs = this.searchFieldOutputs.getText().toLowerCase(); - final String searchFieldNames = this.searchFieldNames.getText().toLowerCase(); - - final Set cachedSearch = this.getCacheForSearchTerm("IN:" + searchFieldInputs + " OUT:" + searchFieldOutputs - + "NAME:" + searchFieldNames + onlyShowWithSpace + onlyMolecularAssemblers + onlyBrokenRecipes); - final boolean rebuild = cachedSearch.isEmpty(); - - for (final ClientDCInternalInv entry : this.byId.values()) { - // ignore inventory if not doing a full rebuild and cache already marks it as miss. - if (!rebuild && !cachedSearch.contains(entry)) { - continue; - } - - // Shortcut to skip any filter if search term is ""/empty - - boolean found = searchFieldInputs.isEmpty() && searchFieldOutputs.isEmpty(); - boolean interfaceHasFreeSlots = false; - boolean interfaceHasBrokenRecipes = false; - - // Search if the current inventory holds a pattern containing the search term. - if (!found || onlyShowWithSpace || onlyBrokenRecipes) { - int slot = 0; - for (final ItemStack itemStack : entry.getInventory()) { - if (crazyae$patterns.get(entry) ? slot > 72 : crazyae$macs.get(entry) ? slot > 45 : slot > 8 + numUpgradesMap.get(entry) * 9) { - break; - } - - if (itemStack.isEmpty()) { - interfaceHasFreeSlots = true; - } - - if (onlyBrokenRecipes && recipeIsBroken(itemStack)) { - interfaceHasBrokenRecipes = true; - } - - if ((!searchFieldInputs.isEmpty() && itemStackMatchesSearchTerm(itemStack, searchFieldInputs, 0)) - || (!searchFieldOutputs.isEmpty() && itemStackMatchesSearchTerm(itemStack, searchFieldOutputs, 1))) { - found = true; - matchedStacks.add(itemStack); - } - - slot++; - } - } - - // Exit if not found - if (!found) { - cachedSearch.remove(entry); - continue; - } - // Exit if the interface does not match the name search - if (!entry.getName().toLowerCase().contains(searchFieldNames)) { - cachedSearch.remove(entry); - continue; - } - // Exit if molecular assembler filter is on and this is not a molecular assembler - if (onlyMolecularAssemblers && !entry.getName().toLowerCase().contains(MOLECULAR_ASSEMBLER)) { - cachedSearch.remove(entry); - continue; - } - // Exit if we are only showing interfaces with free slots and there are none free in this interface - if (onlyShowWithSpace && !interfaceHasFreeSlots) { - cachedSearch.remove(entry); - continue; - } - // Exit if we are only showing interfaces with broken patterns and there are no broken patterns in this interface - if (onlyBrokenRecipes && !interfaceHasBrokenRecipes) { - cachedSearch.remove(entry); - continue; - } - - // Successful search - this.byName.put(entry.getName(), entry); - cachedSearch.add(entry); - } - - this.names.clear(); - this.names.addAll(this.byName.keySet()); - Collections.sort(this.names); - - this.lines.clear(); - this.lines.ensureCapacity(this.names.size() + this.byId.size()); - - for (final String n : this.names) { - this.lines.add(n); - final ArrayList clientInventories = new ArrayList<>(this.byName.get(n)); - Collections.sort(clientInventories); - this.lines.addAll(clientInventories); - } - - this.setScrollBar(); - } - - @Unique - private ClientDCInternalInv crazyae$getById(final int length, final long id, final long sortBy, final String string) { - ClientDCInternalInv o = this.byId.get(id); - if (o == null) { - this.byId.put(id, o = new ClientDCInternalInv(length, id, sortBy, string)); - this.refreshList = true; - } - return o; - } -} diff --git a/src/main/resources/mixins.crazyae.patterns.interface.json b/src/main/resources/mixins.crazyae.patterns.interface.json deleted file mode 100644 index 0233250..0000000 --- a/src/main/resources/mixins.crazyae.patterns.interface.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "package": "dev.beecube31.crazyae2.mixins", - "refmap": "mixins.crazyae.refmap.json", - "target": "@env(DEFAULT)", - "minVersion": "0.8", - "compatibilityLevel": "JAVA_8", - "mixins": [ - "features.interfaceterm.MixinContainerInterfaceTerminal" - ], - "client": [ - "features.interfaceterm.MixinGuiInterfaceTerminal" - ], - "server": [] -} From ba4ef81ebf6b2ada9fd837173373a201ad9ef537 Mon Sep 17 00:00:00 2001 From: Shiver211 <2863677073@qq.com> Date: Tue, 3 Feb 2026 10:01:09 +0800 Subject: [PATCH 03/16] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8E=E5=85=B6?= =?UTF-8?q?=E4=BB=96ae=E9=99=84=E5=B1=9E=E7=9A=84mixin=E4=BC=98=E5=85=88?= =?UTF-8?q?=E7=BA=A7=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../crazyae2/mixins/core/crafting/MixinPacketCraftRequest.java | 2 +- .../core/crafting/container/MixinContainerCraftConfirm.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/beecube31/crazyae2/mixins/core/crafting/MixinPacketCraftRequest.java b/src/main/java/dev/beecube31/crazyae2/mixins/core/crafting/MixinPacketCraftRequest.java index 9e2b1fa..a0c92af 100644 --- a/src/main/java/dev/beecube31/crazyae2/mixins/core/crafting/MixinPacketCraftRequest.java +++ b/src/main/java/dev/beecube31/crazyae2/mixins/core/crafting/MixinPacketCraftRequest.java @@ -25,7 +25,7 @@ import java.util.concurrent.Future; -@Mixin(value = PacketCraftRequest.class, remap = false) +@Mixin(value = PacketCraftRequest.class, remap = false, priority = 900) public abstract class MixinPacketCraftRequest extends AppEngPacket { @Shadow @Final private long amount; diff --git a/src/main/java/dev/beecube31/crazyae2/mixins/core/crafting/container/MixinContainerCraftConfirm.java b/src/main/java/dev/beecube31/crazyae2/mixins/core/crafting/container/MixinContainerCraftConfirm.java index 38241bb..f69593c 100644 --- a/src/main/java/dev/beecube31/crazyae2/mixins/core/crafting/container/MixinContainerCraftConfirm.java +++ b/src/main/java/dev/beecube31/crazyae2/mixins/core/crafting/container/MixinContainerCraftConfirm.java @@ -55,7 +55,7 @@ import java.util.Set; import java.util.concurrent.Future; -@Mixin(value = ContainerCraftConfirm.class, remap = false) +@Mixin(value = ContainerCraftConfirm.class, remap = false, priority = 900) public abstract class MixinContainerCraftConfirm extends AEBaseContainer { public MixinContainerCraftConfirm(InventoryPlayer ip, TileEntity myTile, IPart myPart) { super(ip, myTile, myPart); From 65b47e9000a4c513c05eb3569c00c844ab9cb979 Mon Sep 17 00:00:00 2001 From: Shiver211 <2863677073@qq.com> Date: Sat, 28 Feb 2026 17:50:11 +0800 Subject: [PATCH 04/16] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=87=9D=E8=81=9A?= =?UTF-8?q?=E5=A4=84=E7=90=86=E4=BB=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../recipes/botania/RecipeTerraplate.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeTerraplate.java b/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeTerraplate.java index cac71bd..547e7bd 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeTerraplate.java +++ b/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeTerraplate.java @@ -67,13 +67,18 @@ public RecipeTerraplate(AgglomerationRecipe s) { public boolean matches(IItemHandler inv) { List inputsMissing = new ArrayList<>(this.recipeStacks); + inputsMissing.addAll(this.recipeOreKeys); + int nonEmptyInputs = 0; for(int i = 0; i < inv.getSlots(); i++) { ItemStack stack = inv.getStackInSlot(i); - if(stack.isEmpty()) - break; + if(stack.isEmpty()) { + continue; + } + + nonEmptyInputs++; - int stackIndex = -1, oredictIndex = -1; + int matchedIndex = -1; for(int j = 0; j < inputsMissing.size(); j++) { Object input = inputsMissing.get(j); @@ -81,7 +86,7 @@ public boolean matches(IItemHandler inv) { boolean found = false; for(ItemStack ostack : OreDictionary.getOres((String) input, false)) { if(OreDictionary.itemMatches(ostack, stack, false)) { - oredictIndex = j; + matchedIndex = j; found = true; break; } @@ -90,19 +95,19 @@ public boolean matches(IItemHandler inv) { if(found) break; } else if(input instanceof ItemStack && compareStacks((ItemStack) input, stack)) { - stackIndex = j; + matchedIndex = j; break; } } - if(stackIndex != -1) - inputsMissing.remove(stackIndex); - else if(oredictIndex != -1) - inputsMissing.remove(oredictIndex); - else return false; + if(matchedIndex != -1) { + inputsMissing.remove(matchedIndex); + } else { + return false; + } } - return inputsMissing.isEmpty(); + return nonEmptyInputs == this.totalInputs && inputsMissing.isEmpty(); } private boolean compareStacks(ItemStack recipe, ItemStack supplied) { From cee8262affb5888eca8e4b6d4c3091e68c5d933a Mon Sep 17 00:00:00 2001 From: Shiver211 <2863677073@qq.com> Date: Sat, 28 Feb 2026 18:57:20 +0800 Subject: [PATCH 05/16] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9B=B4=E5=A4=9A?= =?UTF-8?q?=E6=A7=BD=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContainerTeraplateMechanical.java | 10 ++++++---- .../crazyae2/common/features/Features.java | 4 +--- .../botania/TileMechanicalTerraplate.java | 2 +- .../textures/guis/teraplate_mechanical.png | Bin 1274 -> 1454 bytes 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerTeraplateMechanical.java b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerTeraplateMechanical.java index 1706c89..1baa047 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerTeraplateMechanical.java +++ b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerTeraplateMechanical.java @@ -22,11 +22,13 @@ protected void initSlots() { final IItemHandler input = this.getUpgradeable().getInventoryByName("input"); final IItemHandler output = this.getUpgradeable().getInventoryByName("output"); - this.addSlotToContainer(new SlotFake(input, 0, 61, 30, true)); - this.addSlotToContainer(new SlotFake(input, 1, 80, 30, true)); - this.addSlotToContainer(new SlotFake(input, 2, 99, 30, true)); + for (int y = 0; y < 2; y++) { + for (int x = 0; x < 7; x++) { + this.addSlotToContainer(new SlotFake(input, x + y * 7, 26 + 18 * x, 16 + 18 * y, true)); + } + } - this.addSlotToContainer(new SlotOutput(output, 0, 80, 68, null)); + this.addSlotToContainer(new SlotOutput(output, 0, 80, 87, null)); this.addSlotToContainer(new RestrictedSlot( this.type == BotaniaMechanicalDeviceType.ELVENTRADE ? RestrictedSlot.PlaceableItemType.ELVENTRADE_BLANK_PATTERN diff --git a/src/main/java/dev/beecube31/crazyae2/common/features/Features.java b/src/main/java/dev/beecube31/crazyae2/common/features/Features.java index 4e4758a..998c977 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/features/Features.java +++ b/src/main/java/dev/beecube31/crazyae2/common/features/Features.java @@ -95,9 +95,7 @@ public enum Features implements IFeature { QUANTUM_CHANNELS_MULTIPLIER( new FeatureSet().add("mixin:qcm") ), - PATTERNS_INTERFACE( - new FeatureSet().add("mixin:patterns.interface") - ), + PATTERNS_INTERFACE, DENSE_CPU_COPROCESSORS( new FeatureSet().add("mixin:dense.coprocessor") diff --git a/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalTerraplate.java b/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalTerraplate.java index a91bcd3..24a4573 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalTerraplate.java +++ b/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalTerraplate.java @@ -33,7 +33,7 @@ public class TileMechanicalTerraplate extends TileBotaniaMechanicalMachineBase { public TileMechanicalTerraplate() { super(); - this.craftingInputInv = new CrazyAEInternalInv(this, 16, 64); + this.craftingInputInv = new CrazyAEInternalInv(this, 14, 64); (this.craftingOutputInv = new CrazyAEInternalInv(this, 1, 64)).setFilter(new DisabledFilter()); this.actionSource = new MachineSource(this); diff --git a/src/main/resources/assets/crazyae/textures/guis/teraplate_mechanical.png b/src/main/resources/assets/crazyae/textures/guis/teraplate_mechanical.png index 17440a04ef1aecb63162ff4fe6f0fe2e899021cb..0bcdc76ce4259f3ad896219d3cdaa091fd7519f8 100644 GIT binary patch literal 1454 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911L)MWvCLm zuqJrAIEGZrd3)C|UpQUn_{Za+YAS3?y8L2=C-SZ=UY^n+ArT?4zG>q0BZm$&7#%p$ zm#}Hdo)#TRrH#9qqr2H|zmU8C^W6FOpCi3o=Ks*SyS=>b&3@}>9WmB_#jy^9I#27?ms+N;=5dii~H$%n<|^B%t<=i&9nW!EBf_p#~YthUm>70l$wP7wY2i|4@qm0it`ktC1|`DtNt zcLqmu*$$=)y`2U?8=K2GP^ikn`Zp z&*u5}{}+ABPghzacslscJ=wLJ?S1nYo-Svb^S99{zcDQAyVGj<Pkhb~e zjrI-vd5s;{4v8LEqJK4tW5J9sOT&~Ifn?uxX!1ZxDM-vMZg$)*@5Q>0-e|utTX!=r zQ^Ml@>AF5g^5@%&G28|v*Oy6rD>23#5io157>1yxH;s~ug z+2!>~CAC4)@ysQ%#`RUd)=c?S`tRVX=7`Y0TN#4w47KK6ImYnn*qOCfYeK857o4=y zT+awi??|Zx3p4kR#h3ZV>qGunt>#M)eVXB&?0-tMAwzmSL-4$`OK#)kyXx-p_#YT-O^t(@7Psm@rAj#3|_5GafSav;%R_u5N&T+T)Z+AG$|Nn55`_ico>&v$Pzopr0N-F?i2wiq literal 1274 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911MRQ8&P5D>38$lZxy-8q?;Kn_c~qpu?a z!^VE@KZ&eBzI1?3i0l9V|95S>diu=&PoF-`n!jb;;ur1xOHZHt50sDn+n^1kI7@>3 zf`Q7wfFanwLI@;S;1OBOz`(a3gc&VZgH?cn5+$w?CBgY=CFO}lsSE*$nRz98ey$-3 zrh0~Y=H1u6TLRT=OO5bM^YqkW-~e)18Kf9l!Or#q@}!|`pidYy7@5K1OhC3FBNKxF zkd6Z4%yt&AcovWi0=;F73@?BlhS6x2G61C}ursg#RT>x>8!#?_m zzyvgx39K^6(gMhW>M}Gi0Li+}-TF=ZMd}&`2IgE(7srr_xVLxS_RTgBa7)~k>Gke^ zSNPJ4PWLvhJZM&7^88Pi+qw4nTxPGQTKS%<+8bweDb9V?viNmT3?)BqCN}81?`166 z!^^->(!ZN=!~d+stOwX0Bt}i2@?7%4b`ib@nv5ItH2Hy+PWUci1+p9j5-NEZ7%npU zyq@%lp@8Q=XTX>01AiH+c( z!{uE|Y#3yim(-u;VVO{O*PGD?sFjzkpq7E*0n37SUgw{)FL)ICI>5W4N^aS(qh*NBycWP{@P9>BncH83ou6Yyo-oIK#_$YbM4e z_koES7$~Of1~0o-9b@hh7HJUVxDnL^{FM>31EEgI)1l?>5Uk}gY$U|FXYOL zIX}z?>a1kRh_Y>{lg_N+`E_#w!%O=MUot%!zJ!0WV`ON^TVMt>#Nqyv1emc0S{bSs ziq!5iRPj{pS;n9idvSw#Ltp|X&Jx?Zw={MAGddfNI zi&g);W9`ZCLg=@OH9SCIdK+{b=E?Mg0aZ_7aS(Ip_j{9gYA?dxIGt~wc9u_KxS;yY zvka6wP(gIV!_5rKPcd3#at8=9Fj%m!ILGv2Z_*w!hF|kDs#(w-()g5Vd`)h$&?G`TjU?!;{=La5Ks7F#cTm&mN0Mi-0# sU$&I|01BJdJLWSkXwIMoZe{<$miKe*=eLg@`hXnh>FVdQ&MBb@0JV6l2mk;8 From a24f2d2348bdf20fd44ef263f6d84622ae541716 Mon Sep 17 00:00:00 2001 From: Shiver211 <2863677073@qq.com> Date: Sat, 28 Feb 2026 19:03:43 +0800 Subject: [PATCH 06/16] update --- .../ContainerTeraplateMechanical.java | 2 +- .../textures/guis/teraplate_mechanical.png | Bin 1454 -> 1481 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerTeraplateMechanical.java b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerTeraplateMechanical.java index 1baa047..32d60e3 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerTeraplateMechanical.java +++ b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerTeraplateMechanical.java @@ -28,7 +28,7 @@ protected void initSlots() { } } - this.addSlotToContainer(new SlotOutput(output, 0, 80, 87, null)); + this.addSlotToContainer(new SlotOutput(output, 0, 80, 86, null)); this.addSlotToContainer(new RestrictedSlot( this.type == BotaniaMechanicalDeviceType.ELVENTRADE ? RestrictedSlot.PlaceableItemType.ELVENTRADE_BLANK_PATTERN diff --git a/src/main/resources/assets/crazyae/textures/guis/teraplate_mechanical.png b/src/main/resources/assets/crazyae/textures/guis/teraplate_mechanical.png index 0bcdc76ce4259f3ad896219d3cdaa091fd7519f8..89aa41b7b3bc5a97048c3b0dd712da51c615d204 100644 GIT binary patch literal 1481 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911L)MWvCLm zuvUAzIEGZrd3$$b-W3mq;}35JYpHN85e|>_cClKrdcBgXi=$(61(%mxXIm3fpo44w zf+)?(786aSi|<6MU1Dy;o=dKNJNN&0)0iV?*M~`5oYiUiz{y9~~Gg>cio-AK4lYe~2S2tm+sQ-oU|HYVftc;1xyK(pU4MVei7enf1 zS1~7eF)7Sq=ul%=BzIM!vb z$h2(nElmNqHPSzncKlZPSgQH-$HKr`x4`p)4H;oAvVT_01X?;rG_kj5QD3kEvavuL z_VM|ehqX9bV>fcM(wfG=E7C>{KmRXVwd;P8+5hvdTX$q$IJRu#OHI875Ovbk0PX^y zM_C-U?8pqL+N8vD>mi4OdGB2>afZ7lW!iU<9NN8`BQHm4_Pk9@8@6>vZ(_Rf;&|yK zF3-nO3#J6w?fd)fNQeAp8#wil|4m4YK?md%lL}asOGfG5TdEGGKjL}W`V^3Qe+&x%duEp z`_PH2_pUFR!z2id;9{;Ldg0SguQX4LVMVni#ip^$rH9*+&*EU&C-~ z_7RDztEcNPyVr6tmG!`XV4?&vYcmuXv};#hb7DB^6`y4))G&45l|tnnc*G-Fi^Mej zlxo4YJ!&n`fP-%$ZYwZs`}JX8tLVqw*X7MYMkwzruh(0B{q>(uE5&qK5^}|_#;^!O z5~5i=^A+3l#=}8{Z%zKoE`Hs9t4i?BS4-}Gzj;%F_UYW0EEQP1YJRujbJ@j@oO5{> zytCwXlfAZL@7{|!_EWM^5+#y@P?^#D`Tjm{w%3X~x8ks5=*}%mH}XH_aM-fey}@#Q zn$fEND;~E`)jlNkJ0PsZwg1*_>9gOQEm@TynGDq=^w3Xpjd-J>eaNejMFE(g7cO4I z5xrSSr|QbRdl}p0Pa!2Sa7u*dKBSBYOrLAx+w1;(@jE_!m)=qtdy`iIZlSZj_g%dC zi~*Rf`~Du2S@f-pXSo9?+ir_vcF=tKs>t%IT2FQ{!*PDC`7;kP{(Q>$_xb1b)i);; z&Yd^+&5zqapIy(lE3KOS)1Lj{3VGZ5u%96v$11d3zO1+#x3|XdNA|hiYzDJv9kJm2 zLv}NW@awIltx>fV`}dUpx9?`t>F_Mbc068CGmRGxS*Ft-tH%J6Fhl@WidxvuP$r@37DlD6=hMZCG$Vv+*P|UQjuV9~{v8&mgX~^um@tv0EUOp00i_ I>zopr03MugG5`Po literal 1454 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911L)MWvCLm zuqJrAIEGZrd3)C|UpQUn_{Za+YAS3?y8L2=C-SZ=UY^n+ArT?4zG>q0BZm$&7#%p$ zm#}Hdo)#TRrH#9qqr2H|zmU8C^W6FOpCi3o=Ks*SyS=>b&3@}>9WmB_#jy^9I#27?ms+N;=5dii~H$%n<|^B%t<=i&9nW!EBf_p#~YthUm>70l$wP7wY2i|4@qm0it`ktC1|`DtNt zcLqmu*$$=)y`2U?8=K2GP^ikn`Zp z&*u5}{}+ABPghzacslscJ=wLJ?S1nYo-Svb^S99{zcDQAyVGj<Pkhb~e zjrI-vd5s;{4v8LEqJK4tW5J9sOT&~Ifn?uxX!1ZxDM-vMZg$)*@5Q>0-e|utTX!=r zQ^Ml@>AF5g^5@%&G28|v*Oy6rD>23#5io157>1yxH;s~ug z+2!>~CAC4)@ysQ%#`RUd)=c?S`tRVX=7`Y0TN#4w47KK6ImYnn*qOCfYeK857o4=y zT+awi??|Zx3p4kR#h3ZV>qGunt>#M)eVXB&?0-tMAwzmSL-4$`OK#)kyXx-p_#YT-O^t(@7Psm@rAj#3|_5GafSav;%R_u5N&T+T)Z+AG$|Nn55`_ico>&v$Pzopr0N-F?i2wiq From def1c11970c8df4d0955e010dfdb5e4c962c64b2 Mon Sep 17 00:00:00 2001 From: Shiver211 <2863677073@qq.com> Date: Sat, 28 Feb 2026 19:52:38 +0800 Subject: [PATCH 07/16] =?UTF-8?q?=E6=94=AF=E6=8C=81bot=20tweaks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/recipes/botania/RecipeRepo.java | 18 ++++- .../recipes/botania/RecipeTerraplate.java | 79 ++++++++----------- .../common/registration/Registration.java | 4 +- 3 files changed, 51 insertions(+), 50 deletions(-) diff --git a/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeRepo.java b/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeRepo.java index 2a0f4bc..dba0ca9 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeRepo.java +++ b/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeRepo.java @@ -2,6 +2,7 @@ import com.google.common.collect.ImmutableList; import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.common.Loader; import net.minecraftforge.items.IItemHandler; import quaternary.botaniatweaks.modules.botania.recipe.AgglomerationRecipe; import quaternary.botaniatweaks.modules.botania.recipe.AgglomerationRecipes; @@ -13,6 +14,10 @@ public class RecipeRepo { public static ArrayList terraplateRecipes = new ArrayList<>(); + public static boolean isBotaniaTweaksLoaded() { + return Loader.isModLoaded("botania_tweaks") || Loader.isModLoaded("botaniatweaks"); + } + public static void copyFromBotaniaTweaks() { terraplateRecipes.clear(); @@ -32,9 +37,20 @@ public static void addDefaultTerrasteelRecipe() { public static Optional findMatchingRecipe(IItemHandler inv) { for (RecipeTerraplate recipe : terraplateRecipes) { - if(recipe.matches(inv)) + if (recipe.matches(inv)) { return Optional.of(recipe); + } } + + if (isBotaniaTweaksLoaded()) { + for (AgglomerationRecipe recipe : AgglomerationRecipes.recipes) { + final RecipeTerraplate wrapped = new RecipeTerraplate(recipe); + if (wrapped.matches(inv)) { + return Optional.of(wrapped); + } + } + } + return Optional.empty(); } diff --git a/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeTerraplate.java b/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeTerraplate.java index 547e7bd..9cf5507 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeTerraplate.java +++ b/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeTerraplate.java @@ -2,10 +2,13 @@ import com.google.common.collect.ImmutableList; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.oredict.OreDictionary; import quaternary.botaniatweaks.modules.botania.recipe.AgglomerationRecipe; -import vazkii.botania.common.core.helper.ItemNBTHelper; + +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.HashSet; @@ -49,69 +52,53 @@ public RecipeTerraplate(ImmutableList recipeInputs, ItemStack recipeOutp } public RecipeTerraplate(AgglomerationRecipe s) { - ImmutableList.Builder stackInputBuilder = new ImmutableList.Builder<>(); - ImmutableList.Builder keyInputBuilder = new ImmutableList.Builder<>(); - - for(Object o : s.recipeStacks) { - if(o instanceof ItemStack) stackInputBuilder.add((ItemStack) o); - else keyInputBuilder.add((String) o); - } - - this.recipeStacks = stackInputBuilder.build(); - this.recipeOreKeys = keyInputBuilder.build(); + this.recipeStacks = ImmutableList.copyOf(s.recipeStacks); + this.recipeOreKeys = ImmutableList.copyOf(s.recipeOreKeys); this.totalInputs = recipeStacks.size() + recipeOreKeys.size(); - this.recipeOutput = s.recipeOutput; + this.recipeOutput = s.getRecipeOutputCopy(); this.manaCost = s.manaCost; } public boolean matches(IItemHandler inv) { - List inputsMissing = new ArrayList<>(this.recipeStacks); - inputsMissing.addAll(this.recipeOreKeys); - int nonEmptyInputs = 0; - - for(int i = 0; i < inv.getSlots(); i++) { + final List userInputs = new ArrayList<>(); + for (int i = 0; i < inv.getSlots(); i++) { ItemStack stack = inv.getStackInSlot(i); - if(stack.isEmpty()) { - continue; + if (!stack.isEmpty()) { + userInputs.add(stack); } + } - nonEmptyInputs++; + return itemsMatch(userInputs); + } - int matchedIndex = -1; + private boolean compareStacks(ItemStack recipe, ItemStack supplied) { + if(recipe.isEmpty() || supplied.isEmpty()) return false; + if(recipe.getItem() != supplied.getItem()) return false; + if(recipe.getItemDamage() != supplied.getItemDamage()) return false; - for(int j = 0; j < inputsMissing.size(); j++) { - Object input = inputsMissing.get(j); - if(input instanceof String) { - boolean found = false; - for(ItemStack ostack : OreDictionary.getOres((String) input, false)) { - if(OreDictionary.itemMatches(ostack, stack, false)) { - matchedIndex = j; - found = true; - break; - } - } + return isTagSubset(recipe.getTagCompound(), supplied.getTagCompound()); + } + private static boolean isTagSubset(@Nullable NBTTagCompound recipeTag, @Nullable NBTTagCompound suppliedTag) { + if (recipeTag == null || recipeTag.isEmpty()) return true; + if (suppliedTag == null || suppliedTag.isEmpty()) return false; + if (recipeTag.getKeySet().size() > suppliedTag.getKeySet().size()) return false; - if(found) break; - } else if(input instanceof ItemStack && compareStacks((ItemStack) input, stack)) { - matchedIndex = j; - break; - } - } + for (String key : suppliedTag.getKeySet()) { + if (!recipeTag.hasKey(key)) continue; + + NBTBase suppliedEntry = suppliedTag.getTag(key); + NBTBase recipeEntry = recipeTag.getTag(key); - if(matchedIndex != -1) { - inputsMissing.remove(matchedIndex); + if (suppliedEntry instanceof NBTTagCompound && recipeEntry instanceof NBTTagCompound) { + if (!isTagSubset((NBTTagCompound) recipeEntry, (NBTTagCompound) suppliedEntry)) return false; } else { - return false; + if (!suppliedEntry.equals(recipeEntry)) return false; } } - return nonEmptyInputs == this.totalInputs && inputsMissing.isEmpty(); - } - - private boolean compareStacks(ItemStack recipe, ItemStack supplied) { - return recipe.getItem() == supplied.getItem() && recipe.getItemDamage() == supplied.getItemDamage() && ItemNBTHelper.matchTag(recipe.getTagCompound(), supplied.getTagCompound()); + return true; } public boolean itemsMatch(List userInputs) { diff --git a/src/main/java/dev/beecube31/crazyae2/common/registration/Registration.java b/src/main/java/dev/beecube31/crazyae2/common/registration/Registration.java index baf99be..d9766ea 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/registration/Registration.java +++ b/src/main/java/dev/beecube31/crazyae2/common/registration/Registration.java @@ -69,9 +69,7 @@ public void postInit(FMLPostInitializationEvent event) { if (Loader.isModLoaded("botania")) { ManaPoolRecipesMaker.init(); - if (Loader.isModLoaded("botania_tweaks")) { - RecipeRepo.copyFromBotaniaTweaks(); - } else { + if (!RecipeRepo.isBotaniaTweaksLoaded()) { RecipeRepo.addDefaultTerrasteelRecipe(); } } From 14ecebbdd9fc53f118526e040c2230383f79fd15 Mon Sep 17 00:00:00 2001 From: Shiver211 <2863677073@qq.com> Date: Sat, 28 Feb 2026 20:27:24 +0800 Subject: [PATCH 08/16] =?UTF-8?q?=E6=94=AF=E6=8C=81=20bot=20additions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/recipes/botania/RecipeRepo.java | 50 +++++++++++++++++++ .../recipes/botania/RecipeTerraplate.java | 9 ++++ .../resources/assets/crazyae/lang/zh_cn.lang | 8 +-- 3 files changed, 63 insertions(+), 4 deletions(-) diff --git a/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeRepo.java b/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeRepo.java index dba0ca9..0df0c4e 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeRepo.java +++ b/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeRepo.java @@ -1,14 +1,19 @@ package dev.beecube31.crazyae2.common.recipes.botania; import com.google.common.collect.ImmutableList; +import appeng.tile.inventory.AppEngInternalInventory; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.items.IItemHandler; import quaternary.botaniatweaks.modules.botania.recipe.AgglomerationRecipe; import quaternary.botaniatweaks.modules.botania.recipe.AgglomerationRecipes; +import vazkii.botania.api.recipe.RecipePetals; import vazkii.botania.common.item.ModItems; +import java.lang.reflect.Field; +import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.List; import java.util.Optional; public class RecipeRepo { @@ -51,6 +56,51 @@ public static Optional findMatchingRecipe(IItemHandler inv) { } } + final Optional botanicAdditionsMatch = findMatchingBotanicAdditionsRecipe(inv); + if (botanicAdditionsMatch.isPresent()) { + return botanicAdditionsMatch; + } + + return Optional.empty(); + } + + private static Optional findMatchingBotanicAdditionsRecipe(IItemHandler inv) { + if (!Loader.isModLoaded("botanicadds") || !(inv instanceof AppEngInternalInventory appEngInv)) { + return Optional.empty(); + } + + try { + final Class gaiaRecipesClass = Class.forName("tk.zeitheron.botanicadds.api.GaiaPlateRecipes"); + final Field gaiaRecipesField = gaiaRecipesClass.getField("gaiaRecipes"); + final Object recipes = gaiaRecipesField.get(null); + if (!(recipes instanceof List recipeList)) { + return Optional.empty(); + } + + for (Object recipeObj : recipeList) { + if (!(recipeObj instanceof RecipePetals recipePetals)) { + continue; + } + + if (!recipePetals.matches(appEngInv)) { + continue; + } + + int manaCost = 0; + try { + final Method getManaMethod = recipeObj.getClass().getMethod("getMana"); + final Object manaObj = getManaMethod.invoke(recipeObj); + if (manaObj instanceof Number number) { + manaCost = number.intValue(); + } + } catch (ReflectiveOperationException ignored) { + } + + return Optional.of(new RecipeTerraplate(recipePetals.getOutput().copy(), manaCost)); + } + } catch (ReflectiveOperationException ignored) { + } + return Optional.empty(); } diff --git a/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeTerraplate.java b/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeTerraplate.java index 9cf5507..0640c2a 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeTerraplate.java +++ b/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeTerraplate.java @@ -60,6 +60,15 @@ public RecipeTerraplate(AgglomerationRecipe s) { this.manaCost = s.manaCost; } + public RecipeTerraplate(ItemStack recipeOutput, int manaCost) { + this.recipeStacks = ImmutableList.of(); + this.recipeOreKeys = ImmutableList.of(); + this.totalInputs = 0; + + this.recipeOutput = recipeOutput; + this.manaCost = manaCost; + } + public boolean matches(IItemHandler inv) { final List userInputs = new ArrayList<>(); for (int i = 0; i < inv.getSlots(); i++) { diff --git a/src/main/resources/assets/crazyae/lang/zh_cn.lang b/src/main/resources/assets/crazyae/lang/zh_cn.lang index 4efedd7..8e5031b 100644 --- a/src/main/resources/assets/crazyae/lang/zh_cn.lang +++ b/src/main/resources/assets/crazyae/lang/zh_cn.lang @@ -113,7 +113,7 @@ item.crazyae.material.manapool_blank_pattern.name=魔力灌注空白样板 item.crazyae.material.petal_blank_pattern.name=花瓣炼制空白样板 item.crazyae.material.runealtar_blank_pattern.name=符文祭坛空白样板 item.crazyae.material.puredaisy_blank_pattern.name=白雏活化空白样板 -item.crazyae.material.teraplate_blank_pattern.name=泰拉凝聚空白样板 +item.crazyae.material.teraplate_blank_pattern.name=魔力凝聚空白样板 item.crazyae.material.brewery_blank_pattern.name=植物酿造空白样板 item.crazyae.elventrade_encoded_pattern.name=精灵交易编码样板 @@ -121,7 +121,7 @@ item.crazyae.manapool_encoded_pattern.name=魔力灌注编码样板 item.crazyae.petal_encoded_pattern.name=花瓣炼制编码样板 item.crazyae.runealtar_encoded_pattern.name=符文祭坛编码样板 item.crazyae.puredaisy_encoded_pattern.name=白雏活化编码样板 -item.crazyae.teraplate_encoded_pattern.name=泰拉凝聚编码样板 +item.crazyae.teraplate_encoded_pattern.name=魔力凝聚编码样板 item.crazyae.brewery_encoded_pattern.name=植物酿造编码样板 item.crazyae.creative_mana_cell.name=创造型ME魔力存储组件 @@ -213,7 +213,7 @@ tile.crazyae.mechanical_manapool.name=魔力灌注处理仓 tile.crazyae.mechanical_runealtar.name=符文祭坛处理仓 tile.crazyae.mechanical_petal.name=花瓣炼制处理仓 tile.crazyae.mechanical_puredaisy.name=白雏活化处理仓 -tile.crazyae.mechanical_teraplate.name=泰拉凝聚处理仓 +tile.crazyae.mechanical_teraplate.name=魔力凝聚处理仓 tile.crazyae.mechanical_brewery.name=植物酿造处理仓 @@ -262,7 +262,7 @@ gui.crazyae.mechanical_manapool.name=魔力灌注处理仓 gui.crazyae.mechanical_runealtar.name=符文祭坛处理仓 gui.crazyae.mechanical_petal.name=花瓣炼制处理仓 gui.crazyae.mechanical_puredaisy.name=白雏活化处理仓 -gui.crazyae.mechanical_teraplate.name=泰拉凝聚处理仓 +gui.crazyae.mechanical_teraplate.name=魔力凝聚处理仓 gui.crazyae.mechanical_brewery.name=植物酿造处理仓 gui.crazyae.patterns_inv_gui.name=样板存放处 From 4bf7d369bdd1ccf5c594dfc325d9b62b5986bf48 Mon Sep 17 00:00:00 2001 From: Shiver211 <2863677073@qq.com> Date: Sat, 28 Feb 2026 21:09:18 +0800 Subject: [PATCH 09/16] =?UTF-8?q?=E9=9C=80=E8=A6=81=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E5=87=9D=E8=81=9A=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContainerTeraplateMechanical.java | 3 ++ .../common/recipes/botania/RecipeRepo.java | 2 +- .../recipes/botania/RecipeTerraplate.java | 17 ++++++++++ .../botania/TileMechanicalTerraplate.java | 31 ++++++++++++++++++- 4 files changed, 51 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerTeraplateMechanical.java b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerTeraplateMechanical.java index 32d60e3..4e53f3e 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerTeraplateMechanical.java +++ b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerTeraplateMechanical.java @@ -21,6 +21,7 @@ protected void initSlots() { final IItemHandler upgrades = this.getUpgradeable().getInventoryByName("upgrades"); final IItemHandler input = this.getUpgradeable().getInventoryByName("input"); final IItemHandler output = this.getUpgradeable().getInventoryByName("output"); + final IItemHandler marker = this.getUpgradeable().getInventoryByName("findSlot"); for (int y = 0; y < 2; y++) { for (int x = 0; x < 7; x++) { @@ -28,6 +29,8 @@ protected void initSlots() { } } + this.addSlotToContainer(new SlotFake(marker, 0, 80, 52, true)); + this.addSlotToContainer(new SlotOutput(output, 0, 80, 86, null)); this.addSlotToContainer(new RestrictedSlot( diff --git a/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeRepo.java b/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeRepo.java index 0df0c4e..6fae023 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeRepo.java +++ b/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeRepo.java @@ -96,7 +96,7 @@ private static Optional findMatchingBotanicAdditionsRecipe(IIt } catch (ReflectiveOperationException ignored) { } - return Optional.of(new RecipeTerraplate(recipePetals.getOutput().copy(), manaCost)); + return Optional.of(new RecipeTerraplate(recipePetals.getOutput().copy(), manaCost, RecipeTerraplate.PlateType.GAIA_PLATE)); } } catch (ReflectiveOperationException ignored) { } diff --git a/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeTerraplate.java b/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeTerraplate.java index 0640c2a..b323bb1 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeTerraplate.java +++ b/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeTerraplate.java @@ -16,10 +16,16 @@ public class RecipeTerraplate { + public enum PlateType { + TERRA_PLATE, + GAIA_PLATE + } + public final ImmutableList recipeStacks; public final ImmutableList recipeOreKeys; public final ItemStack recipeOutput; public final int manaCost; + public final PlateType plateType; final int totalInputs; @@ -49,6 +55,7 @@ public RecipeTerraplate(ImmutableList recipeInputs, ItemStack recipeOutp this.recipeOutput = recipeOutput; this.manaCost = manaCost; + this.plateType = PlateType.TERRA_PLATE; } public RecipeTerraplate(AgglomerationRecipe s) { @@ -58,15 +65,21 @@ public RecipeTerraplate(AgglomerationRecipe s) { this.recipeOutput = s.getRecipeOutputCopy(); this.manaCost = s.manaCost; + this.plateType = PlateType.TERRA_PLATE; } public RecipeTerraplate(ItemStack recipeOutput, int manaCost) { + this(recipeOutput, manaCost, PlateType.TERRA_PLATE); + } + + public RecipeTerraplate(ItemStack recipeOutput, int manaCost, PlateType plateType) { this.recipeStacks = ImmutableList.of(); this.recipeOreKeys = ImmutableList.of(); this.totalInputs = 0; this.recipeOutput = recipeOutput; this.manaCost = manaCost; + this.plateType = plateType; } public boolean matches(IItemHandler inv) { @@ -165,6 +178,10 @@ public ItemStack getOutput() { return recipeOutput; } + public PlateType getPlateType() { + return this.plateType; + } + @Override public boolean equals(Object obj) { if (this == obj) return true; diff --git a/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalTerraplate.java b/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalTerraplate.java index 24a4573..223e9c3 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalTerraplate.java +++ b/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalTerraplate.java @@ -16,11 +16,14 @@ import dev.beecube31.crazyae2.common.util.inv.CrazyAEInternalInv; import dev.beecube31.crazyae2.common.util.patterns.crafting.TeraplateCraftingPatternDetails; import dev.beecube31.crazyae2.core.CrazyAE; +import appeng.util.inv.InvOperation; import net.minecraft.block.Block; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.items.IItemHandler; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -76,7 +79,7 @@ public boolean validateRecipe() { if (input != null) { final Optional recipe = RecipeRepo.findMatchingRecipe(this.craftingInputInv); - if (recipe.isPresent()) { + if (recipe.isPresent() && this.hasValidPlateMarker(recipe.get())) { this.isRecipeValidated = true; this.currentRecipe = recipe.get(); this.craftingOutputInv.setStackInSlot(0, recipe.get().getOutput()); @@ -87,6 +90,32 @@ public boolean validateRecipe() { return false; } + private boolean hasValidPlateMarker(RecipeTerraplate recipe) { + final ItemStack marker = this.findSlot.getStackInSlot(0); + if (marker.isEmpty() || marker.getItem() == null) { + return false; + } + + final ResourceLocation registryName = marker.getItem().getRegistryName(); + if (registryName == null) { + return false; + } + + return switch (recipe.getPlateType()) { + case TERRA_PLATE -> registryName.toString().equals("botania:terraplate"); + case GAIA_PLATE -> registryName.toString().equals("botanicadds:gaia_plate"); + }; + } + + @Override + public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removed, final ItemStack added) { + super.onChangeInventory(inv, slot, mc, removed, added); + + if (inv == this.findSlot && (!removed.isEmpty() || !added.isEmpty())) { + this.validateRecipe(); + } + } + @NotNull @Override public TickRateModulation tickingRequest(@NotNull IGridNode iGridNode, int ticksSinceLastCall) { From 8e927cbcef42ecfa99b21a19b991342466fafa11 Mon Sep 17 00:00:00 2001 From: Shiver211 <2863677073@qq.com> Date: Sat, 28 Feb 2026 21:56:24 +0800 Subject: [PATCH 10/16] =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=A5=9E=E7=81=B5?= =?UTF-8?q?=E5=87=9D=E8=81=9A=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/recipes/botania/RecipeRepo.java | 68 ++++++++++++++++++ .../recipes/botania/RecipeTerraplate.java | 9 ++- .../botania/TileMechanicalTerraplate.java | 1 + .../textures/guis/teraplate_mechanical.png | Bin 1481 -> 1651 bytes 4 files changed, 76 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeRepo.java b/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeRepo.java index 6fae023..0c00dd1 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeRepo.java +++ b/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeRepo.java @@ -23,6 +23,10 @@ public static boolean isBotaniaTweaksLoaded() { return Loader.isModLoaded("botania_tweaks") || Loader.isModLoaded("botaniatweaks"); } + public static boolean isGodAgglomerationPlateLoaded() { + return Loader.isModLoaded("godagglomerationplate"); + } + public static void copyFromBotaniaTweaks() { terraplateRecipes.clear(); @@ -61,6 +65,11 @@ public static Optional findMatchingRecipe(IItemHandler inv) { return botanicAdditionsMatch; } + final Optional godAgglomerationMatch = findMatchingGodAgglomerationRecipe(inv); + if (godAgglomerationMatch.isPresent()) { + return godAgglomerationMatch; + } + return Optional.empty(); } @@ -104,6 +113,65 @@ private static Optional findMatchingBotanicAdditionsRecipe(IIt return Optional.empty(); } + private static Optional findMatchingGodAgglomerationRecipe(IItemHandler inv) { + if (!isGodAgglomerationPlateLoaded()) { + return Optional.empty(); + } + + try { + final Class recipesClass = Class.forName("com.wdcftgg.godagglomerationplate.recipes.GodAgglomerationRecipes"); + final Field recipesField = recipesClass.getField("recipes"); + final Object recipes = recipesField.get(null); + if (!(recipes instanceof List recipeList)) { + return Optional.empty(); + } + + for (Object recipeObj : recipeList) { + final Field stacksField = recipeObj.getClass().getField("recipeStacks"); + final Field oreKeysField = recipeObj.getClass().getField("recipeOreKeys"); + final Field outputField = recipeObj.getClass().getField("recipeOutput"); + final Field manaField = recipeObj.getClass().getField("manaCost"); + + final Object stacksObj = stacksField.get(recipeObj); + final Object oreKeysObj = oreKeysField.get(recipeObj); + final Object outputObj = outputField.get(recipeObj); + final Object manaObj = manaField.get(recipeObj); + + if (!(stacksObj instanceof List stackList) + || !(oreKeysObj instanceof List oreKeyList) + || !(outputObj instanceof ItemStack outputStack) + || !(manaObj instanceof Number manaNumber)) { + continue; + } + + final ArrayList inputs = new ArrayList<>(); + for (Object stack : stackList) { + if (stack instanceof ItemStack itemStack) { + inputs.add(itemStack.copy()); + } + } + for (Object oreKey : oreKeyList) { + if (oreKey instanceof String key) { + inputs.add(key); + } + } + + final RecipeTerraplate wrapped = new RecipeTerraplate( + ImmutableList.copyOf(inputs), + outputStack.copy(), + manaNumber.intValue(), + RecipeTerraplate.PlateType.GOD_AGGLOMERATION_PLATE + ); + if (wrapped.matches(inv)) { + return Optional.of(wrapped); + } + } + } catch (ReflectiveOperationException ignored) { + } + + return Optional.empty(); + } + public static void add(RecipeTerraplate recipe) { terraplateRecipes.add(recipe); } diff --git a/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeTerraplate.java b/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeTerraplate.java index b323bb1..0687b58 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeTerraplate.java +++ b/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeTerraplate.java @@ -18,7 +18,8 @@ public class RecipeTerraplate { public enum PlateType { TERRA_PLATE, - GAIA_PLATE + GAIA_PLATE, + GOD_AGGLOMERATION_PLATE } public final ImmutableList recipeStacks; @@ -39,6 +40,10 @@ private void verifyInputs(ImmutableList inputs) { } public RecipeTerraplate(ImmutableList recipeInputs, ItemStack recipeOutput, int manaCost) { + this(recipeInputs, recipeOutput, manaCost, PlateType.TERRA_PLATE); + } + + public RecipeTerraplate(ImmutableList recipeInputs, ItemStack recipeOutput, int manaCost, PlateType plateType) { verifyInputs(recipeInputs); ImmutableList.Builder stackInputBuilder = new ImmutableList.Builder<>(); @@ -55,7 +60,7 @@ public RecipeTerraplate(ImmutableList recipeInputs, ItemStack recipeOutp this.recipeOutput = recipeOutput; this.manaCost = manaCost; - this.plateType = PlateType.TERRA_PLATE; + this.plateType = plateType; } public RecipeTerraplate(AgglomerationRecipe s) { diff --git a/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalTerraplate.java b/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalTerraplate.java index 223e9c3..65b765a 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalTerraplate.java +++ b/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalTerraplate.java @@ -104,6 +104,7 @@ private boolean hasValidPlateMarker(RecipeTerraplate recipe) { return switch (recipe.getPlateType()) { case TERRA_PLATE -> registryName.toString().equals("botania:terraplate"); case GAIA_PLATE -> registryName.toString().equals("botanicadds:gaia_plate"); + case GOD_AGGLOMERATION_PLATE -> registryName.toString().equals("godagglomerationplate:godagglomerationplate"); }; } diff --git a/src/main/resources/assets/crazyae/textures/guis/teraplate_mechanical.png b/src/main/resources/assets/crazyae/textures/guis/teraplate_mechanical.png index 89aa41b7b3bc5a97048c3b0dd712da51c615d204..041257760269eea84148b1ec0670133049101137 100644 GIT binary patch delta 1444 zcmZWodpOg39R6WLOh_>ymkJ|}J+6l^g&p@=B2gy9DO%)l$!2pYq&S+8a!E%aMLVv? zWoYHNteIqOF55UIF^c#`zJGn6=lgy>-}imq_wAKkhWuiMmpts^=-?gy zkT*`oD1`w%T*hhLLwQ;X?)O+XGTfa)=N%=}3?!8)fn9%;Qo1_{&@$O;3huexC?6f2 zJ=$>XmRAmrcX*uT92+uw+K(kY@wKK+6T8M*2sKgPEsHgULW+cbs}w6-*_FsVREhoQ z!n(=l8{_^qYwCLF(n&|rmcUE@Xv?#_6DJ*sXxUI2%`u{+_LG_wwrxru8P0U5eL zd1MR@s3G#6m7cwA9iN!QMUwQz(H1!e$PZ^0*sTJ_-Rux;P-ld3nY2`ME^{mb!zj(AFk0HQ&-MM62JuS<#ZQ=kdqdjWo zLVZ@0+`qFsYp6Ys?o+8Y)4$uLIW5T`%xZywH`ylTr&paDPHC0zB82bIY~*Bdm@1j} z_fU;>pO;cedzRj+4b*5+k2QQMf3r`5Q+f9v_lTN)J4@O(WrYSxr zSymT|EB?b=^t(;B0n{lm3sNQ|S5=Q=;IqQz@`mQn!M^;L_fG`?_l$x~^;EjHWqwzT zfK_0>lGeEW=NU)`smXi?q}lRTlOeePHPOyC9C4wcnAvq>Ku77i99|XV3gPrr3BPbW zU>|8b`&*E=D5n2Rl$dBkTnsik>hkgcIUxp%YFu@l;nOgD0|8RonBb;n**7vlU+kqX zKFIQaKqaqH$(wiL7KFCecCdl7IyGlfT%WyPzv6btp!=o>^&}~q0`xU87TpRu z&dZxIfG0`#vO&Pp{M}~d#;IzX){kKnut}_{;NrJLKJu7m2pEk~IY<(R&I)jMWn89y zLsaA~P4-T!c-h6__QoJ~%>Aw!pzmQz6-K90a_yHIJ9Flw{S&1yG)pC12v4}u|0yhD zRqrQA8TK;gQ}H$X4q@o3R~YgP{_q4I~b-O;-UnMG{%21sjDZ2rp8;;?-xh|nzP0L+lEt_;ur!cE;q4TXX` zX=)Hj(bZsBfl%C0?{ge@?HS0bJ_Oj{e(q5V5;;!9g4FTP@5;Y=dG!^yZua<@LRg|2 zsMC>F`o8X9()!kvt9aeJI2Yr9`Tlu+?Ax|yPI6)&Mx8Djr(|wtj}SgpE5;fROXd$v zvZ{ni!6SO+i#qWmf+GR!mUFHN?ZV;82I%|s4k)e!YE&{z0Yu=gO8))^lGGO-F?y#Z z#1zm0OHtDzCwm^@+pkx=ZZf@ub8Z-8p_oKbRq8Wq0o(*NWO(CoV{OBjq7RcuI(X#z zaNmK-CNE+FNKZ=?@C!($qR%Z~pqr_vY~7b#cT*#X{@7;~(T+oTCKKV{y~KG5MZCv` z)rzQt7dL!LU16h)+h+?-8u1e^3`Af7kZZZNlQ^b1GL(8t|Va^>Kf@@sJz zUK&< zuvUAzIEGZrd3$$b-W3mq;}35JYpHN85e|>_cClKrdcBgXi=$(61(%mxXIm3fpo44w zf+)?(786aSi|<6MU1Dy;o=dKNJNN&0)0iV?*M~`5oYiUiz{y9~~Gg>cio-AK4lYe~2S2tm+sQ-oU|HYVftc;1xyK(pU4MVei7enf1 zS1~7eF)7Sq=ul%=BzIM!vb z$h2(nElmNqHPSzncKlZPSgQH-$HKr`x4`p)4H;oAvVT_01X?;rG_kj5QD3kEvavuL z_VM|ehqX9bV>fcM(wfG=E7C>{KmRXVwd;P8+5hvdTX$q$IJRu#OHI875Ovbk0PX^y zM_C-U?8pqL+N8vD>mi4OdGB2>afZ7lW!iU<9NN8`BQHm4_Pk9@8@6>vZ(_Rf;&|yK zF3-nO3#J6w?fd)fNQeAp8#wil|4m4YK?md%lL}asOGfG5TdEGGKjL}W`V^3Qe+&x%duEp z`_PH2_pUFR!z2id;9{;Ldg0SguQX4LVMVni#ip^$rH9*+&*EU&C-~ z_7RDztEcNPyVr6tmG!`XV4?&vYcmuXv};#hb7DB^6`y4))G&45l|tnnc*G-Fi^Mej zlxo4YJ!&n`fP-%$ZYwZs`}JX8tLVqw*X7MYMkwzruh(0B{q>(uE5&qK5^}|_#;^!O z5~5i=^A+3l#=}8{Z%zKoE`Hs9t4i?BS4-}Gzj;%F_UYW0EEQP1YJRujbJ@j@oO5{> zytCwXlfAZL@7{|!_EWM^5+#y@P?^#D`Tjm{w%3X~x8ks5=*}%mH}XH_aM-fey}@#Q zn$fEND;~E`)jlNkJ0PsZwg1*_>9gOQEm@TynGDq=^w3Xpjd-J>eaNejMFE(g7cO4I z5xrSSr|QbRdl}p0Pa!2Sa7u*dKBSBYOrLAx+w1;(@jE_!m)=qtdy`iIZlSZj_g%dC zi~*Rf`~Du2S@f-pXSo9?+ir_vcF=tKs>t%IT2FQ{!*PDC`7;kP{(Q>$_xb1b)i);; z&Yd^+&5zqapIy(lE3KOS)1Lj{3VGZ5u%96v$11d3zO1+#x3|XdNA|hiYzDJv9kJm2 zLv}NW@awIltx>fV`}dUpx9?`t>F_Mbc068CGmRGxS*Ft-tH%J6Fhl@WidxvuP$r@37DlD6=hMZCG$Vv+*P|UQjuV9~{v8&mgX~^um@tv0EUOp00i_ I>zopr03MugG5`Po From c1fe5dcb5a4e86e230dea28eed92fe7b40bf1fb1 Mon Sep 17 00:00:00 2001 From: Shiver211 <2863677073@qq.com> Date: Sat, 28 Feb 2026 22:15:14 +0800 Subject: [PATCH 11/16] =?UTF-8?q?=E5=87=9D=E8=81=9A=E6=9D=BF=E6=A7=BD?= =?UTF-8?q?=E4=BD=8D=E7=A6=81=E6=AD=A2=E6=8B=96=E6=8B=BD=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/gui/implementations/GuiCrazyAEUpgradeable.java | 2 +- .../common/containers/ContainerTeraplateMechanical.java | 2 +- .../common/networking/packets/orig/PacketInventoryAction.java | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/beecube31/crazyae2/client/gui/implementations/GuiCrazyAEUpgradeable.java b/src/main/java/dev/beecube31/crazyae2/client/gui/implementations/GuiCrazyAEUpgradeable.java index a455b39..f74d925 100644 --- a/src/main/java/dev/beecube31/crazyae2/client/gui/implementations/GuiCrazyAEUpgradeable.java +++ b/src/main/java/dev/beecube31/crazyae2/client/gui/implementations/GuiCrazyAEUpgradeable.java @@ -430,7 +430,7 @@ public List> getPhantomTargets(Object ingredient) { List slots = new ArrayList<>(); if (!this.inventorySlots.inventorySlots.isEmpty()) { for (Slot slot : this.inventorySlots.inventorySlots) { - if (slot instanceof SlotFake && !itemStack.isEmpty()) { + if (slot instanceof SlotFake fakeSlot && fakeSlot.isDraggable() && !itemStack.isEmpty()) { slots.add((IJEITargetSlot) slot); } } diff --git a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerTeraplateMechanical.java b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerTeraplateMechanical.java index 4e53f3e..3116bcd 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerTeraplateMechanical.java +++ b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerTeraplateMechanical.java @@ -29,7 +29,7 @@ protected void initSlots() { } } - this.addSlotToContainer(new SlotFake(marker, 0, 80, 52, true)); + this.addSlotToContainer(new SlotFake(marker, 0, 80, 52, true).setNotDraggable()); this.addSlotToContainer(new SlotOutput(output, 0, 80, 86, null)); diff --git a/src/main/java/dev/beecube31/crazyae2/common/networking/packets/orig/PacketInventoryAction.java b/src/main/java/dev/beecube31/crazyae2/common/networking/packets/orig/PacketInventoryAction.java index 4e2974f..6283aec 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/networking/packets/orig/PacketInventoryAction.java +++ b/src/main/java/dev/beecube31/crazyae2/common/networking/packets/orig/PacketInventoryAction.java @@ -11,6 +11,7 @@ import appeng.helpers.InventoryAction; import appeng.util.Platform; import appeng.util.item.AEItemStack; +import dev.beecube31.crazyae2.client.gui.CrazyAESlot; import dev.beecube31.crazyae2.common.containers.base.CrazyAEBaseContainer; import dev.beecube31.crazyae2.common.containers.base.slot.SlotDisconnected; import dev.beecube31.crazyae2.common.containers.base.slot.SlotFake; @@ -130,7 +131,7 @@ public void serverPacketData(final INetworkInfo manager, final CrazyAEPacket pac if (this.action == InventoryAction.PLACE_JEI_GHOST_ITEM) { if (this.slot < sender.openContainer.inventorySlots.size()) { Slot senderSlot = sender.openContainer.inventorySlots.get(this.slot); - if (senderSlot instanceof SlotFake) { + if (senderSlot instanceof SlotFake && (!(senderSlot instanceof CrazyAESlot) || ((CrazyAESlot) senderSlot).isDraggable())) { if (this.slotItem != null) { senderSlot.putStack(this.slotItem.createItemStack()); if (senderSlot.getStack().isEmpty()) { From 0380708fd8f693b47cf700215e4d581bec631fff Mon Sep 17 00:00:00 2001 From: Shiver211 <2863677073@qq.com> Date: Sun, 1 Mar 2026 10:18:18 +0800 Subject: [PATCH 12/16] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E8=83=BD=E6=9C=89=E7=A9=BA=E6=A7=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tile/botania/TileMechanicalBrewery.java | 16 +++++++++++++++- .../tile/botania/TileMechanicalElventrade.java | 14 ++++++++++---- .../tile/botania/TileMechanicalPetal.java | 17 ++++++++++++++++- .../tile/botania/TileMechanicalRunealtar.java | 17 ++++++++++++++++- 4 files changed, 57 insertions(+), 7 deletions(-) diff --git a/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalBrewery.java b/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalBrewery.java index 57f8377..d614813 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalBrewery.java +++ b/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalBrewery.java @@ -21,6 +21,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraftforge.items.IItemHandler; +import net.minecraftforge.items.ItemStackHandler; import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -145,7 +146,20 @@ public static RecipeBrew getMatchingRecipe(@Nonnull CrazyAEInternalInv inv) { } private static boolean compareRecipes(RecipeBrew recipe, @Nonnull CrazyAEInternalInv inv) { - return recipe.matches(inv); + return recipe.matches(compactInventory(inv)); + } + + @Nonnull + private static ItemStackHandler compactInventory(@Nonnull CrazyAEInternalInv inv) { + ItemStackHandler compacted = new ItemStackHandler(inv.getSlots()); + int index = 0; + for (int i = 0; i < inv.getSlots(); i++) { + ItemStack stack = inv.getStackInSlot(i); + if (!stack.isEmpty()) { + compacted.setStackInSlot(index++, stack.copy()); + } + } + return compacted; } @NotNull diff --git a/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalElventrade.java b/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalElventrade.java index ab4cde0..524b693 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalElventrade.java +++ b/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalElventrade.java @@ -57,6 +57,7 @@ public boolean validateRecipe() { for (int i = 0; i < this.craftingOutputInv.getSlots(); i++) { this.craftingOutputInv.setStackInSlot(i, ItemStack.EMPTY); } + List input = new ArrayList<>(); for (ItemStack s : this.craftingInputInv) { if (!s.isEmpty()) { @@ -114,15 +115,20 @@ public static RecipeElvenTrade getMatchingRecipe(@Nonnull List input, private static boolean compareRecipes(RecipeElvenTrade recipe, @Nonnull List input, @Nonnull AppEngInternalInventory inv) { if (recipe.matches(input, false) && input.size() == recipe.getInputs().size()) { - for (int i = 0; i < inv.getSlots(); i++) { - if (i > recipe.getInputs().size() - 1) break; + int recipeInputIndex = 0; + for (int i = 0; i < inv.getSlots() && recipeInputIndex < recipe.getInputs().size(); i++) { ItemStack invStack = inv.getStackInSlot(i); + if (invStack.isEmpty()) { + continue; + } - if (!invStack.isEmpty() && recipe.getInputs().get(i) instanceof ItemStack ris) { + if (recipe.getInputs().get(recipeInputIndex) instanceof ItemStack ris) { invStack.setCount(ris.getCount()); - } else if (recipe.getInputs().get(i) instanceof String) { + } else if (recipe.getInputs().get(recipeInputIndex) instanceof String) { invStack.setCount(1); } + + recipeInputIndex++; } return true; } diff --git a/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalPetal.java b/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalPetal.java index e1097b7..6cb4e37 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalPetal.java +++ b/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalPetal.java @@ -20,6 +20,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraftforge.items.ItemStackHandler; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import vazkii.botania.api.BotaniaAPI; @@ -58,6 +59,7 @@ public boolean validateRecipe() { for (int i = 0; i < this.craftingOutputInv.getSlots(); i++) { this.craftingOutputInv.setStackInSlot(i, ItemStack.EMPTY); } + ItemStack input = null; for (ItemStack s : this.craftingInputInv) { if (!s.isEmpty()) { @@ -111,7 +113,20 @@ public static RecipePetals getMatchingRecipe(@Nonnull AppEngInternalInventory in } private static boolean compareRecipes(RecipePetals recipe, @Nonnull AppEngInternalInventory inv) { - return recipe.matches(inv); + return recipe.matches(compactInventory(inv)); + } + + @Nonnull + private static ItemStackHandler compactInventory(@Nonnull AppEngInternalInventory inv) { + ItemStackHandler compacted = new ItemStackHandler(inv.getSlots()); + int index = 0; + for (int i = 0; i < inv.getSlots(); i++) { + ItemStack stack = inv.getStackInSlot(i); + if (!stack.isEmpty()) { + compacted.setStackInSlot(index++, stack.copy()); + } + } + return compacted; } @NotNull diff --git a/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalRunealtar.java b/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalRunealtar.java index eb3f7eb..1ebf993 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalRunealtar.java +++ b/src/main/java/dev/beecube31/crazyae2/common/tile/botania/TileMechanicalRunealtar.java @@ -24,6 +24,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraftforge.items.ItemStackHandler; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import vazkii.botania.api.BotaniaAPI; @@ -113,6 +114,7 @@ public boolean validateRecipe() { for (int i = 0; i < this.craftingOutputInv.getSlots(); i++) { this.craftingOutputInv.setStackInSlot(i, ItemStack.EMPTY); } + ItemStack input = null; for (ItemStack s : this.craftingInputInv) { if (!s.isEmpty()) { @@ -167,7 +169,20 @@ public static RecipeRuneAltar getMatchingRecipe(@Nonnull AppEngInternalInventory } private static boolean compareRecipes(RecipeRuneAltar recipe, @Nonnull AppEngInternalInventory inv) { - return recipe.matches(inv); + return recipe.matches(compactInventory(inv)); + } + + @Nonnull + private static ItemStackHandler compactInventory(@Nonnull AppEngInternalInventory inv) { + ItemStackHandler compacted = new ItemStackHandler(inv.getSlots()); + int index = 0; + for (int i = 0; i < inv.getSlots(); i++) { + ItemStack stack = inv.getStackInSlot(i); + if (!stack.isEmpty()) { + compacted.setStackInSlot(index++, stack.copy()); + } + } + return compacted; } @NotNull From 801978e8bf904e0212884b631a1b086bb872221e Mon Sep 17 00:00:00 2001 From: Shiver211 <2863677073@qq.com> Date: Sun, 1 Mar 2026 10:32:47 +0800 Subject: [PATCH 13/16] =?UTF-8?q?=E4=BB=85=E8=83=BD=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E7=89=A9=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContainerMechanicalBotaniaTileBase.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerMechanicalBotaniaTileBase.java b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerMechanicalBotaniaTileBase.java index 068b410..6fe32ac 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerMechanicalBotaniaTileBase.java +++ b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerMechanicalBotaniaTileBase.java @@ -4,10 +4,15 @@ import appeng.api.networking.IGridHost; import appeng.api.networking.IGridNode; import appeng.api.util.AEPartLocation; +import appeng.helpers.InventoryAction; import appeng.helpers.IContainerCraftingPacket; +import dev.beecube31.crazyae2.common.containers.base.slot.SlotFake; import dev.beecube31.crazyae2.common.enums.BotaniaMechanicalDeviceType; import dev.beecube31.crazyae2.common.tile.botania.TileBotaniaMechanicalMachineBase; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; public abstract class ContainerMechanicalBotaniaTileBase extends ContainerCrazyAEUpgradeable implements IContainerCraftingPacket { @@ -68,4 +73,22 @@ public void detectAndSendChanges() { this.standardDetectAndSendChanges(); } + + @Override + public void doAction(final EntityPlayerMP player, final InventoryAction action, final int slot, final long id) { + if (action == InventoryAction.PICKUP_OR_SET_DOWN && slot >= 0 && slot < this.inventorySlots.size()) { + final Slot targetSlot = this.getSlot(slot); + if (targetSlot instanceof SlotFake) { + final ItemStack hand = player.inventory.getItemStack(); + if (!hand.isEmpty()) { + final ItemStack configuredStack = hand.copy(); + configuredStack.setCount(1); + targetSlot.putStack(configuredStack); + return; + } + } + } + + super.doAction(player, action, slot, id); + } } From 6bc9eda9c225a2bbcfe8be4e2354dc5b2dcdb805 Mon Sep 17 00:00:00 2001 From: Shiver211 <2863677073@qq.com> Date: Sun, 1 Mar 2026 10:42:25 +0800 Subject: [PATCH 14/16] bump version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 87f6652..7339827 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ modId=crazyae modGroup=dev.beecube31.crazyae2 # Version of your mod. # This field can be left empty if you want your mod's version to be determined by the latest git tag instead. -modVersion=v0.6.0.2 +modVersion=v0.6.0.3 # The name of your jar when you produce builds, not including any versioning info modArchivesBaseName=CrazyAE-1.12.2 # Will update your build.gradle automatically whenever an update is available From 9779865032056c3a4c91110ff608b372e1c652f5 Mon Sep 17 00:00:00 2001 From: Shiver211 <2863677073@qq.com> Date: Sun, 1 Mar 2026 11:27:08 +0800 Subject: [PATCH 15/16] upadte --- .../common/recipes/botania/RecipeRepo.java | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeRepo.java b/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeRepo.java index 0c00dd1..9da8b07 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeRepo.java +++ b/src/main/java/dev/beecube31/crazyae2/common/recipes/botania/RecipeRepo.java @@ -1,10 +1,10 @@ package dev.beecube31.crazyae2.common.recipes.botania; import com.google.common.collect.ImmutableList; -import appeng.tile.inventory.AppEngInternalInventory; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.items.IItemHandler; +import net.minecraftforge.items.ItemStackHandler; import quaternary.botaniatweaks.modules.botania.recipe.AgglomerationRecipe; import quaternary.botaniatweaks.modules.botania.recipe.AgglomerationRecipes; import vazkii.botania.api.recipe.RecipePetals; @@ -45,8 +45,10 @@ public static void addDefaultTerrasteelRecipe() { } public static Optional findMatchingRecipe(IItemHandler inv) { + final IItemHandler compactedInv = compactInventory(inv); + for (RecipeTerraplate recipe : terraplateRecipes) { - if (recipe.matches(inv)) { + if (recipe.matches(compactedInv)) { return Optional.of(recipe); } } @@ -54,18 +56,18 @@ public static Optional findMatchingRecipe(IItemHandler inv) { if (isBotaniaTweaksLoaded()) { for (AgglomerationRecipe recipe : AgglomerationRecipes.recipes) { final RecipeTerraplate wrapped = new RecipeTerraplate(recipe); - if (wrapped.matches(inv)) { + if (wrapped.matches(compactedInv)) { return Optional.of(wrapped); } } } - final Optional botanicAdditionsMatch = findMatchingBotanicAdditionsRecipe(inv); + final Optional botanicAdditionsMatch = findMatchingBotanicAdditionsRecipe(compactedInv); if (botanicAdditionsMatch.isPresent()) { return botanicAdditionsMatch; } - final Optional godAgglomerationMatch = findMatchingGodAgglomerationRecipe(inv); + final Optional godAgglomerationMatch = findMatchingGodAgglomerationRecipe(compactedInv); if (godAgglomerationMatch.isPresent()) { return godAgglomerationMatch; } @@ -74,7 +76,7 @@ public static Optional findMatchingRecipe(IItemHandler inv) { } private static Optional findMatchingBotanicAdditionsRecipe(IItemHandler inv) { - if (!Loader.isModLoaded("botanicadds") || !(inv instanceof AppEngInternalInventory appEngInv)) { + if (!Loader.isModLoaded("botanicadds")) { return Optional.empty(); } @@ -91,7 +93,7 @@ private static Optional findMatchingBotanicAdditionsRecipe(IIt continue; } - if (!recipePetals.matches(appEngInv)) { + if (!recipePetals.matches(inv)) { continue; } @@ -183,4 +185,16 @@ public static void remove(RecipeTerraplate recipe) { private static ItemStack manaResource(int meta) { return new ItemStack(ModItems.manaResource, 1, meta); } + + private static IItemHandler compactInventory(IItemHandler inv) { + ItemStackHandler compacted = new ItemStackHandler(inv.getSlots()); + int index = 0; + for (int i = 0; i < inv.getSlots(); i++) { + ItemStack stack = inv.getStackInSlot(i); + if (!stack.isEmpty()) { + compacted.setStackInSlot(index++, stack.copy()); + } + } + return compacted; + } } From e3242e8cf446ba8ec79534e48cfc7b5bebbcf069 Mon Sep 17 00:00:00 2001 From: Shiver211 <2863677073@qq.com> Date: Sun, 1 Mar 2026 11:50:07 +0800 Subject: [PATCH 16/16] =?UTF-8?q?=E4=BF=AE=E6=94=B9shift=20+=20=E5=B7=A6?= =?UTF-8?q?=E9=94=AE=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 这样也只能塞一个东西了 --- .../ContainerBreweryMechanical.java | 6 ++--- .../ContainerElventradeMechanical.java | 4 +-- .../ContainerManapoolMechanical.java | 6 ++--- .../ContainerMechanicalBotaniaTileBase.java | 23 ----------------- .../containers/ContainerPetalMechanical.java | 4 +-- .../ContainerPuredaisyMechanical.java | 4 +-- .../ContainerRunealtarMechanical.java | 4 +-- .../ContainerTeraplateMechanical.java | 6 ++--- .../containers/base/slot/BotaniaSlotFake.java | 25 +++++++++++++++++++ 9 files changed, 42 insertions(+), 40 deletions(-) create mode 100644 src/main/java/dev/beecube31/crazyae2/common/containers/base/slot/BotaniaSlotFake.java diff --git a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerBreweryMechanical.java b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerBreweryMechanical.java index 2dfeda9..5c6f09b 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerBreweryMechanical.java +++ b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerBreweryMechanical.java @@ -2,8 +2,8 @@ import appeng.api.networking.IGridNode; import dev.beecube31.crazyae2.client.gui.sprites.StateSprite; +import dev.beecube31.crazyae2.common.containers.base.slot.BotaniaSlotFake; import dev.beecube31.crazyae2.common.containers.base.slot.RestrictedSlot; -import dev.beecube31.crazyae2.common.containers.base.slot.SlotFake; import dev.beecube31.crazyae2.common.containers.base.slot.SlotOutput; import dev.beecube31.crazyae2.common.enums.BotaniaMechanicalDeviceType; import dev.beecube31.crazyae2.common.tile.botania.TileMechanicalBrewery; @@ -26,11 +26,11 @@ protected void initSlots() { for (int y = 0; y < 2; y++) { for (int x = 0; x < 3; x++) { - this.addSlotToContainer(new SlotFake(input, x + y * 3, 62 + x * 18, 16 + y * 18, true)); + this.addSlotToContainer(new BotaniaSlotFake(input, x + y * 3, 62 + x * 18, 16 + y * 18, true)); } } - this.addSlotToContainer(new SlotFake(bottle, 0, 80, 53, true).setIIcon(StateSprite.BREW)); + this.addSlotToContainer(new BotaniaSlotFake(bottle, 0, 80, 53, true).setIIcon(StateSprite.BREW)); this.addSlotToContainer(new SlotOutput(output, 0, 80, 87, null)); this.addSlotToContainer(new RestrictedSlot( diff --git a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerElventradeMechanical.java b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerElventradeMechanical.java index d693828..58fcb77 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerElventradeMechanical.java +++ b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerElventradeMechanical.java @@ -2,8 +2,8 @@ import appeng.api.networking.IGridNode; import dev.beecube31.crazyae2.client.gui.sprites.StateSprite; +import dev.beecube31.crazyae2.common.containers.base.slot.BotaniaSlotFake; import dev.beecube31.crazyae2.common.containers.base.slot.RestrictedSlot; -import dev.beecube31.crazyae2.common.containers.base.slot.SlotFake; import dev.beecube31.crazyae2.common.containers.base.slot.SlotOutput; import dev.beecube31.crazyae2.common.enums.BotaniaMechanicalDeviceType; import dev.beecube31.crazyae2.common.tile.botania.TileMechanicalElventrade; @@ -26,7 +26,7 @@ protected void initSlots() { for (int y = 0; y < 2; y++) { for (int x = 0; x < 8; x++) { - this.addSlotToContainer(new SlotFake(input, x + y * 8, 17 + 18 * x, 14 + 18 * y, true)); + this.addSlotToContainer(new BotaniaSlotFake(input, x + y * 8, 17 + 18 * x, 14 + 18 * y, true)); } } diff --git a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerManapoolMechanical.java b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerManapoolMechanical.java index fdc6fc6..6260b95 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerManapoolMechanical.java +++ b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerManapoolMechanical.java @@ -1,9 +1,9 @@ package dev.beecube31.crazyae2.common.containers; import appeng.api.networking.IGridNode; +import dev.beecube31.crazyae2.common.containers.base.slot.BotaniaSlotFake; import dev.beecube31.crazyae2.client.gui.sprites.StateSprite; import dev.beecube31.crazyae2.common.containers.base.slot.RestrictedSlot; -import dev.beecube31.crazyae2.common.containers.base.slot.SlotFake; import dev.beecube31.crazyae2.common.containers.base.slot.SlotOutput; import dev.beecube31.crazyae2.common.enums.BotaniaMechanicalDeviceType; import dev.beecube31.crazyae2.common.tile.botania.TileMechanicalManapool; @@ -23,8 +23,8 @@ protected void initSlots() { final IItemHandler input = this.getUpgradeable().getInventoryByName("input"); final IItemHandler output = this.getUpgradeable().getInventoryByName("output"); - this.addSlotToContainer(new SlotFake(input, 0, 70, 30, true)); - this.addSlotToContainer((new SlotFake(input, 1, 89, 30, true)).setIIcon(StateSprite.BOTANIA_CATALYSTS_SLOT)); + this.addSlotToContainer(new BotaniaSlotFake(input, 0, 70, 30, true)); + this.addSlotToContainer((new BotaniaSlotFake(input, 1, 89, 30, true)).setIIcon(StateSprite.BOTANIA_CATALYSTS_SLOT)); this.addSlotToContainer(new SlotOutput(output, 0, 80, 68, null)); diff --git a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerMechanicalBotaniaTileBase.java b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerMechanicalBotaniaTileBase.java index 6fe32ac..068b410 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerMechanicalBotaniaTileBase.java +++ b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerMechanicalBotaniaTileBase.java @@ -4,15 +4,10 @@ import appeng.api.networking.IGridHost; import appeng.api.networking.IGridNode; import appeng.api.util.AEPartLocation; -import appeng.helpers.InventoryAction; import appeng.helpers.IContainerCraftingPacket; -import dev.beecube31.crazyae2.common.containers.base.slot.SlotFake; import dev.beecube31.crazyae2.common.enums.BotaniaMechanicalDeviceType; import dev.beecube31.crazyae2.common.tile.botania.TileBotaniaMechanicalMachineBase; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; public abstract class ContainerMechanicalBotaniaTileBase extends ContainerCrazyAEUpgradeable implements IContainerCraftingPacket { @@ -73,22 +68,4 @@ public void detectAndSendChanges() { this.standardDetectAndSendChanges(); } - - @Override - public void doAction(final EntityPlayerMP player, final InventoryAction action, final int slot, final long id) { - if (action == InventoryAction.PICKUP_OR_SET_DOWN && slot >= 0 && slot < this.inventorySlots.size()) { - final Slot targetSlot = this.getSlot(slot); - if (targetSlot instanceof SlotFake) { - final ItemStack hand = player.inventory.getItemStack(); - if (!hand.isEmpty()) { - final ItemStack configuredStack = hand.copy(); - configuredStack.setCount(1); - targetSlot.putStack(configuredStack); - return; - } - } - } - - super.doAction(player, action, slot, id); - } } diff --git a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerPetalMechanical.java b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerPetalMechanical.java index 603797c..7a0bf4f 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerPetalMechanical.java +++ b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerPetalMechanical.java @@ -1,9 +1,9 @@ package dev.beecube31.crazyae2.common.containers; import appeng.api.networking.IGridNode; +import dev.beecube31.crazyae2.common.containers.base.slot.BotaniaSlotFake; import dev.beecube31.crazyae2.client.gui.sprites.StateSprite; import dev.beecube31.crazyae2.common.containers.base.slot.RestrictedSlot; -import dev.beecube31.crazyae2.common.containers.base.slot.SlotFake; import dev.beecube31.crazyae2.common.containers.base.slot.SlotOutput; import dev.beecube31.crazyae2.common.enums.BotaniaMechanicalDeviceType; import dev.beecube31.crazyae2.common.tile.botania.TileMechanicalPetal; @@ -25,7 +25,7 @@ protected void initSlots() { for (int y = 0; y < 2; y++) { for (int x = 0; x < 8; x++) { - this.addSlotToContainer(new SlotFake(input, x + y * 8, 17 + 18 * x, 14 + 18 * y, true)); + this.addSlotToContainer(new BotaniaSlotFake(input, x + y * 8, 17 + 18 * x, 14 + 18 * y, true)); } } diff --git a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerPuredaisyMechanical.java b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerPuredaisyMechanical.java index df0da62..cefb375 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerPuredaisyMechanical.java +++ b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerPuredaisyMechanical.java @@ -2,8 +2,8 @@ import appeng.api.networking.IGridNode; import dev.beecube31.crazyae2.client.gui.sprites.StateSprite; +import dev.beecube31.crazyae2.common.containers.base.slot.BotaniaSlotFake; import dev.beecube31.crazyae2.common.containers.base.slot.RestrictedSlot; -import dev.beecube31.crazyae2.common.containers.base.slot.SlotFake; import dev.beecube31.crazyae2.common.containers.base.slot.SlotOutput; import dev.beecube31.crazyae2.common.enums.BotaniaMechanicalDeviceType; import dev.beecube31.crazyae2.common.tile.botania.TileMechanicalPuredaisy; @@ -23,7 +23,7 @@ protected void initSlots() { final IItemHandler input = this.getUpgradeable().getInventoryByName("input"); final IItemHandler output = this.getUpgradeable().getInventoryByName("output"); - this.addSlotToContainer(new SlotFake(input, 0, 80, 30, true)); + this.addSlotToContainer(new BotaniaSlotFake(input, 0, 80, 30, true)); this.addSlotToContainer(new SlotOutput(output, 0, 80, 68, null)); diff --git a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerRunealtarMechanical.java b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerRunealtarMechanical.java index 5ca9e84..65e0a5b 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerRunealtarMechanical.java +++ b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerRunealtarMechanical.java @@ -1,8 +1,8 @@ package dev.beecube31.crazyae2.common.containers; import appeng.api.networking.IGridNode; +import dev.beecube31.crazyae2.common.containers.base.slot.BotaniaSlotFake; import dev.beecube31.crazyae2.common.containers.base.slot.RestrictedSlot; -import dev.beecube31.crazyae2.common.containers.base.slot.SlotFake; import dev.beecube31.crazyae2.common.containers.base.slot.SlotOutput; import dev.beecube31.crazyae2.common.enums.BotaniaMechanicalDeviceType; import dev.beecube31.crazyae2.common.tile.botania.TileMechanicalRunealtar; @@ -24,7 +24,7 @@ protected void initSlots() { for (int y = 0; y < 2; y++) { for (int x = 0; x < 8; x++) { - this.addSlotToContainer(new SlotFake(input, x + y * 8, 17 + 18 * x, 14 + 18 * y, true)); + this.addSlotToContainer(new BotaniaSlotFake(input, x + y * 8, 17 + 18 * x, 14 + 18 * y, true)); } } diff --git a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerTeraplateMechanical.java b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerTeraplateMechanical.java index 3116bcd..6e25b43 100644 --- a/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerTeraplateMechanical.java +++ b/src/main/java/dev/beecube31/crazyae2/common/containers/ContainerTeraplateMechanical.java @@ -1,8 +1,8 @@ package dev.beecube31.crazyae2.common.containers; import appeng.api.networking.IGridNode; +import dev.beecube31.crazyae2.common.containers.base.slot.BotaniaSlotFake; import dev.beecube31.crazyae2.common.containers.base.slot.RestrictedSlot; -import dev.beecube31.crazyae2.common.containers.base.slot.SlotFake; import dev.beecube31.crazyae2.common.containers.base.slot.SlotOutput; import dev.beecube31.crazyae2.common.enums.BotaniaMechanicalDeviceType; import dev.beecube31.crazyae2.common.tile.botania.TileMechanicalTerraplate; @@ -25,11 +25,11 @@ protected void initSlots() { for (int y = 0; y < 2; y++) { for (int x = 0; x < 7; x++) { - this.addSlotToContainer(new SlotFake(input, x + y * 7, 26 + 18 * x, 16 + 18 * y, true)); + this.addSlotToContainer(new BotaniaSlotFake(input, x + y * 7, 26 + 18 * x, 16 + 18 * y, true)); } } - this.addSlotToContainer(new SlotFake(marker, 0, 80, 52, true).setNotDraggable()); + this.addSlotToContainer(new BotaniaSlotFake(marker, 0, 80, 52, true).setNotDraggable()); this.addSlotToContainer(new SlotOutput(output, 0, 80, 86, null)); diff --git a/src/main/java/dev/beecube31/crazyae2/common/containers/base/slot/BotaniaSlotFake.java b/src/main/java/dev/beecube31/crazyae2/common/containers/base/slot/BotaniaSlotFake.java new file mode 100644 index 0000000..a58fe68 --- /dev/null +++ b/src/main/java/dev/beecube31/crazyae2/common/containers/base/slot/BotaniaSlotFake.java @@ -0,0 +1,25 @@ +package dev.beecube31.crazyae2.common.containers.base.slot; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.items.IItemHandler; + +public class BotaniaSlotFake extends SlotFake { + + public BotaniaSlotFake(final IItemHandler inv, final int idx, final int x, final int y) { + super(inv, idx, x, y); + } + + public BotaniaSlotFake(final IItemHandler inv, final int idx, final int x, final int y, final boolean oneStack) { + super(inv, idx, x, y, oneStack); + } + + @Override + public void putStack(ItemStack is) { + if (!is.isEmpty()) { + is = is.copy(); + is.setCount(1); + } + + super.putStack(is); + } +}