From a59d2fbaed3057b8f5ad4961ee65b4ef7a5e0693 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Mon, 18 Jun 2018 02:35:47 +0200 Subject: fix for #2152 fix for reused DataSticks keep parts of old NBTTagCompound fixed blockores and removed one hashmap --- .../java/gregtech/api/util/GT_Assemblyline_Server.java | 18 +++++++----------- .../machines/basic/GT_MetaTileEntity_Scanner.java | 10 +++++++--- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java b/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java index d5a47621ac..13bac88f91 100644 --- a/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java +++ b/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java @@ -19,7 +19,7 @@ public class GT_Assemblyline_Server { public static LinkedHashMap lServerNames = new LinkedHashMap(); - private static LinkedHashMap internal2= new LinkedHashMap(),internal3 = new LinkedHashMap(),internal4= new LinkedHashMap(),internal5= new LinkedHashMap(); + private static LinkedHashMap internal2= new LinkedHashMap(),internal3 = new LinkedHashMap(),internal4= new LinkedHashMap(); private static HashMap internal = new HashMap(); public static void fillMap(FMLPreInitializationEvent aEvent) { @@ -36,14 +36,12 @@ public class GT_Assemblyline_Server { for (Map.Entry entry : internal.entrySet()) { s=entry.getValue().getString().replaceAll("%", ""); - if (entry.getKey().contains("metaitem")&&s.contains("material")) + if (entry.getKey().contains("metaitem") && s.contains("material")) internal2.put(entry.getKey(), s); - else if (entry.getKey().contains("blockmachines")&&s.contains("material")) + else if (entry.getKey().contains("blockmachines") && s.contains("material")) internal3.put(entry.getKey(), s); - else if (entry.getKey().contains("blockores")&&s.contains("material")) + else if ((entry.getKey().contains("blockores")||(entry.getKey().contains("blockmetal")||entry.getKey().contains("blockgem"))) && s.contains("material")) internal4.put(entry.getKey(), s); - else if ((entry.getKey().contains("blockmetal")||entry.getKey().contains("blockgem"))&&s.contains("material")) - internal5.put(entry.getKey(), s); else lServerNames.put(entry.getKey(), s); } @@ -84,15 +82,13 @@ public class GT_Assemblyline_Server { lServerNames.put(entry.getKey(), entry.getValue()); } for (Map.Entry entry : internal4.entrySet()) { - if (entry.getValue().contains("blockores")) { + if (entry.getKey().contains("blockores")) { int i = Integer.parseInt(entry.getKey().substring("gt.blockores.".length(), entry.getKey().length()-".name".length())); i=i%1000; lServerNames.put(entry.getKey(), entry.getValue().replace("material",GregTech_API.sGeneratedMaterials[i].toString())); } - } - - for (Map.Entry entry : internal5.entrySet()) { - if(entry.getKey().contains("blockmetal")) { + + else if(entry.getKey().contains("blockmetal")) { Materials[] mMats = null; String t = entry.getKey().substring("gt.blockmetal".length()); t=t.substring(0,1); diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java index 4fa4059108..c5dfb5483f 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java @@ -105,8 +105,8 @@ public class GT_MetaTileEntity_Scanner } if (ItemList.Tool_DataOrb.isStackEqual(getSpecialSlot(), false, true)) { if (ItemList.Tool_DataOrb.isStackEqual(aStack, false, true)) { - aStack.stackSize -= 1; - this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[]{ItemList.Tool_DataStick.get(1, new Object[]{})}); + aStack.stackSize -= 1; + this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[]{getSpecialSlot()}); calculateOverclockedNess(30,512); //In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) @@ -227,12 +227,16 @@ public class GT_MetaTileEntity_Scanner s=tRecipe.mOutput.getDisplayName(); } this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[]{getSpecialSlot()}); + + //remove possible old NBTTagCompound + this.mOutputItems[0].setTagCompound(new NBTTagCompound()); GT_Utility.ItemNBT.setBookTitle(this.mOutputItems[0], s+" Construction Data"); NBTTagCompound tNBT = this.mOutputItems[0].getTagCompound(); if (tNBT == null) { tNBT = new NBTTagCompound(); - } + } + tNBT.setTag("output", tRecipe.mOutput.writeToNBT(new NBTTagCompound())); tNBT.setInteger("time", tRecipe.mDuration); tNBT.setInteger("eu", tRecipe.mEUt); -- cgit