aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Robertz <dream-master@gmx.net>2017-09-16 21:29:48 +0200
committerGitHub <noreply@github.com>2017-09-16 21:29:48 +0200
commit084961c2f6986d91f1a78506570792d8b1456a63 (patch)
tree444ae348e4f39e78c901b1dbaa068a813a869bea
parentcc826f78e43a12595b3fe03376d6c64f36be12c5 (diff)
parent747b7a40ba77dcbcbef78cbb8eda802547e9ece7 (diff)
downloadGT5-Unofficial-084961c2f6986d91f1a78506570792d8b1456a63.tar.gz
GT5-Unofficial-084961c2f6986d91f1a78506570792d8b1456a63.tar.bz2
GT5-Unofficial-084961c2f6986d91f1a78506570792d8b1456a63.zip
Merge pull request #36 from richardhendricks/feature/cleanroom_debug
Feature/cleanroom debug
-rw-r--r--src/main/java/gregtech/GT_Mod.java1
-rw-r--r--src/main/java/gregtech/api/enums/GT_Values.java6
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java10
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java48
4 files changed, 64 insertions, 1 deletions
diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java
index 3d6bae86dc..edb27a03ad 100644
--- a/src/main/java/gregtech/GT_Mod.java
+++ b/src/main/java/gregtech/GT_Mod.java
@@ -188,6 +188,7 @@ public class GT_Mod implements IGT_Mod {
GT_Log.out.println("GT_Mod: Setting Configs");
GT_Values.D1 = tMainConfig.get(aTextGeneral, "Debug", false).getBoolean(false);
GT_Values.D2 = tMainConfig.get(aTextGeneral, "Debug2", false).getBoolean(false);
+ GT_Values.debugCleanroom = tMainConfig.get(aTextGeneral, "debugCleanroom", false).getBoolean(false);
GregTech_API.TICKS_FOR_LAG_AVERAGING = tMainConfig.get(aTextGeneral, "TicksForLagAveragingWithScanner", 25).getInt(25);
GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING = tMainConfig.get(aTextGeneral, "MillisecondsPassedInGTTileEntityUntilLagWarning", 100).getInt(100);
diff --git a/src/main/java/gregtech/api/enums/GT_Values.java b/src/main/java/gregtech/api/enums/GT_Values.java
index 041ff1d618..27341027f7 100644
--- a/src/main/java/gregtech/api/enums/GT_Values.java
+++ b/src/main/java/gregtech/api/enums/GT_Values.java
@@ -118,6 +118,10 @@ public class GT_Values {
*/
public static IGT_NetworkHandler NW;
/**
+ * Debug parameter for cleanroom testing.
+ */
+ public static boolean debugCleanroom = false;
+ /**
* Not really Constants, but they set using the Config and therefore should be constant (those are for the Debug Mode)
*/
public static boolean D1 = false, D2 = false;
@@ -125,4 +129,4 @@ public class GT_Values {
* If you have to give something a World Parameter but there is no World... (Dummy World)
*/
public static World DW;
-} \ No newline at end of file
+}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
index 2ecdd039a1..5b6b2367c9 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
@@ -2,6 +2,7 @@ package gregtech.api.metatileentity.implementations;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
+import gregtech.api.util.GT_Log;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_Container_BasicMachine;
@@ -29,6 +30,7 @@ import net.minecraftforge.fluids.IFluidHandler;
import java.util.Arrays;
import static gregtech.api.enums.GT_Values.V;
+import static gregtech.api.enums.GT_Values.debugCleanroom;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
@@ -829,7 +831,15 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
if (tRecipe.mSpecialValue == -200 || tRecipe.mSpecialValue == -300)
for (int i = 0; i < mOutputItems.length; i++)
if (mOutputItems[i] != null && getBaseMetaTileEntity().getRandomNumber(10000) > mCleanroom.mEfficiency)
+ {
+ if (debugCleanroom) {
+ GT_Log.out.println(
+ "BasicMachine: Voiding output due to efficiency failure. mEfficiency = " +
+ mCleanroom.mEfficiency
+ );
+ }
mOutputItems[i] = null;
+ }
mOutputFluid = tRecipe.getFluidOutput(0);
if(!skipOC){
calculateOverclockedNess(tRecipe);
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java
index 64b5914bb4..3bc1a2ca4f 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java
@@ -11,9 +11,11 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachin
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Log;
import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
+import static gregtech.api.enums.GT_Values.debugCleanroom;
public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBase {
private int mHeatingCapacity = 0;
@@ -62,6 +64,12 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas
int mPlascreteCount = 0;
boolean doorState = false;
mUpdate = 100;
+
+ if (debugCleanroom) {
+ GT_Log.out.println(
+ "Cleanroom: Checking machine"
+ );
+ }
for (int i = 1; i < 8; i++) {
Block tBlock = aBaseMetaTileEntity.getBlockOffset(i, 0, 0);
int tMeta = aBaseMetaTileEntity.getMetaIDOffset(i, 0, 0);
@@ -71,6 +79,11 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas
z = i;
break;
} else {
+ if (debugCleanroom) {
+ GT_Log.out.println(
+ "Cleanroom: Unable to detect room edge?"
+ );
+ }
return false;
}
}
@@ -84,6 +97,11 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas
}
}
if (y > -2) {
+ if (debugCleanroom) {
+ GT_Log.out.println(
+ "Cleanroom: Room not tall enough?"
+ );
+ }
return false;
}
for (int dX = -x; dX <= x; dX++) {
@@ -95,11 +113,21 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas
if (y == 0) {
if (dX == -x || dX == x || dZ == -z || dZ == z) {
if (tBlock != GregTech_API.sBlockReinforced || tMeta != 2) {
+ if (debugCleanroom) {
+ GT_Log.out.println(
+ "Cleanroom: Non reinforced block on top edge? tMeta != 2"
+ );
+ }
return false;
}
} else if (dX == 0 && dZ == 0) {
} else {
if (tBlock != GregTech_API.sBlockCasings3 || tMeta != 11) {
+ if (debugCleanroom) {
+ GT_Log.out.println(
+ "Cleanroom: Non reinforced block on top face interior? tMeta != 11"
+ );
+ }
return false;
}
}
@@ -115,15 +143,30 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas
mDoorCount++;
} else {
if (tTileEntity == null) {
+ if (debugCleanroom) {
+ GT_Log.out.println(
+ "Cleanroom: Missing block? Not a tTileEntity"
+ );
+ }
return false;
}
IMetaTileEntity aMetaTileEntity = tTileEntity.getMetaTileEntity();
if (aMetaTileEntity == null) {
+ if (debugCleanroom) {
+ GT_Log.out.println(
+ "Cleanroom: Missing block? Not a aMetaTileEntity"
+ );
+ }
return false;
}
if (aMetaTileEntity instanceof GT_MetaTileEntity_BasicHull) {
mHullCount++;
} else {
+ if (debugCleanroom) {
+ GT_Log.out.println(
+ "Cleanroom: Incorrect block?"
+ );
+ }
return false;
}
}
@@ -143,6 +186,11 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas
if (tTileEntity != null) {
IMetaTileEntity aMetaTileEntity = tTileEntity.getMetaTileEntity();
if (aMetaTileEntity != null && aMetaTileEntity instanceof GT_MetaTileEntity_BasicMachine_GT_Recipe) {
+ if (debugCleanroom) {
+ GT_Log.out.println(
+ "Cleanroom: Machine detected, adding pointer back to cleanroom"
+ );
+ }
((GT_MetaTileEntity_BasicMachine_GT_Recipe) aMetaTileEntity).mCleanroom = this;
}
}