diff options
author | Technus <daniel112092@gmail.com> | 2017-08-16 17:12:13 +0200 |
---|---|---|
committer | Technus <daniel112092@gmail.com> | 2017-08-19 11:05:14 +0200 |
commit | 655fde447950c738b916d50d7c4307749afd36b1 (patch) | |
tree | fbd77d245517971b99dce87ebe75a9c704af792d /src/main/java | |
parent | 966b1fb62e73c50cda748e8cb8ca9ce1ba7122f2 (diff) | |
download | GT5-Unofficial-655fde447950c738b916d50d7c4307749afd36b1.tar.gz GT5-Unofficial-655fde447950c738b916d50d7c4307749afd36b1.tar.bz2 GT5-Unofficial-655fde447950c738b916d50d7c4307749afd36b1.zip |
Add quantum stuff block, recipe adder methods x2 and some more research multiblock code to go with it
Diffstat (limited to 'src/main/java')
14 files changed, 595 insertions, 91 deletions
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/rElementalRecipeMap.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/rElementalRecipeMap.java index 2ae8ddbede..57effa005e 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/rElementalRecipeMap.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/rElementalRecipeMap.java @@ -36,6 +36,10 @@ public class rElementalRecipeMap {//TODO FIX return recipes.remove(map);//suspicious but ok, equals and hashcode methods are adjusted for that } + public HashMap<Short, rElementalRecipe> findExact(cElementalInstanceStackMap in) { + return recipes.get(in.toDefinitionMapForComparison());//suspicious but ok, equals and hashcode methods are adjusted for that + } + //Recipe founding should not check amounts - this checks if the types of matter in map are equal to any recipe! //Return a recipeShortMap when the content of input is equal (ignoring amounts and instance data) @Deprecated @@ -43,10 +47,6 @@ public class rElementalRecipeMap {//TODO FIX return recipes.get(in);//suspicious but ok, equals and hashcode methods are adjusted for that } - public HashMap<Short, rElementalRecipe> findExact(cElementalInstanceStackMap in) { - return recipes.get(in.toDefinitionMapForComparison());//suspicious but ok, equals and hashcode methods are adjusted for that - } - //this does check if the map contains all the requirements for any recipe, and the required amounts //Return a recipeShortMap when the content of input matches the recipe input - does not ignore amounts but ignores instance data! @Deprecated diff --git a/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java b/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java index 344fa44ff9..4704b369ba 100644 --- a/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java @@ -2,6 +2,7 @@ package com.github.technus.tectech.loader; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.thing.block.QuantumGlassBlock; +import com.github.technus.tectech.thing.block.QuantumStuffBlock; import com.github.technus.tectech.thing.casing.GT_Block_CasingsTT; import com.github.technus.tectech.thing.casing.GT_Block_HintTT; import com.github.technus.tectech.thing.casing.TT_Container_Casings; @@ -25,6 +26,9 @@ public class ThingsLoader implements Runnable { QuantumGlassBlock.run(); TecTech.Logger.info("Quantum Glass registered"); + QuantumStuffBlock.run(); + TecTech.Logger.info("Quantum Stuff registered"); + if(Loader.isModLoaded("openmodularturrets")) { TurretHeadEM.run(); TecTech.Logger.info("TurretHeadEM registered"); diff --git a/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java b/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java index 443a069d2e..b488e29ee7 100644 --- a/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java +++ b/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java @@ -11,7 +11,7 @@ public class NEI_TT_Config implements IConfigureNEI {//must be NEI*Config public void loadConfig() { sIsAdded = false; if(FMLCommonHandler.instance().getEffectiveSide().isClient()) - TT_RH =new TT_NEI_ResearchHandler(TT_recipe.TT_Recipe_Map.sResearchableFakeRecipes); + TT_RH =new TT_NEI_ResearchHandler(TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes); sIsAdded = true; } diff --git a/src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java b/src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java index 54035707ca..f4a8ca8e7e 100644 --- a/src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java +++ b/src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java @@ -44,9 +44,9 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { GuiContainerManager.addTooltipHandler(new GT_RectHandler()); } - protected final TT_recipe.TT_Recipe_Map mRecipeMap; + protected final TT_recipe.GT_Recipe_MapTT mRecipeMap; - public TT_NEI_ResearchHandler(TT_recipe.TT_Recipe_Map aRecipeMap) { + public TT_NEI_ResearchHandler(TT_recipe.GT_Recipe_MapTT aRecipeMap) { this.mRecipeMap = aRecipeMap; this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), getOverlayIdentifier())); if (!NEI_TT_Config.sIsAdded) { diff --git a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java index ab1307cb3e..89eae43bcd 100644 --- a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java +++ b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.proxy; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.entity.fx.BlockHint; import com.github.technus.tectech.thing.block.QuantumGlassRender; +import com.github.technus.tectech.thing.block.QuantumStuffRender; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; @@ -42,6 +43,9 @@ public class ClientProxy extends CommonProxy { QuantumGlassRender.renderID = RenderingRegistry.getNextAvailableRenderId(); RenderingRegistry.registerBlockHandler(QuantumGlassRender.renderID, new QuantumGlassRender()); + QuantumStuffRender.renderID = RenderingRegistry.getNextAvailableRenderId(); + RenderingRegistry.registerBlockHandler(QuantumStuffRender.renderID, new QuantumStuffRender()); + if(Loader.isModLoaded("openmodularturrets")) { TurretHeadRenderEM turretHeadRenderEM=new TurretHeadRenderEM(); ClientRegistry.bindTileEntitySpecialRenderer(TileTurretHeadEM.class, turretHeadRenderEM); diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java index f131dde200..a3f6f9ea17 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java @@ -1,16 +1,174 @@ package com.github.technus.tectech.recipe; +import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStackMap; +import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackMap; +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_Recipe; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; -public class TT_recipe /*extends GT_Recipe*/ { - public static class TT_Recipe_Map extends GT_Recipe.GT_Recipe_Map { - public static TT_Recipe_Map sResearchableFakeRecipes =new TT_Recipe_Map(new HashSet(30), "gt.recipe.researchStation", "Research station", (String)null, "gregtech:textures/gui/multimachines/ResearchFake", 1, 1, 1, 0, 1, "", 1, "", true, false);//nei to false - using custom handler +public class TT_recipe extends GT_Recipe { + public final cElementalDefinitionStackMap input[],output[], eCatalyst[]; + public final AdditionalCheck additionalCheck; - public TT_Recipe_Map (Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { + public TT_recipe(boolean aOptimize, + ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, + FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue, + cElementalDefinitionStackMap[] in, cElementalDefinitionStackMap[] out, cElementalDefinitionStackMap[] catalyst, AdditionalCheck check){ + super(aOptimize,aInputs,aOutputs,aSpecialItems,aChances,aFluidInputs,aFluidOutputs,aDuration,aEUt,aSpecialValue); + input=in; + output=out; + eCatalyst=catalyst; + additionalCheck=check; + } + + public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks){ + return EMisRecipeInputEqual(consume,doNotCheckStackSizes,itemStacks,fluidStacks,null,null); + } + + public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap[] in){ + return EMisRecipeInputEqual(consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,null); + } + + public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap[] in, cElementalInstanceStackMap[] catalyst) { + if(additionalCheck !=null && !additionalCheck.check(this,consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,catalyst)) return false; + if (this.eCatalyst != null) { + if (catalyst != null && catalyst.length >= this.eCatalyst.length) { + for (int i = 0; i < this.eCatalyst.length; i++) { + if (this.eCatalyst[i] != null && this.eCatalyst[i].hasStacks()) { + if (catalyst[i] != null && catalyst[i].hasStacks()) { + if (!catalyst[i].removeAllAmounts(true, this.eCatalyst[i])) return false; + } else { + return false; + } + } + } + } else { + return false; + } + } + if (input != null) { + if (in != null && in.length >= input.length) { + for (int i = 0; i < input.length; i++) { + if (input[i] != null && input[i].hasStacks()) { + if (in[i] != null && in[i].hasStacks()) { + if (!in[i].removeAllAmounts(consume, input[i])) return false; + } else { + return false; + } + } + } + } else { + return false; + } + } + return super.isRecipeInputEqual(consume, doNotCheckStackSizes, fluidStacks, itemStacks); + } + + public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap in){ + return EMisRecipeInputEqualConsumeFromOne(consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,null); + } + + public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap in, cElementalInstanceStackMap[] catalyst) { + if(additionalCheck !=null && !additionalCheck.check(this,consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,catalyst)) return false; + if (this.eCatalyst != null) { + if (catalyst != null && catalyst.length >= this.eCatalyst.length) { + for (int i = 0; i < this.eCatalyst.length; i++) { + if (this.eCatalyst[i] != null && this.eCatalyst[i].hasStacks()) { + if (catalyst[i] != null && catalyst[i].hasStacks()) { + if (!catalyst[i].removeAllAmounts(true, this.eCatalyst[i])) return false; + } else { + return false; + } + } + } + } else { + return false; + } + } + if (input != null) { + if (in != null) { + for (int i = 0; i < input.length; i++) { + if (input[i] != null && input[i].hasStacks()) { + if (in.hasStacks()) { + if (!in.removeAllAmounts(consume, input[i])) return false; + } else { + return false; + } + } + } + } else { + return false; + } + } + return super.isRecipeInputEqual(consume, doNotCheckStackSizes, fluidStacks, itemStacks); + } + + public interface AdditionalCheck { + boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap[] in, cElementalInstanceStackMap[] e); + boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap in, cElementalInstanceStackMap[] e); + } + + public static class TT_Recipe_Map<T extends TT_recipe> { + public static TT_Recipe_Map<TT_assLineRecipe> sEMcrafterRecipes = new TT_Recipe_Map(); + public static TT_Recipe_Map<TT_assLineRecipe> sEMmachineRecipes = new TT_Recipe_Map(); + + public final HashMap<String,T> mRecipeMap; + + public TT_Recipe_Map(){ + mRecipeMap =new HashMap<>(16); + } + + public T findRecipe(String identifier){ + return mRecipeMap.get(identifier); + } + + public T findRecipe(ItemStack dataHandler){ + if(dataHandler==null || dataHandler.stackTagCompound==null) return null; + return mRecipeMap.get(dataHandler.stackTagCompound.getString("mapID")); + } + + public void add(String identifier, T recipe){ + if(identifier.length()==0) return; + mRecipeMap.put(identifier,recipe); + } + + public Collection<T> recipeList(){ + return mRecipeMap.values(); + } + } + + public static class GT_Recipe_MapTT extends GT_Recipe.GT_Recipe_Map { + public static GT_Recipe_MapTT sResearchableFakeRecipes =new GT_Recipe_MapTT(new HashSet(30), "gt.recipe.researchStation", "Research station", (String)null, "gregtech:textures/gui/multimachines/ResearchFake", 1, 1, 1, 0, 1, "", 1, "", true, false);//nei to false - using custom handler + + public GT_Recipe_MapTT(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); } } + + public static class TT_assLineRecipe extends TT_recipe{ + public final ItemStack mResearchItem; + public final String id; + + public TT_assLineRecipe(boolean aOptimize, ItemStack researchItem, + ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, + FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, + cElementalDefinitionStackMap[] in, cElementalDefinitionStackMap[] out, cElementalDefinitionStackMap[] catalyst, AdditionalCheck check) { + super(aOptimize, aInputs, aOutputs, aSpecialItems, null, aFluidInputs, null, aDuration, aEUt, aSpecialValue, in, out, catalyst, check); + mResearchItem=researchItem; + GameRegistry.UniqueIdentifier id=GameRegistry.findUniqueIdentifierFor(aOutputs[0].getItem()); + this.id=id.modId+":"+id.name+":"+aOutputs[0].getItemDamage(); + } + + public TT_assLineRecipe(boolean aOptimize, ItemStack researchItem, + ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, + FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, + cElementalDefinitionStackMap[] in) { + this(aOptimize, researchItem, aInputs, aOutputs, aSpecialItems, aFluidInputs, aDuration, aEUt, aSpecialValue, in, null, null,null); + } + } } 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 460a9aa056..ffeeb9ec0f 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 @@ -1,6 +1,9 @@ package com.github.technus.tectech.recipe; -import gregtech.api.GregTech_API; +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStackMap; +import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_research; +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.ItemList; import gregtech.api.util.GT_Recipe; import gregtech.common.GT_RecipeAdder; @@ -8,38 +11,78 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; public class TT_recipeAdder extends GT_RecipeAdder { + public static final ItemStack[] nullItem=new ItemStack[0]; + public static final FluidStack[] nullFluid=new FluidStack[0]; + public static boolean addResearchableAssemblylineRecipe(ItemStack aResearchItem, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput, int assDuration, int assEUt) { - if(aInputs==null)aInputs=new ItemStack[0]; - if(aFluidInputs==null)aFluidInputs=new FluidStack[0]; + if(aInputs==null)aInputs=nullItem; + if(aFluidInputs==null)aFluidInputs=nullFluid; if ((aResearchItem==null)||(totalComputationRequired<=0)||(aOutput == null) || aInputs.length>15) { return false; } - if ((assDuration = GregTech_API.sRecipeFile.get("assemblingline", aOutput, assDuration)) <= 0) { - return false; - } for(ItemStack tItem : aInputs){ if(tItem==null){ - System.out.println("addAssemblingLineRecipe "+aResearchItem.getDisplayName()+" --> "+aOutput.getUnlocalizedName()+" there is some null item in that recipe"); + TecTech.Logger.error("addAssemblingLineRecipe "+aResearchItem.getDisplayName()+" --> "+aOutput.getUnlocalizedName()+" there is some null item in that recipe"); } } if(researchAmperage<=0) researchAmperage=1; else if(researchAmperage > Short.MAX_VALUE) researchAmperage=Short.MAX_VALUE; if(computationRequiredPerSec<=0) computationRequiredPerSec=1; else if(computationRequiredPerSec > Short.MAX_VALUE) computationRequiredPerSec=Short.MAX_VALUE; - TT_recipe.TT_Recipe_Map.sResearchableFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Writes Research result")}, null, null, totalComputationRequired, researchEUt, researchAmperage|(computationRequiredPerSec<<16)); + TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Writes Research result")}, null, null, totalComputationRequired, researchEUt, researchAmperage|(computationRequiredPerSec<<16)); GT_Recipe.GT_Recipe_Map.sAssemblylineVisualRecipes.addFakeRecipe(false, aInputs, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Reads Research result")}, aFluidInputs, null, assDuration, assEUt, 0,true); GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add(new GT_Recipe.GT_Recipe_AssemblyLine( aResearchItem, 0/*ignored*/, aInputs, aFluidInputs, aOutput, assDuration, assEUt)); return true; } - //public boolean addResearchableEMAssemblyRecipe(ItemStack aResearchItem, int computationRequired, rElementalRecipe emREcipe, int aDuration, int aEUt) { - // if ((aResearchItem==null)||(computationRequired<=0)||(emREcipe == null)) { - // return false; - // } - // todo write recipe maps - // GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Writes Research result", new Object[0])}, null, null, computationRequired, 30, 0); - // GT_Recipe.GT_Recipe_Map.sAssemblylineVisualRecipes.addFakeRecipe(false, aInputs, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Reads Research result", new Object[0])}, aFluidInputs, null, aDuration, aEUt, 0,true); - // GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add(new GT_Recipe.GT_Recipe_AssemblyLine( aResearchItem, computationRequired, aInputs, aFluidInputs, aOutput, aDuration, aEUt)); - // return true; - //} + /* + (boolean aOptimize, + ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, + FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue, + cElementalDefinitionStackMap[] in, cElementalDefinitionStackMap[] out, cElementalDefinitionStackMap[] catalyst, AdditionalCheck check) + */ + + public static boolean addResearchableEMmachineRecipe( + ItemStack aResearchItem, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, + ItemStack[] aInputs, FluidStack[] aFluidInputs, cElementalDefinitionStackMap[] eInputs, + ItemStack aOutput, int machineDuration, int machineEUt, int machineAmperage) { + if(aInputs==null)aInputs=nullItem; + if(aFluidInputs==null)aFluidInputs=nullFluid; + if ((aResearchItem==null)||(totalComputationRequired<=0)||(aOutput == null)) { + return false; + } + for(ItemStack tItem : aInputs){ + if(tItem==null){ + TecTech.Logger.error("addAssemblingLineRecipe "+aResearchItem.getDisplayName()+" --> "+aOutput.getUnlocalizedName()+" there is some null item in that recipe"); + } + } + if(researchAmperage<=0) researchAmperage=1; + else if(researchAmperage > Short.MAX_VALUE) researchAmperage=Short.MAX_VALUE; + if(computationRequiredPerSec<=0) computationRequiredPerSec=1; + else if(computationRequiredPerSec > Short.MAX_VALUE) computationRequiredPerSec=Short.MAX_VALUE; + TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_research.machine)}, null, null, totalComputationRequired, researchEUt, researchAmperage|(computationRequiredPerSec<<16)); + TT_recipe.TT_Recipe_Map.sEMmachineRecipes.add(GameRegistry.findUniqueIdentifierFor(aOutput.getItem()).modId+":"+aOutput.getUnlocalizedName()+":"+aOutput.getItemDamage(), + new TT_recipe.TT_assLineRecipe(false,aResearchItem,aInputs,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, + aFluidInputs,machineDuration,machineEUt,machineAmperage,eInputs)); + return true; + } + + public static boolean addResearchableEMcrafterRecipe( + ItemStack aResearchItem, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, + cElementalDefinitionStackMap[] eInputs, cElementalDefinitionStackMap[] catalyst, TT_recipe.AdditionalCheck check, + ItemStack aOutput, int crafterDuration, int crafterEUt, int crafterAmperage) { + if ((aResearchItem==null)||(totalComputationRequired<=0)||(aOutput == null)) { + return false; + } + if(researchAmperage<=0) researchAmperage=1; + else if(researchAmperage > Short.MAX_VALUE) researchAmperage=Short.MAX_VALUE; + if(computationRequiredPerSec<=0) computationRequiredPerSec=1; + else if(computationRequiredPerSec > Short.MAX_VALUE) computationRequiredPerSec=Short.MAX_VALUE; + TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+GT_MetaTileEntity_EM_research.crafter)}, null, null, totalComputationRequired, researchEUt, researchAmperage|(computationRequiredPerSec<<16)); + GameRegistry.UniqueIdentifier id=GameRegistry.findUniqueIdentifierFor(aOutput.getItem()); + TT_recipe.TT_Recipe_Map.sEMcrafterRecipes.add(id.modId+":"+id.name+":"+aOutput.getItemDamage(), + new TT_recipe.TT_assLineRecipe(false,aResearchItem,null,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, + null,crafterDuration,crafterEUt,crafterAmperage,eInputs,null,catalyst,check)); + return true; + } } diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java index f96a104ce9..94a948593e 100644 --- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java +++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java @@ -31,11 +31,16 @@ public enum CustomItemList implements IItemContainer { Parametrizer_Hatch, Uncertainty_Hatch, UncertaintyX_Hatch, dataIn_Hatch, dataOut_Hatch, eM_Containment, eM_Containment_Field, eM_Containment_Advanced, eM_Coil, eM_Teleportation, eM_Dimensional, eM_Ultimate_Containment, eM_Ultimate_Containment_Advanced, eM_Ultimate_Containment_Field, eM_Spacetime, eM_Computer_Casing, eM_Computer_Bus, eM_Computer_Vent, eM_Hollow, eM_Power, debugBlock, + Machine_Multi_Microwave, + Machine_Multi_Transformer, + Machine_Multi_Computer, Machine_Multi_Switch, Machine_Multi_Research, + Machine_Multi_MatterToEM, Machine_Multi_EMToMatter, Machine_Multi_EMjunction, Machine_Multi_Scanner, Machine_Multi_EssentiaToEM, Machine_Multi_EMToEssentia, - Machine_Multi_MatterToEM, Machine_Multi_EMToMatter, Machine_Multi_EMjunction, - Machine_Multi_Transformer, Machine_Multi_Computer, Machine_Multi_Microwave, Machine_Multi_Infuser, Machine_Multi_Switch, - Machine_Multi_BHG, Machine_Multi_Annihilation, Machine_Multi_Decay, - Machine_Multi_EMmachine, Machine_Multi_Stabilizer, Machine_Multi_Collider, Machine_Multi_Wormhole, Machine_Multi_EMCrafter, Machine_Multi_Scanner, Machine_Multi_Research, + Machine_Multi_Infuser, Machine_Multi_Collider, + Machine_Multi_Decay, Machine_Multi_EMmachine, + Machine_Multi_Stabilizer, Machine_Multi_EMCrafter, + Machine_Multi_Wormhole, Machine_Multi_Annihilation, + Machine_Multi_BHG, hint_0,hint_1,hint_2,hint_3,hint_4,hint_5,hint_6,hint_7,hint_8,hint_9,hint_10,hint_11, hint_general,hint_air,hint_noAir,hint_error; diff --git a/src/main/java/com/github/technus/tectech/thing/block/QuantumStuffBlock.java b/src/main/java/com/github/technus/tectech/thing/block/QuantumStuffBlock.java new file mode 100644 index 0000000000..a244ed2829 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/block/QuantumStuffBlock.java @@ -0,0 +1,102 @@ +package com.github.technus.tectech.thing.block; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import eu.usrv.yamcore.blocks.BlockBase; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +import java.util.ArrayList; +import java.util.Random; + +import static com.github.technus.tectech.auxiliary.Reference.MODID; + +/** + * Created by danie_000 on 17.12.2016. + */ +public final class QuantumStuffBlock extends BlockBase { + public static IIcon stuff; + public static QuantumStuffBlock INSTANCE; + + public QuantumStuffBlock() { + super(Material.iron); + this.setBlockBounds(0, 0, 0, 1, 1, 1); + setBlockName("quantumStuff"); + setHarvestLevel("wrench", 0); + setHardness(500); + setResistance(1); + setLightOpacity(0); + setBlockTextureName(MODID + ":blockQuantumStuff"); + } + + @Override + public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) { + return false; + } + + @Override + public void registerBlockIcons(IIconRegister p_149651_1_) { + super.registerBlockIcons(p_149651_1_); + stuff = this.blockIcon; + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean getCanBlockGrass() { + return false; + } + + //@Override + //public boolean canRenderInPass(int pass) { + // return true; + //} + + @Override + public boolean canBeReplacedByLeaves(IBlockAccess world, int x, int y, int z) { + return false; + } + + @SideOnly(Side.CLIENT) + public int getRenderBlockPass() { + return 1; + } + + public boolean renderAsNormalBlock() { + return false; + } + + @SideOnly(Side.CLIENT) + public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) { + return false; + } + + @Override + public int getRenderType() { + return QuantumStuffRender.renderID; + } + + public static void run() { + INSTANCE = new QuantumStuffBlock(); + GameRegistry.registerBlock(INSTANCE, INSTANCE.getUnlocalizedName()); + } + + @Override + public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) { + return new ArrayList<>(); + } + + @Override + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { + return null; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/block/QuantumStuffRender.java b/src/main/java/com/github/technus/tectech/thing/block/QuantumStuffRender.java new file mode 100644 index 0000000000..7890ecd028 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/block/QuantumStuffRender.java @@ -0,0 +1,99 @@ +package com.github.technus.tectech.thing.block; + +import com.github.technus.tectech.TecTech; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.IIcon; +import net.minecraft.util.Vec3; +import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +/** + * Created by danie_000 on 19.12.2016. + */ +public final class QuantumStuffRender implements ISimpleBlockRenderingHandler { + public static int renderID; + private static Vec3 pos; + private static Tessellator tes=Tessellator.instance; + + public QuantumStuffRender() {} + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + GL11.glPushMatrix(); + //Get icons from custom register (useful for renderers and fluids) + IIcon side = QuantumStuffBlock.stuff; + tes.startDrawingQuads(); + tes.setNormal(0.0F, -1.0F, 0.0F); + renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, side); + tes.draw(); + tes.startDrawingQuads(); + tes.setNormal(0.0F, 0.0F, -1.0F); + renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, side); + tes.draw(); + tes.startDrawingQuads(); + tes.setNormal(0.0F, 0.0F, 1.0F); + renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, side); + tes.draw(); + tes.startDrawingQuads(); + tes.setNormal(-1.0F, 0.0F, 0.0F); + renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, side); + tes.draw(); + tes.startDrawingQuads(); + tes.setNormal(1.0F, 0.0F, 0.0F); + renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, side); + tes.draw(); + tes.startDrawingQuads(); + tes.setNormal(0.0F, 1.0F, 0.0F); + renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, side); + tes.draw(); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + GL11.glPopMatrix(); + } + + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + //renderer.renderStandardBlock(block, x, y, z); + GL11.glPushMatrix(); + tes.setNormal(0F, 1F, 0F); + tes.setBrightness(15728880); + IIcon side = QuantumStuffBlock.stuff; + for(int i=0;i<6;i++){ + float b = 1 - (TecTech.Rnd.nextFloat() / 4f), g = b - (TecTech.Rnd.nextFloat() / 4f), r = g - (TecTech.Rnd.nextFloat() / 4f) - 0.25f; + tes.setColorOpaque_F(r, g, b); + float rotX=TecTech.Rnd.nextFloat()*2*(float) Math.PI,rotY=TecTech.Rnd.nextFloat()*2*(float) Math.PI,rotZ=TecTech.Rnd.nextFloat()*2*(float) Math.PI; + tesAbuse(x,y,z,-1.425f,-1.425f,.1f,rotX,rotY,rotZ,side.getMinU(), side.getMaxV()); + tesAbuse(x,y,z,-1.425f,1.425f,.1f,rotX,rotY,rotZ,side.getMinU(), side.getMinV()); + tesAbuse(x,y,z,1.425f,1.425f,.1f,rotX,rotY,rotZ,side.getMaxU(), side.getMinV()); + tesAbuse(x,y,z,1.425f,-1.425f,.1f,rotX,rotY,rotZ,side.getMaxU(), side.getMaxV()); + + tesAbuse(x,y,z,1.425f,-1.425f,-.1f,rotX,rotY,rotZ,side.getMaxU(), side.getMaxV()); + tesAbuse(x,y,z,1.425f,1.425f,-.1f,rotX,rotY,rotZ,side.getMaxU(), side.getMinV()); + tesAbuse(x,y,z,-1.425f,1.425f,-.1f,rotX,rotY,rotZ,side.getMinU(), side.getMinV()); + tesAbuse(x,y,z,-1.425f,-1.425f,-.1f,rotX,rotY,rotZ,side.getMinU(), side.getMaxV()); + } + GL11.glPopMatrix(); + return true; + } + + private void tesAbuse(int x, int y, int z, float sx, float sy, float sz, float rotX, float rotY, float rotZ,float sideU, float sideV){ + pos=Vec3.createVectorHelper(sx,sy,sz); + pos.rotateAroundX(rotX); + pos.rotateAroundY(rotY); + pos.rotateAroundZ(rotZ); + tes.addVertexWithUV(pos.xCoord+x+.5f, pos.yCoord+y+.5f, pos.zCoord+z+.5f, sideU, sideV); + } + + + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } + + @Override + public int getRenderId() { + return QuantumStuffRender.renderID; + } +} 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 83d55187c3..8f5ff2c603 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 @@ -40,7 +40,10 @@ import static gregtech.api.enums.GT_Values.E; public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { private final ArrayList<GT_MetaTileEntity_Hatch_Holder> eHolders = new ArrayList<>(); private GT_Recipe.GT_Recipe_AssemblyLine tRecipe; + private TT_recipe.TT_assLineRecipe aRecipe; + private String machineType; private long computationRemaining,computationRequired; + public final static String crafter="EM Crafting",machine="EM Machinery"; //region structure private static final String[][] shape = new String[][]{ @@ -120,47 +123,104 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB @Override protected void EM_onFirstTick() { if(computationRemaining>0) { - tRecipe = null; - if (!eHolders.isEmpty() && eHolders.get(0).mInventory[0] != null && - ItemList.Tool_DataStick.isStackEqual(mInventory[1], false, true)) { + aRecipe=null; + tRecipe=null; + if (!eHolders.isEmpty() && eHolders.get(0).mInventory[0] != null) { ItemStack researchItem = eHolders.get(0).mInventory[0]; - for (GT_Recipe.GT_Recipe_AssemblyLine tRecipe : GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes) { - if (GT_Utility.areStacksEqual(tRecipe.mResearchItem, researchItem, true)) { - this.tRecipe = tRecipe; + if(ItemList.Tool_DataStick.isStackEqual(mInventory[1], false, true)) { + for (GT_Recipe.GT_Recipe_AssemblyLine tRecipe : GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes) { + if (GT_Utility.areStacksEqual(tRecipe.mResearchItem, researchItem, true)) { + this.tRecipe = tRecipe; + } + } + }else if(ItemList.Tool_DataOrb.isStackEqual(mInventory[1], false, true)) { + for (TT_recipe.TT_assLineRecipe assRecipeTT:TT_recipe.TT_Recipe_Map.sEMmachineRecipes.recipeList()){ + if (GT_Utility.areStacksEqual(assRecipeTT.mResearchItem, researchItem, true)) { + this.aRecipe = assRecipeTT; + machineType=machine; + } + } + for (TT_recipe.TT_assLineRecipe assRecipeTT:TT_recipe.TT_Recipe_Map.sEMcrafterRecipes.recipeList()){ + if (GT_Utility.areStacksEqual(assRecipeTT.mResearchItem, researchItem, true)) { + this.aRecipe = assRecipeTT; + machineType=crafter; + } } } } - if (tRecipe == null) { + if (tRecipe == null && aRecipe == null) { + computationRequired=computationRemaining=0; mMaxProgresstime = 0; mEfficiencyIncrease = 0; for (GT_MetaTileEntity_Hatch_Holder r : eHolders) - r.getBaseMetaTileEntity().setActive(false); + r.getBaseMetaTileEntity().setActive(false); } } } @Override public boolean EM_checkRecipe(ItemStack itemStack) { - if(!eHolders.isEmpty() && eHolders.get(0).mInventory[0]!=null && - ItemList.Tool_DataStick.isStackEqual(itemStack, false, true)){ - ItemStack researchItem=eHolders.get(0).mInventory[0]; - for(GT_Recipe.GT_Recipe_AssemblyLine tRecipe:GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes){ - if(GT_Utility.areStacksEqual(tRecipe.mResearchItem, researchItem, true)){ - this.tRecipe=tRecipe; - //if found - for(GT_Recipe ttRecipe: TT_recipe.TT_Recipe_Map.sResearchableFakeRecipes.mRecipeList){ - if(GT_Utility.areStacksEqual(ttRecipe.mInputs[0], researchItem, true)){ - computationRequired=computationRemaining=ttRecipe.mDuration*20L; - mMaxProgresstime=20; - mEfficiencyIncrease=10000; - eRequiredData=(short)(ttRecipe.mSpecialValue>>>16); - eAmpereFlow=(short)(ttRecipe.mSpecialValue&0xFFFF); - mEUt=ttRecipe.mEUt; - eHolders.get(0).getBaseMetaTileEntity().setActive(true); - return true; + tRecipe=null; + aRecipe=null; + if(!eHolders.isEmpty() && eHolders.get(0).mInventory[0]!=null) { + ItemStack researchItem = eHolders.get(0).mInventory[0]; + if(ItemList.Tool_DataStick.isStackEqual(itemStack, false, true)) { + for (GT_Recipe.GT_Recipe_AssemblyLine assRecipe : GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes) { + if (GT_Utility.areStacksEqual(assRecipe.mResearchItem, researchItem, true)) { + this.tRecipe = assRecipe; + //if found + for (GT_Recipe ttRecipe : TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.mRecipeList) { + if (GT_Utility.areStacksEqual(ttRecipe.mInputs[0], researchItem, true)) { + computationRequired = computationRemaining = ttRecipe.mDuration * 20L; + mMaxProgresstime = 20; + mEfficiencyIncrease = 10000; + eRequiredData = (short) (ttRecipe.mSpecialValue >>> 16); + eAmpereFlow = (short) (ttRecipe.mSpecialValue & 0xFFFF); + mEUt = ttRecipe.mEUt; + eHolders.get(0).getBaseMetaTileEntity().setActive(true); + return true; + } + } + } + } + }else if(ItemList.Tool_DataOrb.isStackEqual(itemStack, false, true)){ + for (TT_recipe.TT_assLineRecipe assRecipeTT:TT_recipe.TT_Recipe_Map.sEMmachineRecipes.recipeList()){ + if (GT_Utility.areStacksEqual(assRecipeTT.mResearchItem, researchItem, true)) { + this.aRecipe = assRecipeTT; + machineType=machine; + //if found + for (GT_Recipe ttRecipe : TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.mRecipeList) { + if (GT_Utility.areStacksEqual(ttRecipe.mInputs[0], researchItem, true)) { + computationRequired = computationRemaining = ttRecipe.mDuration * 20L; + mMaxProgresstime = 20; + mEfficiencyIncrease = 10000; + eRequiredData = (short) (ttRecipe.mSpecialValue >>> 16); + eAmpereFlow = (short) (ttRecipe.mSpecialValue & 0xFFFF); + mEUt = ttRecipe.mEUt; + eHolders.get(0).getBaseMetaTileEntity().setActive(true); + return true; + } + } + } + } + for (TT_recipe.TT_assLineRecipe assRecipeTT:TT_recipe.TT_Recipe_Map.sEMcrafterRecipes.recipeList()){ + if (GT_Utility.areStacksEqual(assRecipeTT.mResearchItem, researchItem, true)) { + this.aRecipe = assRecipeTT; + machineType=crafter; + //if found + for (GT_Recipe ttRecipe : TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.mRecipeList) { + if (GT_Utility.areStacksEqual(ttRecipe.mInputs[0], researchItem, true)) { + computationRequired = computationRemaining = ttRecipe.mDuration * 20L; + mMaxProgresstime = 20; + mEfficiencyIncrease = 10000; + eRequiredData = (short) (ttRecipe.mSpecialValue >>> 16); + eAmpereFlow = (short) (ttRecipe.mSpecialValue & 0xFFFF); + mEUt = ttRecipe.mEUt; + eHolders.get(0).getBaseMetaTileEntity().setActive(true); + return true; + } } } - } } } @@ -187,39 +247,52 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB @Override public void EM_outputFunction() { - if(tRecipe!=null && !eHolders.isEmpty() && ItemList.Tool_DataStick.isStackEqual(mInventory[1], false, true)){ - eHolders.get(0).getBaseMetaTileEntity().setActive(false); - eHolders.get(0).mInventory[0]=null; - - mInventory[1].setStackDisplayName(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(""+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+" "+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()))); + if(!eHolders.isEmpty()) { + if (tRecipe != null && ItemList.Tool_DataStick.isStackEqual(mInventory[1], false, true)){ + eHolders.get(0).getBaseMetaTileEntity().setActive(false); + eHolders.get(0).mInventory[0] = null; + + mInventory[1].setStackDisplayName(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("" + i, tRecipe.mInputs[i].writeToNBT(new NBTTagCompound())); } - } - 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()))); + 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 + " " + 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); + }else if (aRecipe != null && ItemList.Tool_DataOrb.isStackEqual(mInventory[1], false, true)) { + eHolders.get(0).getBaseMetaTileEntity().setActive(false); + eHolders.get(0).mInventory[0] = null; + + mInventory[1].setStackDisplayName(GT_LanguageManager.getTranslation(tRecipe.mOutput.getDisplayName()) + ' ' + machineType +" Construction Data"); + NBTTagCompound tNBT = mInventory[1].getTagCompound();//code above makes it not null + + tNBT.setString("eMachineType", machineType); + tNBT.setString("eRecipeID", aRecipe.id); + //tNBT.setString("author", EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.WHITE + ' ' + machineType+ " Recipe Generator"); } - tNBT.setTag("pages", tNBTList); } computationRequired=computationRemaining=0; tRecipe=null; + aRecipe=null; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java index 18a22ae125..c1435de900 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java @@ -8,6 +8,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.Util.StructureBuilder; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; @@ -23,9 +24,9 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa {" ", " 222 ", " 2.2 ", " 222 ", " ",}, {"00000", "00000", "00000", "00000", "00000",}, {"00100", "01110", "11111", "01110", "00100",}, - {"01110", "1C1", "1C1", "1C1", "01110",}, - {"01110", "1C1", "1C1", "1C1", "01110",}, - {"01110", "1C1", "1C1", "1C1", "01110",}, + {"01110", "1---1", "1---1", "1---1", "01110",}, + {"01110", "1---1", "1-A-1", "1---1", "01110",}, + {"01110", "1---1", "1---1", "1---1", "01110",}, {"00100", "01110", "11\"11", "01110", "00100",}, {"#####", "#000#", "#0!0#", "#000#", "#####",}, }; @@ -85,4 +86,14 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "I HAVE NO IDEA (yet)!" }; } + + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if(aBaseMetaTileEntity.isActive() && (aTick & 0x2)==0 && aBaseMetaTileEntity.isClientSide()){ + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX*3; + int yDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY*3; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ*3; + aBaseMetaTileEntity.getWorld().markBlockRangeForRenderUpdate(xDir,yDir,zDir,xDir,yDir,zDir); + } + } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java index 60febcb9f9..d7b152b105 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java @@ -658,7 +658,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (isValidMetaTileEntity(tHatch)) { euVar = tHatch.maxEUOutput(); if (tHatch.getBaseMetaTileEntity().getStoredEU() <= (tHatch.maxEUStore() - euVar) && - aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + (euVar >> 7), false)) + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.min(euVar >> 7,1), false)) tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); } } @@ -666,7 +666,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (isValidMetaTileEntity(tHatch)) { euVar = tHatch.maxEUOutput() * tHatch.Amperes; if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && - aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + (euVar >> 7), false)) + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.min(euVar >> 7,tHatch.Amperes), false)) tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index f9fbebf7f3..ac9e7b95d0 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -280,4 +280,9 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock public byte getTileEntityBaseType() { return 1; } + + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + ePowerPass=false; + } } |