From c31dccdcaf3768a9fd8e943ef21970b23b49b233 Mon Sep 17 00:00:00 2001 From: reobf <2215595288@qq.com> Date: Mon, 4 Nov 2024 21:28:01 +0800 Subject: [PATCH] update --- .../ae/BlockCraftingCondenser.java | 87 +++++++++ .../java/reobf/proghatches/ae/ICondenser.java | 6 + .../proghatches/ae/ItemPartSubnetExciter.java | 3 +- .../proghatches/ae/TileCraftingCondenser.java | 42 ++++ .../proghatches/block/ItemBlockTooltip.java | 9 +- .../eucrafting/CoverToMachineAdaptor.java | 42 +++- .../BufferedDualInputHatch.java | 61 +++++- .../gt/metatileentity/DecoyInputBusME.java | 11 +- .../gt/metatileentity/DecoyInputHatchME.java | 2 +- .../gt/metatileentity/DualInputHachOC.java | 16 +- .../gt/metatileentity/DualInputHatch.java | 152 ++++++++++++++- .../PriorityFilterInputBusME.java | 4 +- .../PriorityFilterInputHatchME.java | 4 +- .../gt/metatileentity/SuperChestME.java | 10 +- .../gt/metatileentity/SuperTankME.java | 10 +- .../multi/IngredientDistributor.java | 22 ++- .../reobf/proghatches/main/CommonProxy.java | 40 +++- .../java/reobf/proghatches/main/MyMod.java | 20 +- .../proghatches/main/mixin/MixinCallback.java | 11 +- .../proghatches/main/mixin/MixinPlugin.java | 1 + .../mixins/part2/MixinCraftingCondender.java | 90 +++++++++ .../mixin/mixins/part2/MixinMultiPattern.java | 184 ++++++++++++++++-- .../mixins/part2/MixinPresetsInject.java | 13 +- .../main/registration/PHRecipes.java | 2 +- .../assets/proghatches/lang/en_US.lang | 17 +- .../assets/proghatches/lang/zh_CN.lang | 15 ++ 26 files changed, 804 insertions(+), 70 deletions(-) create mode 100644 src/main/java/reobf/proghatches/ae/BlockCraftingCondenser.java create mode 100644 src/main/java/reobf/proghatches/ae/ICondenser.java create mode 100644 src/main/java/reobf/proghatches/ae/TileCraftingCondenser.java create mode 100644 src/main/java/reobf/proghatches/main/mixin/mixins/part2/MixinCraftingCondender.java diff --git a/src/main/java/reobf/proghatches/ae/BlockCraftingCondenser.java b/src/main/java/reobf/proghatches/ae/BlockCraftingCondenser.java new file mode 100644 index 0000000..7f65186 --- /dev/null +++ b/src/main/java/reobf/proghatches/ae/BlockCraftingCondenser.java @@ -0,0 +1,87 @@ +package reobf.proghatches.ae; + +import java.util.List; + +import appeng.block.crafting.BlockCraftingUnit; +import appeng.block.crafting.ItemCraftingStorage; +import appeng.client.texture.ExtraBlockTextures; +import appeng.tile.crafting.TileCraftingStorageTile; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +public class BlockCraftingCondenser extends BlockCraftingUnit { + + public BlockCraftingCondenser(int tier) { + this.setTileEntity(TileCraftingCondenser.class); + setBlockName("proghatches.craftingdumper."+tier); + setBlockTextureName("?");setHardness(1); + this.tier=tier; + } + + @Override + public Class getItemBlockClass() { + return ItemCraftingStorage.class; + } + + ExtraBlockTextures[] nfit= + { + ExtraBlockTextures. BlockCraftingStorage1k, + ExtraBlockTextures. BlockCraftingStorage4k, + ExtraBlockTextures. BlockCraftingStorage16k, + ExtraBlockTextures. BlockCraftingStorage64k, + ExtraBlockTextures. BlockCraftingStorage256k, + ExtraBlockTextures. BlockCraftingStorage1024k, + ExtraBlockTextures. BlockCraftingStorage4096k, + ExtraBlockTextures. BlockCraftingStorage16384k, + ExtraBlockTextures. BlockCraftingStorageSingularity }; + ExtraBlockTextures[] fit= + { + ExtraBlockTextures. BlockCraftingStorage1kFit, + ExtraBlockTextures. BlockCraftingStorage4kFit, + ExtraBlockTextures. BlockCraftingStorage16kFit, + ExtraBlockTextures. BlockCraftingStorage64kFit, + ExtraBlockTextures. BlockCraftingStorage256kFit, + ExtraBlockTextures. BlockCraftingStorage1024kFit, + ExtraBlockTextures. BlockCraftingStorage4096kFit, + ExtraBlockTextures. BlockCraftingStorage16384kFit, + ExtraBlockTextures. BlockCraftingStorageSingularityFit + }; + int[] num={1,4,16,64,256,1024,4096,16384,Integer.MAX_VALUE}; + + + @Override + public IIcon getIcon(final int direction, final int metadata) { + if((metadata &8)>0){ + + + return fit[tier].getIcon(); + + } + + return nfit[tier].getIcon(); + } + + @Override + @SideOnly(Side.CLIENT) + public void getCheckedSubBlocks(final Item item, final CreativeTabs tabs, final List itemStacks) { + itemStacks.add(new ItemStack(this, 1, 0)); + } + int tier; + public int getSkips() { + return num[tier]; + } + + public void addTips(List toolTip) { + toolTip.add(StatCollector.translateToLocalFormatted("proghatches.craftingdumper.tooltip.0",num[tier])); + + } + + +} diff --git a/src/main/java/reobf/proghatches/ae/ICondenser.java b/src/main/java/reobf/proghatches/ae/ICondenser.java new file mode 100644 index 0000000..7f0bc0e --- /dev/null +++ b/src/main/java/reobf/proghatches/ae/ICondenser.java @@ -0,0 +1,6 @@ +package reobf.proghatches.ae; + +public interface ICondenser { +public int getSkips(); +public default boolean isinf(){return false;} +} diff --git a/src/main/java/reobf/proghatches/ae/ItemPartSubnetExciter.java b/src/main/java/reobf/proghatches/ae/ItemPartSubnetExciter.java index 1134132..8267a97 100644 --- a/src/main/java/reobf/proghatches/ae/ItemPartSubnetExciter.java +++ b/src/main/java/reobf/proghatches/ae/ItemPartSubnetExciter.java @@ -6,6 +6,7 @@ import appeng.api.AEApi; import appeng.api.parts.IPartItem; +import appeng.core.Api; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; @@ -81,7 +82,7 @@ public void registerIcons(IIconRegister _iconRegister) { @Override public IIcon getIconIndex(ItemStack p_77650_1_) { - return super.getIconIndex(p_77650_1_); + return Api.INSTANCE.blocks().blockFluix.block().getIcon(0, 0); } @Override @SideOnly(Side.CLIENT) diff --git a/src/main/java/reobf/proghatches/ae/TileCraftingCondenser.java b/src/main/java/reobf/proghatches/ae/TileCraftingCondenser.java new file mode 100644 index 0000000..400928e --- /dev/null +++ b/src/main/java/reobf/proghatches/ae/TileCraftingCondenser.java @@ -0,0 +1,42 @@ + +package reobf.proghatches.ae; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; + +import appeng.api.AEApi; +import appeng.api.definitions.IBlocks; +import appeng.block.crafting.BlockAdvancedCraftingStorage; +import appeng.block.crafting.BlockSingularityCraftingStorage; +import appeng.tile.crafting.TileCraftingTile; + +public class TileCraftingCondenser extends TileCraftingTile implements ICondenser { + + + public TileCraftingCondenser(){ + + + } + + @Override + public boolean isAccelerator() { + return false; + } + + @Override + public boolean isStorage() { + return false; + } +@Override +public boolean isinf() { + // TODO Auto-generated method stub + return getSkips()==Integer.MAX_VALUE; +} + @Override + public int getSkips() { + + return ((BlockCraftingCondenser)getBlockType()).getSkips(); + } + + +} diff --git a/src/main/java/reobf/proghatches/block/ItemBlockTooltip.java b/src/main/java/reobf/proghatches/block/ItemBlockTooltip.java index d5580eb..e7fc98c 100644 --- a/src/main/java/reobf/proghatches/block/ItemBlockTooltip.java +++ b/src/main/java/reobf/proghatches/block/ItemBlockTooltip.java @@ -7,7 +7,9 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; 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; import reobf.proghatches.lang.LangManager; @@ -36,8 +38,11 @@ public int getMetadata(int p_77647_1_) { return (p_77647_1_); } - - +@Override +public boolean getHasSubtypes() { + + return true; +} @Override public String getUnlocalizedName(ItemStack stack) { if(field_150939_a instanceof INameAndTooltips){ diff --git a/src/main/java/reobf/proghatches/eucrafting/CoverToMachineAdaptor.java b/src/main/java/reobf/proghatches/eucrafting/CoverToMachineAdaptor.java index 2d86e28..003567c 100644 --- a/src/main/java/reobf/proghatches/eucrafting/CoverToMachineAdaptor.java +++ b/src/main/java/reobf/proghatches/eucrafting/CoverToMachineAdaptor.java @@ -132,8 +132,42 @@ public ItemStack simulateSimilarRemove(int amount, ItemStack filter, FuzzyMode f IInventoryDestination destination) { return invItems != null ? invItems.simulateSimilarRemove(amount, filter, fuzzyMode, destination) : null; } - private int checkItemFluids(IFluidHandler tank, InventoryAdaptor inv, ForgeDirection direction) { + if (tank == null && inv == null) + return 2; + + if (tank != null && tank.getTankInfo(direction) != null) { + List tankInfos = (List)new LinkedList<>(); + + if (false) {} else { + tankInfos.add(tank.getTankInfo(direction)); + } + boolean hasTank = false; + for (FluidTankInfo[] tankInfoArray : tankInfos) { + for (FluidTankInfo tankInfo : tankInfoArray) { + hasTank = true; + FluidStack fluid = tankInfo.fluid; + if (fluid != null && fluid.amount > 0) + return 1; + } + } + if (!hasTank && inv == null) + return 2; + } + if (isGTMachine(tank)) + return gtMachineCircuitCheck(inv); + return (inv != null && inv.containsItems()) ? 1 : 0; + } + private boolean isGTMachine(Object o) { + + if (o instanceof TileEntity) { + TileEntity te = (TileEntity)o; + return te.getBlockType().getUnlocalizedName().equals("gt.blockmachines"); + } + return false; + } + + private int checkItemFluids0(IFluidHandler tank, InventoryAdaptor inv, ForgeDirection direction) { if (tank == null && inv == null) { return 2; } @@ -186,7 +220,11 @@ public ItemStack simulateAdd(ItemStack toBeSimulated) { return simulateAdd(toBeSimulated, InsertionMode.DEFAULT); } @Override - public boolean containsItems() { + public boolean containsItems() { + + + + return checkItemFluids(this.invFluids, this.invItems, this.fd) > 0; } diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/BufferedDualInputHatch.java b/src/main/java/reobf/proghatches/gt/metatileentity/BufferedDualInputHatch.java index 1fccad7..3802260 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/BufferedDualInputHatch.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/BufferedDualInputHatch.java @@ -44,6 +44,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; @@ -616,6 +617,12 @@ public ItemStack[] getItemInputs() { ItemStack[] condensed = filterStack.apply(mStoredItemInternal,shared.getItems()); + + if(!trunOffEnsure){condensed=ensureIntMax(condensed);} + + + + return condensed; @@ -623,8 +630,10 @@ public ItemStack[] getItemInputs() { @Override public FluidStack[] getFluidInputs() { - - return asFluidStack.apply(mStoredFluidInternal,shared.getFluid()); + FluidStack[] condensed = asFluidStack.apply(mStoredFluidInternal,shared.getFluid()); + if(!trunOffEnsure){condensed=ensureIntMax(condensed);} + + return condensed; } public int space() { @@ -1118,7 +1127,7 @@ public boolean onKeyPressed(char character, int keyCode) { }); return wd; } - +static int EX_CONFIG=985211; private NBTTagCompound cv(String s) { try { return (NBTTagCompound) JsonToNBT.func_150315_a(s); @@ -1130,7 +1139,11 @@ private NBTTagCompound cv(String s) { ButtonWidget createPowerSwitchButton(IWidgetBuilder builder) { IGregTechTileEntity thiz = this.getBaseMetaTileEntity(); Widget button = new ButtonWidget().setOnClick((clickData, widget) -> { - + if(clickData.shift==true){ + if(widget.getContext().isClient()==false)widget.getContext().openSyncedWindow(EX_CONFIG); + return; + + } if (thiz.isAllowedToWork()) { thiz.disableWorking(); } else { @@ -1169,7 +1182,7 @@ public void addUIWidgets(Builder builder, UIBuildContext buildContext) { } - + buildContext.addSyncedWindow(EX_CONFIG, (s) -> createWindowEx(s)); //.setPos(new Pos2d(getGUIWidth() - 18 - 3, 5)).setSize(16, 16) @@ -1900,4 +1913,42 @@ static public boolean fluidEquals(FluidTank a, FluidTank b) { return true; } + protected ModularWindow createWindowEx(final EntityPlayer player) { + + final int WIDTH = 18 * 6 + 6; + final int HEIGHT = 18 * 4 + 6; + final int PARENT_WIDTH = getGUIWidth(); + final int PARENT_HEIGHT = getGUIHeight(); + ModularWindow.Builder builder = ModularWindow.builder(WIDTH, HEIGHT); + builder.setBackground(GT_UITextures.BACKGROUND_SINGLEBLOCK_DEFAULT); + builder.setGuiTint(getGUIColorization()); + builder.setDraggable(true); + + + builder.setPos((size, window) -> Alignment.Center.getAlignedPos(size, new Size(PARENT_WIDTH, PARENT_HEIGHT)) + .add(Alignment.TopRight.getAlignedPos(new Size(PARENT_WIDTH, PARENT_HEIGHT), new Size(WIDTH, HEIGHT)))); + + builder.widget(new CycleButtonWidget().setToggle(() -> updateEveryTick, (s) -> { + updateEveryTick = s; + + }).setStaticTexture(GT_UITextures.OVERLAY_BUTTON_CHECKMARK) + .setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE).setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(3 + 18 * 0, 3 + 18 * 0).setSize(18, 18) + .setGTTooltip(() -> mTooltipCache.getData("programmable_hatches.gt.forcecheck")) + + ); + builder.widget(new CycleButtonWidget().setToggle(() ->!trunOffEnsure , (s) -> { + trunOffEnsure =! s; + + }).setStaticTexture(GT_UITextures.OVERLAY_BUTTON_CHECKMARK) + .setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE).setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(3 + 18 * 1, 3 + 18 * 0).setSize(18, 18) + .addTooltip(StatCollector.translateToLocal("programmable_hatches.gt.ensureintmax.0")) + .addTooltip(StatCollector.translateToLocal("programmable_hatches.gt.ensureintmax.1")) + .addTooltip(StatCollector.translateToLocal("programmable_hatches.gt.ensureintmax.2")) + .addTooltip(StatCollector.translateToLocal("programmable_hatches.gt.ensureintmax.3")) + ); + return builder.build(); + + } } diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/DecoyInputBusME.java b/src/main/java/reobf/proghatches/gt/metatileentity/DecoyInputBusME.java index 60b3727..d4a6227 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/DecoyInputBusME.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/DecoyInputBusME.java @@ -26,6 +26,7 @@ import org.spongepowered.asm.mixin.Unique; +import com.glodblock.github.common.item.ItemFluidDrop; import com.google.common.collect.HashMultimap; import com.google.common.collect.ImmutableMap; import com.google.common.collect.TreeMultimap; @@ -158,7 +159,7 @@ public void overridedBehoviour(int minPull) { .getCellArray(StorageChannel.ITEMS); for(IMEInventoryHandler l:list){ - if(!(l instanceof MEInventoryHandler))continue; + // if(!(l instanceof MEInventoryHandler))continue; /* if(l instanceof MEInventoryHandler){ MEInventoryHandler hh=(MEInventoryHandler) l; if((hh.getInternal() instanceof MEPassThrough)) continue; @@ -191,7 +192,7 @@ public void add(final IAEItemStack option) { if (option == null) { return; } - + if(option.getItem()instanceof ItemFluidDrop){return;} final IAEItemStack st = this.records.get(option); if (st != null) { @@ -228,7 +229,7 @@ public void addStorage(final IAEItemStack option) { if (option == null) { return; } - + if(option.getItem()instanceof ItemFluidDrop){return;} final IAEItemStack st = this.records.get(option); if (st != null) { @@ -449,7 +450,7 @@ private BaseActionSource getRequestSource() { @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - /*try { + try { System.out.println(overridedExtract( ((IStorageGrid) this.getProxy().getNode().getGrid().getCache(IStorageGrid.class)).getItemInventory(), @@ -459,7 +460,7 @@ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlaye } catch (Exception e) { e.printStackTrace(); - }*/ + } return super.onRightclick(aBaseMetaTileEntity, aPlayer); } diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/DecoyInputHatchME.java b/src/main/java/reobf/proghatches/gt/metatileentity/DecoyInputHatchME.java index c7d9717..d35461c 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/DecoyInputHatchME.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/DecoyInputHatchME.java @@ -135,7 +135,7 @@ public void overridedBehoviour(int minPull) { .getCellArray(StorageChannel.FLUIDS); for(IMEInventoryHandler l:list){ - if(!(l instanceof MEInventoryHandler))continue; + // if(!(l instanceof MEInventoryHandler))continue; /* if(l instanceof MEInventoryHandler){ MEInventoryHandler hh=(MEInventoryHandler) l; if((hh.getInternal() instanceof MEPassThrough)) continue; diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHachOC.java b/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHachOC.java index 08f4026..3e4fdda 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHachOC.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHachOC.java @@ -310,9 +310,23 @@ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundExcept in.readFully(b); NBTTagCompound tag = CompressedStreamTools.func_152457_a(b, new NBTSizeTracker(Long.MAX_VALUE)); IAEStack ch= - in.readInt()==1?AEItemStack.loadItemStackFromNBT(tag):AEFluidStack.loadFluidStackFromNBT(tag); + in.readInt()==1?AEItemStack.loadItemStackFromNBT(tag):loadFluidStackFromNBT(tag); stack=ch; } + public static IAEFluidStack loadFluidStackFromNBT(final NBTTagCompound i) { + final FluidStack itemstack = FluidStack.loadFluidStackFromNBT(i); + if (itemstack == null) { + return null; + } + final AEFluidStack fluid = AEFluidStack.create(itemstack); + // fluid.priority = i.getInteger( "Priority" ); + fluid.setStackSize(i.getLong("Cnt")); + fluid.setCountRequestable(i.getLong("Req")); + fluid.setCraftable(i.getBoolean("Craft")); + fluid.setCountRequestableCrafts(i.getLong("ReqMade")); + fluid.setUsedPercent(i.getFloat("UsedPercent")); + return fluid; + } } public static class TargetStack implements Serializable{ diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatch.java b/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatch.java index 2c799d8..462ca78 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatch.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatch.java @@ -13,12 +13,16 @@ import java.util.Collection; import java.util.HashMap; import java.util.HashSet; +import java.util.IdentityHashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; +import java.util.Map.Entry; import java.util.NoSuchElementException; import java.util.Optional; +import java.util.Set; +import java.util.TreeSet; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Function; @@ -27,6 +31,8 @@ import java.util.stream.IntStream; import java.util.stream.Stream; +import org.spongepowered.include.com.google.common.collect.ImmutableSet; + import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -128,6 +134,7 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_TooltipDataCache; import gregtech.api.util.GT_Utility; +import gregtech.api.util.GT_Utility.ItemId; import gregtech.api.util.GT_TooltipDataCache.TooltipData; import gregtech.api.util.shutdown.ShutDownReasonRegistry; import gregtech.common.tileentities.machines.IDualInputHatch; @@ -303,6 +310,7 @@ public ItemStack loadItemStackFromNBT(NBTTagCompound tag) { @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); + aNBT.setBoolean("trunOffEnsure",trunOffEnsure); aNBT.setTag("shared", shared.ser()); aNBT.setInteger("fluidLimit", fluidLimit); aNBT.setBoolean("program", program); @@ -345,6 +353,8 @@ public void saveNBTData(NBTTagCompound aNBT) { public void loadNBTData(NBTTagCompound aNBT) { if(aNBT.hasKey("x")==false)return; super.loadNBTData(aNBT); + if(aNBT.hasKey("trunOffEnsure")) + trunOffEnsure=aNBT.getBoolean("trunOffEnsure"); shared.deser(aNBT.getCompoundTag("shared")); fluidLimit= aNBT.getInteger("fluidLimit"); program = aNBT.getBoolean("program"); @@ -356,6 +366,7 @@ public void loadNBTData(NBTTagCompound aNBT) { } } } + /* GT will read 'Count' Tag try{ @@ -962,16 +973,151 @@ public boolean isEmpty() { @Override public ItemStack[] getItemInputs() { ItemStack[] is=dualItem(); - //System.out.println(Arrays.toString(is)); + if(!trunOffEnsure){is=ensureIntMax(is);} return is; } @Override public FluidStack[] getFluidInputs() { - - return dualFluid(); + FluidStack[] is=dualFluid(); + if(!trunOffEnsure){is=ensureIntMax(is);} + return is; + } + } + + static TreeSet recycle=null; + static TreeSet retrieve(){ + + TreeSet t= recycle; + recycle=null; + return t; + } + static void dump(TreeSet t){t.clear(); + recycle=t; + +} + + static public ItemStack[] ensureIntMax(ItemStack[] in) { + class Source implements Comparable{ + int num; + int index; + public Source(int n,int i) { + num=n;index=i; + } + @Override + public int compareTo(Source o) { + return Integer.compare(o.num,num);//inversed + } + } + int removed=0; + + HashMap> count=new HashMap<>(in.length); + for(int i=0;i set= (recycle==null)?new TreeSet<>():retrieve(); + + set.add(new Source(in[i].stackSize, i)); + count.merge(ItemId.createNoCopy(in[i]), set, + (a,b)->{a.addAll(b);dump(b);return a;} + ); + Iterator> itr = count.values().iterator(); + TreeSet thiz ; + for(;itr.hasNext();){thiz=itr.next(); + long howmany=0; + Iterator s = thiz.iterator(); + end:while(s.hasNext()){ + howmany+=s.next().num; + if(howmany>Integer.MAX_VALUE){ + s.remove();removed++; + while(s.hasNext()){s.next();s.remove();removed++;break end;} + } + } + + + } + } + + if(removed==0)return in; + + ItemStack[] ret=new ItemStack[in.length-removed]; + int[] cnt=new int[1]; + count.values().stream().flatMap(s->s.stream()).forEach(s->{ + ret[cnt[0]]=in[s.index]; + cnt[0]++; + }); + + + + return ret; + } + + boolean trunOffEnsure=true; + static public FluidStack[] ensureIntMax(FluidStack[] in) { + class Source implements Comparable{ + int num; + int index; + public Source(int n,int i) { + num=n;index=i; + } + @Override + public int compareTo(Source o) { + return Integer.compare(o.num,num);//inversed + } + } + int removed=0; + + IdentityHashMap> count=new IdentityHashMap<>(in.length); + //do not use hashcode() for better performance + for(int i=0;i set= (recycle==null)?new TreeSet<>():retrieve(); + + set.add(new Source(in[i].amount, i)); + count.merge(in[i].getFluid(), set, + (a,b)->{a.addAll(b);dump(b);return a;} + ); + Iterator> itr = count.values().iterator(); + TreeSet thiz = null; + for(;itr.hasNext();){ + thiz=itr.next(); + long howmany=0; + Iterator s = thiz.iterator(); + end:while(s.hasNext()){ + howmany+=s.next().num; + if(howmany>Integer.MAX_VALUE){ + s.remove();removed++; + while(s.hasNext()){s.next();s.remove();removed++;break end;} + } + } + + } + } + + if(removed==0)return in; + + FluidStack[] ret=new FluidStack[in.length-removed]; + int[] cnt=new int[1]; + count.values().stream().flatMap(s->s.stream()).forEach(s->{ + ret[cnt[0]]=in[s.index]; + cnt[0]++; + }); + + + + return ret; } + + + + + + + + + + + + + public interface VargsFunction { R apply(T... t); } diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputBusME.java b/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputBusME.java index 6f8b0c7..928b30a 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputBusME.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputBusME.java @@ -122,7 +122,7 @@ public void overridedBehoviour(int minPull) { .getCellArray(StorageChannel.ITEMS); if(cc.getPriority()==filter) for(IMEInventoryHandler l:list){ - if(!(l instanceof MEInventoryHandler))continue; + //if(!(l instanceof MEInventoryHandler))continue; all.add( l); } @@ -171,7 +171,7 @@ public IAEStack overridedExtract(IMEMonitor thiz, IAEStack request, Actionable m .getCellArray(StorageChannel.ITEMS); if(cc.getPriority()==filter) for(IMEInventoryHandler l:list){ - if(!(l instanceof MEInventoryHandler))continue; + //if(!(l instanceof MEInventoryHandler))continue; IAEStack ext = l.extractItems(request, mode, src); if(ext!=null) request.decStackSize(ext.getStackSize()); diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputHatchME.java b/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputHatchME.java index 340b91c..00eb10c 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputHatchME.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputHatchME.java @@ -122,7 +122,7 @@ public void overridedBehoviour(int minPull) { .getCellArray(StorageChannel.FLUIDS); if(cc.getPriority()==filter) for(IMEInventoryHandler l:list){ - if(!(l instanceof MEInventoryHandler))continue; + //if(!(l instanceof MEInventoryHandler))continue; all.add( l); } @@ -171,7 +171,7 @@ public IAEStack overridedExtract(IMEMonitor thiz, IAEStack request, Actionable m .getCellArray(StorageChannel.FLUIDS); if(cc.getPriority()==filter) for(IMEInventoryHandler l:list){ - if(!(l instanceof MEInventoryHandler))continue; + // if(!(l instanceof MEInventoryHandler))continue; IAEStack ext = l.extractItems(request, mode, src); if(ext!=null) request.decStackSize(ext.getStackSize()); diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/SuperChestME.java b/src/main/java/reobf/proghatches/gt/metatileentity/SuperChestME.java index cf1d539..61864f9 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/SuperChestME.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/SuperChestME.java @@ -181,7 +181,7 @@ private void post(){ try { this.getProxy().getGrid().postEvent(new MENetworkCellArrayUpdate()); - this.getProxy().getGrid().postEvent(new MENetworkStorageEvent(handler0, StorageChannel.ITEMS)); + //this.getProxy().getGrid().postEvent(new MENetworkStorageEvent(handler0, StorageChannel.ITEMS)); try { if(last!=null){ @@ -228,7 +228,7 @@ public void securityBreak() { @Override public List getCellArray(StorageChannel channel) { if(channel==StorageChannel.ITEMS) - return ImmutableList.of(handler0); + return ImmutableList.of(handler); else return ImmutableList.of(); @@ -336,7 +336,7 @@ public void updateFilter(ItemStack fs){ } }; - IMEMonitor handler0= new MEMonitorHandler(handler + IMEMonitor handler0x= new MEMonitorHandler(handler ); /*IMEMonitor handler0= new MEMonitorHandler(handler );*/ @@ -428,7 +428,7 @@ public IAEItemStack extractItems(IAEItemStack input, Actionable type, BaseAction } @Override public IItemList getAvailableItems(IItemList out) { - out.addStorage(AEItemStack.create(mInventory[0])); + if(mInventory[0]!=null)out.addStorage(AEItemStack.create(mInventory[0])); return out; } @@ -705,7 +705,7 @@ public void setStackInSlot(int slot, ItemStack stack) { builder.widget(new TextFieldWidget() - .setPattern(BaseTextFieldWidget.NATURAL_NUMS) + .setPattern(BaseTextFieldWidget.WHOLE_NUMS) .setGetter(()->piority+"") .setSetter(s-> {try{piority=Integer.parseInt(s);}catch(Exception e){piority=0;};post();}) diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/SuperTankME.java b/src/main/java/reobf/proghatches/gt/metatileentity/SuperTankME.java index 5575d69..321ed70 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/SuperTankME.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/SuperTankME.java @@ -161,7 +161,7 @@ private void post(){ try { this.getProxy().getGrid().postEvent(new MENetworkCellArrayUpdate()); - this.getProxy().getGrid().postEvent(new MENetworkStorageEvent(handler0, StorageChannel.FLUIDS)); + //this.getProxy().getGrid().postEvent(new MENetworkStorageEvent(handler, StorageChannel.FLUIDS)); try { if(last!=null){ @@ -212,7 +212,7 @@ public void securityBreak() { @Override public List getCellArray(StorageChannel channel) { if(channel==StorageChannel.FLUIDS) - return ImmutableList.of(handler0); + return ImmutableList.of(handler); else return ImmutableList.of(); @@ -319,7 +319,7 @@ public void updateFilter(FluidStack fs){ this.setPartitionList(new PrecisePriorityList(s)); } }; -IMEMonitor handler0= new MEMonitorHandler(handler +IMEMonitor handler0x= new MEMonitorHandler(handler ); @@ -394,7 +394,7 @@ public IAEFluidStack extractItems(IAEFluidStack input, Actionable type, BaseActi @Override public IItemList getAvailableItems(IItemList out) { - out.addStorage(AEFluidStack.create(content.getFluid())); + if(content.getFluidAmount()>0)out.addStorage(AEFluidStack.create(content.getFluid())); return out; } @@ -764,7 +764,7 @@ public void addUIWidgets(Builder builder, UIBuildContext buildContext) { builder.widget(new TextFieldWidget() - .setPattern(BaseTextFieldWidget.NATURAL_NUMS) + .setPattern(BaseTextFieldWidget.WHOLE_NUMS) .setGetter(()->piority+"") .setSetter(s-> {try{piority=Integer.parseInt(s);}catch(Exception e){piority=0;};post();}) diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/multi/IngredientDistributor.java b/src/main/java/reobf/proghatches/gt/metatileentity/multi/IngredientDistributor.java index 276af15..2216fbe 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/multi/IngredientDistributor.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/multi/IngredientDistributor.java @@ -857,8 +857,8 @@ static TransferCheckResult deser(PacketBuffer pb){ r=AEItemStack.loadItemStackFromNBT(tag.getCompoundTag("o"+i)); if(type==3) r=FluidStack.loadFluidStackFromNBT(tag.getCompoundTag("o"+i)); - if(type==4) - r=AEFluidStack.loadFluidStackFromNBT(tag.getCompoundTag("o"+i)); + //if(type==4) + //r=AEFluidStack.loadFluidStackFromNBT(tag.getCompoundTag("o"+i)); @@ -902,16 +902,20 @@ static void ser(PacketBuffer pb,TransferCheckResult thiz){ tag.setTag("o"+i, tmp); tag.setInteger("t"+i, 2); } - if(o instanceof FluidStack){ - tag.setTag("o"+i, ((FluidStack) o).writeToNBT(new NBTTagCompound())); - tag.setInteger("t"+i, 3); - } + if(o instanceof AEFluidStack){ - NBTTagCompound tmp = new NBTTagCompound(); + /*NBTTagCompound tmp = new NBTTagCompound(); ((AEFluidStack) o).writeToNBT(tmp); tag.setTag("o"+i, tmp); - tag.setInteger("t"+i, 4); + tag.setInteger("t"+i, 4);*/ + o=((AEFluidStack) o).getFluidStack(); } + + if(o instanceof FluidStack){ + tag.setTag("o"+i, ((FluidStack) o).writeToNBT(new NBTTagCompound())); + tag.setInteger("t"+i, 3); + } + if(o instanceof Number){ tag.setString("o"+i, o.toString()); @@ -1037,7 +1041,7 @@ private TransferCheckResult checkMEHatch(GT_MetaTileEntity_Hatch_Output_ME bus,F while(itr.hasNext()){IAEFluidStack next; if(!sameType(next=itr.next(),(check))&&next.getStackSize()>0){ if(check==null) - return TransferCheckResult.ofFail("net.diff.hatch.null",index,cp(next)); + return TransferCheckResult.ofFail("cache.diff.hatch.null",index,cp(next)); return TransferCheckResult.ofFail("cache.diff.hatch",index,cp(next),cp(check)); } } diff --git a/src/main/java/reobf/proghatches/main/CommonProxy.java b/src/main/java/reobf/proghatches/main/CommonProxy.java index cc1852e..fe0df6b 100644 --- a/src/main/java/reobf/proghatches/main/CommonProxy.java +++ b/src/main/java/reobf/proghatches/main/CommonProxy.java @@ -1,9 +1,15 @@ package reobf.proghatches.main; +import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; + +import java.util.List; + import appeng.api.AEApi; +import appeng.block.AEBaseItemBlock; import appeng.core.AEConfig; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLInterModComms; @@ -11,14 +17,18 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.util.GT_ModHandler; import mcp.mobius.waila.api.IWailaRegistrar; import reobf.proghatches.Tags; +import reobf.proghatches.ae.BlockCraftingCondenser; import reobf.proghatches.ae.BlockCyclicPatternSubmitter; import reobf.proghatches.ae.BlockStorageProxy; import reobf.proghatches.ae.ItemPartAmountMaintainer; import reobf.proghatches.ae.ItemPartStorageProxy; import reobf.proghatches.ae.ItemPartSubnetExciter; +import reobf.proghatches.ae.TileCraftingCondenser; import reobf.proghatches.ae.TileCyclicPatternSubmitter; import reobf.proghatches.ae.TileStorageProxy; import reobf.proghatches.block.BlockAnchorAlert; @@ -189,8 +199,36 @@ public void preInit(FMLPreInitializationEvent event) { "proghatches.exciter"); + a(); + + + GameRegistry.registerTileEntity(TileCraftingCondenser.class, "proghatches.craftingdumper"); + } - + static public class ToolTipAEBaseItemBlock extends AEBaseItemBlock{ + public ToolTipAEBaseItemBlock(Block id) { + super(id); + bt=(BlockCraftingCondenser) id; + } BlockCraftingCondenser bt; + @SideOnly(Side.CLIENT) + @Override + public void addCheckedInformation(ItemStack itemStack, EntityPlayer player, List toolTip, + boolean advancedToolTips) { + //toolTip.add("proghatches.condenser.tooltip"); + bt.addTips(toolTip); + } + } + private static void a(){ + for(int i=0;i<=8;i++){ + + + MyMod.condensers[i] = GameRegistry.registerBlock(new BlockCraftingCondenser(i),ToolTipAEBaseItemBlock.class, "proghatches.craftingdumper."+ i); + } + + } + + + public static ProgHatchCreativeTab tab; public void init(FMLInitializationEvent event) { diff --git a/src/main/java/reobf/proghatches/main/MyMod.java b/src/main/java/reobf/proghatches/main/MyMod.java index a04dca9..c9f7667 100644 --- a/src/main/java/reobf/proghatches/main/MyMod.java +++ b/src/main/java/reobf/proghatches/main/MyMod.java @@ -52,6 +52,8 @@ import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.world.ChunkEvent; import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -70,6 +72,7 @@ import appeng.api.config.FuzzyMode; import appeng.api.config.Upgrades; import appeng.api.implementations.IUpgradeableHost; +import appeng.api.storage.data.IAEFluidStack; import appeng.client.gui.implementations.GuiPriority; import appeng.client.gui.widgets.ITooltip; import appeng.container.implementations.ContainerOptimizePatterns; @@ -93,6 +96,7 @@ import appeng.server.AECommand; import appeng.tile.inventory.AppEngInternalAEInventory; import appeng.tile.inventory.AppEngInternalInventory; +import appeng.util.item.AEFluidStack; import appeng.util.item.AEItemStack; import appeng.util.item.ItemList; import codechicken.multipart.MultipartGenerator; @@ -176,9 +180,21 @@ public class MyMod { final public static String MODID="programmablehatches"; final public static String MODNAME="ProgrammableHatches"; public static final Logger LOG = LogManager.getLogger(MODID); + + public static MyMod instance; { - GT_MetaTileEntity_Hatch_InputBus_ME.class.getDeclaredFields(); + if((Boolean)Launch.blackboard.get("fml.deobfuscatedEnvironment") ){ + + /*CraftingCPUCluster.class.getDeclaredFields(); + NBTTagCompound t=new NBTTagCompound(); + AEFluidStack.create(new FluidStack(FluidRegistry.WATER,123).writeToNBT(t)); + */ + + } + + + instance = this; } @@ -679,6 +695,8 @@ public void init(Entity entity, World world) { public static Item partproxy; public static Item exciter; + public static Block[] condensers=new Block[16]; + @SubscribeEvent(priority = EventPriority.HIGH, receiveCanceled = false) public void pretick(final TickEvent.ServerTickEvent event) { if (event.phase == Phase.START && event.side == Side.SERVER) { diff --git a/src/main/java/reobf/proghatches/main/mixin/MixinCallback.java b/src/main/java/reobf/proghatches/main/mixin/MixinCallback.java index ac78bd3..4a1fc41 100644 --- a/src/main/java/reobf/proghatches/main/mixin/MixinCallback.java +++ b/src/main/java/reobf/proghatches/main/mixin/MixinCallback.java @@ -11,10 +11,12 @@ import appeng.api.config.Actionable; import appeng.api.config.FuzzyMode; +import appeng.api.networking.crafting.ICraftingMedium; import appeng.api.networking.crafting.ICraftingPatternDetails; import appeng.api.networking.energy.IEnergyGrid; import appeng.api.networking.security.MachineSource; import appeng.api.storage.data.IAEItemStack; +import appeng.container.ContainerNull; import appeng.crafting.MECraftingInventory; import appeng.me.cache.CraftingGridCache; import appeng.tile.crafting.TileCraftingTile; @@ -22,6 +24,8 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap; +import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -213,6 +217,11 @@ public static void cb(final IEnergyGrid eg, final CraftingGridCache cc, Callback storage.clear(); needed.clear(); }catch(Exception e){MyMod.LOG.error("caught error in mixin",e);} -}} +} + + + + +} diff --git a/src/main/java/reobf/proghatches/main/mixin/MixinPlugin.java b/src/main/java/reobf/proghatches/main/mixin/MixinPlugin.java index 8a64f3f..1a1d1a9 100644 --- a/src/main/java/reobf/proghatches/main/mixin/MixinPlugin.java +++ b/src/main/java/reobf/proghatches/main/mixin/MixinPlugin.java @@ -203,6 +203,7 @@ public List getMixins() { retLate.add("part2.MixinMultiPattern"); //retLate.add("part2.MixinSplitDetect"); retLate.add("part2.MixinMEBusOverride"); + retLate.add("part2.MixinCraftingCondender"); if (FMLLaunchHandler.side().isClient()) { if (!"true".equals(pp.get("noAEItemSortMixins"))) if(ff)retLate.add("MixinAEItemStackCompare"); diff --git a/src/main/java/reobf/proghatches/main/mixin/mixins/part2/MixinCraftingCondender.java b/src/main/java/reobf/proghatches/main/mixin/mixins/part2/MixinCraftingCondender.java new file mode 100644 index 0000000..3c9c556 --- /dev/null +++ b/src/main/java/reobf/proghatches/main/mixin/mixins/part2/MixinCraftingCondender.java @@ -0,0 +1,90 @@ +package reobf.proghatches.main.mixin.mixins.part2; + +import java.util.Map; +import java.util.Set; + +import org.spongepowered.asm.lib.Opcodes; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyVariable; +import org.spongepowered.asm.mixin.injection.At.Shift; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; + +import appeng.api.networking.IGrid; +import appeng.api.networking.crafting.ICraftingMedium; +import appeng.api.networking.crafting.ICraftingPatternDetails; +import appeng.api.networking.energy.IEnergyGrid; +import appeng.me.cache.CraftingGridCache; +import appeng.me.cluster.implementations.CraftingCPUCluster; +import appeng.tile.crafting.TileCraftingTile; +import it.unimi.dsi.fastutil.objects.Reference2IntOpenCustomHashMap; +import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap; +import it.unimi.dsi.fastutil.objects.ReferenceArraySet; +import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; +import it.unimi.dsi.fastutil.objects.ReferenceSet; +import it.unimi.dsi.fastutil.objects.ReferenceSets; +import reobf.proghatches.ae.ICondenser; + +@Mixin(value = CraftingCPUCluster.class, remap = false) +public class MixinCraftingCondender { + /* + @Shadow + private int remainingOperations; + @Unique + boolean skip; + @Unique + Reference2IntOpenHashMap temp1=new Reference2IntOpenHashMap(); + + private long maxSkips; + @Inject(at = @At(value = "RETURN"), method = "updateCraftingLogic") + public void a(final IGrid grid, final IEnergyGrid eg, final CraftingGridCache cc, CallbackInfo it) { + if(getMaxSkips()<=0)return; + temp1.clear(); + + } + + @ModifyVariable(at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lappeng/me/cluster/implementations/CraftingCPUCluster;remainingOperations"), method = "executeCrafting") + + public ICraftingPatternDetails a(ICraftingPatternDetails m) { + if(getMaxSkips()<=0)return m; + int now= temp1 .getOrDefault(m, 0); + skip =getMaxSkips()>=now; + + if(now { +public abstract class MixinMultiPattern { @Unique boolean isMulti; @Unique @@ -54,8 +61,8 @@ public class MixinMultiPattern is=new LinkedList<>(); - for(int i=0;i is = new LinkedList<>(); + for (int i = 0; i < inv.getSizeInventory(); i++) { + if (inv.getStackInSlot(i) != null) { is.addLast(inv.getStackInSlot(i)); } } ListIterator itr = is.listIterator(); - while(itr.hasNext()){ - Object o=itr.next(); - if(o==null){itr.remove();} - if(((ItemStack)o).getItem() instanceof ItemFluidPacket){ - o=(ItemFluidDrop.newStack(ItemFluidPacket.getFluidStack((ItemStack) o))); + while (itr.hasNext()) { + Object o = itr.next(); + if (o == null) { + itr.remove(); + } + if (((ItemStack) o).getItem() instanceof ItemFluidPacket) { + o = (ItemFluidDrop.newStack(ItemFluidPacket.getFluidStack((ItemStack) o))); } itr.set(AEItemStack.create((ItemStack) o)); } - - + IAEItemStack[] input = is.toArray(EMPTY); - + int[] nums = new int[input.length]; for (int x = 0; x < input.length; x++) { IAEItemStack tmp = input[x].copy().setStackSize(Integer.MAX_VALUE); @@ -163,7 +172,7 @@ public void b(IEnergyGrid eg, CraftingGridCache cc, CallbackInfo ci) { if (maxtry <= 0) { return; } - used = medium.pushPatternMulti(detail, inv, maxtry); + used = ((IMultiplePatternPushable) medium).pushPatternMulti(detail, inv, maxtry); MixinCallback.setter.accept(e.getValue(), num - used); @@ -177,7 +186,7 @@ public void b(IEnergyGrid eg, CraftingGridCache cc, CallbackInfo ci) { } } finally { - //return all unused + // return all unused for (int x = 0; x < input.length; x++) { this.inventory.injectItems(input[x].copy().setStackSize( /* all availavle - pushed recipes*per recipe */ @@ -186,10 +195,78 @@ public void b(IEnergyGrid eg, CraftingGridCache cc, CallbackInfo ci) { } } + } else { + if(getMaxSkips()<=0)return; + //int now = temp1.getOrDefault(detail, 0); + final long max = getMaxSkips(); + for (int i = 0; i < max; i=(i getExtractItems(IAEItemStack ingredient, ICraftingPatternDetails patternDetails) { + return null; + }; + @Shadow int remainingOperations; @@ -199,7 +276,72 @@ public void ret(IEnergyGrid eg, CraftingGridCache cc, CallbackInfo ci) { e = null; inv = null; medium = null; + if (getMaxSkips() <= 0) + return; + temp1.clear(); + } + + ////////// xxxxxxxxxx + // @Shadow + // private int remainingOperations; + // @Unique + // boolean skip; + @Unique + Reference2IntOpenHashMap temp1 = new Reference2IntOpenHashMap(); + + private long maxSkips; + /* + * @Inject(at = @At(value = "RETURN"), method = "updateCraftingLogic") + * public void a(final IGrid grid, final IEnergyGrid eg, final + * CraftingGridCache cc, CallbackInfo it) { + * + * + * } + */ + + /* + * @ModifyVariable(at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, + * target = + * "Lappeng/me/cluster/implementations/CraftingCPUCluster;remainingOperations" + * ), method = "executeCrafting") + * + * public ICraftingPatternDetails a(ICraftingPatternDetails m) { + * if(getMaxSkips()<=0)return m; int now= temp1 .getOrDefault(m, 0); skip + * =getMaxSkips()>=now; + * + * if(nowMyMod.condensers[s]) + .map(s->new ItemStack(s)) + .map(StackInfo::getItemStackGUID + ).collect(Collectors.toSet()) + + ) + ; diff --git a/src/main/java/reobf/proghatches/main/registration/PHRecipes.java b/src/main/java/reobf/proghatches/main/registration/PHRecipes.java index 74b0080..cc49583 100644 --- a/src/main/java/reobf/proghatches/main/registration/PHRecipes.java +++ b/src/main/java/reobf/proghatches/main/registration/PHRecipes.java @@ -1317,7 +1317,7 @@ public void run() { .itemOutputs(new ItemStack( GregTech_API.sBlockMachines, 1, Config.metaTileEntityOffset+Registration.PatternMappingSlaveOffset)) - .duration(2000000 * SECONDS).eut(GT_Values.VP[1]).addTo(GT_RecipeConstants.AssemblyLine); + .duration(20000 * SECONDS).eut(GT_Values.VP[1]).addTo(GT_RecipeConstants.AssemblyLine); /*GT_Values.RA.stdBuilder() .metadata(RESEARCH_ITEM, new ItemStack(Items.apple)) diff --git a/src/main/resources/assets/proghatches/lang/en_US.lang b/src/main/resources/assets/proghatches/lang/en_US.lang index fa953a4..2f377d5 100644 --- a/src/main/resources/assets/proghatches/lang/en_US.lang +++ b/src/main/resources/assets/proghatches/lang/en_US.lang @@ -331,7 +331,7 @@ item.prog_toolkit.legacywarning.1=§4Warning!! Using this is deprecated, you sho item.prog_toolkit.legacywarning.2=Use Programming Circuit Pattern Fixing Tool to fix patterns. item.prog_toolkit.legacywarning.3=This slot is going to be removed in §4recent release. item.prog_circuit.legacy=LEGACY -programmable_hatches.gt.insertion=Option Insertion Window +programmable_hatches.gt.insertion=Open Insertion Window programmable_hatches.gt.insertion.tooltip.0=Put items here to insert them to input. programmable_hatches.gt.insertion.tooltip.1=In this way you might stack items up to %s, ignoring the stacksize limit. programmable_hatches.gt.insertion.tooltip.2=ME Interface is not limited by max stacksize as well. @@ -622,3 +622,18 @@ item.exciter.name.tooltip.2=That's to say, it will not work with: item.exciter.name.tooltip.3=ME Controller, Quartz Fiber, Energy Cell or Charger proghatch.ingbuf.noblocking.reason.1=Blocking Mode Off: ALL Frame Boxes must be Terbium Frame Boxes. proghatch.ingbuf.noblocking.reason.2=Blocking Mode Off: Non-ME Hatch is not allowed. +programmable_hatches.gt.forcecheck=Force update every tick. Harmful to server performance. Useless if hatch works fine. +programmable_hatches.gt.ensureintmax.0=Hide part of the slots from multiblock controller to avoid total amount exceeding IntMax. +programmable_hatches.gt.ensureintmax.1=Guarantee: controller can see at least IntMax/2 of the items. +programmable_hatches.gt.ensureintmax.2=You can trun it off if you are pretty sure that the same item won't occupy 2 or more slots +programmable_hatches.gt.ensureintmax.3=or the controller can handle amount>IntMax properly. +proghatches.craftingdumper.tooltip.0=When pattern pushed successfully, retry %s times without co-processes cost. +tile.proghatches.craftingdumper.0.name=Crafting Dumper +tile.proghatches.craftingdumper.1.name=4x Speed Crafting Dumper +tile.proghatches.craftingdumper.2.name=16x Speed Crafting Dumper +tile.proghatches.craftingdumper.3.name=64x Speed Crafting Dumper +tile.proghatches.craftingdumper.4.name=256x Speed Crafting Dumper +tile.proghatches.craftingdumper.5.name=1024x Speed Crafting Dumper +tile.proghatches.craftingdumper.6.name=4096x Speed Crafting Dumper +tile.proghatches.craftingdumper.7.name=16384x Speed Crafting Dumper +tile.proghatches.craftingdumper.8.name=Superluminal Crafting Dumper diff --git a/src/main/resources/assets/proghatches/lang/zh_CN.lang b/src/main/resources/assets/proghatches/lang/zh_CN.lang index e922edc..95b99b6 100644 --- a/src/main/resources/assets/proghatches/lang/zh_CN.lang +++ b/src/main/resources/assets/proghatches/lang/zh_CN.lang @@ -620,3 +620,18 @@ item.exciter.name.tooltip.2=即无法和以下部件一起工作: item.exciter.name.tooltip.3=ME控制器,石英纤维,能源元件,充能器 proghatch.ingbuf.noblocking.reason.1=阻挡模式关闭:全部框架必须是铽制 proghatch.ingbuf.noblocking.reason.2=阻挡模式关闭:含有非ME仓 +programmable_hatches.gt.forcecheck=强制每tick更新 对服务器性能不利 仓室运行正常时无效果 +programmable_hatches.gt.ensureintmax.0=必要时对主控隐藏部分槽位以免同类物品数量总和超IntMax(数量会溢出成负数导致无法检测配方) +programmable_hatches.gt.ensureintmax.1=保证至少IntMax/2的物品会被主控看到 +programmable_hatches.gt.ensureintmax.2=如果确定同类物品不会占两个槽 +programmable_hatches.gt.ensureintmax.3=或者主控能正确处理大于IntMax的物品,可以关掉这个选项 +proghatches.craftingdumper.tooltip.0=样板成功发配后,重新尝试至多%s次,不消耗并行 +tile.proghatches.craftingdumper.0.name=合成转储器 +tile.proghatches.craftingdumper.1.name=4倍速合成转储器 +tile.proghatches.craftingdumper.2.name=16倍速合成转储器 +tile.proghatches.craftingdumper.3.name=64倍速合成转储器 +tile.proghatches.craftingdumper.4.name=256倍速合成转储器 +tile.proghatches.craftingdumper.5.name=1024倍速合成转储器 +tile.proghatches.craftingdumper.6.name=4096倍速合成转储器 +tile.proghatches.craftingdumper.7.name=16384倍速合成转储器 +tile.proghatches.craftingdumper.8.name=超光速合成转储器