diff options
Diffstat (limited to 'src/main')
7 files changed, 148 insertions, 309 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/debug/CreativeScanner.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/debug/CreativeScanner.java index a34685bb9c..b6f58ebd0f 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/debug/CreativeScanner.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/debug/CreativeScanner.java @@ -54,6 +54,16 @@ public class CreativeScanner extends GT_MetaTileEntity_Scanner { } @Override + protected boolean hasEnoughEnergyToCheckRecipe() { + return true; + } + + @Override + protected boolean drainEnergyForProcess(long aEUt) { + return true; + } + + @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { this.mProgresstime = this.mMaxProgresstime; super.onPostTick(aBaseMetaTileEntity, aTick); diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java index 6cb0ec0791..ce98b6dc86 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java @@ -19,6 +19,7 @@ import com.github.technus.tectech.thing.CustomItemList; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; +import gregtech.api.util.GT_AssemblyLineUtils; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_AssemblyLine; @@ -54,10 +55,32 @@ public class TT_recipeAdder extends GT_RecipeAdder { } researchAmperage = GT_Utility.clamp(researchAmperage, 1, Short.MAX_VALUE); computationRequiredPerSec = GT_Utility.clamp(computationRequiredPerSec, 1, Short.MAX_VALUE); + + GT_Recipe_AssemblyLine recipeGT = new GT_Recipe.GT_Recipe_AssemblyLine( + CustomItemList.UnusedStuff.get(1), + totalComputationRequired / computationRequiredPerSec, + aInputs, + aFluidInputs, + aOutput, + assDuration, + assEUt); + GT_Recipe_AssemblyLine recipeTT = new GT_Recipe.GT_Recipe_AssemblyLine( + aResearchItem, + totalComputationRequired / computationRequiredPerSec, + aInputs, + aFluidInputs, + aOutput, + assDuration, + assEUt); + GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add(recipeGT); + TecTechRecipeMaps.researchableALRecipeList.add(recipeTT); + + ItemStack writesDataStick = ItemList.Tool_DataStick.getWithName(1L, "Writes Research result"); + GT_AssemblyLineUtils.setAssemblyLineRecipeOnDataStick(writesDataStick, recipeTT, false); GT_Values.RA.stdBuilder() .itemInputs(aResearchItem) .itemOutputs(aOutput) - .special(ItemList.Tool_DataStick.getWithName(1L, "Writes Research result")) + .special(writesDataStick) .duration(totalComputationRequired) .eut(researchEUt) .metadata(RESEARCH_STATION_DATA, researchAmperage | computationRequiredPerSec << 16) @@ -66,35 +89,18 @@ public class TT_recipeAdder extends GT_RecipeAdder { .fake() .addTo(researchStationFakeRecipes); + ItemStack readsDataStick = ItemList.Tool_DataStick.getWithName(1L, "Reads Research result"); + GT_AssemblyLineUtils.setAssemblyLineRecipeOnDataStick(readsDataStick, recipeTT, false); GT_Values.RA.stdBuilder() .itemInputs(aInputs) .itemOutputs(aOutput) .fluidInputs(aFluidInputs) - .special(ItemList.Tool_DataStick.getWithName(1L, "Reads Research result")) + .special(readsDataStick) .duration(assDuration) .eut(assEUt) .ignoreCollision() .fake() .addTo(assemblylineVisualRecipes); - - GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add( - new GT_Recipe.GT_Recipe_AssemblyLine( - CustomItemList.UnusedStuff.get(1), - totalComputationRequired / computationRequiredPerSec, - aInputs, - aFluidInputs, - aOutput, - assDuration, - assEUt)); - TecTechRecipeMaps.researchableALRecipeList.add( - new GT_Recipe.GT_Recipe_AssemblyLine( - aResearchItem, - totalComputationRequired / computationRequiredPerSec, - aInputs, - aFluidInputs, - aOutput, - assDuration, - assEUt)); return true; } @@ -190,30 +196,6 @@ public class TT_recipeAdder extends GT_RecipeAdder { tPersistentHash = tPersistentHash * 31 + assDuration; tPersistentHash = tPersistentHash * 31 + assEUt; - GT_Values.RA.stdBuilder() - .itemInputs(aResearchItem) - .itemOutputs(aOutput) - .special(ItemList.Tool_DataStick.getWithName(1L, "Writes Research result")) - .duration(totalComputationRequired) - .eut(researchEUt) - .metadata(RESEARCH_STATION_DATA, researchAmperage | computationRequiredPerSec << 16) - .noOptimize() - .ignoreCollision() - .fake() - .addTo(researchStationFakeRecipes); - - assemblylineVisualRecipes.addFakeRecipe( - false, - tInputs, - new ItemStack[] { aOutput }, - new ItemStack[] { ItemList.Tool_DataStick.getWithName(1L, "Reads Research result") }, - aFluidInputs, - null, - assDuration, - assEUt, - 0, - tAlts, - false); GT_Recipe_AssemblyLine recipeGT = new GT_Recipe_AssemblyLine( CustomItemList.UnusedStuff.get(1), totalComputationRequired / computationRequiredPerSec, @@ -236,6 +218,35 @@ public class TT_recipeAdder extends GT_RecipeAdder { tAlts); recipeTT.setPersistentHash(tPersistentHash); TecTechRecipeMaps.researchableALRecipeList.add(recipeTT); + + ItemStack writesDataStick = ItemList.Tool_DataStick.getWithName(1L, "Writes Research result"); + GT_AssemblyLineUtils.setAssemblyLineRecipeOnDataStick(writesDataStick, recipeTT, false); + GT_Values.RA.stdBuilder() + .itemInputs(aResearchItem) + .itemOutputs(aOutput) + .special(writesDataStick) + .duration(totalComputationRequired) + .eut(researchEUt) + .metadata(RESEARCH_STATION_DATA, researchAmperage | computationRequiredPerSec << 16) + .noOptimize() + .ignoreCollision() + .fake() + .addTo(researchStationFakeRecipes); + + ItemStack readsDataStick = ItemList.Tool_DataStick.getWithName(1L, "Reads Research result"); + GT_AssemblyLineUtils.setAssemblyLineRecipeOnDataStick(readsDataStick, recipeTT, false); + assemblylineVisualRecipes.addFakeRecipe( + false, + tInputs, + new ItemStack[] { aOutput }, + new ItemStack[] { readsDataStick }, + aFluidInputs, + null, + assDuration, + assEUt, + 0, + tAlts, + false); return true; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index 26dd4248b1..af9439d13a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -20,7 +20,6 @@ import static net.minecraft.util.StatCollector.translateToLocalFormatted; import java.util.ArrayList; import java.util.Collections; -import java.util.LinkedHashMap; import java.util.List; import javax.annotation.Nonnull; @@ -29,8 +28,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.nbt.NBTTagString; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.EnumChatFormatting; @@ -58,6 +55,7 @@ import com.gtnewhorizons.modularui.common.widget.TextWidget; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; +import gregtech.api.enums.TierEU; import gregtech.api.interfaces.IHatchElement; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -69,7 +67,6 @@ import gregtech.api.recipe.check.CheckRecipeResult; import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.recipe.check.SimpleCheckRecipeResult; import gregtech.api.util.GT_AssemblyLineUtils; -import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; @@ -99,8 +96,6 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB // Used to sync currently researching item to GUI private String clientOutputName; - private static LinkedHashMap<String, String> lServerNames; - private static final String[] description = new String[] { EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.research.hint.0"), // 1 - Classic/Data Hatches or @@ -148,183 +143,17 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB private void makeStick() { mInventory[1].setTagCompound(new NBTTagCompound()); - mInventory[1].setStackDisplayName( - GT_LanguageManager.getTranslation(tRecipe.mOutput.getDisplayName()) + " Construction Data"); - GT_Utility.ItemNBT.setBookTitle( - mInventory[1], - GT_LanguageManager.getTranslation(tRecipe.mOutput.getDisplayName()) + " Construction Data"); - NBTTagCompound tNBT = mInventory[1].getTagCompound(); // code above makes it not null - - tNBT.setTag("output", tRecipe.mOutput.writeToNBT(new NBTTagCompound())); - tNBT.setInteger("time", tRecipe.mDuration); - tNBT.setInteger("eu", tRecipe.mEUt); - for (int i = 0; i < tRecipe.mInputs.length; i++) { - tNBT.setTag(String.valueOf(i), tRecipe.mInputs[i].writeToNBT(new NBTTagCompound())); - } - for (int i = 0; i < tRecipe.mFluidInputs.length; i++) { - tNBT.setTag("f" + i, tRecipe.mFluidInputs[i].writeToNBT(new NBTTagCompound())); - } - tNBT.setString( - "author", - EnumChatFormatting.BLUE + "Tec" - + EnumChatFormatting.DARK_BLUE - + "Tech" - + EnumChatFormatting.WHITE - + " Assembling Line Recipe Generator"); - NBTTagList tNBTList = new NBTTagList(); - tNBTList.appendTag( - new NBTTagString( - "Construction plan for " + tRecipe.mOutput.stackSize + mInventory[1].getTagCompound() + .setString( + "author", + EnumChatFormatting.BLUE + "Tec" + + EnumChatFormatting.DARK_BLUE + + "Tech" + + EnumChatFormatting.WHITE + ' ' - + GT_LanguageManager.getTranslation(tRecipe.mOutput.getDisplayName()) - + ". Needed EU/t: " - + tRecipe.mEUt - + " Production time: " - + tRecipe.mDuration / 20)); - for (int i = 0; i < tRecipe.mInputs.length; i++) { - if (tRecipe.mInputs[i] != null) { - tNBTList.appendTag( - new NBTTagString( - "Input Bus " + (i + 1) - + ": " - + tRecipe.mInputs[i].stackSize - + ' ' - + GT_LanguageManager.getTranslation(tRecipe.mInputs[i].getDisplayName()))); - } - } - for (int i = 0; i < tRecipe.mFluidInputs.length; i++) { - if (tRecipe.mFluidInputs[i] != null) { - tNBTList.appendTag( - new NBTTagString( - "Input Hatch " + (i + 1) - + ": " - + tRecipe.mFluidInputs[i].amount - + "L " - + GT_LanguageManager.getTranslation(tRecipe.mFluidInputs[i].getLocalizedName()))); - } - } - tNBT.setTag("pages", tNBTList); - } - - static { - try { - Class<?> GT_Assemblyline_Server = Class.forName("gregtech.api.util.GT_Assemblyline_Server"); - lServerNames = (LinkedHashMap<String, String>) GT_Assemblyline_Server.getField("lServerNames") - .get(null); - } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) { - lServerNames = null; - } - } - - private void makeStick2() { - String s = tRecipe.mOutput.getDisplayName(); - if (getBaseMetaTileEntity().isServerSide()) { - if (lServerNames != null) { - s = lServerNames.get(tRecipe.mOutput.getDisplayName()); - if (s == null) { - s = tRecipe.mOutput.getDisplayName(); - } - } else { - s = tRecipe.mOutput.getDisplayName(); - } - } - mInventory[1].setTagCompound(new NBTTagCompound()); - mInventory[1].setStackDisplayName(s + " Construction Data"); - GT_Utility.ItemNBT.setBookTitle(mInventory[1], s + " Construction Data"); - - NBTTagCompound tNBT = mInventory[1].getTagCompound(); - - tNBT.setTag("output", tRecipe.mOutput.writeToNBT(new NBTTagCompound())); - tNBT.setInteger("time", tRecipe.mDuration); - tNBT.setInteger("eu", tRecipe.mEUt); - for (int i = 0; i < tRecipe.mInputs.length; i++) { - tNBT.setTag("" + i, tRecipe.mInputs[i].writeToNBT(new NBTTagCompound())); - } - for (int i = 0; i < tRecipe.mOreDictAlt.length; i++) { - if (tRecipe.mOreDictAlt[i] != null && tRecipe.mOreDictAlt[i].length > 0) { - tNBT.setInteger("a" + i, tRecipe.mOreDictAlt[i].length); - for (int j = 0; j < tRecipe.mOreDictAlt[i].length; j++) { - tNBT.setTag("a" + i + ":" + j, tRecipe.mOreDictAlt[i][j].writeToNBT(new NBTTagCompound())); - } - } - } - for (int i = 0; i < tRecipe.mFluidInputs.length; i++) { - tNBT.setTag("f" + i, tRecipe.mFluidInputs[i].writeToNBT(new NBTTagCompound())); - } - tNBT.setString( - "author", - EnumChatFormatting.BLUE + "Tec" - + EnumChatFormatting.DARK_BLUE - + "Tech" - + EnumChatFormatting.WHITE - + ' ' - + machineType - + " Recipe Generator"); - NBTTagList tNBTList = new NBTTagList(); - s = tRecipe.mOutput.getDisplayName(); - if (getBaseMetaTileEntity().isServerSide()) { - s = lServerNames.get(tRecipe.mOutput.getDisplayName()); - if (s == null) { - s = tRecipe.mOutput.getDisplayName(); - } - } - tNBTList.appendTag( - new NBTTagString( - "Construction plan for " + tRecipe.mOutput.stackSize - + " " - + s - + ". Needed EU/t: " - + tRecipe.mEUt - + " Production time: " - + (tRecipe.mDuration / 20))); - for (int i = 0; i < tRecipe.mInputs.length; i++) { - if (tRecipe.mOreDictAlt[i] != null) { - int count = 0; - StringBuilder tBuilder = new StringBuilder("Input Bus " + (i + 1) + ": "); - for (ItemStack tStack : tRecipe.mOreDictAlt[i]) { - if (tStack != null) { - s = tStack.getDisplayName(); - if (getBaseMetaTileEntity().isServerSide()) { - s = lServerNames.get(tStack.getDisplayName()); - if (s == null) s = tStack.getDisplayName(); - } - - tBuilder.append(count == 0 ? "" : "\nOr ") - .append(tStack.stackSize) - .append(" ") - .append(s); - count++; - } - } - if (count > 0) tNBTList.appendTag(new NBTTagString(tBuilder.toString())); - } else if (tRecipe.mInputs[i] != null) { - s = tRecipe.mInputs[i].getDisplayName(); - if (getBaseMetaTileEntity().isServerSide()) { - s = lServerNames.get(tRecipe.mInputs[i].getDisplayName()); - if (s == null) { - s = tRecipe.mInputs[i].getDisplayName(); - } - } - tNBTList.appendTag( - new NBTTagString("Input Bus " + (i + 1) + ": " + tRecipe.mInputs[i].stackSize + " " + s)); - } - } - for (int i = 0; i < tRecipe.mFluidInputs.length; i++) { - if (tRecipe.mFluidInputs[i] != null) { - s = tRecipe.mFluidInputs[i].getLocalizedName(); - if (getBaseMetaTileEntity().isServerSide()) { - s = lServerNames.get(tRecipe.mFluidInputs[i].getLocalizedName()); - if (s == null) { - s = tRecipe.mFluidInputs[i].getLocalizedName(); - } - } - tNBTList.appendTag( - new NBTTagString("Input Hatch " + (i + 1) + ": " + tRecipe.mFluidInputs[i].amount + "L " + s)); - } - } - tNBT.setTag("pages", tNBTList); - - mInventory[1].setTagCompound(tNBT); + + machineType + + " Recipe Generator"); + GT_AssemblyLineUtils.setAssemblyLineRecipeOnDataStick(mInventory[1], tRecipe); } private boolean iterateRecipes() { @@ -392,16 +221,13 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB return SimpleCheckRecipeResult.ofFailure("wrongRequirements"); } this.tRecipe = assRecipe; - // Scanner mode should consume item first - eHolders.get(0).mInventory[0] = null; - mInventory[1] = null; // Set property computationRequired = computationRemaining = assRecipe.mResearchTime; mMaxProgresstime = 20; mEfficiencyIncrease = 10000; eRequiredData = 1; eAmpereFlow = 1; - mEUt = -524288; + mEUt = (int) -TierEU.RECIPE_UV; eHolders.get(0) .getBaseMetaTileEntity() .setActive(true); @@ -435,31 +261,12 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB @Override public void outputAfterRecipe_EM() { if (!eHolders.isEmpty()) { - switch (machineType) { - case assembly -> { - if (tRecipe != null && ItemList.Tool_DataStick.isStackEqual(mInventory[1], false, true)) { - eHolders.get(0) - .getBaseMetaTileEntity() - .setActive(false); - eHolders.get(0).mInventory[0] = null; - if (lServerNames == null) { - makeStick(); - } else { - try { - makeStick2(); - } catch (NoSuchFieldError e) { - makeStick(); - } - } - } - } - case scanner -> { - mInventory[1] = ItemList.Tool_DataStick.get(1); - GT_AssemblyLineUtils.setAssemblyLineRecipeOnDataStick(mInventory[1], tRecipe); - eHolders.get(0) - .getBaseMetaTileEntity() - .setActive(false); - } + if (tRecipe != null && ItemList.Tool_DataStick.isStackEqual(mInventory[1], false, true)) { + eHolders.get(0) + .getBaseMetaTileEntity() + .setActive(false); + eHolders.get(0).mInventory[0] = null; + makeStick(); } } computationRequired = computationRemaining = 0; @@ -470,8 +277,8 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB @Override public GT_Multiblock_Tooltip_Builder createTooltip() { final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType(translateToLocal("gt.blockmachines.multimachine.em.research.name")) // Machine Type: Research - // Station + tt.addMachineType(translateToLocal("gt.blockmachines.multimachine.em.research.type")) // Machine Type: Research + // Station, Scanner .addInfo(translateToLocal("gt.blockmachines.multimachine.em.research.desc.0")) // Controller block of // the Research Station .addInfo(translateToLocal("gt.blockmachines.multimachine.em.research.desc.1")) // Used to scan Data @@ -482,6 +289,8 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB .addInfo(translateToLocal("gt.blockmachines.multimachine.em.research.desc.3")) // Does not consume the // item until // the Data Stick is written + .addInfo(translateToLocal("gt.blockmachines.multimachine.em.research.desc.4")) // Use screwdriver to change + // mode .addInfo(translateToLocal("tt.keyword.Structure.StructureTooComplex")) // The structure is too complex! .addSeparator() .beginStructureBlock(3, 7, 7, false) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java index 48c2e44bba..ad0c5a0c97 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java @@ -1518,7 +1518,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM if (!drainEnergyInput( getPowerFlow() * getMaxEfficiency(aStack) / Math.max(1000L, mEfficiency), eAmpereFlow)) { - criticalStopMachine(); + stopMachine(ShutDownReasonRegistry.POWER_LOSS); return false; } } diff --git a/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java b/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java index 1ada9c78d5..dbe0ff2c40 100644 --- a/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java +++ b/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java @@ -367,7 +367,12 @@ public class GT_AssemblyLineUtils { * @return Did we set the new recipe data & Recipe Hash String on the Data Stick? */ public static boolean setAssemblyLineRecipeOnDataStick(ItemStack aDataStick, GT_Recipe_AssemblyLine aNewRecipe) { - if (isItemDataStick(aDataStick)) { + return setAssemblyLineRecipeOnDataStick(aDataStick, aNewRecipe, true); + } + + public static boolean setAssemblyLineRecipeOnDataStick(ItemStack aDataStick, GT_Recipe_AssemblyLine aNewRecipe, + boolean setUpdateTime) { + if (isItemDataStick(aDataStick) && aNewRecipe.mOutput != null) { String s = aNewRecipe.mOutput.getDisplayName(); if (FMLCommonHandler.instance() .getEffectiveSide() @@ -419,29 +424,8 @@ public class GT_AssemblyLineUtils { tNBT.setTag("output", aNewRecipe.mOutput.writeToNBT(new NBTTagCompound())); tNBT.setInteger("time", aNewRecipe.mDuration); tNBT.setInteger("eu", aNewRecipe.mEUt); - for (int i = 0; i < aNewRecipe.mInputs.length; i++) { - tNBT.setTag("" + i, aNewRecipe.mInputs[i].writeToNBT(new NBTTagCompound())); - } - for (int i = 0; i < aNewRecipe.mOreDictAlt.length; i++) { - if (aNewRecipe.mOreDictAlt[i] != null && aNewRecipe.mOreDictAlt[i].length > 0) { - tNBT.setInteger("a" + i, aNewRecipe.mOreDictAlt[i].length); - for (int j = 0; j < aNewRecipe.mOreDictAlt[i].length; j++) { - tNBT.setTag("a" + i + ":" + j, aNewRecipe.mOreDictAlt[i][j].writeToNBT(new NBTTagCompound())); - } - } - } - for (int i = 0; i < aNewRecipe.mFluidInputs.length; i++) { - tNBT.setTag("f" + i, aNewRecipe.mFluidInputs[i].writeToNBT(new NBTTagCompound())); - } tNBT.setString("author", author); NBTTagList tNBTList = new NBTTagList(); - s = aNewRecipe.mOutput.getDisplayName(); - if (FMLCommonHandler.instance() - .getEffectiveSide() - .isServer()) { - s = GT_Assemblyline_Server.lServerNames.get(aNewRecipe.mOutput.getDisplayName()); - if (s == null) s = aNewRecipe.mOutput.getDisplayName(); - } tNBTList.appendTag( new NBTTagString( "Construction plan for " + aNewRecipe.mOutput.stackSize @@ -452,11 +436,17 @@ public class GT_AssemblyLineUtils { + " Production time: " + (aNewRecipe.mDuration / 20))); for (int i = 0; i < aNewRecipe.mInputs.length; i++) { - if (aNewRecipe.mOreDictAlt[i] != null) { + boolean hasSetOreDictAlt = false; + + if (aNewRecipe.mOreDictAlt[i] != null && aNewRecipe.mOreDictAlt[i].length > 0) { + tNBT.setInteger("a" + i, aNewRecipe.mOreDictAlt[i].length); int count = 0; StringBuilder tBuilder = new StringBuilder("Input Bus " + (i + 1) + ": "); - for (ItemStack tStack : aNewRecipe.mOreDictAlt[i]) { + for (int j = 0; j < aNewRecipe.mOreDictAlt[i].length; j++) { + ItemStack tStack = aNewRecipe.mOreDictAlt[i][j]; if (tStack != null) { + tNBT.setTag("a" + i + ":" + j, tStack.writeToNBT(new NBTTagCompound())); + s = tStack.getDisplayName(); if (FMLCommonHandler.instance() .getEffectiveSide() @@ -472,21 +462,33 @@ public class GT_AssemblyLineUtils { count++; } } - if (count > 0) tNBTList.appendTag(new NBTTagString(tBuilder.toString())); - } else if (aNewRecipe.mInputs[i] != null) { - s = aNewRecipe.mInputs[i].getDisplayName(); - if (FMLCommonHandler.instance() - .getEffectiveSide() - .isServer()) { - s = GT_Assemblyline_Server.lServerNames.get(aNewRecipe.mInputs[i].getDisplayName()); - if (s == null) s = aNewRecipe.mInputs[i].getDisplayName(); + if (count > 0) { + tNBTList.appendTag(new NBTTagString(tBuilder.toString())); + hasSetOreDictAlt = true; + } + } + + if (aNewRecipe.mInputs[i] != null) { + tNBT.setTag("" + i, aNewRecipe.mInputs[i].writeToNBT(new NBTTagCompound())); + + if (!hasSetOreDictAlt) { + s = aNewRecipe.mInputs[i].getDisplayName(); + if (FMLCommonHandler.instance() + .getEffectiveSide() + .isServer()) { + s = GT_Assemblyline_Server.lServerNames.get(aNewRecipe.mInputs[i].getDisplayName()); + if (s == null) s = aNewRecipe.mInputs[i].getDisplayName(); + } + tNBTList.appendTag( + new NBTTagString( + "Input Bus " + (i + 1) + ": " + aNewRecipe.mInputs[i].stackSize + " " + s)); } - tNBTList.appendTag( - new NBTTagString("Input Bus " + (i + 1) + ": " + aNewRecipe.mInputs[i].stackSize + " " + s)); } } for (int i = 0; i < aNewRecipe.mFluidInputs.length; i++) { if (aNewRecipe.mFluidInputs[i] != null) { + tNBT.setTag("f" + i, aNewRecipe.mFluidInputs[i].writeToNBT(new NBTTagCompound())); + s = aNewRecipe.mFluidInputs[i].getLocalizedName(); if (FMLCommonHandler.instance() .getEffectiveSide() @@ -500,7 +502,7 @@ public class GT_AssemblyLineUtils { } } tNBT.setTag("pages", tNBTList); - tNBT.setLong("lastUpdate", System.currentTimeMillis()); + if (setUpdateTime) tNBT.setLong("lastUpdate", System.currentTimeMillis()); aDataStick.setTagCompound(tNBT); // Set recipe hash setRecipeHashOnDataStick(aDataStick, aHash); diff --git a/src/main/java/gregtech/api/util/GT_RecipeConstants.java b/src/main/java/gregtech/api/util/GT_RecipeConstants.java index 7077654fb4..a8cdb19b7a 100644 --- a/src/main/java/gregtech/api/util/GT_RecipeConstants.java +++ b/src/main/java/gregtech/api/util/GT_RecipeConstants.java @@ -480,12 +480,28 @@ public class GT_RecipeConstants { tPersistentHash = tPersistentHash * 31 + aResearchTime; tPersistentHash = tPersistentHash * 31 + r.mDuration; tPersistentHash = tPersistentHash * 31 + r.mEUt; + + GT_Recipe.GT_Recipe_AssemblyLine tRecipe = new GT_Recipe.GT_Recipe_AssemblyLine( + aResearchItem, + aResearchTime, + r.mInputs, + r.mFluidInputs, + aOutput, + r.mDuration, + r.mEUt, + r.mOreDictAlt); + tRecipe.setPersistentHash(tPersistentHash); + GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add(tRecipe); + GT_AssemblyLineUtils.addRecipeToCache(tRecipe); + + ItemStack writesDataStick = ItemList.Tool_DataStick.getWithName(1L, "Writes Research result"); + GT_AssemblyLineUtils.setAssemblyLineRecipeOnDataStick(writesDataStick, tRecipe, false); Collection<GT_Recipe> ret = new ArrayList<>(3); ret.addAll( GT_Values.RA.stdBuilder() .itemInputs(aResearchItem) .itemOutputs(aOutput) - .special(ItemList.Tool_DataStick.getWithName(1L, "Writes Research result")) + .special(writesDataStick) .duration(aResearchTime) .eut(TierEU.RECIPE_LV) .specialValue(-201) // means it's scanned @@ -494,12 +510,14 @@ public class GT_RecipeConstants { .fake() .addTo(scannerFakeRecipes)); + ItemStack readsDataStick = ItemList.Tool_DataStick.getWithName(1L, "Reads Research result"); + GT_AssemblyLineUtils.setAssemblyLineRecipeOnDataStick(readsDataStick, tRecipe, false); ret.add( RecipeMaps.assemblylineVisualRecipes.addFakeRecipe( false, r.mInputs, new ItemStack[] { aOutput }, - new ItemStack[] { ItemList.Tool_DataStick.getWithName(1L, "Reads Research result") }, + new ItemStack[] { readsDataStick }, r.mFluidInputs, null, r.mDuration, @@ -508,18 +526,6 @@ public class GT_RecipeConstants { r.mOreDictAlt, false)); - GT_Recipe.GT_Recipe_AssemblyLine tRecipe = new GT_Recipe.GT_Recipe_AssemblyLine( - aResearchItem, - aResearchTime, - r.mInputs, - r.mFluidInputs, - aOutput, - r.mDuration, - r.mEUt, - r.mOreDictAlt); - tRecipe.setPersistentHash(tPersistentHash); - GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add(tRecipe); - GT_AssemblyLineUtils.addRecipeToCache(tRecipe); return ret; }); diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index 65350025a5..3bfc3a13e7 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -763,13 +763,14 @@ gt.blockmachines.multimachine.em.scanner.hint.2=3 - Elemental Output Hatches or gt.blockmachines.multimachine.em.scanner.hint.3=4 - Elemental Overflow Hatches or Molecular Casing gt.blockmachines.multimachine.em.scanner.desc.0=Controller block of the Elemental Scanner -gt.blockmachines.multimachine.em.research.name=Research Station +gt.blockmachines.multimachine.em.research.type=Research Station, Scanner gt.blockmachines.multimachine.em.research.hint.0=1 - Classic/Data Hatches or Computer casing gt.blockmachines.multimachine.em.research.hint.1=2 - Holder Hatch gt.blockmachines.multimachine.em.research.desc.0=Controller block of the Research Station gt.blockmachines.multimachine.em.research.desc.1=Used to scan Data Sticks for Assembling Line Recipes gt.blockmachines.multimachine.em.research.desc.2=Needs to be fed with computation to work gt.blockmachines.multimachine.em.research.desc.3=Does not consume the item until the Data Stick is written +gt.blockmachines.multimachine.em.research.desc.4=Use screwdriver to change mode gt.blockmachines.multimachine.em.research.mode.Assembly_line=Mode: Research Station gt.blockmachines.multimachine.em.research.mode.Scanner=Mode: Scanner |