diff --git a/build.gradle b/build.gradle index 3a4a177..53c4771 100644 --- a/build.gradle +++ b/build.gradle @@ -373,7 +373,7 @@ catch (Exception ignored) { // Pulls version first from the VERSION env and then git tag String identifiedVersion = null -String versionOverride = '0.0.16' +String versionOverride = '0.0.16p1' try { // Produce a version based on the tag, or for branches something like 0.2.2-configurable-maven-and-extras.38+43090270b6-dirty if (versionOverride == null) { diff --git a/dependencies.gradle b/dependencies.gradle index a5c6950..27281f4 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -69,7 +69,7 @@ api("com.github.GTNewHorizons:NotEnoughEnergistics:1.5.1:dev") api('com.github.GTNewHorizons:BlockRenderer6343:1.1.6:dev') api("com.google.auto.value:auto-value-annotations:1.10.1") { transitive = false } annotationProcessor("com.google.auto.value:auto-value:1.10.1") - + api('com.github.GTNewHorizons:GTplusplus:1.11.58:dev') api("com.github.GTNewHorizons:OpenComputers:1.9.14-GTNH:dev") api('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.163:dev') diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/RemoteInputBus.java b/src/main/java/reobf/proghatches/gt/metatileentity/RemoteInputBus.java index c1ea5c6..43d615c 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/RemoteInputBus.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/RemoteInputBus.java @@ -2,11 +2,13 @@ import static gregtech.api.enums.Textures.BlockIcons.ITEM_IN_SIGN; +import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Optional; +import java.util.stream.IntStream; import javax.annotation.Nullable; @@ -17,21 +19,31 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.ForgeDirection; import com.gtnewhorizons.modularui.api.screen.ModularWindow.Builder; +import com.gtnewhorizons.modularui.api.widget.Widget; import com.google.common.collect.ImmutableMap; +import com.gtnewhorizons.modularui.api.ModularUITextures; import com.gtnewhorizons.modularui.api.forge.ItemHandlerHelper; import com.gtnewhorizons.modularui.api.forge.ItemStackHandler; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot; +import com.gtnewhorizons.modularui.common.widget.DrawableWidget; +import com.gtnewhorizons.modularui.common.widget.SlotGroup; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; +import com.gtnewhorizons.modularui.common.widget.SyncedWidget; import com.gtnewhorizons.modularui.common.widget.TextWidget; import gregtech.GT_Mod; import gregtech.api.GregTech_API; +import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.IConfigurationCircuitSupport; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -197,6 +209,93 @@ public void addUIWidgets(Builder builder, UIBuildContext buildContext) { } ).setSynced(true).setPos(5, 5)); + ItemStackHandler is; + SlotWidget[] circuitslot=new SlotWidget[1]; + builder.widget( + SlotGroup.ofItemHandler(is=new ItemStackHandler(17), 8) + .widgetCreator(s->{ + SlotWidget sw= + (SlotWidget)new SlotWidget(s).disableInteraction(); + + if(s.getSlotIndex()==16){ + circuitslot[0]=sw; + } + + return sw; + } + ) + .phantom(true).startFromSlot(0).endAtSlot(16) + .build().setPos(3, 3+16) + ); + + + + circuitslot[0].setBackground( getGUITextureSet().getItemSlot(),GT_UITextures.OVERLAY_SLOT_INT_CIRCUIT); + + + builder.widget(new SyncedWidget() { + int count; + @Override + public void detectAndSendChanges(boolean init) { + if(count--<=0){count=100;}else return; + + Optional opt = getTile(); + if(opt.isPresent()){ + List list = opt.map(e->filterTakable(e)).get(); + for(int i=0;ii? + list.get(i):null + ); + } + + TileEntity gt = opt.orElse(null); + if (gt != null && gt instanceof IGregTechTileEntity) { + IMetaTileEntity meta = ((IGregTechTileEntity) gt).getMetaTileEntity(); + if (meta != null && (meta instanceof IConfigurationCircuitSupport)) { + IConfigurationCircuitSupport c = (IConfigurationCircuitSupport) meta; + is.setStackInSlot(16,meta.getStackInSlot(c.getCircuitSlot())); + } + } + + + + + }else{ + for(int i=0;i w.addTooltip(LangManager.translateToLocal( + "programmable_hatches.gt.remotebus.tooltip." + + s))); + + + // buildContext.addCloseListener(() -> uiButtonCount = 0); } @@ -249,7 +348,7 @@ public List filterTakable(TileEntity e) { ; // } - slots.stream().map(inv::getStackInSlot).forEach(arr::add); + //slots.stream().map(inv::getStackInSlot).forEach(arr::add); ; for (int i = 0; i < size; i++) { if (slots.contains(i)) { diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/RemoteInputHatch.java b/src/main/java/reobf/proghatches/gt/metatileentity/RemoteInputHatch.java index 8a75f3b..7d4b345 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/RemoteInputHatch.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/RemoteInputHatch.java @@ -3,37 +3,61 @@ import static gregtech.api.enums.Textures.BlockIcons.FLUID_IN_SIGN; import java.io.Closeable; +import java.io.IOException; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Optional; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; import javax.annotation.Nullable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.PacketBuffer; 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; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; +import net.minecraftforge.fluids.IFluidTank; import com.gtnewhorizons.modularui.api.screen.ModularWindow.Builder; +import com.gtnewhorizons.modularui.api.widget.Interactable; +import com.gtnewhorizons.modularui.api.widget.Widget; +import com.gtnewhorizons.modularui.api.widget.Widget.ClickData; +import com.google.common.collect.HashMultiset; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import com.gtnewhorizons.modularui.api.ModularUITextures; +import com.gtnewhorizons.modularui.api.drawable.Text; +import com.gtnewhorizons.modularui.api.forge.ItemStackHandler; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.DrawableWidget; +import com.gtnewhorizons.modularui.common.widget.FluidSlotWidget; +import com.gtnewhorizons.modularui.common.widget.SlotGroup; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; +import com.gtnewhorizons.modularui.common.widget.SyncedWidget; import com.gtnewhorizons.modularui.common.widget.TextWidget; import gregtech.GT_Mod; import gregtech.api.GregTech_API; +import gregtech.api.gui.modularui.GT_UITextures; +import gregtech.api.interfaces.IConfigurationCircuitSupport; import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_MultiInput; @@ -168,6 +192,7 @@ public RemoteInputHatch(int id, String name, String nameRegional, int tier) { } + @SuppressWarnings("unchecked") @Override public void addUIWidgets(Builder builder, UIBuildContext buildContext) { // super.addUIWidgets(builder, buildContext); @@ -200,7 +225,113 @@ public void addUIWidgets(Builder builder, UIBuildContext buildContext) { ).setSynced(true).setPos(5, 5)) ; + List is; + + builder.widget( + SlotGroup.ofFluidTanks( + (List) + ( + is=Stream.generate(()->new FluidTank(Integer.MAX_VALUE)).limit(16).collect(Collectors.toList()) + ), + 8) + .widgetCreator((s,b)->{ + FluidSlotWidget sw= + new FluidSlotWidget(b){ + @Override + public void buildTooltip(List tooltip) { + // super.buildTooltip(tooltip); + FluidStack fluid = getContent(); + if (fluid != null) { + addFluidNameInfo(tooltip, fluid); + tooltip.add(Text.localised("modularui.fluid.phantom.amount", fluid.amount)); + addAdditionalFluidInfo(tooltip, fluid); + if (!Interactable.hasShiftDown()) { + tooltip.add(Text.EMPTY); + tooltip.add(Text.localised("modularui.tooltip.shift")); + } + } else { + tooltip.add( + Text.localised("modularui.fluid.empty") + .format(EnumChatFormatting.WHITE)); + } + } + @Override + protected void tryClickPhantom(ClickData clickData, ItemStack cursorStack) {} + + @Override + protected void tryScrollPhantom(int direction) {} + }; + + + + return sw; + } + ) + .phantom(true).startFromSlot(0).endAtSlot(16) + .build().setPos(3, 3+16) + ); + + + + builder.widget(new SyncedWidget() { + int count; + @Override + public void detectAndSendChanges(boolean init) { + if(count--<=0){count=100;}else return; + + Optional opt = getTile(); + if(opt.isPresent()){ + List list = opt.map(e->{ + try{processingRecipe=true; + return filterTakable(e); + }finally{processingRecipe=false; + tmp=null; + } + + }).get(); + for(int i=0;ii? + list.get(i):null + ); + } + + + + + + + }else{ + for(int i=0;i w.addTooltip(LangManager.translateToLocal( + "programmable_hatches.gt.remotehatch.tooltip." + + s))); + } @Override @@ -294,7 +425,7 @@ public List filterTakable(TileEntity e) { if (e instanceof IFluidHandler) { IFluidHandler side = (IFluidHandler) e; - HashSet slots = new HashSet(); + HashMultiset slots = HashMultiset.create(); // for(ForgeDirection dir:ForgeDirection.VALID_DIRECTIONS){ for (FluidTankInfo i : side.getTankInfo(this.getBaseMetaTileEntity().getFrontFacing())) { @@ -315,7 +446,7 @@ public List filterTakable(TileEntity e) { private volatile ArrayList tmp = null; public class ShadowFluidStack extends FluidStack { - + FluidStack original; public ShadowFluidStack(FluidStack stack) { diff --git a/src/main/java/reobf/proghatches/main/mixin/mixins/eucrafting/MixinRemoveExcessiveEU.java b/src/main/java/reobf/proghatches/main/mixin/mixins/eucrafting/MixinRemoveExcessiveEU.java index 6d687ec..28e45f6 100644 --- a/src/main/java/reobf/proghatches/main/mixin/mixins/eucrafting/MixinRemoveExcessiveEU.java +++ b/src/main/java/reobf/proghatches/main/mixin/mixins/eucrafting/MixinRemoveExcessiveEU.java @@ -56,19 +56,24 @@ public void startCrafting(MECraftingInventory storage, ICraftingCPU rawCluster, if (a instanceof CircuitProviderPatternDetial) { CircuitProviderPatternDetial w = (CircuitProviderPatternDetial) a; - Optional.ofNullable(w).map(s->s.out).ifPresent(x-> - MyMod.LOG.info("Removing EU Source Pattern Request: " + x+x.getTagCompound())); + Optional.ofNullable(w).map(s->s.out).ifPresent(x->{ + if (w.out.getItem() == MyMod.eu_token) { + MyMod.LOG.info("Removing EU Source Pattern Request: " + x+x.getTagCompound()); MixinCallback.setter.accept(b, 0l); } + }); + } if (a instanceof SISOPatternDetail) { SISOPatternDetail w = (SISOPatternDetail) a; - Optional.ofNullable(w).map(s->s.out).ifPresent(x-> - MyMod.LOG.info("Removing EU Interface Binding Pattern Request: " + x+x.getTagCompound())); + Optional.ofNullable(w).map(s->s.out).ifPresent(x->{ if (w.in.getItem() == MyMod.eu_token && w.out.getItem() == MyMod.eu_token) { + MyMod.LOG.info("Removing EU Interface Binding Pattern Request: " + x+x.getTagCompound()); MixinCallback.setter.accept(b, 0l); } + }); + } }); diff --git a/src/main/resources/assets/proghatches/lang/en_US.lang b/src/main/resources/assets/proghatches/lang/en_US.lang index aee7111..bac49a1 100644 --- a/src/main/resources/assets/proghatches/lang/en_US.lang +++ b/src/main/resources/assets/proghatches/lang/en_US.lang @@ -351,3 +351,13 @@ circuitprovider.prefab.2.type.name=Slicer circuitprovider.prefab.3.type.name=Extruder circuitprovider.prefab.4.type.name=White Dwarf Extruder circuitprovider.prefab.5.type.name=Lens +programmable_hatches.gt.remotehatch.tooltip.0=Preview of accessible fluid of target tank. +programmable_hatches.gt.remotehatch.tooltip.1=Only partially display first 16 types of accessible fluid. +programmable_hatches.gt.remotehatch.tooltip.2=Preview is updated every 5 sec for better server performance. No latency for multiblock. +programmable_hatches.gt.remotehatch.tooltip.3=If fluid is present but not shown, make sure the target fluid can be extracted from the same direction this hatch points to. +programmable_hatches.gt.remotehatch.tooltip=4 +programmable_hatches.gt.remotebus.tooltip.0=Preview of accessible items of target inventory. +programmable_hatches.gt.remotebus.tooltip.1=Only partially display slot #0 to #15 and an optional circuit slot. +programmable_hatches.gt.remotebus.tooltip.2=Preview is updated every 5 sec for better server performance. No latency for multiblock. +programmable_hatches.gt.remotebus.tooltip.3=If item is present but not shown, make sure the target item can be extracted from the same direction this hatch points to. +programmable_hatches.gt.remotebus.tooltip=4 diff --git a/src/main/resources/assets/proghatches/lang/zh_CN.lang b/src/main/resources/assets/proghatches/lang/zh_CN.lang index c957a0a..9fe38d9 100644 --- a/src/main/resources/assets/proghatches/lang/zh_CN.lang +++ b/src/main/resources/assets/proghatches/lang/zh_CN.lang @@ -388,3 +388,13 @@ circuitprovider.prefab.2.type.name=刀具 circuitprovider.prefab.3.type.name=模头 circuitprovider.prefab.4.type.name=白矮星物质模头 circuitprovider.prefab.5.type.name=透镜 +programmable_hatches.gt.remotehatch.tooltip.0=目标容器可用流体的预览 +programmable_hatches.gt.remotehatch.tooltip.1=只显示前16种流体 超出16种未能显示的流体也能被访问 +programmable_hatches.gt.remotehatch.tooltip.2=视觉上5秒更新一次以优化性能 实际使用时访问不存在无延迟 +programmable_hatches.gt.remotehatch.tooltip.3=如果目标流体未能显示,请确认其是否能被从此仓指向的方向抽出 +programmable_hatches.gt.remotehatch.tooltip=4 +programmable_hatches.gt.remotebus.tooltip.0=目标容器可用物品的预览 +programmable_hatches.gt.remotebus.tooltip.1=只显示前#0到#15号物品槽,以及其虚拟电路板槽的内容 +programmable_hatches.gt.remotebus.tooltip.2=视觉上5秒更新一次以优化性能 实际使用时访问不存在延迟 +programmable_hatches.gt.remotebus.tooltip.3=如果目标物品未能显示,请确认其是否能被从此仓指向的方向抽出 +programmable_hatches.gt.remotebus.tooltip=4