aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTechnus <daniel112092@gmail.com>2017-08-13 00:34:18 +0200
committerTechnus <daniel112092@gmail.com>2017-08-13 00:34:18 +0200
commit425332f22b3971f9a3c5b72786634121d538cc64 (patch)
treecee7b6c392dd275264cbff629b57b1f608aded7d /src
parent4129313b9b16dc650ffab9d4b19e0d6644d2d67d (diff)
downloadGT5-Unofficial-425332f22b3971f9a3c5b72786634121d538cc64.tar.gz
GT5-Unofficial-425332f22b3971f9a3c5b72786634121d538cc64.tar.bz2
GT5-Unofficial-425332f22b3971f9a3c5b72786634121d538cc64.zip
implemented research station
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java (renamed from src/main/java/com/github/technus/tectech/nei/TT_NEI_config.java)6
-rw-r--r--src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java41
-rw-r--r--src/main/java/com/github/technus/tectech/recipe/TT_recipe.java2
-rw-r--r--src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DataConnector.java3
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java7
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java6
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java185
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java5
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java117
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java3
11 files changed, 270 insertions, 109 deletions
diff --git a/src/main/java/com/github/technus/tectech/nei/TT_NEI_config.java b/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java
index a6b729f407..443a069d2e 100644
--- a/src/main/java/com/github/technus/tectech/nei/TT_NEI_config.java
+++ b/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java
@@ -4,7 +4,7 @@ import codechicken.nei.api.IConfigureNEI;
import com.github.technus.tectech.recipe.TT_recipe;
import cpw.mods.fml.common.FMLCommonHandler;
-public class TT_NEI_config implements IConfigureNEI {
+public class NEI_TT_Config implements IConfigureNEI {//must be NEI*Config
public static boolean sIsAdded = true;
public static TT_NEI_ResearchHandler TT_RH;
@@ -16,10 +16,10 @@ public class TT_NEI_config implements IConfigureNEI {
}
public String getName() {
- return "GregTech NEI Plugin";
+ return "TecTech NEI Plugin";
}
public String getVersion() {
- return "(5.03a)";
+ return "(1.0)";
}
}
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 c414220922..64dfb900da 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
@@ -9,11 +9,11 @@ import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.GuiRecipe;
import codechicken.nei.recipe.GuiUsageRecipe;
import codechicken.nei.recipe.TemplateRecipeHandler;
+import com.github.technus.tectech.TecTech;
import com.github.technus.tectech.auxiliary.Reference;
import com.github.technus.tectech.recipe.TT_recipe;
import cpw.mods.fml.common.event.FMLInterModComms;
import gregtech.GT_Mod;
-import gregtech.api.enums.GT_Values;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.gui.GT_GUIContainer_BasicMachine;
import gregtech.api.objects.ItemData;
@@ -22,7 +22,6 @@ import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import gregtech.common.gui.GT_GUIContainer_FusionReactor;
-import gregtech.nei.NEI_GT_Config;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.init.Blocks;
@@ -50,9 +49,9 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler {
public TT_NEI_ResearchHandler(TT_recipe.TT_Recipe_Map aRecipeMap) {
this.mRecipeMap = aRecipeMap;
- this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), getOverlayIdentifier(), new Object[0]));
- if (!NEI_GT_Config.sIsAdded) {
- FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", Reference.MODID+"@" + getRecipeName() + "@" + getOverlayIdentifier());
+ this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), getOverlayIdentifier()));
+ if (!NEI_TT_Config.sIsAdded) {
+ FMLInterModComms.sendRuntimeMessage(TecTech.instance, "NEIPlugins", "register-crafting-handler", Reference.MODID+"@" + getRecipeName() + "@" + getOverlayIdentifier());
GuiCraftingRecipe.craftinghandlers.add(this);
GuiUsageRecipe.usagehandlers.add(this);
}
@@ -69,8 +68,8 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler {
}
public TemplateRecipeHandler newInstance() {
- TT_NEI_config.TT_RH=new TT_NEI_ResearchHandler(mRecipeMap);
- return TT_NEI_config.TT_RH;
+ NEI_TT_Config.TT_RH=new TT_NEI_ResearchHandler(mRecipeMap);
+ return NEI_TT_Config.TT_RH;
}
public void loadCraftingRecipes(String outputId, Object... results) {
@@ -101,7 +100,7 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler {
tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false));
for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) {
if (tData.fluid.isFluidEqual(tFluid)) {
- tResults.add(GT_Utility.copy(new Object[]{tData.filledContainer}));
+ tResults.add(GT_Utility.copy(tData.filledContainer));
}
}
}
@@ -135,7 +134,7 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler {
tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false));
for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) {
if (tData.fluid.isFluidEqual(tFluid)) {
- tInputs.add(GT_Utility.copy(new Object[]{tData.filledContainer}));
+ tInputs.add(GT_Utility.copy(tData.filledContainer));
}
}
}
@@ -208,19 +207,19 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler {
int computation = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration;
String[] recipeDesc = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.getNeiDesc();
if (recipeDesc == null) {
- //if (tEUt != 0) {
- // drawText(10, 73, trans("152","Total: ") + computation * tEUt + " EU", -16777216);
- // drawText(10, 83, trans("153","Usage: ") + tEUt + " EU/t", -16777216);
- // if (this.mRecipeMap.mShowVoltageAmperageInNEI) {
- // drawText(10, 93, trans("154","Voltage: ") + tEUt / this.mRecipeMap.mAmperage + " EU", -16777216);
- // drawText(10, 103, trans("155","Amperage: ") + this.mRecipeMap.mAmperage, -16777216);
- // } else {
- // drawText(10, 93, trans("156","Voltage: unspecified"), -16777216);
- // drawText(10, 103, trans("157","Amperage: unspecified"), -16777216);
- // }
- //}
+ if (tEUt != 0) {
+ //drawText(10, 73, trans("152","Total: ") + computation * tEUt + " EU", -16777216);
+ drawText(10, 83, trans("153","Usage: ") + tEUt + " EU/t", -16777216);
+ if (this.mRecipeMap.mShowVoltageAmperageInNEI) {
+ drawText(10, 93, trans("154","Voltage: ") + tEUt / this.mRecipeMap.mAmperage + " EU", -16777216);
+ drawText(10, 103, trans("155","Amperage: ") + this.mRecipeMap.mAmperage, -16777216);
+ } else {
+ drawText(10, 93, trans("156","Voltage: unspecified"), -16777216);
+ drawText(10, 103, trans("157","Amperage: unspecified"), -16777216);
+ }
+ }
if (computation > 0) {
- drawText(10, 113, "Computation: "+String.format("%.2f ", 0.05F * computation), -16777216);
+ drawText(10, 113, "Computation: "+computation, -16777216);
}
int tSpecial = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue;
if (tSpecial == -100 && GT_Mod.gregtechproxy.mLowGravProcessing) {
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 6f1196f0aa..96bdcf2703 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
@@ -7,7 +7,7 @@ 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/basicmachines/Scanner", 1, 1, 1, 0, 1, "", 1, "", false, true);
+ public static TT_Recipe_Map sResearchableFakeRecipes =new TT_Recipe_Map(new HashSet(30), "gt.recipe.researchStation", "Research station", (String)null, "gregtech:textures/gui/basicmachines/Scanner", 1, 1, 1, 0, 1, "", 1, "", true, false);//nei to false - using custom handler
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) {
super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed);
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 d700514903..9389d73c3b 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
@@ -9,7 +9,9 @@ import net.minecraftforge.fluids.FluidStack;
public class TT_recipeAdder extends GT_RecipeAdder {
public static boolean addResearchableAssemblylineRecipe(ItemStack aResearchItem, int computationRequired, ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput, int aDuration, int aEUt) {
- if ((aResearchItem==null)||(computationRequired<=0)||(aInputs == null) || (aOutput == null) || aInputs.length>15) {
+ if(aInputs==null)aInputs=new ItemStack[0];
+ if(aFluidInputs==null)aFluidInputs=new FluidStack[0];
+ if ((aResearchItem==null)||(computationRequired<=0)||(aOutput == null) || aInputs.length>15) {
return false;
}
if ((aDuration = GregTech_API.sRecipeFile.get("assemblingline", aOutput, aDuration)) <= 0) {
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DataConnector.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DataConnector.java
index aeb7abb7e6..1d069cb77d 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DataConnector.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DataConnector.java
@@ -90,8 +90,7 @@ public abstract class GT_MetaTileEntity_Hatch_DataConnector extends GT_MetaTileE
}
}
- public void moveAround(IGregTechTileEntity aBaseMetaTileEntity) {
- }
+ public abstract void moveAround(IGregTechTileEntity aBaseMetaTileEntity);
@Override
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java
index c2b3cd7f3f..4bd0c53a36 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java
@@ -112,13 +112,6 @@ public class GT_MetaTileEntity_Hatch_Holder extends GT_MetaTileEntity_Hatch {
return 1;
}
- //@Override
- //public void onRemoval() {
- // if(mInventory!=null && (heat>0 || (getBaseMetaTileEntity()!=null && getBaseMetaTileEntity().isActive())))
- // for(int i=0;i<mInventory.length;i++)
- // mInventory[i]=null;
- //}
-
@Override
public String[] getDescription() {
return new String[]{
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java
index 13bdf7991c..bb39b661e9 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java
@@ -110,7 +110,8 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB
}
mMaxProgresstime = 0;
mEfficiencyIncrease = 0;
- EM_stopMachine();//to stop all hatches
+ for (GT_MetaTileEntity_Hatch_Rack r : eRacks)
+ r.getBaseMetaTileEntity().setActive(false);
return false;
}
@@ -181,7 +182,8 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB
}
@Override
- protected void EM_stopMachine() {
+ public void stopMachine() {
+ super.stopMachine();
for (GT_MetaTileEntity_Hatch_Rack r : eRacks)
r.getBaseMetaTileEntity().setActive(false);
}
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 29c0d03be5..1d81287007 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
@@ -2,34 +2,45 @@ package com.github.technus.tectech.thing.metaTileEntity.multi;
import com.github.technus.tectech.CommonValues;
import com.github.technus.tectech.auxiliary.TecTechConfig;
-import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Holder;
+import com.github.technus.tectech.recipe.TT_recipe;
import com.github.technus.tectech.thing.metaTileEntity.IConstructable;
+import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti;
+import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Holder;
+import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.nbt.NBTTagString;
import net.minecraft.util.EnumChatFormatting;
import java.util.ArrayList;
-import static com.github.technus.tectech.Util.StructureBuilder;
+import static com.github.technus.tectech.Util.*;
import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset;
import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage;
import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT;
import static gregtech.api.enums.GT_Values.E;
-import static com.github.technus.tectech.Util.V;
/**
* Created by danie_000 on 17.12.2016.
*/
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 long computationRemaining,computationRequired;
//region structure
private static final String[][] shape = new String[][]{
@@ -44,9 +55,9 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB
private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT};
private static final byte[] blockMeta = new byte[]{1, 3, 2};
private static final String[] addingMethods = new String[]{"addClassicToMachineList", "addHolderToMachineList"};
- private static final short[] casingTextures = new short[]{textureOffset + 3, textureOffset + 3};
+ private static final short[] casingTextures = new short[]{textureOffset + 1, textureOffset + 3};
private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, Blocks.air};
- private static final byte[] blockMetaFallback = new byte[]{3, 0};
+ private static final byte[] blockMetaFallback = new byte[]{1, 0};
private static final String[] description = new String[]{
EnumChatFormatting.AQUA+"Hint Details:",
"1 - Classic/Data Hatches or Computer casing",
@@ -93,19 +104,125 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB
}
@Override
- public boolean EM_checkRecipe(ItemStack itemStack) {
- //for (GT_MetaTileEntity_Hatch_Holder r : eHolders) {
- // r.getBaseMetaTileEntity().setActive(true);
- //}//Look in Computer code
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setLong("eComputationRemaining",computationRemaining);
+ aNBT.setLong("eComputationRequired",computationRequired);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ computationRemaining=aNBT.getLong("eComputationRemaining");
+ computationRequired=aNBT.getLong("eComputationRequired");
+ }
+
+ @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)) {
+ 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 (tRecipe == null) {
+ mMaxProgresstime = 0;
+ mEfficiencyIncrease = 0;
+ for (GT_MetaTileEntity_Hatch_Holder r : eHolders)
+ r.getBaseMetaTileEntity().setActive(false);
+ }
+ }
+ }
- //check for item in controller and holder
- //find research
- //DO IT
+ @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=1;//require constant pc connection doesn't matter how fast is the computer
+ eAmpereFlow=1;
+ mEUt=(int)V[8];
+ eHolders.get(0).getBaseMetaTileEntity().setActive(true);
+ return true;
+ }
+ }
+ }
+ }
+ }
+ computationRequired=computationRemaining=0;
+ mMaxProgresstime=0;
+ mEfficiencyIncrease = 0;
+ for (GT_MetaTileEntity_Hatch_Holder r : eHolders)
+ r.getBaseMetaTileEntity().setActive(false);
return false;
}
@Override
+ public boolean onRunningTick(ItemStack aStack) {
+ if(computationRemaining<=0) {
+ computationRemaining=0;
+ mProgresstime=mMaxProgresstime;
+ return true;
+ }else{
+ computationRemaining-=eAvailableData;
+ mProgresstime=1;
+ return super.onRunningTick(aStack);
+ }
+ }
+
+ @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", "EM 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);
+ }
+ computationRequired=computationRemaining=0;
+ tRecipe=null;
+ }
+
+ @Override
protected void EM_extraExplosions() {
for (MetaTileEntity tTileEntity : eHolders) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]);
}
@@ -141,7 +258,8 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB
}
@Override
- protected void EM_stopMachine() {
+ public void stopMachine() {
+ super.stopMachine();
for (GT_MetaTileEntity_Hatch_Holder r : eHolders)
r.getBaseMetaTileEntity().setActive(false);
}
@@ -165,4 +283,45 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB
if (TecTechConfig.DEBUG_MODE) e.printStackTrace();
}
}
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 1;
+ }
+
+ public String[] getInfoData() {
+ long storedEnergy = 0;
+ long maxEnergy = 0;
+ for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU();
+ maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity();
+ }
+ }
+ for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) {
+ if (isValidMetaTileEntity(tHatch)) {
+ storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU();
+ maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity();
+ }
+ }
+
+ return new String[]{
+ "Energy Hatches:",
+ EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " +
+ EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET + " EU",
+ (mEUt <= 0 ? "Probably uses: " : "Probably makes: ") +
+ EnumChatFormatting.RED + Integer.toString(Math.abs(mEUt)) + EnumChatFormatting.RESET + " EU/t at " +
+ EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A",
+ "Tier Rating: " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier()] + EnumChatFormatting.RESET +
+ " Amp Rating: " + EnumChatFormatting.GREEN + eMaxAmpereFlow + EnumChatFormatting.RESET + " A",
+ "Problems: " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET +
+ " Efficiency: " + EnumChatFormatting.YELLOW + Float.toString(mEfficiency / 100.0F) + EnumChatFormatting.RESET + " %",
+ "PowerPass: " + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET +
+ " SafeVoid: " + EnumChatFormatting.BLUE + eSafeVoid,
+ "Computation Available: " + EnumChatFormatting.GREEN + eAvailableData + EnumChatFormatting.RESET,
+ "Computation Remaining:",
+ EnumChatFormatting.GREEN + Long.toString(computationRemaining / 20L) + EnumChatFormatting.RESET + " / " +
+ EnumChatFormatting.YELLOW + Long.toString(computationRequired / 20L)
+ };
+ }
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java
index ebe1ff3de4..b8a65b3328 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java
@@ -111,6 +111,11 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo
}
@Override
+ public boolean onRunningTick(ItemStack aStack) {
+ return true;
+ }
+
+ @Override
public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
if ((aTick & 31) == 31) {
ePowerPass = aBaseMetaTileEntity.isAllowedToWork();
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 2cea388504..c5ca46923e 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
@@ -121,9 +121,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
protected void EM_extraExplosions() {
}//For that extra hatches explosions, and maybe some MOORE EXPLOSIONS
- protected void EM_stopMachine() {
- }//On machine stop - now called when softhammered to offline state! - it does not cause a full stop like power failure
-
@Deprecated
protected void EM_workJustGotEnabled(){}//usually check recipe is more useful, therefore this one is deprecated
protected void EM_workJustGotDisabled(){}
@@ -153,6 +150,36 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
protected void EM_onFirstTick(){} // callback on first tick
+ //Override but call supermethod at start!
+ @Override
+ public void stopMachine() {
+ mOutputItems = null;
+ mOutputFluids = null;
+ mEfficiency = 0;
+ mProgresstime = 0;
+ mMaxProgresstime = 0;
+ mEfficiencyIncrease = 0;
+ getBaseMetaTileEntity().disableWorking();
+
+ for (GT_MetaTileEntity_Hatch_OutputData data : eOutputData) {
+ data.q = null;
+ }
+
+ float mass = 0;
+ if (outputEM == null) return;
+ for (cElementalInstanceStackMap tree : outputEM)
+ mass += tree.getMass();
+ if (mass > 0) {
+ if (eMufflerHatches.size() < 1) explodeMultiblock();
+ mass /= eMufflerHatches.size();
+ for (GT_MetaTileEntity_Hatch_MufflerElemental dump : eMufflerHatches) {
+ if (dump.addOverflowMatter(mass)) explodeMultiblock();
+ }
+ }
+ outputEM = null;
+
+ hatchesStatusUpdate();
+ }//On machine stop - now called when softhammered to offline state! - it does not cause a full stop like power failure
//RATHER LEAVE ALONE Section
@@ -383,10 +410,10 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
if (aBaseMetaTileEntity.isServerSide()) {
if (mEfficiency < 0) mEfficiency = 0;
- if(getBaseMetaTileEntity().hasWorkJustBeenEnabled()) EM_workJustGotEnabled();
- if(previousTickValueForWorkEnabled && !getBaseMetaTileEntity().isAllowedToWork())
+ if (getBaseMetaTileEntity().hasWorkJustBeenEnabled()) EM_workJustGotEnabled();
+ if (previousTickValueForWorkEnabled && !getBaseMetaTileEntity().isAllowedToWork())
EM_workJustGotDisabled();
- previousTickValueForWorkEnabled=getBaseMetaTileEntity().isAllowedToWork();//Assign new value
+ previousTickValueForWorkEnabled = getBaseMetaTileEntity().isAllowedToWork();//Assign new value
if (--mUpdate == 0 || --mStartUpCheck == 0 || cyclicUpdate() || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) {
mInputHatches.clear();
@@ -510,7 +537,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
mSolderingTool = true;
mCrowbar = true;
} else {
- if (tHatch.mAuto && !(mWrench && mScrewdriver && mSoftHammer && mHardHammer && mSolderingTool && mCrowbar)) tHatch.autoMaintainance();
+ if (tHatch.mAuto && !(mWrench && mScrewdriver && mSoftHammer && mHardHammer && mSolderingTool && mCrowbar))
+ tHatch.autoMaintainance();
if (tHatch.mWrench) mWrench = true;
if (tHatch.mScrewdriver) mScrewdriver = true;
if (tHatch.mSoftHammer) mSoftHammer = true;
@@ -536,7 +564,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
int qty = (int) Math.floor(remaining / instance.definition.getMass());
if (qty > 0) {
qty = Math.min(qty, instance.amount);
- if(voider.addOverflowMatter(instance.definition.getMass() * qty))
+ if (voider.addOverflowMatter(instance.definition.getMass() * qty))
voider.setOverflowMatter(voider.overflowMax);
in.getContainerHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty));
}
@@ -547,7 +575,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
int qty = (int) Math.floor(remaining / instance.definition.getMass());
if (qty > 0) {
qty = Math.min(qty, instance.amount);
- if(voider.addOverflowMatter(instance.definition.getMass() * qty))
+ if (voider.addOverflowMatter(instance.definition.getMass() * qty))
voider.setOverflowMatter(voider.overflowMax);
out.getContainerHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty));
}
@@ -562,8 +590,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) {//Start
if (onRunningTick(mInventory[1])) {//Compute EU
- if (!polluteEnvironment(getPollutionPerTick(mInventory[1])))
- stopMachine();
+ if (!polluteEnvironment(getPollutionPerTick(mInventory[1]))) stopMachine();//todo add em pollution
if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime && recipeAt == Tick) {//progress increase and done
hatchesStatusUpdate();
@@ -575,7 +602,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
if (tStack != null) addOutput(tStack);
mOutputItems = null;
- if(mOutputFluids!=null) {
+ if (mOutputFluids != null) {
if (mOutputFluids.length == 1) {
for (FluidStack tStack : mOutputFluids)
if (tStack != null) addOutput(tStack);
@@ -592,18 +619,22 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000)));
}
updateSlots();
- } else stopMachine();
+ }// else {//not allowed to work
+ // stopMachine();
+ //}
}
- }
- } else {
- if (recipeAt == Tick || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) {
- if (aBaseMetaTileEntity.isAllowedToWork()) {
- if (checkRecipe(mInventory[1])) {
- mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000)));
- }
- updateSlots();
- } else stopMachine();
- }
+ }// else {//failed to consume power/resources - inside on running tick
+ // stopMachine();
+ //}
+ } else if (recipeAt == Tick || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) {
+ if (aBaseMetaTileEntity.isAllowedToWork()) {
+ if (checkRecipe(mInventory[1])) {
+ mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000)));
+ }
+ updateSlots();
+ }// else {//not allowed to work
+ // stopMachine();
+ //}
}
{//DO ONCE
@@ -689,12 +720,15 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
@Override
public boolean onRunningTick(ItemStack aStack) {
- if (eRequiredData > 0 && eRequiredData > eAvailableData) return false;
+ if (eRequiredData > 0 && eRequiredData > eAvailableData) {
+ stopMachine();
+ return false;
+ }
if (this.mEUt > 0) {
this.EMaddEnergyOutput((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow);
return true;
} else if (this.mEUt < 0 && !this.EMdrainEnergyInput((long) (-this.mEUt) * getMaxEfficiency(aStack) / (long) Math.max(1000, this.mEfficiency), eAmpereFlow)) {
- this.stopMachine();
+ stopMachine();
return false;
} else return true;
}
@@ -846,39 +880,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
}
@Override
- public final void stopMachine() {
- mOutputItems = null;
- mOutputFluids = null;
- //mEUt = 0;
- mEfficiency = 0;
- mProgresstime = 0;
- mMaxProgresstime = 0;
- mEfficiencyIncrease = 0;
- getBaseMetaTileEntity().disableWorking();
-
- for (GT_MetaTileEntity_Hatch_OutputData data : eOutputData) {
- data.q = null;
- }
-
- float mass = 0;
- if (outputEM == null) return;
- for (cElementalInstanceStackMap tree : outputEM)
- mass += tree.getMass();
- if (mass > 0) {
- if (eMufflerHatches.size() < 1) explodeMultiblock();
- mass /= eMufflerHatches.size();
- for (GT_MetaTileEntity_Hatch_MufflerElemental dump : eMufflerHatches) {
- if (dump.addOverflowMatter(mass)) explodeMultiblock();
- }
- }
- outputEM = null;
-
- hatchesStatusUpdate();
-
- EM_stopMachine();
- }
-
- @Override
public GT_Recipe.GT_Recipe_Map getRecipeMap() {
return null;
}
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 da8290bed7..f9fbebf7f3 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
@@ -249,7 +249,8 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock
}
@Override
- protected void EM_stopMachine() {
+ public void stopMachine() {
+ super.stopMachine();
timerValue=0;
}