diff --git a/src/main/java/reobf/proghatches/block/BlockIOHub.java b/src/main/java/reobf/proghatches/block/BlockIOHub.java index b3cdf12..95529fc 100644 --- a/src/main/java/reobf/proghatches/block/BlockIOHub.java +++ b/src/main/java/reobf/proghatches/block/BlockIOHub.java @@ -52,6 +52,11 @@ public void registerBlockIcons(IIconRegister reg) { provider_in_overlay = reg.registerIcon("proghatches:provider_in"); provider_in_active_overlay = reg.registerIcon("proghatches:provider_in_active"); inv_me_slave = reg.registerIcon("proghatches:inv_me_slave"); + + overlay_dual = reg.registerIcon("proghatches:overlay_dual"); + overlay_dual_active = reg.registerIcon("proghatches:overlay_dual_active"); + + super.registerBlockIcons(reg); } @@ -104,12 +109,14 @@ public boolean onBlockActivated(World worldIn, int x, int y, int z, EntityPlayer public static IIcon provider_active_overlay; public static IIcon provider_in_overlay; public static IIcon provider_in_active_overlay; + public static IIcon overlay_dual,overlay_dual_active; static public int magicNO_provider_overlay = 0x7e; static public int magicNO_provider_active_overlay = 0x7d; static public int magicNO_provider_in_overlay = 0x7c; static public int magicNO_provider_in_active_overlay = 0x7b; static public int magicNO_inv_me_slave = 0x7a; - + static public int magicNO_overlay_dual = 0x79; + static public int magicNO_overlay_dual_active= 0x78; @SideOnly(value = Side.CLIENT) @Override public IIcon getIcon(int side, int meta) { @@ -120,6 +127,9 @@ public IIcon getIcon(int side, int meta) { if(meta==0x7c)return provider_in_overlay; if(meta==0x7b)return provider_in_active_overlay; if(meta==0x7a)return inv_me_slave; + + if(meta==magicNO_overlay_dual)return overlay_dual; + if(meta==magicNO_overlay_dual_active)return overlay_dual_active; //spotless:on return super.getIcon(side, meta); } diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/BufferedDualInputHatch.java b/src/main/java/reobf/proghatches/gt/metatileentity/BufferedDualInputHatch.java index 955eddc..e4f1ae5 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/BufferedDualInputHatch.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/BufferedDualInputHatch.java @@ -7,6 +7,7 @@ import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.reflect.Method; +import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Deque; @@ -99,6 +100,9 @@ import gregtech.api.util.GTTooltipDataCache.TooltipData; import gregtech.api.util.GTUtility; import gregtech.common.tileentities.machines.IDualInputInventory; +import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectSortedMaps; import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; import reobf.proghatches.gt.metatileentity.BufferedDualInputHatch.Recipe; @@ -253,6 +257,21 @@ public class DualInvBuffer implements INeoDualInputInventory { * } */ public long tickFirstClassify = -1; + + protected Int2ObjectMap> mExItem=new Int2ObjectArrayMap<>(); + protected Int2ObjectMap> mExFluid=new Int2ObjectArrayMap<>(); + protected ArrayList getExItem(int index){ + if(mExItem.containsKey(index)){ + mExItem.put(index, new ArrayList<>()); + } + return mExItem.get(index); + } + protected ArrayList getExFluid(int index){ + if(mExFluid.containsKey(index)){ + mExFluid.put(index, new ArrayList<>()); + } + return mExFluid.get(index); + } protected FluidTank[] mStoredFluidInternal; protected ItemStack[] mStoredItemInternal; protected FluidTank[] mStoredFluidInternalSingle; @@ -268,8 +287,7 @@ public class DualInvBuffer implements INeoDualInputInventory { // public boolean lock; public boolean full() { - - for (int index = 0; index < mStoredItemInternalSingle.length; index++) { + for (int index = 0; index < mStoredItemInternalSingle.length; index++) { ItemStack i = mStoredItemInternal[index]; ItemStack si = mStoredItemInternalSingle[index]; if (i != null) { diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/StockingDualInputHatchME.java b/src/main/java/reobf/proghatches/gt/metatileentity/StockingDualInputHatchME.java index c850ee3..8af0596 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/StockingDualInputHatchME.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/StockingDualInputHatchME.java @@ -1,6 +1,8 @@ package reobf.proghatches.gt.metatileentity; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_ME_INPUT_HATCH_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_ME_CRAFTING_INPUT_BUFFER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_ME_CRAFTING_INPUT_BUS; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_ME_INPUT_FLUID_HATCH_ACTIVE; import static kubatech.api.Variables.numberFormat; import static kubatech.api.Variables.numberFormatScientific; @@ -57,11 +59,13 @@ import appeng.api.config.FuzzyMode; import appeng.api.implementations.IPowerChannelState; import appeng.api.networking.GridFlags; +import appeng.api.networking.IGridNode; import appeng.api.networking.security.IActionHost; import appeng.api.networking.security.MachineSource; import appeng.api.storage.IMEMonitor; import appeng.api.storage.data.IAEFluidStack; import appeng.api.storage.data.IAEItemStack; +import appeng.api.util.DimensionalCoord; import appeng.me.GridAccessException; import appeng.me.helpers.AENetworkProxy; import appeng.me.helpers.IGridProxyable; @@ -84,6 +88,7 @@ import gregtech.api.recipe.check.CheckRecipeResult; import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.recipe.check.SimpleCheckRecipeResult; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GTOreDictUnificator; import gregtech.api.util.GTUtility; import gregtech.api.util.shutdown.ShutDownReason; @@ -99,6 +104,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; @@ -109,7 +115,7 @@ import reobf.proghatches.main.registration.Registration; public class StockingDualInputHatchME extends MTEHatchInputBus - implements IDualInputHatch, IRecipeProcessingAwareDualHatch, IPowerChannelState + implements IDualInputHatch, IRecipeProcessingAwareDualHatch, IPowerChannelState,IGridProxyable { @@ -611,7 +617,20 @@ public void program(){ if(ext!=null&&ext.getStackSize()>0){ ItemStack item = ext.getItemStack(); item.stackSize=0; - this.setInventorySlotContents(getCircuitSlot(),ItemProgrammingCircuit.getCircuit(item).orElse(null)); + + ItemStack circuit = ItemProgrammingCircuit.getCircuit(item).orElse(null); + this.setInventorySlotContents(getCircuitSlot(),circuit); + + this.getProxy().getNode().getGrid().getMachines(this.getClass()).forEach(m->{ + StockingDualInputHatchME thiz=(StockingDualInputHatchME) m.getMachine(); + if(thiz.program){ + thiz.setInventorySlotContents(thiz.getCircuitSlot(),circuit); + + } + + + + });; } } @@ -860,7 +879,7 @@ public AENetworkProxy getProxy() { if (gridProxy == null) { if (getBaseMetaTileEntity() instanceof IGridProxyable) { - gridProxy = new AENetworkProxy((IGridProxyable) getBaseMetaTileEntity(), "proxy", + gridProxy = new AENetworkProxy(this, "proxy", new ItemStack(GregTechAPI.sBlockMachines, 1, getBaseMetaTileEntity().getMetaTileID()), true); gridProxy.setFlags(GridFlags.REQUIRE_CHANNEL); updateValidGridProxySides(); @@ -896,7 +915,7 @@ protected void updateValidGridProxySides() { } @Override - public void saveNBTData(NBTTagCompound aNBT) {allowAuto=aNBT.getBoolean("allowAuto"); + public void saveNBTData(NBTTagCompound aNBT) {aNBT.setBoolean("allowAuto",allowAuto); getProxy().writeToNBT(aNBT); super.saveNBTData(aNBT); NBTTagList nbtTagList = new NBTTagList(); @@ -941,7 +960,7 @@ protected void updateValidGridProxySides() { } @Override - public void loadNBTData(NBTTagCompound aNBT) {aNBT.setBoolean("allowAuto", allowAuto); + public void loadNBTData(NBTTagCompound aNBT) {allowAuto=aNBT.getBoolean("allowAuto" ); getProxy().readFromNBT(aNBT); super.loadNBTData(aNBT); if (aNBT.hasKey("storedFluids")) { @@ -1003,5 +1022,35 @@ protected void updateValidGridProxySides() { } public IItemHandlerModifiable inventoryHandlerMark = new ItemStackHandler(i_mark);; - public IItemHandlerModifiable inventoryHandlerDisplay = new ItemStackHandler(i_display);; + public IItemHandlerModifiable inventoryHandlerDisplay = new ItemStackHandler(i_display); + + @Override + public IGridNode getGridNode(ForgeDirection dir) { + + return getProxy().getNode(); + } + + @Override + public void securityBreak() { + + + } + + @Override + public DimensionalCoord getLocation() { + + return new DimensionalCoord((TileEntity)this.getBaseMetaTileEntity()); + }; + @Override + public ITexture[] getTexturesActive(ITexture aBaseTexture) { + return new ITexture[] { aBaseTexture, + TextureFactory.of(MyMod.iohub ,MyMod.iohub.magicNO_overlay_dual_active) }; + } + + @Override + public ITexture[] getTexturesInactive(ITexture aBaseTexture) { + return new ITexture[] { aBaseTexture, + TextureFactory.of( MyMod.iohub,MyMod.iohub.magicNO_overlay_dual) }; + } + } 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 d25dba2..2618026 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/multi/LargeProgrammingCircuitProvider.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/multi/LargeProgrammingCircuitProvider.java @@ -441,6 +441,9 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a // if(succ){forceUpdatePattern=true ;} multiply = Math.min(multiply, totalAcc + 1); multiply = Math.max(multiply, 1); + + if(mEnergyHatches.size()==0)return false; + return succ; } diff --git a/src/main/java/reobf/proghatches/main/CommonProxy.java b/src/main/java/reobf/proghatches/main/CommonProxy.java index 0aed7a6..a70b463 100644 --- a/src/main/java/reobf/proghatches/main/CommonProxy.java +++ b/src/main/java/reobf/proghatches/main/CommonProxy.java @@ -181,7 +181,7 @@ public void preInit(FMLPreInitializationEvent event) { "proghatches.proxy", new Object[] { "tile.proghatches.proxy.tooltip" }); - MyMod.iohub = GameRegistry.registerBlock(new BlockIOHub(), ItemBlockIOHub.class, "proghatches.iohub"); + MyMod.iohub = (BlockIOHub) GameRegistry.registerBlock(new BlockIOHub(), ItemBlockIOHub.class, "proghatches.iohub"); MyMod.alert = GameRegistry.registerBlock( new BlockAnchorAlert(Material.rock), ItemBlockAnchorAlert.class, diff --git a/src/main/java/reobf/proghatches/main/MyMod.java b/src/main/java/reobf/proghatches/main/MyMod.java index 4b30f8c..f2c1c30 100644 --- a/src/main/java/reobf/proghatches/main/MyMod.java +++ b/src/main/java/reobf/proghatches/main/MyMod.java @@ -84,6 +84,7 @@ import reobf.proghatches.ae.BlockMolecularAssemblerInterface; import reobf.proghatches.ae.BlockOrbSwitcher; import reobf.proghatches.ae.BlockRequestTunnel; +import reobf.proghatches.block.BlockIOHub; import reobf.proghatches.block.ChunkTrackingGridCahce; import reobf.proghatches.block.TileIOHub; import reobf.proghatches.eio.ICraftingMachineConduit; @@ -218,7 +219,7 @@ public int getItemStackLimit() { public static Item cover; public static Item oc_redstone; public static Item oc_api; - public static Block iohub; + public static BlockIOHub iohub; public static Block pstation; public static Item pitem; @Nullable diff --git a/src/main/java/reobf/proghatches/main/registration/PHRecipes.java b/src/main/java/reobf/proghatches/main/registration/PHRecipes.java index 7a40732..722fa46 100644 --- a/src/main/java/reobf/proghatches/main/registration/PHRecipes.java +++ b/src/main/java/reobf/proghatches/main/registration/PHRecipes.java @@ -2068,6 +2068,38 @@ public void run() { .duration(1 * SECONDS) .eut(30) .addTo(RecipeMaps.assemblerRecipes); + + + + GTValues.RA.stdBuilder() + .itemInputs( + ItemList.Hatch_Input_Bus_ME.get(1), + ItemList.Hatch_Input_ME.get(1), + new ItemStack(MyMod.toolkit,0,OreDictionary.WILDCARD_VALUE) + ) + .itemOutputs( new ItemStack( + GregTechAPI.sBlockMachines, + 1, + Config.metaTileEntityOffset + Registration.StockingDualInputOffset)) + .duration(1 * SECONDS) + .eut(30) + .addTo(RecipeMaps.assemblerRecipes); + + GTValues.RA.stdBuilder() + .itemInputs( + ItemList.Hatch_Input_Bus_ME_Advanced.get(1), + ItemList.Hatch_Input_ME_Advanced.get(1), + new ItemStack(MyMod.toolkit,0,OreDictionary.WILDCARD_VALUE) + ) + .itemOutputs( new ItemStack( + GregTechAPI.sBlockMachines, + 1, + Config.metaTileEntityOffset + Registration.StockingDualInputOffset+1)) + .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/util/A.java b/src/main/java/reobf/proghatches/util/A.java new file mode 100644 index 0000000..c8c835b --- /dev/null +++ b/src/main/java/reobf/proghatches/util/A.java @@ -0,0 +1,10 @@ +package reobf.proghatches.util; + +public class A { +public static void main(String[] args){ + + System.out.println(Integer.MAX_VALUE+Integer.MAX_VALUE); + + +} +} diff --git a/src/main/resources/assets/proghatches/lang/en_US/SDIHME.lang b/src/main/resources/assets/proghatches/lang/en_US/SDIHME.lang index 1e26234..58135f1 100644 --- a/src/main/resources/assets/proghatches/lang/en_US/SDIHME.lang +++ b/src/main/resources/assets/proghatches/lang/en_US/SDIHME.lang @@ -1 +1,3 @@ -Just as its name implies... \ No newline at end of file +Just as its name implies... +You'd better not install more than one of this on the same Multiblock. +Or it might void your ingredients, use at your own risk! \ No newline at end of file diff --git a/src/main/resources/assets/proghatches/lang/zh_CN/SDIHME.lang b/src/main/resources/assets/proghatches/lang/zh_CN/SDIHME.lang index 9e34b2a..f114b9b 100644 --- a/src/main/resources/assets/proghatches/lang/zh_CN/SDIHME.lang +++ b/src/main/resources/assets/proghatches/lang/zh_CN/SDIHME.lang @@ -1 +1,3 @@ -你懂的 \ No newline at end of file +顾名思义 +最好不要在一个机器上装多个这玩意儿 +否则可能会吞材料,后果自负! \ No newline at end of file diff --git a/src/main/resources/assets/proghatches/textures/blocks/overlay_dual.png b/src/main/resources/assets/proghatches/textures/blocks/overlay_dual.png new file mode 100644 index 0000000..a878570 Binary files /dev/null and b/src/main/resources/assets/proghatches/textures/blocks/overlay_dual.png differ diff --git a/src/main/resources/assets/proghatches/textures/blocks/overlay_dual_active.png b/src/main/resources/assets/proghatches/textures/blocks/overlay_dual_active.png new file mode 100644 index 0000000..357d1ab Binary files /dev/null and b/src/main/resources/assets/proghatches/textures/blocks/overlay_dual_active.png differ