diff --git a/src/main/java/reobf/proghatches/ae/TileOrbSwitcher.java b/src/main/java/reobf/proghatches/ae/TileOrbSwitcher.java index 54075ca..a9d862a 100644 --- a/src/main/java/reobf/proghatches/ae/TileOrbSwitcher.java +++ b/src/main/java/reobf/proghatches/ae/TileOrbSwitcher.java @@ -5,10 +5,13 @@ import com.google.common.base.Objects; import com.gtnewhorizons.modularui.api.ModularUITextures; import com.gtnewhorizons.modularui.api.drawable.IDrawable; +import com.gtnewhorizons.modularui.api.math.Alignment; +import com.gtnewhorizons.modularui.api.math.Color; import com.gtnewhorizons.modularui.api.screen.ITileWithModularUI; import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import com.gtnewhorizons.modularui.common.widget.CycleButtonWidget; +import com.gtnewhorizons.modularui.common.widget.textfield.NumericWidget; import appeng.api.config.Actionable; import appeng.api.config.FuzzyMode; @@ -75,6 +78,7 @@ public void validate() { boolean meta; boolean circuit=true; boolean index; +private int amount=1; public void pretick(){ @@ -104,7 +108,7 @@ public void pretick(){ select=mte.getStackInSlot(((IConfigurationCircuitSupport) mte).getCircuitSlot()); if(select!=null){select=select.copy(); - select.stackSize=1;} + select.stackSize=amount;} } } }else{ @@ -113,7 +117,7 @@ public void pretick(){ for(int i=0;i0){ select=inv.getStackInSlot(i).copy(); - select.stackSize=1; + select.stackSize=amount; } @@ -222,6 +226,8 @@ public void writeToNBT(NBTTagCompound compound) { compound.setByte("facing", (byte) facing.ordinal()); compound.setBoolean("nbt",nbt); compound.setBoolean("meta",meta); + compound.setByte("amount", (byte) amount); + super.writeToNBT(compound); } @@ -235,6 +241,8 @@ public void readFromNBT(NBTTagCompound compound) { facing=ForgeDirection.VALID_DIRECTIONS[compound.getByte("facing")]; nbt=compound.getBoolean("nbt"); meta=compound.getBoolean("meta"); + amount=compound.getByte("amount"); + if(amount<0)amount=1; super.readFromNBT(compound); } @@ -403,7 +411,9 @@ public ModularWindow createWindow(UIBuildContext buildContext) { builder.bindPlayerInventory(buildContext.getPlayer()); } - + builder.widget(new NumericWidget().setSetter(val -> amount = (int) val).setGetter(() -> amount).setBounds(1, Integer.MAX_VALUE-1).setScrollValues(1, 4, 64).setTextAlignment(Alignment.Center).setTextColor(Color.WHITE.normal).setSize(70, 18).setPos(43, 3).setBackground(GTUITextures.BACKGROUND_TEXT_FIELD) + .addTooltip(StatCollector.translateToLocal("proghatches.orb_switcher.amount")) + ); builder.widget( new CycleButtonWidget().setToggle(() -> nbt, s -> nbt = s) .setTextureGetter(s -> { diff --git a/src/main/java/reobf/proghatches/ae/part2/RequestTunnel.java b/src/main/java/reobf/proghatches/ae/part2/RequestTunnel.java index 6e3dcd5..b2b8722 100644 --- a/src/main/java/reobf/proghatches/ae/part2/RequestTunnel.java +++ b/src/main/java/reobf/proghatches/ae/part2/RequestTunnel.java @@ -21,6 +21,7 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; +import reobf.proghatches.ae.PatternCraftingJob; import com.glodblock.github.common.item.ItemFluidDrop; import com.glodblock.github.common.item.ItemFluidPacket; @@ -61,6 +62,14 @@ public RequestTunnel() { @Override public boolean pushPattern(ICraftingPatternDetails patternDetails, InventoryCrafting table, ForgeDirection ejectionDirection) { + + try { + PatternCraftingJob job = new PatternCraftingJob(patternDetails, getProxy().getStorage()); + getProxy().getCrafting().getCraftingPatterns(); + } catch (GridAccessException e) { + } + + for (int i = 0; i < table.getSizeInventory(); i++) { ItemStack is = table.getStackInSlot(i); if (is != null) { @@ -233,7 +242,7 @@ public boolean acceptsPlans() { public ImmutableSet getRequestedJobs() { return last == null ? ImmutableSet.of() : ImmutableSet.of(last); } - +boolean returnAll=true; @Override public IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack items, Actionable mode) { if (mode == Actionable.SIMULATE) { @@ -274,12 +283,16 @@ public IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack items, A } else { if ((this.mode & 1) != 0) { - + if(!returnAll) return items;// not waiting, just return items as unwanted } } - + if(returnAll){ + long size=left.getStackSize(); + left.decStackSize(size); + items.incStackSize(size); + } if (items.getItem() instanceof ItemFluidDrop) { cacheFR.add( ItemFluidDrop.getAeFluidStack(items) @@ -288,7 +301,7 @@ public IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack items, A cacheR.add(items.getItemStack()); } - + if(left.getStackSize()==0)left=null; return left; } diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/BufferedDualInputHatch.java b/src/main/java/reobf/proghatches/gt/metatileentity/BufferedDualInputHatch.java index 2655df2..b47ec2a 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/BufferedDualInputHatch.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/BufferedDualInputHatch.java @@ -1760,8 +1760,8 @@ private IDualInputInventory wrap(DualInvBuffer to) { return to; } - - final int mask = new Random().nextInt(); + static Random ran=new Random(); + final int mask = ran.nextInt(); public static class Recipe { @@ -1826,7 +1826,7 @@ public NBTTagCompound ser() { } tag.setInteger("ff", f.length); for (int ii = 0; ii < i.length; ii++) { - if (i[ii] != null) tag.setTag("i" + i, writeToNBT(i[ii], new NBTTagCompound())); + if (i[ii] != null) tag.setTag("i" + ii, writeToNBT(i[ii], new NBTTagCompound())); } tag.setInteger("ii", i.length); return tag; diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/PhantomInputBus.java b/src/main/java/reobf/proghatches/gt/metatileentity/PhantomInputBus.java new file mode 100644 index 0000000..046cce2 --- /dev/null +++ b/src/main/java/reobf/proghatches/gt/metatileentity/PhantomInputBus.java @@ -0,0 +1,293 @@ +package reobf.proghatches.gt.metatileentity; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.joml.Vector3i; +import org.joml.Vector4i; + +import com.google.common.collect.ImmutableMap; +import com.gtnewhorizons.modularui.api.drawable.shapes.Rectangle; +import com.gtnewhorizons.modularui.api.math.Color; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.api.screen.ModularWindow.Builder; +import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot; +import com.gtnewhorizons.modularui.common.widget.ScrollBar; +import com.gtnewhorizons.modularui.common.widget.Scrollable; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; +import com.rwtema.extrautils.worldgen.Underdark.WorldGenCastle.Vec2; + +import gregtech.api.GregTechAPI; +import gregtech.api.enums.ItemList; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.MTEHatchInputBus; +import gregtech.api.util.GTTooltipDataCache.TooltipData; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.MTEHatchSuperBusInput; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagIntArray; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.world.World; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.util.ForgeDirection; +import reobf.proghatches.lang.LangManager; +import reobf.proghatches.main.Config; +import reobf.proghatches.main.registration.Registration; + +public class PhantomInputBus extends MTEHatchInputBus{ + + public PhantomInputBus(int id, String name, String nameRegional, int tier) { + super(id, name, nameRegional, tier, 64, Config.get("PIB", ImmutableMap.of())); + Registration.items.add(new ItemStack(GregTechAPI.sBlockMachines, 1, id + + + + )); + + } + public PhantomInputBus(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 64, aDescription, aTextures); + } +@Override +public void updateSlots() { + + +} + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + // TODO Auto-generated method stub + super.onPostTick(aBaseMetaTileEntity, aTimer); + } + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new PhantomInputBus(this.mName, this.mTier, mDescriptionArray, this.mTextures); + } + + + @Override + public void addUIWidgets(Builder builder, UIBuildContext buildContext) { + final Scrollable scrollable = (Scrollable) new Scrollable().setVerticalScroll().setSize(6, 40); + for (int row = 0; row * 4 < inventoryHandler.getSlots() - 1; row++) { + int columnsToMake = Math.min(inventoryHandler.getSlots() - row * 4, 4); + for (int column = 0; column < columnsToMake; column++) { + scrollable.widget( + + + /*new SlotWidget(inventoryHandler, row * 4 + column).setPos(column * 18, row * 18) + .setSize(18, 18)*/ + + new SlotWidget(new BaseSlot(inventoryHandler, row * 4 + column) { + + public int getSlotStackLimit() { + return 0; + }; + + } + + ) { + + @Override + public List getExtraTooltip() { + return Arrays + .asList(LangManager.translateToLocal("programmable_hatches.gt.marking.slot.1")); + } + }.disableShiftInsert() + .setHandlePhantomActionClient(true) + .setGTTooltip( + () -> new TooltipData( + Arrays.asList( + LangManager.translateToLocal("programmable_hatches.gt.marking.slot.0"), + LangManager.translateToLocal("programmable_hatches.gt.marking.slot.1")), + Arrays.asList( + LangManager.translateToLocal("programmable_hatches.gt.marking.slot.0"), + LangManager.translateToLocal("programmable_hatches.gt.marking.slot.1")))) + .setSize(18, 18).setPos(column * 18, row * 18) + + + + ); + } + } + builder.widget( + scrollable.setSize(18 * 4 + 4, 18 * 4) + .setPos(52, 7)); + } +@Override +public boolean canInsertItem(int index, ItemStack itemStack, int ordinalSide) { + + return false; +} +@Override +public boolean canExtractItem(int index, ItemStack itemStack, int ordinalSide) { + + return false; +} + +@Override +public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { + + return false; +} +@Override +public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { + + return false; +} +@Override +public boolean allowSelectCircuit() { + // TODO Auto-generated method stub + return false; +} +@Override +public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (!(aPlayer instanceof EntityPlayerMP)) return; + + ItemStack dataStick = aPlayer.inventory.getCurrentItem(); + if (!ItemList.Tool_DataStick.isStackEqual(dataStick, false, true)) return; + + if(dataStick.hasTagCompound()==false){ + dataStick.setTagCompound(new NBTTagCompound()); + dataStick.getTagCompound().setString("type", "PhantomInput"); + dataStick.setStackDisplayName( + "Phantom Input Bus Link"); + } + if(dataStick.getTagCompound().hasKey("phantom_pos")==false){ + dataStick.getTagCompound().setTag("phantom_pos",new NBTTagIntArray(new int[0])); + }; + + /*if(dataStick.getTagCompound().hasKey("dim")==false){ + dataStick.getTagCompound().setInteger("dim", aPlayer.getEntityWorld().provider.dimensionId);} + if(dataStick.getTagCompound().getInteger("dim")!=aPlayer.getEntityWorld().provider.dimensionId){ + aPlayer.addChatMessage(new ChatComponentText("Cannot link")); + return; + }*/ + + NBTTagIntArray tag = (NBTTagIntArray) dataStick.getTagCompound().getTag("phantom_pos"); + + + List a=p(tag);Vector4i v; + if(a.size()>=1024){ + aPlayer.addChatMessage(new ChatComponentTranslation("proghatch.phantombus.chat.link.exceed")); + }else + + if(!a.contains(v=new Vector4i( + this.getBaseMetaTileEntity().getXCoord(),this.getBaseMetaTileEntity().getYCoord(),this.getBaseMetaTileEntity().getZCoord() + , + this.getBaseMetaTileEntity().getWorld().provider.dimensionId + ))){ + a.add(v);aPlayer.addChatMessage(new ChatComponentTranslation("proghatch.phantombus.chat.link.success",a.size())); + + }else{ + aPlayer.addChatMessage(new ChatComponentTranslation("proghatch.phantombus.chat.link.noop",a.size())); + + } + dataStick.getTagCompound().setTag("phantom_pos",p(a)); + } + +@Override +public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + + ds:{ + if (!(aPlayer instanceof EntityPlayerMP)) break ds; + + ItemStack dataStick = aPlayer.inventory.getCurrentItem(); + if (!ItemList.Tool_DataStick.isStackEqual(dataStick, false, true)) break ds; + if(dataStick.hasTagCompound()==false){ + break ds; + } + if(dataStick.getTagCompound().hasKey("phantom_pos")==false){ + break ds; + }; + if(dataStick.getTagCompound().getString("type").equals("PhantomInput")==false){ + break ds; + }; + if(aPlayer.getEntityWorld().isRemote)return true; + NBTTagIntArray tag = (NBTTagIntArray) dataStick.getTagCompound().getTag("phantom_pos"); + List a = p(tag); + int[] count=new int[1]; + a.removeIf((aw)->{ + World w=DimensionManager.getWorld(aw.w); + if(w==null){ + aPlayer.addChatMessage(new ChatComponentTranslation("proghatch.phantombus.chat.world.missing",aw.w)); + return false;} + if(w.blockExists(aw.x, aw.y, aw.z)==false){ + aPlayer.addChatMessage(new ChatComponentTranslation("proghatch.phantombus.chat.chunk.missing",aw.w,aw.x,aw.y,aw.z)); + return false;}; + + + TileEntity te = w.getTileEntity(aw.x, aw.y, aw.z); + if(te==null){ + aPlayer.addChatMessage(new ChatComponentTranslation("proghatch.phantombus.chat.te.missing",aw.w,aw.x,aw.y,aw.z)); + + return true; + } + if(!(te instanceof IGregTechTileEntity)){ + aPlayer.addChatMessage(new ChatComponentTranslation("proghatch.phantombus.chat.te.incorrect",aw.w,aw.x,aw.y,aw.z)); + return true; + } + + if(!(((IGregTechTileEntity)te ).getMetaTileEntity()instanceof PhantomInputBus)){ + aPlayer.addChatMessage(new ChatComponentTranslation("proghatch.phantombus.chat.te.incorrect",aw.w,aw.x,aw.y,aw.z)); + return true; + } + PhantomInputBus buz=((PhantomInputBus)(((IGregTechTileEntity)te ).getMetaTileEntity() )); + if(buz!=this){ + for(int i=0;i c){ + int[] l=new int[c.size()*4]; +for(int i=0;i p(NBTTagIntArray tag ){ + int[] arr=tag.func_150302_c(); + List l=new ArrayList(arr.length/4); + for(int i=0;i fluidStacks[slotIndex], (stack) -> { + + class IndexFluidStackTank extends FluidStackTank implements Supplier{ + + public IndexFluidStackTank(Supplier getter, Consumer setter, int capacity) { + super(getter, setter, capacity); + + } + + @Override + public Integer get() { + + return slotIndex; + }} + + + return new IndexFluidStackTank(() -> fluidStacks[slotIndex], (stack) -> { if (getBaseMetaTileEntity().isServerSide()) { return; } fluidStacks[slotIndex] = stack; }, capacity); + + + + } @Override @@ -301,7 +346,119 @@ public void addUIWidgets(Builder builder, UIBuildContext buildContext) { .setPos(getGUIWidth() - 4, 56)) .addPage(new MultiChildWidget().addChild(SlotGroup.ofItemHandler(inventoryHandlerDisplay, 4) .startFromSlot(0).endAtSlot(15).phantom(true).background(GTUITextures.SLOT_DARK_GRAY) - .widgetCreator(slot -> aeSlotWidgets[slot.getSlotIndex()] = new AESlotWidget(slot) + .widgetCreator(slot -> aeSlotWidgets[slot.getSlotIndex()] = new AESlotWidget(slot){ + @Override + public List getExtraTooltip() { + List extraLines = new ArrayList<>(); + if (i_client[slot.getSlotIndex()] >= 1000) { + extraLines.add(I18n.format("modularui.amount",i_client[slot.getSlotIndex()])); + } + if (isPhantom()) { + if (canControlAmount()) { + String[] lines = I18n.format("modularui.item.phantom.control").split("\\\\n"); + extraLines.addAll(Arrays.asList(lines)); + } else if (!interactionDisabled) { + extraLines.add(I18n.format("modularui.phantom.single.clear")); + } + } + return extraLines.isEmpty() ? Collections.emptyList() : extraLines; + } + @SideOnly(Side.CLIENT) + private RenderItem setItemRender(final RenderItem item) { + final RenderItem ri = ModularGui.getItemRenderer(); + ModularGui.setItemRenderer(item); + return ri; + } + @Override + @SideOnly(Side.CLIENT) + protected void drawSlot(Slot slotIn) { + final AppEngRenderItem aeRenderItem = new AppEngRenderItem(); + AppEngRenderItem.POST_HOOKS.add(HookHolder.SKIP_ITEM_STACK_SIZE_HOOK); + final RenderItem pIR = this.setItemRender(aeRenderItem); + try { + aeRenderItem.setAeStack(Platform.getAEStackInSlot(slotIn).setStackSize(i_client[slotIn.getSlotIndex()])); + drawSlot(slotIn, true); + } catch (final Exception err) { + AELog.warn("[AppEng] AE prevented crash while drawing slot: " + err); + } + AppEngRenderItem.POST_HOOKS.remove(HookHolder.SKIP_ITEM_STACK_SIZE_HOOK); + this.setItemRender(pIR); + } + + + + @SideOnly(Side.CLIENT) + private final TextRenderer textRenderer = new TextRenderer(); + @SideOnly(Side.CLIENT) + public void drawSlot(Slot slotIn, boolean drawStackSize){ + super.drawSlot(slotIn,false); + + if(drawStackSize){ + + + ItemStack itemstack = getItemStackForRendering(slotIn); + if (itemstack != null) { + + + getContext().getScreen().setZ(100f); + ModularGui.getItemRenderer().zLevel = 100.0F; + GlStateManager.enableRescaleNormal(); + GlStateManager.enableLighting(); + RenderHelper.enableGUIStandardItemLighting(); + GlStateManager.enableDepth(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GlStateManager.pushMatrix(); + // so that item z levels are properly ordered + GlStateManager.translate(0, 0, 150 * getWindowLayer()); + + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GlStateManager.popMatrix(); + long amount=i_client[slotIn.getSlotIndex()]; + if (drawStackSize) { + if (amount < 0) { + amount = itemstack.stackSize; + } + String format=null; + // render the amount overlay + if (amount > 1 || format != null) { + String amountText = numberFormat + .formatWithSuffix(amount, new StringBuffer(format == null ? "" : format)).toString(); + float scale = 1f; + if (amountText.length() == 3) { + scale = 0.8f; + } else if (amountText.length() == 4) { + scale = 0.6f; + } else if (amountText.length() > 4) { + scale = 0.5f; + } + textRenderer.setShadow(true); + textRenderer.setScale(scale); + textRenderer.setColor(Color.WHITE.normal); + textRenderer.setAlignment(Alignment.BottomRight, size.width - 1, size.height - 1); + textRenderer.setPos(1, 1); + GlStateManager.disableLighting(); + GlStateManager.disableDepth(); + GlStateManager.disableBlend(); + textRenderer.draw(amountText); + GlStateManager.enableLighting(); + GlStateManager.enableDepth(); + GlStateManager.enableBlend(); + } + } + + + GlStateManager.disableDepth(); + GL11.glDisable(GL11.GL_BLEND); + ModularGui.getItemRenderer().zLevel = 0.0F; + getContext().getScreen().setZ(0f); + + } + } + + + } + + } .setOverwriteItemStackTooltip(s -> rewriteItem(slot, s)).disableInteraction()) .build().setPos(97, 9)) @@ -313,6 +470,13 @@ public boolean isEnabled() { return !autoPullItemList && super.isEnabled(); } }).widgetCreator(slot -> (SlotWidget) new SlotWidget(slot) { + + + + + + + @Override protected void phantomClick(ClickData clickData, ItemStack cursorStack) { @@ -442,7 +606,17 @@ public void buildTooltip(List tooltip) { } }.setUpdateTooltipEveryTick(true)).build().setPos(new Pos2d(7, 9)) - ).addChild(SlotGroup.ofFluidTanks(IntStream.range(0, 16).mapToObj(index -> createTankForFluidStack(f_display, index, Integer.MAX_VALUE)).collect(Collectors.toList()), 4).phantom(true).widgetCreator((slotIndex, h) -> (FluidSlotWidget) new FluidSlotWidget(h) { + ).addChild(SlotGroup.ofFluidTanks(IntStream.range(0, 16).mapToObj(index -> createTankForFluidStack(f_display, index, Integer.MAX_VALUE)).collect(Collectors.toList()), 4) + .tankHandlerCreator(s->new FluidTanksHandler(new FluidTankLongDelegate(s)){ + + @Override + public long getTankStoredAmount(int tank) { + return f_client[((Supplier)s).get()]; + } + + + }) + .phantom(true).widgetCreator((slotIndex, h) -> (FluidSlotWidget) new FluidSlotWidget(h) { @Override protected void tryClickPhantom(ClickData clickData, ItemStack cursorStack) { @@ -1180,5 +1354,20 @@ public ITexture[] getTexturesActive(ITexture aBaseTexture) { public ITexture[] getTexturesInactive(ITexture aBaseTexture) { return new ITexture[] { aBaseTexture, TextureFactory.of(MyMod.iohub, MyMod.iohub.magicNO_overlay_dual) }; } + + private static class HookHolder { + + static ItemRenderHook SKIP_ITEM_STACK_SIZE_HOOK = new ItemRenderHook() { + + @Override + public boolean renderOverlay(FontRenderer fr, TextureManager tm, ItemStack is, int x, int y) { + return true; + } + @Override + public boolean showStackSize(ItemStack is) { + return false; + } + }; + } } diff --git a/src/main/java/reobf/proghatches/main/MyMod.java b/src/main/java/reobf/proghatches/main/MyMod.java index 16a75ab..a791667 100644 --- a/src/main/java/reobf/proghatches/main/MyMod.java +++ b/src/main/java/reobf/proghatches/main/MyMod.java @@ -52,6 +52,7 @@ import appeng.core.features.registries.InterfaceTerminalRegistry; import appeng.items.tools.ToolMemoryCard; import bartworks.API.BorosilicateGlass; +import codechicken.nei.api.API; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.SidedProxy; @@ -141,9 +142,9 @@ public class MyMod { public static MyMod instance; { - + // System.out.println("cccccccccccccccc"); - + try { new GTDualInputs(); } catch (Throwable t) { @@ -397,7 +398,7 @@ public void join(PlayerLoggedInEvent e) { public void postInit(FMLPostInitializationEvent event) { proxy.postInit(event); - + // API.addRecipeCatalyst(new ItemStack(Items.glowstone_dust), "smelting"); OreDictionary.registerOre("ph:circuit", new ItemStack( progcircuit,1,OreDictionary.WILDCARD_VALUE)); { AchievementPage page = new AchievementPage( diff --git a/src/main/java/reobf/proghatches/main/mixin/mixins/MixinAddProgCircuitExemptToInputFilter.java b/src/main/java/reobf/proghatches/main/mixin/mixins/MixinAddProgCircuitExemptToInputFilter.java index 61bb434..3671aff 100644 --- a/src/main/java/reobf/proghatches/main/mixin/mixins/MixinAddProgCircuitExemptToInputFilter.java +++ b/src/main/java/reobf/proghatches/main/mixin/mixins/MixinAddProgCircuitExemptToInputFilter.java @@ -24,7 +24,9 @@ @Mixin(value = gregtech.api.recipe.RecipeMap.class, remap = false) public abstract class MixinAddProgCircuitExemptToInputFilter { - @Inject(method = "containsInput", at = @At("RETURN"), require = 1, cancellable = true) + @Inject(method = "containsInput", at = @At("RETURN"), require = 1, + + cancellable = true) public void containsInput(ItemStack aStack, CallbackInfoReturnable c) { if (aStack == null) return; boolean ret = c.getReturnValueZ(); diff --git a/src/main/java/reobf/proghatches/main/registration/Registration.java b/src/main/java/reobf/proghatches/main/registration/Registration.java index 7cb2143..c25efe6 100644 --- a/src/main/java/reobf/proghatches/main/registration/Registration.java +++ b/src/main/java/reobf/proghatches/main/registration/Registration.java @@ -56,6 +56,7 @@ import reobf.proghatches.gt.metatileentity.NBTHatchMEFocus; import reobf.proghatches.gt.metatileentity.PatternDualInputHatch; import reobf.proghatches.gt.metatileentity.PatternDualInputHatchInventoryMappingSlave; +import reobf.proghatches.gt.metatileentity.PhantomInputBus; import reobf.proghatches.gt.metatileentity.PriorityFilterInputBusME; import reobf.proghatches.gt.metatileentity.PriorityFilterInputHatchME; import reobf.proghatches.gt.metatileentity.ProgrammingCircuitProvider; @@ -105,7 +106,7 @@ public class Registration implements Runnable { public final static int DataOrbOffset = 83; public final static int MECatalystOffset = 84; public final static int StockingDualInputOffset=85;//-86 - + public final static int PhantomInputBusOffset=87; public final static int BufferedQuadDualInputHatchOffset = 100;// -115 @@ -589,7 +590,10 @@ public boolean supportsFluids() { Config.metaTileEntityOffset + StockingDualInputOffset+1, "hatch.dualinput.stocking.autopull.me", LangManager.translateToLocal("hatch.dualinput.stocking.autopull.me.name"), 10, true); - + new PhantomInputBus( + Config.metaTileEntityOffset + PhantomInputBusOffset, + "phantom.bus", + LangManager.translateToLocal("phantom.bus.name"), 10); /* * for (int i = 0; i < 4; i++) { * new DualInputHatch( diff --git a/src/main/java/reobf/proghatches/util/A.java b/src/main/java/reobf/proghatches/util/A.java index c8c835b..d0bc008 100644 --- a/src/main/java/reobf/proghatches/util/A.java +++ b/src/main/java/reobf/proghatches/util/A.java @@ -1,9 +1,19 @@ package reobf.proghatches.util; +import java.nio.ByteBuffer; + +import sun.nio.ch.DirectBuffer; + public class A { public static void main(String[] args){ + ByteBuffer b = ByteBuffer.allocateDirect(10); + sun.nio.ch.DirectBuffer a = (DirectBuffer) b; + a.cleaner().clean(); + b.put((byte) 12); + b.flip(); + System.out.println(b.get()); + - System.out.println(Integer.MAX_VALUE+Integer.MAX_VALUE); } diff --git a/src/main/java/reobf/proghatches/util/ProghatchesUtil.java b/src/main/java/reobf/proghatches/util/ProghatchesUtil.java index 42ef370..5214aa4 100644 --- a/src/main/java/reobf/proghatches/util/ProghatchesUtil.java +++ b/src/main/java/reobf/proghatches/util/ProghatchesUtil.java @@ -341,22 +341,25 @@ public static void handleUse(EntityPlayer player, TileEntity tile, IPriorityHost } - static List allc=new ArrayList<>(); + static List allc=null; public static List allCircuits(){ if(allc==null){ try { allc=(List) GTUtility.class.getDeclaredMethod("getAllIntegratedCircuits").invoke(null); } catch (Exception e) { - //e.printStackTrace(); + e.printStackTrace(); } - } else{ + } + if(allc==null){ try { allc=(List) GregTechAPI.class.getDeclaredMethod("getConfigurationCircuitList",int.class).invoke(null,100); } catch (Exception e) { - //e.printStackTrace(); + e.printStackTrace(); } } + + return allc; } diff --git a/src/main/resources/assets/proghatches/lang/en_US.lang b/src/main/resources/assets/proghatches/lang/en_US.lang index 48af284..c02a75f 100644 --- a/src/main/resources/assets/proghatches/lang/en_US.lang +++ b/src/main/resources/assets/proghatches/lang/en_US.lang @@ -770,3 +770,13 @@ proghatch.stockingdual.exceedintmax=Actual pulled amount exceeds 2.1G, check too proghatch.stockingdual.intmax=Max pull amount (in int.max) proghatch.stockingdual.intmax.tooltips=Maximum amount allowed to pull in multiples of int.max(2.1G). Do not set to a large number especially when you has 9.2E item/fluid in storage. proghatch.saved.statistic=Saved pushPattern calls: %s +proghatches.orb_switcher.amount=Amount of items expected in Stocking Port Network +phantom.bus.name=Phantom Input Bus +proghatch.phantombus.chat.world.missing=World not loaded. dimID: %s +proghatch.phantombus.chat.chunk.missing=Chunk not loaded. dimID,x,y,z: %s,%s,%s,%s +proghatch.phantombus.chat.te.missing=Not a TE, removing from list. dimID,x,y,z: %s,%s,%s,%s +proghatch.phantombus.chat.te.incorrect=Not a Phantom Input Bus, removing from list. dimID,x,y,z: %s,%s,%s,%s +proghatch.phantombus.chat.success=Synchronized successfully to %s Phantom Input Bus(es). +proghatch.phantombus.chat.link.exceed=Max amount of links exceed: 1023 +proghatch.phantombus.chat.link.success=Linked. Total links: %s +proghatch.phantombus.chat.link.noop=Already linked. Total links: %s diff --git a/src/main/resources/assets/proghatches/lang/en_US/PDIH.lang b/src/main/resources/assets/proghatches/lang/en_US/PDIH.lang index 3348051..dca8752 100644 --- a/src/main/resources/assets/proghatches/lang/en_US/PDIH.lang +++ b/src/main/resources/assets/proghatches/lang/en_US/PDIH.lang @@ -5,6 +5,6 @@ Blocking mode is always on If all pattern inputs cannot be push in one single try, it won't be pushed at all. Buffer: {bufferNum} For each buffer: -Capacity: 2^31-1 L{mMultiFluid?} x{fluidSlots} types of fluid{mMultiFluid:}{mMultiFluid!} -Slot maximum stacksize:2^31-1 +Capacity: 2^63-1 L{mMultiFluid?} x{fluidSlots} types of fluid{mMultiFluid:}{mMultiFluid!} +Slot maximum stacksize:2^63-1 §eHas better performance working with large amount of Co-Processing Units. \ No newline at end of file diff --git a/src/main/resources/assets/proghatches/lang/en_US/PDIHB.lang b/src/main/resources/assets/proghatches/lang/en_US/PDIHB.lang index 5a26a63..dccfa81 100644 --- a/src/main/resources/assets/proghatches/lang/en_US/PDIHB.lang +++ b/src/main/resources/assets/proghatches/lang/en_US/PDIHB.lang @@ -6,5 +6,5 @@ If all pattern inputs cannot be push in one single try, it won't be pushed at al No fluid support, patterns with fluid will be rejected. Buffer: {bufferNum} For each buffer: -Slot maximum stacksize:2^31-1 +Slot maximum stacksize:2^63-1 §eHas better performance working with large amount of Co-Processing Units. \ No newline at end of file diff --git a/src/main/resources/assets/proghatches/lang/en_US/PIB.lang b/src/main/resources/assets/proghatches/lang/en_US/PIB.lang new file mode 100644 index 0000000..deea775 --- /dev/null +++ b/src/main/resources/assets/proghatches/lang/en_US/PIB.lang @@ -0,0 +1,8 @@ +Item Input for Multiblocks, wait... not exactly +Do not accept real item stack inputs +Instead, you can mark phantom items mark up to 64 types +LMB click with a datastick to link, +a datastick can link 1023 Phantom Input Buses at the same time. +Then RMB click a Phantom Input Bus to copy marked items in this bus +to all Phantom Input Buses this datastick links to. +Make sure chunk is loaded or copying will fail. \ No newline at end of file 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 58135f1..7ddf550 100644 --- a/src/main/resources/assets/proghatches/lang/en_US/SDIHME.lang +++ b/src/main/resources/assets/proghatches/lang/en_US/SDIHME.lang @@ -1,3 +1,4 @@ Just as its name implies... +Can pull more than 2.1G item/fluid 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 +Or it might void your ingredients, use at your own risk! diff --git a/src/main/resources/assets/proghatches/lang/zh_CN.lang b/src/main/resources/assets/proghatches/lang/zh_CN.lang index 9a5d5ba..2ca5929 100644 --- a/src/main/resources/assets/proghatches/lang/zh_CN.lang +++ b/src/main/resources/assets/proghatches/lang/zh_CN.lang @@ -768,3 +768,13 @@ proghatch.stockingdual.exceedintmax=拉取数量超过2.1G, 查看tooltips获取 proghatch.stockingdual.intmax=最大拉取数量 (单位:int.max) proghatch.stockingdual.intmax.tooltips=最多能拉取int.max(2.1G)的几倍 不要设太大,尤其是当存储中有9.2E个物品时(比如无限水元件),否则可能会非常卡甚至损坏你的存档 proghatch.saved.statistic=优化掉的pushPattern调用次数: %s +proghatches.orb_switcher.amount=库存网络的期望数量 +phantom.bus.name=虚拟输入总线 +proghatch.phantombus.chat.world.missing=目标维度未加载 dimID: %s +proghatch.phantombus.chat.chunk.missing=目标区块未加载 dimID,x,y,z: %s,%s,%s,%s +proghatch.phantombus.chat.te.missing=不是TE,已移除 dimID,x,y,z: %s,%s,%s,%s +proghatch.phantombus.chat.te.incorrect=不是虚拟输入总线,已移除 dimID,x,y,z: %s,%s,%s,%s +proghatch.phantombus.chat.success=成功同步数据到%s个虚拟输入总线 +proghatch.phantombus.chat.link.exceed=已达到最大标记数量:1023 +proghatch.phantombus.chat.link.success=连接成功 总连接数量:%s +proghatch.phantombus.chat.link.noop=连接已经建立,无需连接 总连接数量:%s diff --git a/src/main/resources/assets/proghatches/lang/zh_CN/PDIH.lang b/src/main/resources/assets/proghatches/lang/zh_CN/PDIH.lang index 4f5ceaf..91707c3 100644 --- a/src/main/resources/assets/proghatches/lang/zh_CN/PDIH.lang +++ b/src/main/resources/assets/proghatches/lang/zh_CN/PDIH.lang @@ -4,7 +4,7 @@ 阻挡模式不可关闭 样板所有原料无法单次全部输入时,将拒绝此样板的输入 缓冲数量: {bufferNum} -缓冲容量: 2^31-1 L{mMultiFluid?} x{fluidSlots}种流体{mMultiFluid:}{mMultiFluid!} +缓冲容量: 2^63-1 L{mMultiFluid?} x{fluidSlots}种流体{mMultiFluid:}{mMultiFluid!} {slots}格 -每格堆叠限制:2^31-1 +每格堆叠限制:2^63-1 §e针对高并行CPU合成有特殊优化 \ No newline at end of file diff --git a/src/main/resources/assets/proghatches/lang/zh_CN/PIB.lang b/src/main/resources/assets/proghatches/lang/zh_CN/PIB.lang new file mode 100644 index 0000000..549b624 --- /dev/null +++ b/src/main/resources/assets/proghatches/lang/zh_CN/PIB.lang @@ -0,0 +1,6 @@ +多方块机器的物品输入,但不完全是... +不接受实体物品,而是允许你标记64种虚拟物品 +使用闪存左击以虚拟输入总线连接,一个闪存至多同时连接1023个虚拟输入总线 +然后右击一个虚拟输入总线以将其内部标记物品 +复制到闪存连接的所有虚拟输入总线内 +目标区块必须被加载 否则复制会失败 \ 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 f114b9b..ff487b9 100644 --- a/src/main/resources/assets/proghatches/lang/zh_CN/SDIHME.lang +++ b/src/main/resources/assets/proghatches/lang/zh_CN/SDIHME.lang @@ -1,3 +1,4 @@ 顾名思义 +可以拉取超过2.1G的物品/流体 最好不要在一个机器上装多个这玩意儿 否则可能会吞材料,后果自负! \ No newline at end of file