From e746be4d25430d73476e1736a5d660abcd4d561c Mon Sep 17 00:00:00 2001 From: reobf <2215595288@qq.com> Date: Tue, 24 Sep 2024 12:40:07 +0800 Subject: [PATCH] update --- build.gradle | 2 +- .../multi/IngredientDistributor.java | 40 +++++++++++++++++-- .../assets/proghatches/lang/en_US.lang | 6 ++- .../assets/proghatches/lang/zh_CN.lang | 4 ++ 4 files changed, 45 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index d6cc584..85e937d 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.19p1' +String versionOverride = '0.0.19p2' 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/src/main/java/reobf/proghatches/gt/metatileentity/multi/IngredientDistributor.java b/src/main/java/reobf/proghatches/gt/metatileentity/multi/IngredientDistributor.java index 72d9c2c..1727b3e 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/multi/IngredientDistributor.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/multi/IngredientDistributor.java @@ -716,6 +716,14 @@ static void ser(PacketBuffer pb,TransferCheckResult thiz){ } +} +private ItemStack cp(ItemStack c){ + if(c!=null)return c.copy(); + return null; +} +private IAEItemStack cp(IAEItemStack c){ + if(c!=null)return c.copy(); + return null; } static Field f,f2; @SuppressWarnings({ "unchecked", "unused" }) @@ -730,15 +738,21 @@ private TransferCheckResult checkMEBus(GT_MetaTileEntity_Hatch_OutputBus_ME bus, try { IItemList itemCache =(IItemList) f.get(bus); Iterator itr = itemCache.iterator(); + //if(check!=null) while(itr.hasNext()){IAEItemStack next; if((next=itr.next()).isSameType(check)==false){ - return TransferCheckResult.ofFail("cache.diff.bus",index,check.copy(),next.copy()); + if(check==null) + return TransferCheckResult.ofFail("cache.diff.bus.null",index,cp(next)); + return TransferCheckResult.ofFail("cache.diff.bus",index,cp(next),cp(check)); } } itr = bus.getProxy().getStorage().getItemInventory().getStorageList().iterator(); + //if(check!=null) while(itr.hasNext()){IAEItemStack next; if((next=itr.next()).isSameType(check)==false){ - return TransferCheckResult.ofFail("net.diff.bus",index,check.copy(),next.copy()); + if(check==null) + return TransferCheckResult.ofFail("net.diff.bus.null",index,cp(next)); + return TransferCheckResult.ofFail("net.diff.bus",index,cp(next),cp(check)); } } if(check!=null){ @@ -771,15 +785,22 @@ private TransferCheckResult checkMEHatch(GT_MetaTileEntity_Hatch_Output_ME bus,F try { IItemList itemCache =(IItemList) f2.get(bus); Iterator itr = itemCache.iterator(); + //if(check!=null) while(itr.hasNext()){IAEFluidStack next; if(!sameType(next=itr.next(),(check))){ - return TransferCheckResult.ofFail("cache.diff.hatch",index,check.copy(),next.copy()); + if(check==null) + return TransferCheckResult.ofFail("net.diff.hatch.null",index,cp(next)); + return TransferCheckResult.ofFail("cache.diff.hatch",index,cp(next),cp(check)); } } + itr = bus.getProxy().getStorage().getFluidInventory().getStorageList().iterator(); + //if(check!=null) while(itr.hasNext()){IAEFluidStack next; if(!sameType(next=itr.next(),(check))){ - return TransferCheckResult.ofFail("net.diff.hatch",index,check.copy(),next.copy()); + if(check==null) + return TransferCheckResult.ofFail("net.diff.hatch.null",index,cp(next)); + return TransferCheckResult.ofFail("net.diff.hatch",index,cp(next),cp(check)); } }if(check!=null){ IAEFluidStack notadded = bus.getProxy().getStorage().getFluidInventory().injectItems( @@ -797,6 +818,17 @@ private TransferCheckResult checkMEHatch(GT_MetaTileEntity_Hatch_Output_ME bus,F return TransferCheckResult.ofSuccess(); } +private IAEFluidStack cp(IAEFluidStack c) { + + if(c!=null)return c.copy(); + return null; +} + +private FluidStack cp(FluidStack c) { + + if(c!=null)return c.copy(); + return null; +} static BaseActionSource fakeSource=new BaseActionSource(); static Method[] cache; diff --git a/src/main/resources/assets/proghatches/lang/en_US.lang b/src/main/resources/assets/proghatches/lang/en_US.lang index 8e5a1e3..c9178b6 100644 --- a/src/main/resources/assets/proghatches/lang/en_US.lang +++ b/src/main/resources/assets/proghatches/lang/en_US.lang @@ -563,5 +563,7 @@ proghatch.chunk_loading_alert.info.none=Alerting Anchor: No improperly-unloaded proghatch.waypoint.info=Alerting Anchor Mark programmable_hatches.buffer.waila.hidden=§rAnd %s more §2Idle§r Buffers... proghatch.dualhatch.optinv.broken=§4This Multiblock Machine does not support Upgrades! Please create issue if you see this. - - \ No newline at end of file +proghatch.ingbuf.fail.net.diff.bus.null=The bus#%s has %s in its ME storage while it should be empty. +proghatch.ingbuf.fail.cache.diff.bus.null=The bus#%s has %s in its cache while it should be empty. +proghatch.ingbuf.fail.net.diff.hatch.null=The hatch#%s has %s in its ME storage while it should be empty. +proghatch.ingbuf.fail.cache.diff.hatch.null=The hatch#%s has %s in its cache while it should be empty. diff --git a/src/main/resources/assets/proghatches/lang/zh_CN.lang b/src/main/resources/assets/proghatches/lang/zh_CN.lang index 4fe0242..7a26d63 100644 --- a/src/main/resources/assets/proghatches/lang/zh_CN.lang +++ b/src/main/resources/assets/proghatches/lang/zh_CN.lang @@ -561,3 +561,7 @@ proghatch.chunk_loading_alert.info.none=警告锚: 没有非正常卸载区块 proghatch.waypoint.info=警告锚标记 programmable_hatches.buffer.waila.hidden=§r以及%s个空闲的§2就绪§r缓存... proghatch.dualhatch.optinv.broken=§4这个多方块不兼容升级!如果看到这行字请提issue +proghatch.ingbuf.fail.net.diff.bus.null=%s号ME输出总线内部缓存含有:%s 尽管不需要向此网络输出但其应该被清空 +proghatch.ingbuf.fail.cache.diff.bus.null=%s号ME输出总线内部缓存含有:%s 尽管不需要向此网络输出但其应该被清空 +proghatch.ingbuf.fail.net.diff.hatch.null=%s号ME输出仓内部缓存含有:%s 尽管不需要向此网络输出但其应该被清空 +proghatch.ingbuf.fail.cache.diff.hatch.null=%s号ME输出仓内部缓存含有:%s 尽管不需要向此网络输出但其应该被清空