From 31823c55ea42878dfe34f85700b233971485df43 Mon Sep 17 00:00:00 2001 From: reobf <2215595288@qq.com> Date: Mon, 3 Jun 2024 13:41:52 +0800 Subject: [PATCH] fix Programming Circuit tag data --- build.gradle | 2 +- .../eucrafting/TileFluidInterface_EU.java | 1 + .../gt/metatileentity/DualInputHatch.java | 6 +++--- .../metatileentity/PatternDualInputHatch.java | 7 ++++--- .../ProgrammingCircuitProvider.java | 3 ++- .../item/ItemProgrammingCircuit.java | 2 ++ .../java/reobf/proghatches/main/MyMod.java | 2 +- .../main/registration/Registration.java | 18 +++++++++--------- .../assets/proghatches/lang/zh_CN.lang | 1 - 9 files changed, 23 insertions(+), 19 deletions(-) diff --git a/build.gradle b/build.gradle index 3ff7470..609f886 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.15' +String versionOverride = '0.0.15p1' 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/eucrafting/TileFluidInterface_EU.java b/src/main/java/reobf/proghatches/eucrafting/TileFluidInterface_EU.java index 03fcb97..2e5365a 100644 --- a/src/main/java/reobf/proghatches/eucrafting/TileFluidInterface_EU.java +++ b/src/main/java/reobf/proghatches/eucrafting/TileFluidInterface_EU.java @@ -196,6 +196,7 @@ private boolean postEvent() { @TileEvent(TileEventType.WORLD_NBT_WRITE) public void write(NBTTagCompound data) { ProghatchesUtil.ser(data, id, "EUFI"); + if(customName!=null) data.setString("customName",customName); data.setLong("amp", amp); data.setLong("voltage", voltage); diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatch.java b/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatch.java index 194e699..d94c9aa 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatch.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/DualInputHatch.java @@ -116,11 +116,11 @@ public DualInputHatch(int id, String name, String nameRegional, int tier, int sl initTierBasedField(); } public int fluidSlots(){ - return Math.max(4, mTier-2); + return Math.max(4, mTier-1); } public static int fluidSlots(int mTier){ - return Math.max(4, mTier-2); + return Math.max(4, mTier-1); } public void initTierBasedField() { @@ -906,7 +906,7 @@ public int getInventoryStackLimit() { public static int getInventoryStackLimit(int mTier) { - return 64+32*mTier; + return 64+64*Math.max(0,mTier-3); } public void add1by1Slot(ModularWindow.Builder builder, IDrawable... background) { diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/PatternDualInputHatch.java b/src/main/java/reobf/proghatches/gt/metatileentity/PatternDualInputHatch.java index d19f3ee..ab3f8a1 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/PatternDualInputHatch.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/PatternDualInputHatch.java @@ -428,7 +428,8 @@ public void loadNBTData(NBTTagCompound aNBT) { pattern[i] = Optional.ofNullable(tag.getCompoundTag("i" + i)).map(ItemStack::loadItemStackFromNBT) .orElse(null); } - Optional.ofNullable(customName).ifPresent(s -> aNBT.setString("customName", s)); + customName = aNBT.getString("customName"); + getProxy().readFromNBT(aNBT); super.loadNBTData(aNBT); } @@ -443,7 +444,7 @@ public void saveNBTData(NBTTagCompound aNBT) { .ifPresent(s -> tag.setTag("i" + ii, s)); } aNBT.setTag("patternSlots", tag); - Optional.ofNullable(aNBT.getTag("customName")).map(NBTBase::toString).ifPresent(s -> customName = s); + Optional.ofNullable(customName).ifPresent(s -> aNBT.setString("customName", s)); getProxy().writeToNBT(aNBT); super.saveNBTData(aNBT); } @@ -625,7 +626,7 @@ public String getCustomName() { @Override public boolean hasCustomName() { - return customName != null; + return customName != null&&(!customName.equals("")); } @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, ForgeDirection side, diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/ProgrammingCircuitProvider.java b/src/main/java/reobf/proghatches/gt/metatileentity/ProgrammingCircuitProvider.java index dde3098..a35a0e8 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/ProgrammingCircuitProvider.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/ProgrammingCircuitProvider.java @@ -531,7 +531,8 @@ public void saveNBTData(NBTTagCompound aNBT) { int[] count = new int[1]; toReturn.forEach(s -> aNBT.setTag("toReturn" + (count[0]++), s.writeToNBT(new NBTTagCompound()))); getProxy().writeToNBT(aNBT); - aNBT.setString("customName",customName); + Optional.ofNullable(customName).ifPresent(s -> aNBT.setString("customName", s)); + //aNBT.setString("customName",customName); aNBT.setBoolean("disabled", disabled); aNBT.setBoolean("legacy", disabled); aNBT.setInteger("tech", tech); diff --git a/src/main/java/reobf/proghatches/item/ItemProgrammingCircuit.java b/src/main/java/reobf/proghatches/item/ItemProgrammingCircuit.java index 5393754..35065f2 100644 --- a/src/main/java/reobf/proghatches/item/ItemProgrammingCircuit.java +++ b/src/main/java/reobf/proghatches/item/ItemProgrammingCircuit.java @@ -147,8 +147,10 @@ public static ItemStack wrap(ItemStack is,int i,boolean legacy) { public static ItemStack parse(NBTTagCompound tag){ String s=tag.getString("string_id"); + if(s.isEmpty()==false){ //if string id is present, replace the number id + tag=(NBTTagCompound) tag.copy();//note to self: copy it before modifying it!!! tag.setInteger("id", Item.itemRegistry.getIDForObject(Item.itemRegistry.getObject(s))); } diff --git a/src/main/java/reobf/proghatches/main/MyMod.java b/src/main/java/reobf/proghatches/main/MyMod.java index 0f2f0e3..5b2b2d2 100644 --- a/src/main/java/reobf/proghatches/main/MyMod.java +++ b/src/main/java/reobf/proghatches/main/MyMod.java @@ -87,7 +87,7 @@ @Mod(modid = Tags.MODID, version = Tags.VERSION, name = Tags.MODNAME, acceptedMinecraftVersions = "[1.7.10]", dependencies = "required-after:appliedenergistics2;required-after:gregtech;" - +,acceptableRemoteVersions="*" /* * ,dependencies= "required-after:neenergistics;" */ diff --git a/src/main/java/reobf/proghatches/main/registration/Registration.java b/src/main/java/reobf/proghatches/main/registration/Registration.java index 3617167..ccd9c6f 100644 --- a/src/main/java/reobf/proghatches/main/registration/Registration.java +++ b/src/main/java/reobf/proghatches/main/registration/Registration.java @@ -128,20 +128,20 @@ public void run() { 6+Math.max(i-4, 0)*2); } - - new ProgrammingCircuitProvider( - Config.metaTileEntityOffset + CircuitProviderOffset, - "circuitprovider", - LangManager.translateToLocal("circuitprovider.name"), - 5, - 4, 1); - new ProgrammingCircuitProvider( + new ProgrammingCircuitProvider( Config.metaTileEntityOffset + CircuitProviderOffsetT0, "circuitprovider", LangManager.translateToLocal("circuitprovider.name.tech0"), 3, 1, 0); + new ProgrammingCircuitProvider( + Config.metaTileEntityOffset + CircuitProviderOffset, + "circuitprovider", + LangManager.translateToLocal("circuitprovider.name"), + 5, + 4, 1); + GregTech_API.registerCover( new ItemStack(MyMod.cover, 1, 0), @@ -302,7 +302,7 @@ public void run() { new LargeProgrammingCircuitProvider( Config.metaTileEntityOffset + LargeProviderOffset, - "multimachine.largeprogrammingcircuitprovider", + "multimachine.largeprogrammingcircuit", LangManager.translateToLocalFormatted("multimachine.largeprogrammingcircuitprovider.name")); new ProviderChainer( Config.metaTileEntityOffset + ChainerOffset , diff --git a/src/main/resources/assets/proghatches/lang/zh_CN.lang b/src/main/resources/assets/proghatches/lang/zh_CN.lang index a30cc50..7d55744 100644 --- a/src/main/resources/assets/proghatches/lang/zh_CN.lang +++ b/src/main/resources/assets/proghatches/lang/zh_CN.lang @@ -350,4 +350,3 @@ programmable_hatches.gt.insertion.tooltip.1=这里的物品插入不受最大堆 programmable_hatches.gt.insertion.tooltip.2=ME接口同样也不受最大堆叠限制 programmable_hatches.gt.insertion.tooltip.3=警告!关闭这个窗口会丢出剩下的物品 programmable_hatches.gt.insertion.tooltip=4 -