From b116e32b409c4e940b550e84dda95274f171c5f3 Mon Sep 17 00:00:00 2001 From: reobf <2215595288@qq.com> Date: Tue, 11 Feb 2025 15:24:55 +0800 Subject: [PATCH] update --- ...lockStockingCircuitRequestInterceptor.java | 8 +- .../proghatches/block/ItemBlockTooltip.java | 2 + .../gt/metatileentity/DataHatchME.java | 4 +- .../gt/metatileentity/DualInputHatch.java | 2 +- .../gt/metatileentity/NBTHatchMEFocus.java | 401 ++++++++++++++++++ .../metatileentity/PatternDualInputHatch.java | 18 +- ...rnDualInputHatchInventoryMappingSlave.java | 18 +- .../gt/metatileentity/StorageOutputBus.java | 7 +- .../gt/metatileentity/StorageOutputHatch.java | 22 +- .../gt/metatileentity/SuperChestME.java | 2 +- .../gt/metatileentity/SuperTankME.java | 2 +- .../LargeProgrammingCircuitProvider.java | 18 +- .../util/IMultiplePatternPushable.java | 5 +- .../mixin/mixins/part2/MixinMultiPattern.java | 8 +- .../main/registration/PHRecipes.java | 16 + .../main/registration/Registration.java | 10 + .../assets/proghatches/lang/en_US.lang | 1 + .../assets/proghatches/lang/en_US/HMEF.lang | 5 + .../assets/proghatches/lang/zh_CN.lang | 1 + .../assets/proghatches/lang/zh_CN/HMEF.lang | 5 + 20 files changed, 510 insertions(+), 45 deletions(-) create mode 100644 src/main/java/reobf/proghatches/gt/metatileentity/NBTHatchMEFocus.java create mode 100644 src/main/resources/assets/proghatches/lang/en_US/HMEF.lang create mode 100644 src/main/resources/assets/proghatches/lang/zh_CN/HMEF.lang diff --git a/src/main/java/reobf/proghatches/ae/BlockStockingCircuitRequestInterceptor.java b/src/main/java/reobf/proghatches/ae/BlockStockingCircuitRequestInterceptor.java index 3346b16..86c221d 100644 --- a/src/main/java/reobf/proghatches/ae/BlockStockingCircuitRequestInterceptor.java +++ b/src/main/java/reobf/proghatches/ae/BlockStockingCircuitRequestInterceptor.java @@ -4,7 +4,9 @@ import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentTranslation; @@ -23,7 +25,11 @@ public BlockStockingCircuitRequestInterceptor() { setBlockName("proghatches.circuit_interceptor"); setBlockTextureName("proghatches:circuit_interceptor"); } - +@Override +public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) { + list.add(new ItemStack(itemIn, 1, 1)); + super.getSubBlocks(itemIn, tab, list); +} @Override public boolean onBlockActivated(World worldIn, int x, int y, int z, EntityPlayer player, int side, float subX, float subY, float subZ) { diff --git a/src/main/java/reobf/proghatches/block/ItemBlockTooltip.java b/src/main/java/reobf/proghatches/block/ItemBlockTooltip.java index f501386..a0fec71 100644 --- a/src/main/java/reobf/proghatches/block/ItemBlockTooltip.java +++ b/src/main/java/reobf/proghatches/block/ItemBlockTooltip.java @@ -3,7 +3,9 @@ import java.util.List; import net.minecraft.block.Block; +import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/DataHatchME.java b/src/main/java/reobf/proghatches/gt/metatileentity/DataHatchME.java index 048fe89..30dd3f1 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/DataHatchME.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/DataHatchME.java @@ -60,11 +60,11 @@ public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { getProxy().onReady(); updateCache(); } - + String[] descCache; @Override public String[] getDescription() { - return reobf.proghatches.main.Config.get("DHME", ImmutableMap.of()); + return descCache==null?(descCache=reobf.proghatches.main.Config.get("DHME", ImmutableMap.of())):descCache; } @Override diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatch.java b/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatch.java index 27c4725..3715633 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatch.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatch.java @@ -130,7 +130,7 @@ public class DualInputHatch extends MTEHatchInputBus implements IConfigurationCircuitSupport, IAddGregtechLogo, IAddUIWidgets, IDualInputHatch, IProgrammingCoverBlacklisted, IRecipeProcessingAwareDualHatch, ISkipStackSizeCheck, IOnFillCallback/* ,IMultiCircuitSupport */ { - +static int[] AZERO={0}; static java.text.DecimalFormat format = new java.text.DecimalFormat("#,###"); public boolean mMultiFluid; diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/NBTHatchMEFocus.java b/src/main/java/reobf/proghatches/gt/metatileentity/NBTHatchMEFocus.java new file mode 100644 index 0000000..7d1de83 --- /dev/null +++ b/src/main/java/reobf/proghatches/gt/metatileentity/NBTHatchMEFocus.java @@ -0,0 +1,401 @@ +package reobf.proghatches.gt.metatileentity; + +import java.util.EnumSet; +import java.util.List; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; + +import appeng.api.config.Actionable; +import appeng.api.networking.GridFlags; +import appeng.api.networking.IGridNode; +import appeng.api.networking.events.MENetworkCellArrayUpdate; +import appeng.api.networking.security.BaseActionSource; +import appeng.api.networking.security.MachineSource; +import appeng.api.storage.ICellContainer; +import appeng.api.storage.IMEInventory; +import appeng.api.storage.IMEInventoryHandler; +import appeng.api.storage.StorageChannel; +import appeng.api.storage.data.IAEItemStack; +import appeng.api.storage.data.IItemList; +import appeng.api.util.DimensionalCoord; +import appeng.helpers.IPriorityHost; +import appeng.me.GridAccessException; +import appeng.me.helpers.AENetworkProxy; +import appeng.me.helpers.IGridProxyable; +import appeng.me.storage.MEInventoryHandler; +import appeng.util.Platform; +import appeng.util.item.AEItemStack; +import gregtech.api.GregTechAPI; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gtnhlanth.common.hatch.MTEBusInputFocus; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; +import reobf.proghatches.gt.metatileentity.SuperChestME.UnlimitedWrapper; +import reobf.proghatches.gt.metatileentity.util.IStoageCellUpdate; +import reobf.proghatches.main.registration.Registration; + +public class NBTHatchMEFocus extends MTEBusInputFocus implements ICellContainer, IGridProxyable, IStoageCellUpdate{ + public NBTHatchMEFocus(int id, String name, String nameRegional) { + super(id, name, nameRegional); + Registration.items.add(new ItemStack(GregTechAPI.sBlockMachines, 1, id)); + } + public NBTHatchMEFocus(String name, String[] descriptionArray, ITexture[][][] textures) { + super(name, descriptionArray, textures); + + } +String[] descCache; +@Override +public String[] getDescription() { + + return descCache==null?(descCache=reobf.proghatches.main.Config.get("HMEF", ImmutableMap.of())):descCache; +} + /*@Override + public boolean isItemValidForUsageSlot(ItemStack aStack) { + return false; + }*/ + @Override + public IGridNode getActionableNode() { + + return getProxy().getNode(); + } + @Override + public IGridNode getGridNode(ForgeDirection dir) { + + return getProxy().getNode(); + } + @Override + public void securityBreak() { + } + public int getIndex(){ + + return getInputSlotCount(); + } + IMEInventoryHandler handler = new MEInventoryHandler(new UnlimitedWrapper(), StorageChannel.ITEMS) ; + public class UnlimitedWrapper implements IMEInventory { + + public UnlimitedWrapper() { + + } + + @Override + public IAEItemStack injectItems(IAEItemStack input, Actionable type, BaseActionSource src) { + if (type != Actionable.SIMULATE)post(); + + if(input==null){ + return input; + } + if(!isItemValidForUsageSlot(input.getItemStack())){ + return input; + } + + try { + long l = input.getStackSize(); + long compl = 0; + if (l > Integer.MAX_VALUE) { + compl = l - Integer.MAX_VALUE; + } + ItemStack in = input.getItemStack(); + ItemStack thiz = mInventory[getIndex()]; + if (thiz != null && !Platform.isSameItem(in, thiz)) return input; + if (thiz == null) { + thiz = in.copy(); + thiz.stackSize = 0; + } + int space = Math.max(0, cap() - thiz.stackSize); + int transfer = Math.min(space, in.stackSize); + if (type == Actionable.SIMULATE) { + in.stackSize -= transfer; + if (in.stackSize <= 0 && compl == 0) in = null; + AEItemStack ret = AEItemStack.create(in); + if (ret != null) ret.incStackSize(compl); + return ret; + } + if (type == Actionable.MODULATE) { + thiz.stackSize += transfer; + mInventory[getIndex()] = thiz; + in.stackSize -= transfer; + if (in.stackSize <= 0 && compl == 0) in = null; + AEItemStack ret = AEItemStack.create(in); + if (ret != null) ret.incStackSize(compl); + return ret; + + } + + return null; + } finally { + last = AEItemStack.create(mInventory[getIndex()]); + + } + } + + + + @Override + public IAEItemStack extractItems(IAEItemStack input, Actionable type, BaseActionSource src) { + try { + + if (type != Actionable.SIMULATE) post(); + + ItemStack in = input.getItemStack(); + ItemStack thiz = mInventory[getIndex()]; + if (thiz != null && !Platform.isSameItem(in, thiz)) return null; + if (thiz == null) { + return null; + } // thiz=in.copy(); } + int transfer = Math.min(in.stackSize, thiz.stackSize); + if (transfer == 0) return null; + if (type == Actionable.SIMULATE) { + in.stackSize = transfer; + return AEItemStack.create(in); + + } + if (type == Actionable.MODULATE) { + thiz.stackSize -= transfer; + if (thiz.stackSize <= 0) thiz = null; + mInventory[getIndex()] = thiz; + in.stackSize = transfer; + return AEItemStack.create(in); + } + + return null; + } finally { + + last = AEItemStack.create(mInventory[getIndex()]); + } + } + + @Override + public IItemList getAvailableItems(IItemList out) { + if (mInventory[getIndex()] != null) out.addStorage(AEItemStack.create(mInventory[getIndex()])); + return out; + } + + @Override + public StorageChannel getChannel() { + + return StorageChannel.ITEMS; + } + } + + private AEItemStack last; + + private void post() { + + try { + + // this.getProxy().getGrid().postEvent(new MENetworkCellArrayUpdate()); + // this.getProxy().getGrid().postEvent(new MENetworkStorageEvent(handler0, StorageChannel.ITEMS)); + try { + + if (last != null) { + if (mInventory[getIndex()] != null) { + if (last.equals(mInventory[getIndex()])) { + if (last.getStackSize() == mInventory[getIndex()].stackSize) { + return; + } else { + + this.getProxy() + .getStorage() + .postAlterationOfStoredItems( + StorageChannel.ITEMS, + ImmutableList.of( + last.copy() + .setStackSize(mInventory[getIndex()].stackSize - last.getStackSize())), + new MachineSource(this)); + last = AEItemStack.create(mInventory[getIndex()]); + return; + } + } + + } ; + + this.getProxy() + .getStorage() + .postAlterationOfStoredItems( + StorageChannel.ITEMS, + ImmutableList.of( + last.copy() + .setStackSize(-last.getStackSize())), + new MachineSource(this)); + } + last = AEItemStack.create(mInventory[getIndex()]); + if (last != null) { + this.getProxy() + .getStorage() + .postAlterationOfStoredItems( + StorageChannel.ITEMS, + ImmutableList.of( + last.copy() + .setStackSize(last.getStackSize())), + new MachineSource(this)); + } + + } catch (final GridAccessException ignore) {} + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + @Override + public List getCellArray(StorageChannel channel) { + + return ImmutableList.of(handler); + } + @Override + public int getPriority() { + + return 0; + } + @Override + public void saveChanges(IMEInventory cellInventory) { + markDirty(); + + } + @Override + public void cellUpdate() { + markDirty(); + update = true; + } + @Override + public DimensionalCoord getLocation() { + + return new DimensionalCoord((TileEntity)this.getBaseMetaTileEntity()); + } + AENetworkProxy gridProxy; + @Override + public AENetworkProxy getProxy() { + + if (gridProxy == null) { + gridProxy = new AENetworkProxy(this, "proxy", visualStack(), true); + gridProxy.setFlags(GridFlags.REQUIRE_CHANNEL); + updateValidGridProxySides(); + if (getBaseMetaTileEntity().getWorld() != null) gridProxy.setOwner( + getBaseMetaTileEntity().getWorld() + .getPlayerEntityByName(getBaseMetaTileEntity().getOwnerName())); + } + + return this.gridProxy;} + + private ItemStack visualStack() { + return new ItemStack(GregTechAPI.sBlockMachines, 1, getBaseMetaTileEntity().getMetaTileID()); + } + + @Override + public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { + + super.onFirstTick(aBaseMetaTileEntity); + getProxy().onReady(); + // onColorChangeServer(aBaseMetaTileEntity.getColorization()); + post(); + } boolean wasActive; + boolean update; + int rep; + public void updateStatus() { + + post(); + + } + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + + boolean active = this.getProxy() + .isActive(); + if (!aBaseMetaTileEntity.getWorld().isRemote) { + if (aTick % 40 == 1) { + post(); + } + + if (rep > 0) { + rep--; + update = true; + } + if (this.getBaseMetaTileEntity() + .hasInventoryBeenModified()) { + update = true; + rep = 1; + } ; + + if (update) { + update = false; + updateStatus(); + } + if (wasActive != active) { + wasActive = active; + + try { + this.getProxy() + .getGrid() + .postEvent(new MENetworkCellArrayUpdate()); + } catch (GridAccessException e) { + + } + post(); + } + + + + if (!aBaseMetaTileEntity.getWorld().isRemote && (aTick & 16) != 0) { + this.getBaseMetaTileEntity() + .setActive( + this.getProxy() + .isPowered() && active); + + } + + + + } + super.onPostTick(aBaseMetaTileEntity, aTick); + + if (aBaseMetaTileEntity.getWorld().isRemote) { + return; + } + + boolean needToSort = false; + for (int i = 1; i < mInventory.length; i++) { + ItemStack is = mInventory[i]; + if (is == null) continue; + markDirty(); + if (mInventory[getIndex()] == null) { + mInventory[getIndex()] = is.copy(); + mInventory[i] = null; + } else if (cap() - is.stackSize >= mInventory[getIndex()].stackSize) { + mInventory[getIndex()].stackSize += is.stackSize; + mInventory[i] = null; + } else { + int to = Math.min(cap() - mInventory[getIndex()].stackSize, is.stackSize); + mInventory[getIndex()].stackSize += to; + mInventory[i].stackSize -= to; + needToSort = true; + } + } + if (needToSort) fillStacksIntoFirstSlots(); + + } + private int cap() { + + return 1; + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + + return new NBTHatchMEFocus(mName, mDescriptionArray, mTextures); + } + private void updateValidGridProxySides() { + /* + * if (disabled) { + * getProxy().setValidSides(EnumSet.noneOf(ForgeDirection.class)); + * return; + * } + */ + getProxy().setValidSides(EnumSet.complementOf(EnumSet.of(ForgeDirection.UNKNOWN))); + + } +} diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/PatternDualInputHatch.java b/src/main/java/reobf/proghatches/gt/metatileentity/PatternDualInputHatch.java index 956853f..9e76b03 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/PatternDualInputHatch.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/PatternDualInputHatch.java @@ -999,16 +999,16 @@ public boolean allowsPatternOptimization() { } @Override - public int pushPatternMulti(ICraftingPatternDetails patternDetails, InventoryCrafting table, int maxTodo) { - if (Config.fastPatternDualInput == false) return 0; - if (maxTodo <= 0) return 0; - if (!isActive() && !skipActiveCheck) return 0; - if (!isEmpty()) return 0; + public int[] pushPatternMulti(ICraftingPatternDetails patternDetails, InventoryCrafting table, int maxTodo) { + if (Config.fastPatternDualInput == false) return AZERO; + if (maxTodo <= 0) return AZERO; + if (!isActive() && !skipActiveCheck) return AZERO; + if (!isEmpty()) return AZERO; if (!supportsFluids()) { for (int i = 0; i < table.getSizeInventory(); ++i) { ItemStack itemStack = table.getStackInSlot(i); if (itemStack == null) continue; - if (itemStack.getItem() instanceof ItemFluidPacket) return 0; + if (itemStack.getItem() instanceof ItemFluidPacket) return AZERO; } } @@ -1022,7 +1022,7 @@ public int pushPatternMulti(ICraftingPatternDetails patternDetails, InventoryCra fluids++; if (fluids > this.fluidSlots()) { clearInv(); - return 0; + return AZERO; } mStoredFluid[fluids - 1].setFluidDirect(ItemFluidPacket.getFluidStack(itemStack)); @@ -1031,7 +1031,7 @@ public int pushPatternMulti(ICraftingPatternDetails patternDetails, InventoryCra items++; if (items > 16) { clearInv(); - return 0; + return AZERO; } mInventory[items - 1] = itemStack; @@ -1111,7 +1111,7 @@ public int pushPatternMulti(ICraftingPatternDetails patternDetails, InventoryCra saved += suc; justHadNewItems = true; - return suc; + return new int[]{suc}; } long saved; diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/PatternDualInputHatchInventoryMappingSlave.java b/src/main/java/reobf/proghatches/gt/metatileentity/PatternDualInputHatchInventoryMappingSlave.java index 19d44f8..0ca0620 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/PatternDualInputHatchInventoryMappingSlave.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/PatternDualInputHatchInventoryMappingSlave.java @@ -1041,10 +1041,10 @@ public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrench new ChatComponentTranslation("GT5U.hatch.additionalConnection." + additionalConnection)); return true; } - + static int[] AZERO={0}; @Override - public int pushPatternMulti(ICraftingPatternDetails patternDetails, InventoryCrafting table, int maxTodo) { - if (Config.fastPatternDualInput == false) return 0; + public int[] pushPatternMulti(ICraftingPatternDetails patternDetails, InventoryCrafting table, int maxTodo) { + if (Config.fastPatternDualInput == false) return AZERO; if (getMaster() instanceof PatternDualInputHatch) { PatternDualInputHatch dih = ((PatternDualInputHatch) getMaster()); @@ -1058,7 +1058,7 @@ public int pushPatternMulti(ICraftingPatternDetails patternDetails, InventoryCra int suc = 0; if (master != null) { if (!isInputEmpty(master)) { - return 0; + return AZERO; } int i = 0; @@ -1079,13 +1079,13 @@ public int pushPatternMulti(ICraftingPatternDetails patternDetails, InventoryCra while (fs.amount > 0) { if (f >= master.mStoredFluid.length) { clearInv(master); - return 0; + return AZERO; } int tosplit = Math.min(fs.amount, flimit); fs.amount -= tosplit; if ((!fsplit) && fs.amount > 0) { clearInv(master); - return 0; + return AZERO; } FluidStack splitted = new FluidStack(fs.getFluid(), tosplit); master.mStoredFluid[f].setFluidDirect(splitted); @@ -1096,12 +1096,12 @@ public int pushPatternMulti(ICraftingPatternDetails patternDetails, InventoryCra while (is.stackSize > 0) { if (master.isValidSlot(i) == false) { clearInv(master); - return 0; + return AZERO; } ItemStack splitted = is.splitStack(Math.min(is.stackSize, ilimit)); if ((!isplit) && is.stackSize > 0) { clearInv(master); - return 0; + return AZERO; } master.mInventory[i] = splitted; i++; @@ -1171,7 +1171,7 @@ public int pushPatternMulti(ICraftingPatternDetails patternDetails, InventoryCra } - return suc; + return new int[]{suc}; } diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/StorageOutputBus.java b/src/main/java/reobf/proghatches/gt/metatileentity/StorageOutputBus.java index eea55b7..4f881d9 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/StorageOutputBus.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/StorageOutputBus.java @@ -74,7 +74,10 @@ public StorageOutputBus(String aName, int aTier, String[] aDescription, ITexture @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - boolean active = this.getProxy() + if (getBaseMetaTileEntity().isServerSide()) { + tickCounter = aTick;} + + boolean active = this.getProxy() .isActive(); if (!aBaseMetaTileEntity.getWorld().isRemote) { if (wasActive != active) { @@ -143,7 +146,7 @@ public boolean canAcceptItem() { return getCachedAmount() < getCacheCapacity(); } - int lastInputTick, tickCounter; + long lastInputTick, tickCounter; public int store(final ItemStack stack) { diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/StorageOutputHatch.java b/src/main/java/reobf/proghatches/gt/metatileentity/StorageOutputHatch.java index ac5c832..75edb58 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/StorageOutputHatch.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/StorageOutputHatch.java @@ -79,7 +79,10 @@ public StorageOutputHatch(String aName, int aTier, String[] aDescription, ITextu @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - boolean active = this.getProxy() + + if (getBaseMetaTileEntity().isServerSide()) { + tickCounter = aTick;} + boolean active = this.getProxy() .isActive(); if (!aBaseMetaTileEntity.getWorld().isRemote) { if (wasActive != active) { @@ -145,15 +148,22 @@ private long getCacheCapacity() { /** * Check if the internal cache can still fit more fluids in it */ - public boolean canAcceptItem() { + /* public boolean canAcceptItem() { return getCachedAmount() < getCacheCapacity() || lastInputTick == tickCounter; - } - - int lastInputTick, tickCounter; + }*/ + @Override + public boolean canAcceptFluid() { + return getCachedAmount() < getCacheCapacity() || lastInputTick == tickCounter; + } + @Override + public boolean canFillFluid() { + return canAcceptFluid() || lastInputTick == tickCounter; + } + long lastInputTick, tickCounter; public int tryFillAE(final FluidStack stack) { - if (canAcceptItem() || (lastInputTick == tickCounter)) { + if (canAcceptFluid() || (lastInputTick == tickCounter)) { try { AEFluidStack is = AEFluidStack.create(stack); diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/SuperChestME.java b/src/main/java/reobf/proghatches/gt/metatileentity/SuperChestME.java index 01269ad..7e11da3 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/SuperChestME.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/SuperChestME.java @@ -410,7 +410,7 @@ public UnlimitedWrapper() { @Override public IAEItemStack injectItems(IAEItemStack input, Actionable type, BaseActionSource src) { - post(); + if (type != Actionable.SIMULATE)post(); try { long l = input.getStackSize(); long compl = 0; diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/SuperTankME.java b/src/main/java/reobf/proghatches/gt/metatileentity/SuperTankME.java index ac00e16..cf0de76 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/SuperTankME.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/SuperTankME.java @@ -383,7 +383,7 @@ public UnlimitedWrapper() { @Override public IAEFluidStack injectItems(IAEFluidStack input, Actionable type, BaseActionSource src) { - post(); + if (type != Actionable.SIMULATE)post(); try { int acc = content.fill(input.getFluidStack(), type == Actionable.MODULATE); IAEFluidStack ret = input.copy(); diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/multi/LargeProgrammingCircuitProvider.java b/src/main/java/reobf/proghatches/gt/metatileentity/multi/LargeProgrammingCircuitProvider.java index 2b71127..d25dba2 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/multi/LargeProgrammingCircuitProvider.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/multi/LargeProgrammingCircuitProvider.java @@ -1345,23 +1345,23 @@ public boolean allowsPatternOptimization() { return false; } - + // boolean instant=true; @Override - public int pushPatternMulti(ICraftingPatternDetails patternDetails, InventoryCrafting table, int maxTodo) { + public int[] pushPatternMulti(ICraftingPatternDetails patternDetails, InventoryCrafting table, int maxTodo) { if (maxTodo <= 0) { - return 0; + return new int[]{0}; } - if (!getBaseMetaTileEntity().isActive()) return 0; + if (!getBaseMetaTileEntity().isActive()) return new int[]{0}; try { if (!(patternDetails instanceof ProgrammingCircuitProvider.CircuitProviderPatternDetial)) { - return 0; + return new int[]{0}; } if (ItemProgrammingCircuit.getCircuit(((CircuitProviderPatternDetial) patternDetails).out) .map(ItemStack::getItem) .orElse(null) == MyMod.progcircuit) { shut(this, null); - return 0; + return new int[]{0}; } } catch (Exception e) {} @@ -1382,8 +1382,10 @@ public int pushPatternMulti(ICraftingPatternDetails patternDetails, InventoryCra AEItemStack ais = AEItemStack.create(circuitItem); if (ais != null) ais.setStackSize(ais.getStackSize() * maxTodo); ret.add(ais); - - return maxTodo; + /* if(instant){ + return new int[]{maxTodo,0}; + }*/ + return new int[]{maxTodo}; } } diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/util/IMultiplePatternPushable.java b/src/main/java/reobf/proghatches/gt/metatileentity/util/IMultiplePatternPushable.java index 32cd9fb..cd980e4 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/util/IMultiplePatternPushable.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/util/IMultiplePatternPushable.java @@ -5,7 +5,8 @@ import appeng.api.networking.crafting.ICraftingPatternDetails; public interface IMultiplePatternPushable { - - public int pushPatternMulti(ICraftingPatternDetails patternDetails, InventoryCrafting table, int maxTodo); +//return array.length==1 -> array[0] pushed&consumed parallels +//return array.length==2 -> array[0] pushed array[1]consumed parallels +public int[] pushPatternMulti(ICraftingPatternDetails patternDetails, InventoryCrafting table, int maxTodo); } diff --git a/src/main/java/reobf/proghatches/main/mixin/mixins/part2/MixinMultiPattern.java b/src/main/java/reobf/proghatches/main/mixin/mixins/part2/MixinMultiPattern.java index 0601a50..a6c0f2d 100644 --- a/src/main/java/reobf/proghatches/main/mixin/mixins/part2/MixinMultiPattern.java +++ b/src/main/java/reobf/proghatches/main/mixin/mixins/part2/MixinMultiPattern.java @@ -181,9 +181,11 @@ public void MixinMultiPattern_executeCrafting(IEnergyGrid eg, CraftingGridCache return; } - used = ((IMultiplePatternPushable) medium).pushPatternMulti(detail, inv, maxtry); - - if (max != Integer.MAX_VALUE) remainingOperations -= Math.max(used - max, 0); + int[] retarr = ((IMultiplePatternPushable) medium).pushPatternMulti(detail, inv, maxtry); + used=retarr[0]; + int parallelused=used;//retarr.length>1?retarr[1]:used; + + if (max != Integer.MAX_VALUE) remainingOperations -= Math.max(parallelused - max, 0); MixinCallback.setter.accept(e.getValue(), num - used); if (used > 0) { diff --git a/src/main/java/reobf/proghatches/main/registration/PHRecipes.java b/src/main/java/reobf/proghatches/main/registration/PHRecipes.java index 15b7714..b489bfc 100644 --- a/src/main/java/reobf/proghatches/main/registration/PHRecipes.java +++ b/src/main/java/reobf/proghatches/main/registration/PHRecipes.java @@ -48,6 +48,7 @@ import gregtech.api.util.GTRecipeConstants; import gregtech.api.util.GTUtility; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtnhlanth.common.register.LanthItemList; import reobf.proghatches.item.ItemProgrammingCircuit; import reobf.proghatches.main.Config; import reobf.proghatches.main.MyMod; @@ -2024,6 +2025,21 @@ public void run() { .duration(1 * SECONDS) .eut(30) .addTo(RecipeMaps.assemblerRecipes); + + + GTValues.RA.stdBuilder() + .itemInputs( + Api.INSTANCE.parts().partStorageBus.stack(1) + , + LanthItemList.BEAMLINE_FOCUS_INPUT_BUS.copy() + ) + .itemOutputs( new ItemStack( + GregTechAPI.sBlockMachines, + 1, + Config.metaTileEntityOffset + Registration.MEFocusOffset)) + .duration(1 * SECONDS) + .eut(30) + .addTo(RecipeMaps.assemblerRecipes); /* * rec = new ShapelessOreRecipe( new ItemStack( MyMod.plunger,1,1), * ItemEnum.BOOSTER_CARD.getStack(0), diff --git a/src/main/java/reobf/proghatches/main/registration/Registration.java b/src/main/java/reobf/proghatches/main/registration/Registration.java index 62ccaf2..a2ef992 100644 --- a/src/main/java/reobf/proghatches/main/registration/Registration.java +++ b/src/main/java/reobf/proghatches/main/registration/Registration.java @@ -51,6 +51,7 @@ import reobf.proghatches.gt.metatileentity.FilterOutputBus; import reobf.proghatches.gt.metatileentity.IngredientBuffer; import reobf.proghatches.gt.metatileentity.MultiCircuitInputBus; +import reobf.proghatches.gt.metatileentity.NBTHatchMEFocus; import reobf.proghatches.gt.metatileentity.PatternDualInputHatch; import reobf.proghatches.gt.metatileentity.PatternDualInputHatchInventoryMappingSlave; import reobf.proghatches.gt.metatileentity.PriorityFilterInputBusME; @@ -97,6 +98,8 @@ public class Registration implements Runnable { private static final int RecipeCheckResultDetectorOffset = 78; public final static int IngBufferOffset = 79;// -80 public final static int WaterProviderOffset = 81; + public final static int MEFocusOffset = 82; + public final static int BufferedQuadDualInputHatchOffset = 100;// -115 public final static int LargeProviderOffset = 116; @@ -560,6 +563,13 @@ public boolean supportsFluids() { ); + new NBTHatchMEFocus( + Config.metaTileEntityOffset + MEFocusOffset, + "input.focus.me", + LangManager.translateToLocal("input.focus.me.name")); + + + /* * for (int i = 0; i < 4; i++) { diff --git a/src/main/resources/assets/proghatches/lang/en_US.lang b/src/main/resources/assets/proghatches/lang/en_US.lang index ff6572c..3bd2921 100644 --- a/src/main/resources/assets/proghatches/lang/en_US.lang +++ b/src/main/resources/assets/proghatches/lang/en_US.lang @@ -747,3 +747,4 @@ programmable_hatches.gt.newcrib.5=When off, GT Multi is not allowed to cache rec programmable_hatches.gt.newcrib.nosupport=§cNot supported on current GT5u item.proghatches.part.tunnel.name=Crafting Request Tunnel provider.water.name=Water Provider +input.focus.me.name=Automatable Focus Input Bus(ME) diff --git a/src/main/resources/assets/proghatches/lang/en_US/HMEF.lang b/src/main/resources/assets/proghatches/lang/en_US/HMEF.lang new file mode 100644 index 0000000..4095c39 --- /dev/null +++ b/src/main/resources/assets/proghatches/lang/en_US/HMEF.lang @@ -0,0 +1,5 @@ +Input Bus for Foci +Connect ME Network to access the first Active Foci slot +Not a Stocking Input Bus! +You still need to automate the Foci switching process +(e.g. use ME Level Emitter to detect items in Input Bus of Target Chamber) \ No newline at end of file diff --git a/src/main/resources/assets/proghatches/lang/zh_CN.lang b/src/main/resources/assets/proghatches/lang/zh_CN.lang index 5b80a6b..d67bf2d 100644 --- a/src/main/resources/assets/proghatches/lang/zh_CN.lang +++ b/src/main/resources/assets/proghatches/lang/zh_CN.lang @@ -745,3 +745,4 @@ programmable_hatches.gt.newcrib.5=此模式关闭时,会阻止GT多方块缓存 programmable_hatches.gt.newcrib.nosupport=§c当前版本GT5u没有缓存机制 这个选项没有意义 item.proghatches.part.tunnel.name=合成请求隧道 provider.water.name=水提供器 +input.focus.me.name=自动化焦点输入总线(ME) diff --git a/src/main/resources/assets/proghatches/lang/zh_CN/HMEF.lang b/src/main/resources/assets/proghatches/lang/zh_CN/HMEF.lang new file mode 100644 index 0000000..66eda8d --- /dev/null +++ b/src/main/resources/assets/proghatches/lang/zh_CN/HMEF.lang @@ -0,0 +1,5 @@ +焦点物品的输入总线 +连接ME网络访问活跃区的第一个焦点物品 +并非存储输入总线! +你依然需要自动化焦点更换过程 +(比如使用ME发信器检测靶仓输入总线内物品) \ No newline at end of file