aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorTechnus <daniel112092@gmail.com>2017-03-25 11:14:58 +0100
committerTechnus <daniel112092@gmail.com>2017-03-25 11:14:58 +0100
commit5b5ed5f14d8902fbef72e383bdc3c8f8eb812d8f (patch)
tree7f750d3fb9296ff37ccb5f47c261971bc36ff3af /src/main
parent1a9336579897a08170452b2dd2d461da9eb43bc4 (diff)
downloadGT5-Unofficial-5b5ed5f14d8902fbef72e383bdc3c8f8eb812d8f.tar.gz
GT5-Unofficial-5b5ed5f14d8902fbef72e383bdc3c8f8eb812d8f.tar.bz2
GT5-Unofficial-5b5ed5f14d8902fbef72e383bdc3c8f8eb812d8f.zip
Expand struct check and build
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/github/technus/tectech/TecTech.java2
-rw-r--r--src/main/java/com/github/technus/tectech/Util.java40
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java16
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java10
4 files changed, 49 insertions, 19 deletions
diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java
index 550e262ccd..73a03c5567 100644
--- a/src/main/java/com/github/technus/tectech/TecTech.java
+++ b/src/main/java/com/github/technus/tectech/TecTech.java
@@ -105,7 +105,7 @@ public class TecTech {
};
RegisterThingsInTabs();
- if (Loader.isModLoaded("dreamcraft")) ;//TODO init recipes for GTNH coremod
+ if (Loader.isModLoaded("dreamcraft")) ;//TODO init recipes for GTNH version
else ;//TODO init recipes for NON-GTNH version
}
diff --git a/src/main/java/com/github/technus/tectech/Util.java b/src/main/java/com/github/technus/tectech/Util.java
index 424b8c8589..c7d8641ae1 100644
--- a/src/main/java/com/github/technus/tectech/Util.java
+++ b/src/main/java/com/github/technus/tectech/Util.java
@@ -35,7 +35,7 @@ public class Util {
//Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller
//This only checks for REGULAR BLOCKS!
- public static boolean StuctureChecker(String[][] structure,//0-9 casing, +- air no air, a... ignore 'a'-CHAR-1 blocks
+ public static boolean StuctureChecker(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR-1 blocks
Block[] blockType,//use numbers 0-9 for casing types
byte[] blockMeta,//use numbers 0-9 for casing types
int horizontalOffset, int verticalOffset, int depthOffset,
@@ -58,8 +58,8 @@ public class Util {
for (String __structure : _structure) {//top to bottom
a = -horizontalOffset;
for (char block : __structure.toCharArray()) {//left to right
- if (block > '`') {//characters allow to skip check a-1 skip, b-2 skips etc.
- a += block - '`';
+ if (block > '@') {//characters allow to skip check a-1 skip, b-2 skips etc.
+ a += block - '@';
} else {
//get x y z from rotation
switch (facing) {//translation
@@ -113,7 +113,7 @@ public class Util {
return true;
}
- public static boolean StuctureBuilder(String[][] structure,//0-9 casing, +- air no air, a... ignore 'a'-CHAR-1 blocks
+ public static boolean StuctureBuilder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks
Block[] blockType,//use numbers 0-9 for casing types
byte[] blockMeta,//use numbers 0-9 for casing types
int horizontalOffset, int verticalOffset, int depthOffset,
@@ -134,8 +134,8 @@ public class Util {
for (String __structure : _structure) {//top to bottom
a = -horizontalOffset;
for (char block : __structure.toCharArray()) {//left to right
- if (block > '`') {//characters allow to skip check a-1 skip, b-2 skips etc.
- a += block - '`';
+ if (block > '@') {//characters allow to skip check a-1 skip, b-2 skips etc.
+ a += block - '@';
} else {
//get x y z from rotation
switch (facing) {//translation
@@ -179,7 +179,7 @@ public class Util {
public static String[] StructureWriter(IGregTechTileEntity aBaseMetaTileEntity,
int horizontalOffset, int verticalOffset, int depthOffset,
- int horizontalSize, int verticalSize, int depthSize){
+ int horizontalSize, int verticalSize, int depthSize, boolean ignoreAir){
//TE Rotation
byte facing = aBaseMetaTileEntity.getFrontFacing();
World world=aBaseMetaTileEntity.getWorld();
@@ -306,10 +306,32 @@ public class Util {
}
line+=str;
}
-
a++;//block in horizontal layer
}
- output.add(line);
+ if(ignoreAir) {
+ String l = "";
+ char temp='@';
+ for (char ch : line.toCharArray()) {
+ if(ch=='-'){
+ temp+=1;
+ if(temp=='~') {
+ l += '~';
+ temp='@';
+ }
+ }else{
+ if(temp>'@') {
+ l += temp;
+ temp='@';
+ }
+ l+=ch;
+ }
+ }
+ while(l.length()>0 && l.toCharArray()[l.length()-1]=='~')
+ l=l.substring(0,l.length()-1);
+ if(l.length()==0)
+ l="#";
+ output.add(l);
+ }else output.add(line);
b--;//horizontal layer
}
c++;//depth
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java
index c4a99446a0..6ec33ce966 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java
@@ -27,19 +27,19 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E
//Startcodes to startup
//per dim disable thingies
private static final String[] s = new String[]{
- "f202", "f020", "g0", "c5g5", "d55c55", "f0a0", "e21212",
- "d00c00", "c0g0", "b0i0", "a20i02", "a02i20", "d0024200",
- "c022c220", "b02g20", "02k20", "a03i30", "21k12"
+ "F202", "F020", "G0", "C5G5", "D55C55", "F0A0", "E21212",
+ "D00C00", "C0G0", "B0I0", "A20I02", "A02I20", "D0024200",
+ "C022C220", "B02G20", "02K20", "A03I30", "21K12"
};
private static final String[][] S = new String[][]{
{E, E, E, E, E, E, s[0], s[5], s[0]},//front
- {E, E, E, E, s[2], s[0], s[6], "d0033300", s[6], s[0], s[2]},
- {E, E, E, s[2], s[1], s[1], s[7], "c033c330", s[7], s[1], s[1], s[2]},
- {E, E, s[2], s[1], s[4], s[4], s[8], "b03g30", s[8], s[4], s[4], s[1], s[2]},
+ {E, E, E, E, s[2], s[0], s[6], "D0033300", s[6], s[0], s[2]},
+ {E, E, E, s[2], s[1], s[1], s[7], "C033C330", s[7], s[1], s[1], s[2]},
+ {E, E, s[2], s[1], s[4], s[4], s[8], "B03G30", s[8], s[4], s[4], s[1], s[2]},
{E, s[2], s[1], s[4], s[3], s[3], s[9], s[16], s[9], s[3], s[3], s[4], s[1], s[2]},
{E, s[0], s[1], s[4], s[3], s[3], s[10], s[16], s[10], s[3], s[3], s[4], s[1], s[0]},
- {s[0], s[6], s[7], s[8], s[9], s[10], s[17], "03k30", s[17], s[10], s[9], s[8], s[7], s[6], s[0]},
- {s[5], s[12], s[13], s[14], s[11], s[11], s[15], "a3k3", s[15], s[11], s[11], s[14], s[13], s[12], s[5]}
+ {s[0], s[6], s[7], s[8], s[9], s[10], s[17], "03K30", s[17], s[10], s[9], s[8], s[7], s[6], s[0]},
+ {s[5], s[12], s[13], s[14], s[11], s[11], s[15], "A3K3", s[15], s[11], s[11], s[14], s[13], s[12], s[5]}
};
private static final String[][] shape = new String[][]{
S[0], S[1], S[2], S[3], S[4], S[5], S[6], S[7], S[6], S[5], S[4], S[3], S[2], S[1], S[0]
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java
index 9163927deb..99d9c1022d 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java
@@ -98,7 +98,7 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
if(aBaseMetaTileEntity.isAllowedToWork()){
- result= StructureWriter(this.getBaseMetaTileEntity(),numbers[0],numbers[1],numbers[2],numbers[3],numbers[4],numbers[5]);
+ result= StructureWriter(this.getBaseMetaTileEntity(),numbers[0],numbers[1],numbers[2],numbers[3],numbers[4],numbers[5],false);
if(TecTech.ModConfig.DEBUG_MODE)
for(String s:result)
TecTech.Logger.info(s);
@@ -107,6 +107,14 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti
}
@Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ result= StructureWriter(this.getBaseMetaTileEntity(),numbers[0],numbers[1],numbers[2],numbers[3],numbers[4],numbers[5],true);
+ if(TecTech.ModConfig.DEBUG_MODE)
+ for(String s:result)
+ TecTech.Logger.info(s);
+ }
+
+ @Override
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
if (aBaseMetaTileEntity.isClientSide()) return true;
aBaseMetaTileEntity.openGUI(aPlayer);