aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/github/technus/tectech/CommonValues.java2
-rw-r--r--src/main/java/com/github/technus/tectech/TecTech.java25
-rw-r--r--src/main/java/com/github/technus/tectech/dataFramework/quantumDataPacket.java12
-rw-r--r--src/main/java/com/github/technus/tectech/loader/CasingLoader.java13
-rw-r--r--src/main/java/com/github/technus/tectech/loader/MachineLoader.java (renamed from src/main/java/com/github/technus/tectech/loader/Machines.java)2
-rw-r--r--src/main/java/com/github/technus/tectech/loader/Main.java28
-rw-r--r--src/main/java/com/github/technus/tectech/loader/MainLoader.java43
-rw-r--r--src/main/java/com/github/technus/tectech/loader/RecipeLoader.java (renamed from src/main/java/com/github/technus/tectech/loader/Recipes.java)2
-rw-r--r--src/main/java/com/github/technus/tectech/loader/ThingsLoader.java23
-rw-r--r--src/main/java/com/github/technus/tectech/thing/casing/GT_Loader_CasingsTT.java10
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DataConnector.java6
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputData.java5
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java57
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java113
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Rack.java65
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Rack.java28
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java86
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java56
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java24
-rw-r--r--src/main/resources/assets/gregtech/textures/gui/rack.pngbin0 -> 262950 bytes
21 files changed, 355 insertions, 247 deletions
diff --git a/src/main/java/com/github/technus/tectech/CommonValues.java b/src/main/java/com/github/technus/tectech/CommonValues.java
index 66ce2cde3d..7293c351d2 100644
--- a/src/main/java/com/github/technus/tectech/CommonValues.java
+++ b/src/main/java/com/github/technus/tectech/CommonValues.java
@@ -10,7 +10,7 @@ public final class CommonValues {
EnumChatFormatting.BLUE + "Tec" +
EnumChatFormatting.DARK_BLUE + "Tech" +
EnumChatFormatting.BLUE + ": Elemental Matter";
- public final static byte decayAt = 0;// hatches compute dacays
+ public final static byte decayAt = 0;// hatches compute decays
public final static byte multiPurge1At = 2;// multiblocks clean their hatches 1
public final static byte moveAt = 4;// move stuff around
public final static byte recipeAt = 6;// move stuff around
diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java
index a903ca21dd..0e6088832c 100644
--- a/src/main/java/com/github/technus/tectech/TecTech.java
+++ b/src/main/java/com/github/technus/tectech/TecTech.java
@@ -2,7 +2,7 @@ package com.github.technus.tectech;
import com.github.technus.tectech.auxiliary.Reference;
import com.github.technus.tectech.auxiliary.TecTechConfig;
-import com.github.technus.tectech.loader.Main;
+import com.github.technus.tectech.loader.MainLoader;
import com.github.technus.tectech.proxy.CommonProxy;
import com.github.technus.tectech.thing.block.QuantumGlass;
import com.github.technus.tectech.thing.casing.GT_Container_CasingsTT;
@@ -46,7 +46,7 @@ public class TecTech {
public static LogHelper Logger = new LogHelper(Reference.MODID);
private static IngameErrorLog Module_AdminErrorLogs = null;
- public static Main GTCustomLoader = null;
+ public static MainLoader GTCustomLoader = null;
public static TecTechConfig ModConfig;
public static XSTR Rnd = null;
public static CreativeTabs mainTab = null;
@@ -84,13 +84,9 @@ public class TecTech {
public void PostLoad(FMLPostInitializationEvent PostEvent) {
hasCOFH=Loader.isModLoaded(Reference.COFHCORE);
- QuantumGlass.run();
- DebugContainer_EM.run();
- DebugBuilder.run();
-
- GTCustomLoader = new Main();
- GTCustomLoader.run();
- GTCustomLoader.run2();
+ GTCustomLoader = new MainLoader();
+ GTCustomLoader.things();
+ GTCustomLoader.recipes();
mainTab = new CreativeTabs("TecTech") {
@SideOnly(Side.CLIENT)
@@ -110,7 +106,7 @@ public class TecTech {
}
};
- RegisterThingsInTabs();
+ GTCustomLoader.registerThingsInTabs();
if (Loader.isModLoaded("dreamcraft")) ;//TODO init recipes for GTNH version
else ;//TODO init recipes for NON-GTNH version
@@ -119,18 +115,11 @@ public class TecTech {
@EventHandler
public void serverLoad(FMLServerStartingEvent pEvent) {
if(!oneTimeFix) {
- if (ModConfig.NERF_FUSION) FixBrokenFusionRecipes();
oneTimeFix=true;
+ if (ModConfig.NERF_FUSION) FixBrokenFusionRecipes();
}
}
- private void RegisterThingsInTabs() {
- QuantumGlass.INSTANCE.setCreativeTab(mainTab);
- GT_Container_CasingsTT.sBlockCasingsTT.setCreativeTab(mainTab);
- DebugContainer_EM.INSTANCE.setCreativeTab(mainTab);
- DebugBuilder.INSTANCE.setCreativeTab(mainTab);
- }
-
private void FixBrokenFusionRecipes(){
HashMap<Fluid,Fluid> binds=new HashMap<>();
for(Materials m:Materials.values()){
diff --git a/src/main/java/com/github/technus/tectech/dataFramework/quantumDataPacket.java b/src/main/java/com/github/technus/tectech/dataFramework/quantumDataPacket.java
index aeb3314d06..7b14a8535e 100644
--- a/src/main/java/com/github/technus/tectech/dataFramework/quantumDataPacket.java
+++ b/src/main/java/com/github/technus/tectech/dataFramework/quantumDataPacket.java
@@ -1,6 +1,7 @@
package com.github.technus.tectech.dataFramework;
import com.github.technus.tectech.vec3pos;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.nbt.NBTTagCompound;
import java.util.TreeSet;
@@ -14,10 +15,6 @@ public class quantumDataPacket {
public long computation=0;
public TreeSet<vec3pos> trace=new TreeSet<>();
- public quantumDataPacket(long comp){
- computation=comp;
- }
-
public quantumDataPacket(vec3pos pos,long computation){
this.computation=computation;
trace.add(pos);
@@ -28,11 +25,6 @@ public class quantumDataPacket {
trace.addAll(q.trace);
}
- public quantumDataPacket(quantumDataPacket q){
- this.computation=q.computation;
- trace.addAll(q.trace);
- }
-
public quantumDataPacket(NBTTagCompound nbt){
computation=nbt.getLong("qComputation");
for(int i=0;i<nbt.getByte("qHistory");i++){
@@ -77,7 +69,7 @@ public class quantumDataPacket {
return check()?this:null;
}
- public long computationIfNotConatined(vec3pos pos){
+ public long computationIfNotContained(vec3pos pos){
if(trace.contains(pos))return 0;
return computation;
}
diff --git a/src/main/java/com/github/technus/tectech/loader/CasingLoader.java b/src/main/java/com/github/technus/tectech/loader/CasingLoader.java
new file mode 100644
index 0000000000..26ed2e554b
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/loader/CasingLoader.java
@@ -0,0 +1,13 @@
+package com.github.technus.tectech.loader;
+
+import com.github.technus.tectech.thing.casing.GT_Block_CasingsTT;
+import com.github.technus.tectech.thing.casing.GT_Container_CasingsTT;
+
+/**
+ * Created by danie_000 on 03.10.2016.
+ */
+public class CasingLoader implements Runnable {
+ public void run() {
+ GT_Container_CasingsTT.sBlockCasingsTT = new GT_Block_CasingsTT();
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/loader/Machines.java b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java
index ff262ba4b7..800f5cd332 100644
--- a/src/main/java/com/github/technus/tectech/loader/Machines.java
+++ b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java
@@ -11,7 +11,7 @@ import static com.github.technus.tectech.thing.CustomItemList.*;
/**
* Created by danie_000 on 16.11.2016.
*/
-public class Machines implements Runnable {
+public class MachineLoader implements Runnable {
public void run() {//TODO add config for starting position
// ===================================================================================================
// eM IN
diff --git a/src/main/java/com/github/technus/tectech/loader/Main.java b/src/main/java/com/github/technus/tectech/loader/Main.java
deleted file mode 100644
index 6a88c06176..0000000000
--- a/src/main/java/com/github/technus/tectech/loader/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.github.technus.tectech.loader;
-
-import com.github.technus.tectech.TecTech;
-import com.github.technus.tectech.thing.casing.GT_Loader_CasingsTT;
-
-public class Main {
- private Machines ElementalLoader;
- private GT_Loader_CasingsTT ElementalCasing;
- private Recipes ElementalRecipes;
-
- public Main() {
- }
-
- public void run() {
- ElementalCasing = new GT_Loader_CasingsTT();
- ElementalCasing.run();
- TecTech.Logger.info("Casing Init Done");
- ElementalLoader = new Machines();
- ElementalLoader.run();
- TecTech.Logger.info("Machine Init Done");
- }
-
- public void run2() {
- ElementalRecipes = new Recipes();
- ElementalRecipes.run();
- TecTech.Logger.info("Recipe Init Done");
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java
new file mode 100644
index 0000000000..e3000759b3
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java
@@ -0,0 +1,43 @@
+package com.github.technus.tectech.loader;
+
+import com.github.technus.tectech.TecTech;
+import com.github.technus.tectech.thing.block.QuantumGlass;
+import com.github.technus.tectech.thing.casing.GT_Container_CasingsTT;
+import com.github.technus.tectech.thing.item.DebugBuilder;
+import com.github.technus.tectech.thing.item.DebugContainer_EM;
+
+import static com.github.technus.tectech.TecTech.mainTab;
+
+public class MainLoader {
+ private MachineLoader machineLoader;
+ private CasingLoader casingLoader;
+ private RecipeLoader recipeLoader;
+ private ThingsLoader thingsLoader;
+
+ public MainLoader() {}
+
+ public void things() {
+ casingLoader = new CasingLoader();
+ casingLoader.run();
+ TecTech.Logger.info("Casing Init Done");
+ machineLoader = new MachineLoader();
+ machineLoader.run();
+ TecTech.Logger.info("Machine Init Done");
+ thingsLoader = new ThingsLoader();
+ thingsLoader.run();
+ TecTech.Logger.info("Other things Init Done");
+ }
+
+ public void recipes() {
+ recipeLoader = new RecipeLoader();
+ recipeLoader.run();
+ TecTech.Logger.info("Recipe Init Done");
+ }
+
+ public void registerThingsInTabs(){
+ QuantumGlass.INSTANCE.setCreativeTab(mainTab);
+ GT_Container_CasingsTT.sBlockCasingsTT.setCreativeTab(mainTab);
+ DebugContainer_EM.INSTANCE.setCreativeTab(mainTab);
+ DebugBuilder.INSTANCE.setCreativeTab(mainTab);
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/loader/Recipes.java b/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java
index 30424076cd..8e97115c01 100644
--- a/src/main/java/com/github/technus/tectech/loader/Recipes.java
+++ b/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java
@@ -10,7 +10,7 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_M
/**
* Created by danie_000 on 16.11.2016.
*/
-public class Recipes implements Runnable {
+public class RecipeLoader implements Runnable {
public void run() {
// ===================================================================================================
// def init
diff --git a/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java b/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java
new file mode 100644
index 0000000000..d08fbba709
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java
@@ -0,0 +1,23 @@
+package com.github.technus.tectech.loader;
+
+import com.github.technus.tectech.TecTech;
+import com.github.technus.tectech.elementalMatter.classes.cElementalPrimitive;
+import com.github.technus.tectech.elementalMatter.definitions.*;
+import com.github.technus.tectech.thing.block.QuantumGlass;
+import com.github.technus.tectech.thing.item.DebugBuilder;
+import com.github.technus.tectech.thing.item.DebugContainer_EM;
+import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Rack;
+import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_computer;
+import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer;
+import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_MultiblockBase_EM;
+
+/**
+ * Created by danie_000 on 16.11.2016.
+ */
+public class ThingsLoader implements Runnable {
+ public void run() {
+ QuantumGlass.run();
+ DebugContainer_EM.run();
+ DebugBuilder.run();
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Loader_CasingsTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Loader_CasingsTT.java
deleted file mode 100644
index 2e7ef20b27..0000000000
--- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Loader_CasingsTT.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.github.technus.tectech.thing.casing;
-
-/**
- * Created by danie_000 on 03.10.2016.
- */
-public class GT_Loader_CasingsTT implements Runnable {
- public void run() {
- GT_Container_CasingsTT.sBlockCasingsTT = new GT_Block_CasingsTT();
- }
-}
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 f0f2c30088..8f34e15e1e 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
@@ -62,14 +62,16 @@ public abstract class GT_MetaTileEntity_Hatch_DataConnector extends GT_MetaTileE
public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT);
aNBT.setShort("eID", id);
- aNBT.setTag("eDATA",q.toNbt());
+ if(q!=null)
+ aNBT.setTag("eDATA",q.toNbt());
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
id = aNBT.getShort("eID");
- q=new quantumDataPacket(aNBT.getCompoundTag("eDATA"));
+ if(aNBT.hasKey("eDATA"))
+ q=new quantumDataPacket(aNBT.getCompoundTag("eDATA"));
}
@Override
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputData.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputData.java
index 5249c78678..7288d182c4 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputData.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputData.java
@@ -52,9 +52,8 @@ public class GT_MetaTileEntity_Hatch_OutputData extends GT_MetaTileEntity_Hatch_
while((next=current.getNext(source))!=null && range++<1000){
if(next instanceof GT_MetaTileEntity_Hatch_InputData){
((GT_MetaTileEntity_Hatch_InputData) next).q=q;
- ((GT_MetaTileEntity_Hatch_InputData) next).delDelay =true;
- q=null;
- return;
+ ((GT_MetaTileEntity_Hatch_InputData) next).delDelay=true;
+ break;
}
source=current; current=next;
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java
index e606374792..ddd68639e4 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java
@@ -1,7 +1,10 @@
package com.github.technus.tectech.thing.metaTileEntity.hatch;
import com.github.technus.tectech.CommonValues;
+import com.github.technus.tectech.TecTech;
import com.github.technus.tectech.thing.machineTT;
+import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_Rack;
+import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_Rack;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_Container_2by2;
@@ -30,7 +33,7 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch implem
private static Textures.BlockIcons.CustomIcon EM_R;
private static Textures.BlockIcons.CustomIcon EM_R_ACTIVE;
public int heat=0;
- private float overclock=1;
+ private float overClock =1, overVolt =1;
private static TreeMap<String,component> componentBinds=new TreeMap<>();
public GT_MetaTileEntity_Hatch_Rack(int aID, String aName, String aNameRegional, int aTier, String descr) {
@@ -45,14 +48,16 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch implem
public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT);
aNBT.setInteger("eHeat",heat);
- aNBT.setFloat("eOverclock",overclock);
+ aNBT.setFloat("eOverClock", overClock);
+ aNBT.setFloat("eOverVolt", overVolt);
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
heat=aNBT.getInteger("eHeat");
- overclock=aNBT.getFloat("eOverclock");
+ overClock =aNBT.getFloat("eOverClock");
+ overVolt =aNBT.getFloat("eOverVolt");
}
@Override
@@ -111,12 +116,12 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch implem
@Override
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_2by2(aPlayerInventory, aBaseMetaTileEntity);
+ return new GT_Container_Rack(aPlayerInventory, aBaseMetaTileEntity);
}
@Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_2by2(aPlayerInventory, aBaseMetaTileEntity, "Computer Rack");
+ return new GT_GUIContainer_Rack(aPlayerInventory, aBaseMetaTileEntity, "Computer Rack");
}
@Override
@@ -132,26 +137,29 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch implem
}
//TODO implement: glitches with OC, random component burning with OC
- private int getComputationPower(float overclock,boolean heatProcess){
+ private int getComputationPower(float overclock, float overvolt, boolean tickingComponents){
float computation=0,heat=0;
- for(ItemStack is:mInventory){
- if(is==null || is.stackSize!=1) continue;
- component comp=componentBinds.get(is.getUnlocalizedName());
+ for(int i=0;i<mInventory.length;i++){
+ if(mInventory[i]==null || mInventory[i].stackSize!=1) continue;
+ component comp=componentBinds.get(mInventory[i].getUnlocalizedName());
if(comp==null) continue;
- if(heatProcess){
- if(this.heat>comp.maxHeat){
- is.stackSize=0;
+ if(tickingComponents) {
+ if (this.heat > comp.maxHeat) {
+ mInventory[i] = null;
continue;
- }
- if(comp.subZero || this.heat>=0)
- heat+=comp.heat>0?comp.heat*overclock*overclock:comp.heat;
+ } else if (comp.subZero || this.heat > 0)
+ heat += comp.heat > 0 ? comp.heat * overclock * overclock * overvolt: comp.heat;
+ //=MAX(0;MIN(MIN($B4;1*C$3+C$3-0,25);1+RAND()+(C$3-1)-($B4-1)/2))
+ if(overvolt*10f>7f+TecTech.Rnd.nextFloat())
+ computation+=comp.computation*Math.max(0,Math.min(Math.min(overclock,overvolt+overvolt-0.25),1+TecTech.Rnd.nextFloat()+(overvolt-1)-(overclock-1)/2));
+ }else{
+ computation+=comp.computation*overclock;
}
- computation+=comp.computation;
}
- if(heatProcess){
+ if(tickingComponents) {
this.heat+=Math.ceil(heat);
}
- return (int)Math.ceil(computation*overclock);
+ return (int)Math.floor(computation);
}
@Override
@@ -159,10 +167,10 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch implem
return 1;
}
- public int tickComponents(float oc) {
- overclock=oc;
- if(overclock>10) getBaseMetaTileEntity().setToFire();
- return getComputationPower(overclock,true);
+ public int tickComponents(float oc,float ov) {
+ if(oc>3+TecTech.Rnd.nextFloat() || ov>2+TecTech.Rnd.nextFloat()) getBaseMetaTileEntity().setToFire();
+ overClock =oc; overVolt =ov;
+ return getComputationPower(overClock, overVolt,true);
}
@Override
@@ -203,8 +211,8 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch implem
@Override
public String[] getInfoData() {
return new String[]{
- "Base computation: "+ EnumChatFormatting.AQUA +getComputationPower(1,false),
- "After overclocking: "+ EnumChatFormatting.AQUA +getComputationPower(overclock,false),
+ "Base computation: "+ EnumChatFormatting.AQUA +getComputationPower(1,0,false),
+ "After overclocking: "+ EnumChatFormatting.AQUA +getComputationPower(overClock,0,false),
"Heat Accumulated: "+ EnumChatFormatting.RED + ((heat+99)/100) +EnumChatFormatting.RESET+" %"};
//heat==0? --> ((heat+9)/10) = 0
//Heat==1-10? --> 1
@@ -228,6 +236,7 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch implem
this.maxHeat=maxHeat;
this.subZero=subZero;
componentBinds.put(unlocalizedName,this);
+ if(TecTech.ModConfig.DEBUG_MODE) TecTech.Logger.info("Component registered: "+unlocalizedName);
}
@Override
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java
index 9db22ab1a4..042b2cf49d 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java
@@ -26,9 +26,8 @@ import net.minecraftforge.fluids.FluidStack;
public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch implements machineTT {
private static Textures.BlockIcons.CustomIcon ScreenON;
private static Textures.BlockIcons.CustomIcon ScreenOFF;
- private static float errorMargin = 0.05f;
public short[] matrix = new short[]{500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500};
- public byte selection = -1, mode = 0, status = -128;
+ public byte selection = -1, mode = 0, status = -128;//all 8 bits set
public GT_MetaTileEntity_Hatch_Uncertainty(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 0, "Feeling certain, or not?");
@@ -71,10 +70,15 @@ public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
if (aBaseMetaTileEntity.isServerSide() && (aTick & 15) == 0) {
- shift();
- compute();
- if (mode == 0) aBaseMetaTileEntity.setActive(false);
- else aBaseMetaTileEntity.setActive(true);
+ if (mode == 0) {
+ aBaseMetaTileEntity.setActive(false);
+ status=-128;
+ }
+ else {
+ aBaseMetaTileEntity.setActive(true);
+ shift();
+ compute();
+ }
}
}
@@ -172,17 +176,12 @@ public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch
};
}
- private float massOffset(int sideLenY, int sideLenX, short... masses) {
- int mass = 0;
- int massI = 0, massJ = 0;
- for (int i = 0; i < sideLenY; i++) {
- for (int j = 0; j < sideLenY * sideLenX; j += sideLenY) {
- mass += masses[i + j];
- massI += ((float) i - ((float) sideLenY / 2f) + .5f) * masses[i + j];
- massJ += ((float) (j / sideLenY) - ((float) sideLenX / 2f) + .5f) * masses[i + j];
- }
+ private boolean balanceCheck(int sideLenY, short... masses) {
+ float inequality = 0;
+ for (int i = 0; i < masses.length>>1; i++) {
+ inequality += Math.abs(masses[i]-masses[masses.length-i-1]);
}
- return ((Math.abs(massI / (float) mass) / (float) sideLenY) + (Math.abs(massJ / (float) mass)) / (float) sideLenX);
+ return inequality < (masses.length<<7);
}
public void regenerate() {
@@ -194,92 +193,80 @@ public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch
int result = 0;
switch (mode) {
case 1://ooo oxo ooo
- result = (massOffset(4, 4, matrix) < errorMargin) ? 0 : 1;
+ result = balanceCheck(4, matrix) ? 0 : 1;
break;
case 2://ooo xox ooo
- result += (massOffset(4, 2,
+ result += balanceCheck(4,
matrix[0], matrix[4],
matrix[1], matrix[5],
matrix[2], matrix[6],
- matrix[3], matrix[7]) < errorMargin) ? 0 : 1;
- result += (massOffset(4, 2,
+ matrix[3], matrix[7]) ? 0 : 1;
+ result += balanceCheck(4,
matrix[8], matrix[12],
matrix[9], matrix[13],
matrix[10], matrix[14],
- matrix[11], matrix[15]) < errorMargin) ? 0 : 2;
+ matrix[11], matrix[15]) ? 0 : 2;
break;
case 3://oxo xox oxo
- result += (massOffset(2, 4,
+ result += balanceCheck(2,
matrix[0], matrix[4], matrix[8], matrix[12],
- matrix[1], matrix[5], matrix[9], matrix[13]) < errorMargin) ? 0 : 1;
- result += (massOffset(4, 2,
+ matrix[1], matrix[5], matrix[9], matrix[13]) ? 0 : 1;
+ result += balanceCheck(4,
matrix[0], matrix[4],
matrix[1], matrix[5],
matrix[2], matrix[6],
- matrix[3], matrix[7]) < errorMargin) ? 0 : 2;
- result += (massOffset(4, 2,
+ matrix[3], matrix[7]) ? 0 : 2;
+ result += balanceCheck(4,
matrix[8], matrix[12],
matrix[9], matrix[13],
matrix[10], matrix[14],
- matrix[11], matrix[15]) < errorMargin) ? 0 : 4;
- result += (massOffset(2, 4,
+ matrix[11], matrix[15]) ? 0 : 4;
+ result += balanceCheck(2,
matrix[2], matrix[6], matrix[10], matrix[14],
- matrix[3], matrix[7], matrix[11], matrix[15]) < errorMargin) ? 0 : 8;
+ matrix[3], matrix[7], matrix[11], matrix[15]) ? 0 : 8;
break;
case 4://xox ooo xox
- result += (massOffset(2, 2,
+ result += balanceCheck(2,
matrix[0], matrix[4],
- matrix[1], matrix[5]) < errorMargin) ? 0 : 1;
- result += (massOffset(2, 2,
+ matrix[1], matrix[5]) ? 0 : 1;
+ result += balanceCheck(2,
matrix[8], matrix[12],
- matrix[9], matrix[13]) < errorMargin) ? 0 : 2;
- result += (massOffset(2, 2,
+ matrix[9], matrix[13]) ? 0 : 2;
+ result += balanceCheck(2,
matrix[2], matrix[6],
- matrix[3], matrix[7]) < errorMargin) ? 0 : 4;
- result += (massOffset(2, 2,
+ matrix[3], matrix[7]) ? 0 : 4;
+ result += balanceCheck(2,
matrix[10], matrix[14],
- matrix[11], matrix[15]) < errorMargin) ? 0 : 8;
+ matrix[11], matrix[15]) ? 0 : 8;
break;
case 5://xox oxo xox
- result += (massOffset(2, 2,
+ result += balanceCheck(2,
matrix[0], matrix[4],
- matrix[1], matrix[5]) < errorMargin) ? 0 : 1;
- result += (massOffset(2, 2,
+ matrix[1], matrix[5]) ? 0 : 1;
+ result += balanceCheck(2,
matrix[8], matrix[12],
- matrix[9], matrix[13]) < errorMargin) ? 0 : 2;
- result += (massOffset(4, 4, matrix) < errorMargin) ? 0 : 4;
- result += (massOffset(2, 2,
+ matrix[9], matrix[13]) ? 0 : 2;
+ result += balanceCheck(4, matrix) ? 0 : 4;
+ result += balanceCheck(2,
matrix[2], matrix[6],
- matrix[3], matrix[7]) < errorMargin) ? 0 : 8;
- result += (massOffset(2, 2,
+ matrix[3], matrix[7]) ? 0 : 8;
+ result += balanceCheck(2,
matrix[10], matrix[14],
- matrix[11], matrix[15]) < errorMargin) ? 0 : 16;
+ matrix[11], matrix[15]) ? 0 : 16;
break;
}
return status = (byte) result;
}
private void shift() {//TODO MAKE IT MORE EVIL
- final int i = TecTech.Rnd.nextInt(16), j = TecTech.Rnd.nextInt(2);
- matrix[i] += (((matrix[i] & 1) == 0) ? 2 : -2) * j;
- switch (matrix[i]) {
- case 1002:
- matrix[i] -= 3;
- break;
- case 1001:
- matrix[i] -= 1;
- break;
- case -1:
- matrix[i] += 1;
- break;
- case -2:
- matrix[i] += 3;
- break;
- }
+ final int i = TecTech.Rnd.nextInt(16);
+ matrix[i] += (((matrix[i] & 1) == 0) ? 2 : -2) * TecTech.Rnd.nextInt(5);
+ if(matrix[i]<0) matrix[i]=0;
+ else if (matrix[i]>1000) matrix[i]=999;
}
public byte update(int newMode) {
- if (newMode == mode) return mode;
+ if (newMode == mode) return status;
if (newMode < 0 || newMode > 5) newMode = 0;
mode = (byte) newMode;
regenerate();
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Rack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Rack.java
new file mode 100644
index 0000000000..5f1889c215
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Rack.java
@@ -0,0 +1,65 @@
+package com.github.technus.tectech.thing.metaTileEntity.hatch.gui;
+
+import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Rack;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.gui.GT_ContainerMetaTile_Machine;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.client.Minecraft;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+
+import java.util.Iterator;
+
+/**
+ * Created by Tec on 09.04.2017.
+ */
+public class GT_Container_Rack extends GT_ContainerMetaTile_Machine {
+ public boolean heat=false;
+
+ public GT_Container_Rack(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ this.addSlotToContainer(new Slot(this.mTileEntity, 0, 69, 28));
+ this.addSlotToContainer(new Slot(this.mTileEntity, 1, 91, 28));
+ this.addSlotToContainer(new Slot(this.mTileEntity, 2, 69, 50));
+ this.addSlotToContainer(new Slot(this.mTileEntity, 3, 91, 50));
+ }
+
+ public int getSlotCount() {
+ return 4;
+ }
+
+ public int getShiftClickSlotCount() {
+ return 4;
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) {
+ return;
+ }
+ this.heat = ((GT_MetaTileEntity_Hatch_Rack) this.mTileEntity.getMetaTileEntity()).heat>0;
+
+ Iterator var2 = this.crafters.iterator();
+ while (var2.hasNext()) {
+ ICrafting var1 = (ICrafting) var2.next();
+ var1.sendProgressBarUpdate(this, 100, this.heat?1:0);
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void updateProgressBar(int par1, int par2) {
+ super.updateProgressBar(par1, par2);
+ switch (par1) {
+ case 100:
+ this.heat = par2!=0;
+ return;
+ }
+ if(heat || mActive!=0) Minecraft.getMinecraft().displayGuiScreen(null);
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Rack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Rack.java
new file mode 100644
index 0000000000..c5aa1cf8a3
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Rack.java
@@ -0,0 +1,28 @@
+package com.github.technus.tectech.thing.metaTileEntity.hatch.gui;
+
+import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+
+/**
+ * Created by Tec on 09.04.2017.
+ */
+public class GT_GUIContainer_Rack extends GT_GUIContainerMetaTile_Machine {
+ private final String mName;
+
+ public GT_GUIContainer_Rack(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) {
+ super(new GT_Container_Rack(aInventoryPlayer, aTileEntity), "gregtech:textures/gui/rack.png");
+ this.mName = aName;
+ }
+
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ this.fontRendererObj.drawString(this.mName, 8, 4, 4210752);
+ }
+
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ super.drawGuiContainerBackgroundLayer(par1, par2, par3);
+ int x = (this.width - this.xSize) / 2;
+ int y = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java
index e2af74aa9f..8ce77067ca 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java
@@ -75,7 +75,7 @@ public class GT_GUIContainer_Uncertainty extends GT_GUIContainerMetaTile_Machine
rU + ((state & 8) == 0 ? 88 : 24),
Vs + 24, 10, 10);
break;
- case 5://xox ooo xox
+ case 5://xox oxo xox
drawTexturedModalRect(x, y,
rU + ((state & 1) == 0 ? 64 : 0),
Vs, 10, 10);
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 187427dfe1..391d8c2b31 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
@@ -7,6 +7,7 @@ import com.github.technus.tectech.dataFramework.quantumDataPacket;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Rack;
+import com.github.technus.tectech.vec3pos;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -29,18 +30,10 @@ import static gregtech.api.enums.GT_Values.V;
public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockBase_EM {
private final ArrayList<GT_MetaTileEntity_Hatch_Rack> eRacks=new ArrayList<>();
- private static final String[][] front = new String[][]{
- {" "," ","+ "," ",},
- };
- private static final String[][] terminator = new String[][]{
- {" "," "," "," ",},
- };
- private static final String[][] cap = new String[][]{
- {"01","22","22","01",},
- };
- private static final String[][] slice = new String[][]{
- {"01","!2","!2","01",},
- };
+ private static final String[][] front = new String[][]{{"A ","A ","A+ ","A ",},};
+ private static final String[][] terminator = new String[][]{{"A ","A ","A ","A ",},};
+ private static final String[][] cap = new String[][]{{"-01","A22","A22","-01",},};
+ private static final String[][] slice = new String[][]{{"-01","A!2","A!2","-01",},};
private static final Block[] blockType = new Block[]{sBlockCasingsTT,sBlockCasingsTT,sBlockCasingsTT};
private static final byte[] blockMeta = new byte[]{2,0,1};
private static final String[] addingMethods = new String[]{"addToMachineList","addRackToMachineList"};
@@ -52,10 +45,14 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB
public GT_MetaTileEntity_EM_computer(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
+ eCertainMode = 5;
+ eCertainStatus = -128;//no-brainer value
}
public GT_MetaTileEntity_EM_computer(String aName) {
super(aName);
+ eCertainMode = 5;
+ eCertainStatus = -128;//no-brainer value
}
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
@@ -70,7 +67,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB
return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[96]};
}
- //TODO implement uncertainty,unstability
+ //TODO implement uncertainty, unstability
@Override
public boolean EM_checkRecipe(ItemStack itemStack) {
eAvailableData=0;
@@ -80,30 +77,29 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB
for (GT_MetaTileEntity_Hatch_Rack r : eRacks) {
if(r.heat>maxTemp)maxTemp=r.heat;
- rackComputation= r.tickComponents(eParamsIn[0]);
+ rackComputation= r.tickComponents(eParamsIn[0],eParamsIn[10]);
if(rackComputation>0){
- r.getBaseMetaTileEntity().setActive(true);
eAvailableData+=rackComputation;
thingsActive+=4;
}
+ r.getBaseMetaTileEntity().setActive(true);
}
- for (GT_MetaTileEntity_Hatch_InputData di : eInputData) {
- if(di.q!=null) {//ok for power losses
+ for (GT_MetaTileEntity_Hatch_InputData di : eInputData)
+ if(di.q!=null)//ok for power losses
thingsActive++;
- }
- }
- if(thingsActive>0){
+ if(thingsActive>0 && eCertainStatus==0){
thingsActive+=eOutputData.size();
- mEUt = -(int) V[8];
- eAmpereFlow = 1 + ((thingsActive + thingsActive) >> 3);
+ mEUt = -(int) (V[8]*eParamsIn[10]);
+ eAmpereFlow = 1 + (thingsActive >> 2);
mMaxProgresstime = 20;
mEfficiencyIncrease = 10000;
return true;
}
mMaxProgresstime = 0;
mEfficiencyIncrease = 0;
+ EM_stopMachine();//to stop all hatches
return false;
}
@@ -120,12 +116,22 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB
eParamsInStatus[0]=PARAM_LOW;
else if(eParamsIn[0]==1)
eParamsInStatus[0]=PARAM_OK;
- else if(eParamsIn[0]<=2)
+ else if(eParamsIn[0]<=3)
eParamsInStatus[0]=PARAM_HIGH;
else eParamsInStatus[0]=PARAM_TOO_HIGH;
- eParamsOut[0]=eAvailableData;
- eParamsOut[10]=maxTemp;
+ if(eParamsIn[10]<=0.7f)
+ eParamsInStatus[10]=PARAM_TOO_LOW;
+ else if(eParamsIn[10]<0.8f)
+ eParamsInStatus[10]=PARAM_LOW;
+ else if(eParamsIn[10]<=1.2f)
+ eParamsInStatus[10]=PARAM_OK;
+ else if(eParamsIn[10]<=2)
+ eParamsInStatus[10]=PARAM_HIGH;
+ else eParamsInStatus[10]=PARAM_TOO_HIGH;
+
+ eParamsOut[0]=maxTemp;
+ eParamsOut[10]=eAvailableData;
if(maxTemp<-10000)
eParamsOutStatus[0]=PARAM_TOO_LOW;
@@ -141,23 +147,18 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB
@Override
public void EM_outputFunction() {
if(eOutputData.size()>0) {
- quantumDataPacket pack = new quantumDataPacket(position, eAvailableData);
+ final vec3pos pos=new vec3pos(getBaseMetaTileEntity());
+ quantumDataPacket pack = new quantumDataPacket(pos, eAvailableData);
for (GT_MetaTileEntity_Hatch_InputData i : eInputData) {
- if(i.q==null)continue;
- if(i.q.contains(position)){
- i.q=null;
- continue;
- }
+ if(i.q==null || i.q.contains(pos)) continue;
pack = pack.unifyPacketWith(i.q);
- i.q = null;
if (pack == null) return;
}
pack.computation /= eOutputData.size();
- for (GT_MetaTileEntity_Hatch_OutputData o : eOutputData) {
+ for (GT_MetaTileEntity_Hatch_OutputData o : eOutputData)
o.q=pack;
- }
}
}
@@ -177,14 +178,17 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB
@Override
public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) {
eRacks.clear();
- if(!EM_StructureCheckAdvanced(front,blockType,blockMeta,addingMethods,casingTextures,blockTypeFallback,blockMetaFallback,0,2,0))return false;
- if(!EM_StructureCheckAdvanced(cap,blockType,blockMeta,addingMethods,casingTextures,blockTypeFallback,blockMetaFallback,0,2,-1))return false;
- int i;
- for(i=-2;i>-16;i--){
- if(!EM_StructureCheckAdvanced(slice,blockType,blockMeta,addingMethods,casingTextures,blockTypeFallback,blockMetaFallback,0,2,i))break;
+ if(!EM_StructureCheckAdvanced(front,blockType,blockMeta,addingMethods,casingTextures,blockTypeFallback,blockMetaFallback,1,2,0))return false;
+ if(!EM_StructureCheckAdvanced(cap,blockType,blockMeta,addingMethods,casingTextures,blockTypeFallback,blockMetaFallback,1,2,-1))return false;
+ byte i,slices=4;
+ for(i=-2;i>-16;){
+ if(!EM_StructureCheckAdvanced(slice,blockType,blockMeta,addingMethods,casingTextures,blockTypeFallback,blockMetaFallback,1,2,i))break;
+ slices++;
+ i--;
}
- if(!EM_StructureCheckAdvanced(cap,blockType,blockMeta,addingMethods,casingTextures,blockTypeFallback,blockMetaFallback,0,2,++i))return false;
- if(!EM_StructureCheckAdvanced(terminator,blockType,blockMeta,addingMethods,casingTextures,blockTypeFallback,blockMetaFallback,0,2,--i))return false;
+ if(!EM_StructureCheckAdvanced(cap,blockType,blockMeta,addingMethods,casingTextures,blockTypeFallback,blockMetaFallback,1,2,++i))return false;
+ if(!EM_StructureCheckAdvanced(terminator,blockType,blockMeta,addingMethods,casingTextures,blockTypeFallback,blockMetaFallback,1,2,--i))return false;
+ eCertainMode=(byte)(slices/3);
return eUncertainHatches.size() == 1;
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java
index 15b2decea5..3bf24e67dc 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java
@@ -6,6 +6,7 @@ import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_H
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputElemental;
+import com.github.technus.tectech.vec3pos;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -73,16 +74,14 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas
@Override
public boolean EM_checkRecipe(ItemStack itemStack) {
short thingsActive=0;
- for (GT_MetaTileEntity_Hatch_InputData di : eInputData) {
- if(di.q!=null) {
+ for (GT_MetaTileEntity_Hatch_InputData di : eInputData)
+ if(di.q!=null)
thingsActive++;
- }
- }
if(thingsActive>0){
thingsActive+=eOutputData.size();
- mEUt = -(int) V[8];
- eAmpereFlow = 1 + ((thingsActive + thingsActive) >> 3);
+ mEUt = -(int) V[7];
+ eAmpereFlow = 1 + (thingsActive >> 2);
mMaxProgresstime = 20;
mEfficiencyIncrease = 10000;
return true;
@@ -94,32 +93,29 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas
@Override
public void EM_outputFunction() {
- float total=0;
- for(int i=0;i<10;i++){//each param pair
- if(eParamsIn[i]>0 && eParamsIn[i+10]>=0)
- total+=eParamsIn[i];//Total weighted div
- }
-
- total+=total/100F;
-
- quantumDataPacket pack=new quantumDataPacket(position,0);
- for(GT_MetaTileEntity_Hatch_InputData i:eInputData){
- if(i.q==null) continue;
- if(i.q.contains(position)){
- i.q=null;
- continue;
+ if(eOutputData.size()>0) {
+ float total = 0;
+ for (int i = 0; i < 10; i++) {//each param pair
+ if (eParamsIn[i] > 0 && eParamsIn[i + 10] >= 0)
+ total += eParamsIn[i];//Total weighted div
+ }
+ total += total / 100F;
+
+ final vec3pos pos = new vec3pos(getBaseMetaTileEntity());
+ quantumDataPacket pack = new quantumDataPacket(pos, 0);
+ for (GT_MetaTileEntity_Hatch_InputData i : eInputData) {
+ if (i.q == null || i.q.contains(pos)) continue;
+ pack = pack.unifyPacketWith(i.q);
+ if (pack == null) return;
}
- pack = pack.unifyPacketWith(i.q);
- i.q = null;
- if (pack == null) return;
- }
- for (int i = 0; i < 10; i++) {
- if(eParamsIn[i]>0) {
- final int outIndex = (int) (eParamsIn[i + 10]) - 1;
- if (outIndex < 0 || outIndex > eOutputData.size()) continue;
- GT_MetaTileEntity_Hatch_OutputData out = eOutputData.get(outIndex);
- out.q = new quantumDataPacket(pack, (long) ((pack.computation * eParamsIn[i]) / total));
+ for (int i = 0; i < 10; i++) {
+ if (eParamsIn[i] > 0) {
+ final int outIndex = (int) (eParamsIn[i + 10]) - 1;
+ if (outIndex < 0 || outIndex > eOutputData.size()) continue;
+ GT_MetaTileEntity_Hatch_OutputData out = eOutputData.get(outIndex);
+ out.q = new quantumDataPacket(pack, (long) ((pack.computation * eParamsIn[i]) / total));
+ }
}
}
}
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 bb427b64dc..1d37a5f0a8 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
@@ -81,7 +81,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
public long eAmpereFlow = 1;
public long eRequiredData = 0;
protected long eAvailableData=0;
- public final vec3pos position;
//init param states in constructor, or implement it in checkrecipe/outputfunction
@@ -111,12 +110,12 @@ 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
- //Get Available data on data producers should return mAvailableData that is set in check recipe
+ //Get Available data, Override only on data producers should return mAvailableData that is set in check recipe
protected long EM_getAvailableData() {
long result=0;
- for(GT_MetaTileEntity_Hatch_InputData in:eInputData) {
- if(in.q!=null) result += in.q.computationIfNotConatined(position);
- }
+ final vec3pos pos=new vec3pos(getBaseMetaTileEntity());
+ for(GT_MetaTileEntity_Hatch_InputData in:eInputData)
+ if(in.q!=null) result += in.q.computationIfNotContained(pos);
return result;
}
@@ -124,16 +123,10 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
public GT_MetaTileEntity_MultiblockBase_EM(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
- if(getBaseMetaTileEntity()!=null)
- position=new vec3pos(getBaseMetaTileEntity());
- else position=null;
}
public GT_MetaTileEntity_MultiblockBase_EM(String aName) {
super(aName);
- if(getBaseMetaTileEntity()!=null)
- position=new vec3pos(getBaseMetaTileEntity());
- else position=null;
}
@Override
@@ -510,7 +503,7 @@ 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 hatchesStatusUpdate();
+ }else stopMachine();
}
}
} else {
@@ -520,7 +513,7 @@ 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 hatchesStatusUpdate();
+ }else stopMachine();
}
}
@@ -607,7 +600,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
@Override
public boolean onRunningTick(ItemStack aStack) {
- if(eRequiredData>eAvailableData) return false;
+ if(eRequiredData>0 && eRequiredData>eAvailableData) return false;
if (this.mEUt > 0) {
this.EMaddEnergyOutput((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow);
return true;
@@ -774,6 +767,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
}
outputEM = null;
+ hatchesStatusUpdate();
+
EM_stopMachine();
}
@@ -1318,6 +1313,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
}
}
+ //CALLBACK
public final boolean addThing(String methodName,IGregTechTileEntity igt,int casing){
try {
return (boolean) adderMethodMap.get(methodName).invoke(this, igt, casing);
diff --git a/src/main/resources/assets/gregtech/textures/gui/rack.png b/src/main/resources/assets/gregtech/textures/gui/rack.png
new file mode 100644
index 0000000000..006c373183
--- /dev/null
+++ b/src/main/resources/assets/gregtech/textures/gui/rack.png
Binary files differ