diff options
| author | Technus <daniel112092@gmail.com> | 2017-05-13 21:34:22 +0200 |
|---|---|---|
| committer | Technus <daniel112092@gmail.com> | 2017-05-13 21:34:22 +0200 |
| commit | 60d5c5d814e3b0600c9052dad605aa801b69adab (patch) | |
| tree | 861c2855f28758ccc7ffed865cd91d099471059b /src/main/java | |
| parent | 11992faf1ea711a8eb56370b498259c48bfe4237 (diff) | |
| download | GT5-Unofficial-60d5c5d814e3b0600c9052dad605aa801b69adab.tar.gz GT5-Unofficial-60d5c5d814e3b0600c9052dad605aa801b69adab.tar.bz2 GT5-Unofficial-60d5c5d814e3b0600c9052dad605aa801b69adab.zip | |
Near to finish another refactor.
Diffstat (limited to 'src/main/java')
65 files changed, 1301 insertions, 1052 deletions
diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index 78cc01eca9..01ac9077f3 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -44,9 +44,9 @@ public class TecTech { public static TecTechConfig ModConfig; public static XSTR Rnd = null; public static CreativeTabs mainTab = null; - private static boolean oneTimeFix=false; + private static boolean oneTimeFix = false; - public static boolean hasCOFH=false; + public static boolean hasCOFH = false; public static void AddLoginError(String pMessage) { if (Module_AdminErrorLogs != null) @@ -76,7 +76,7 @@ public class TecTech { @EventHandler public void PostLoad(FMLPostInitializationEvent PostEvent) { - hasCOFH=Loader.isModLoaded(Reference.COFHCORE); + hasCOFH = Loader.isModLoaded(Reference.COFHCORE); GTCustomLoader = new MainLoader(); GTCustomLoader.things(); @@ -111,37 +111,38 @@ public class TecTech { } @EventHandler - public void onServerAboutToStart(FMLServerAboutToStartEvent ev){ - if(!oneTimeFix) { - oneTimeFix=true; + public void onServerAboutToStart(FMLServerAboutToStartEvent ev) { + if (!oneTimeFix) { + oneTimeFix = true; if (ModConfig.NERF_FUSION) FixBrokenFusionRecipes(); } } - private void FixBrokenFusionRecipes(){ - HashMap<Fluid,Fluid> binds=new HashMap<>(); - for(Materials m:Materials.values()){ - FluidStack p=m.getPlasma(1); - if( p!=null) { - if(TecTechConfig.DEBUG_MODE) TecTech.Logger.info("Found Plasma of "+m.name()); + private void FixBrokenFusionRecipes() { + HashMap<Fluid, Fluid> binds = new HashMap<>(); + for (Materials m : Materials.values()) { + FluidStack p = m.getPlasma(1); + if (p != null) { + if (TecTechConfig.DEBUG_MODE) TecTech.Logger.info("Found Plasma of " + m.name()); if (m.mElement != null && (m.mElement.mProtons >= Materials.Iron.mElement.mProtons || - -m.mElement.mProtons >= Materials.Iron.mElement.mProtons || - m.mElement.mNeutrons >= Materials.Iron.mElement.mNeutrons || - -m.mElement.mNeutrons >= Materials.Iron.mElement.mNeutrons)) { + -m.mElement.mProtons >= Materials.Iron.mElement.mProtons || + m.mElement.mNeutrons >= Materials.Iron.mElement.mNeutrons || + -m.mElement.mNeutrons >= Materials.Iron.mElement.mNeutrons)) { if (TecTechConfig.DEBUG_MODE) TecTech.Logger.info("Attempting to bind " + m.name()); if (m.getMolten(1) != null) binds.put(p.getFluid(), m.getMolten(1).getFluid()); else if (m.getGas(1) != null) binds.put(p.getFluid(), m.getGas(1).getFluid()); else if (m.getFluid(1) != null) binds.put(p.getFluid(), m.getFluid(1).getFluid()); - else binds.put(p.getFluid(),Materials.Iron.getMolten(1).getFluid()); + else binds.put(p.getFluid(), Materials.Iron.getMolten(1).getFluid()); } } } - for(GT_Recipe r:GT_Recipe.GT_Recipe_Map.sFusionRecipes.mRecipeList){ - Fluid f=binds.get(r.mFluidOutputs[0].getFluid()); - if(f!=null){ - if(TecTechConfig.DEBUG_MODE) TecTech.Logger.info("Nerfing Recipe "+r.mFluidOutputs[0].getUnlocalizedName()); - r.mFluidOutputs[0]=new FluidStack(f,r.mFluidInputs[0].amount); + for (GT_Recipe r : GT_Recipe.GT_Recipe_Map.sFusionRecipes.mRecipeList) { + Fluid f = binds.get(r.mFluidOutputs[0].getFluid()); + if (f != null) { + if (TecTechConfig.DEBUG_MODE) + TecTech.Logger.info("Nerfing Recipe " + r.mFluidOutputs[0].getUnlocalizedName()); + r.mFluidOutputs[0] = new FluidStack(f, r.mFluidInputs[0].amount); } } } diff --git a/src/main/java/com/github/technus/tectech/Util.java b/src/main/java/com/github/technus/tectech/Util.java index 154ed10eba..4335791e77 100644 --- a/src/main/java/com/github/technus/tectech/Util.java +++ b/src/main/java/com/github/technus/tectech/Util.java @@ -26,7 +26,7 @@ public class Util { public static String intToString(int number, int groupSize) { StringBuilder result = new StringBuilder(); - for(int i = 31; i >= 0 ; i--) { + for (int i = 31; i >= 0; i--) { int mask = 1 << i; result.append((number & mask) != 0 ? "1" : "0"); @@ -46,8 +46,8 @@ public class Util { int horizontalOffset, int verticalOffset, int depthOffset, IGregTechTileEntity aBaseMetaTileEntity, boolean forceCheck) { - World world=aBaseMetaTileEntity.getWorld(); - if(world.isRemote)return false; + World world = aBaseMetaTileEntity.getWorld(); + if (world.isRemote) return false; //TE Rotation byte facing = aBaseMetaTileEntity.getFrontFacing(); @@ -70,21 +70,46 @@ public class Util { } else { //get x y z from rotation switch (facing) {//translation - case 4: x = aBaseMetaTileEntity.getXCoord()+c; z = aBaseMetaTileEntity.getZCoord()+a; y = aBaseMetaTileEntity.getYCoord()+b; break; - case 3: x = aBaseMetaTileEntity.getXCoord()+a; z = aBaseMetaTileEntity.getZCoord()-c; y = aBaseMetaTileEntity.getYCoord()+b; break; - case 5: x = aBaseMetaTileEntity.getXCoord()-c; z = aBaseMetaTileEntity.getZCoord()-a; y = aBaseMetaTileEntity.getYCoord()+b; break; - case 2: x = aBaseMetaTileEntity.getXCoord()-a; z = aBaseMetaTileEntity.getZCoord()+c; y = aBaseMetaTileEntity.getYCoord()+b; break; + case 4: + x = aBaseMetaTileEntity.getXCoord() + c; + z = aBaseMetaTileEntity.getZCoord() + a; + y = aBaseMetaTileEntity.getYCoord() + b; + break; + case 3: + x = aBaseMetaTileEntity.getXCoord() + a; + z = aBaseMetaTileEntity.getZCoord() - c; + y = aBaseMetaTileEntity.getYCoord() + b; + break; + case 5: + x = aBaseMetaTileEntity.getXCoord() - c; + z = aBaseMetaTileEntity.getZCoord() - a; + y = aBaseMetaTileEntity.getYCoord() + b; + break; + case 2: + x = aBaseMetaTileEntity.getXCoord() - a; + z = aBaseMetaTileEntity.getZCoord() + c; + y = aBaseMetaTileEntity.getYCoord() + b; + break; //Things get odd if the block faces up or down... - case 1: x = aBaseMetaTileEntity.getXCoord()+a; z = aBaseMetaTileEntity.getZCoord()+b; y = aBaseMetaTileEntity.getYCoord()-c; break;//similar to 3 - case 0: x = aBaseMetaTileEntity.getXCoord()-a; z = aBaseMetaTileEntity.getZCoord()-b; y = aBaseMetaTileEntity.getYCoord()+c; break;//similar to 2 - default: return false; + case 1: + x = aBaseMetaTileEntity.getXCoord() + a; + z = aBaseMetaTileEntity.getZCoord() + b; + y = aBaseMetaTileEntity.getYCoord() - c; + break;//similar to 3 + case 0: + x = aBaseMetaTileEntity.getXCoord() - a; + z = aBaseMetaTileEntity.getZCoord() - b; + y = aBaseMetaTileEntity.getYCoord() + c; + break;//similar to 2 + default: + return false; } //that must be here since in some cases other axis (b,c) controls y - if(y<0 || y>=256) return false; + if (y < 0 || y >= 256) return false; //Check block - if (world.blockExists(x,y,z)) {//this actually checks if the chunk is loaded at this pos + if (world.blockExists(x, y, z)) {//this actually checks if the chunk is loaded at this pos switch (block) { case '-'://must be air if (world.getBlock(x, y, z).getMaterial() != Material.air) @@ -108,7 +133,7 @@ public class Util { return false; } } - }else if (forceCheck) return false; + } else if (forceCheck) return false; a++;//block in horizontal layer } } @@ -133,13 +158,13 @@ public class Util { int horizontalOffset, int verticalOffset, int depthOffset, IGregTechTileEntity aBaseMetaTileEntity, boolean forceCheck) { - World world=aBaseMetaTileEntity.getWorld(); - if(world.isRemote)return false; + World world = aBaseMetaTileEntity.getWorld(); + if (world.isRemote) return false; //TE Rotation byte facing = aBaseMetaTileEntity.getFrontFacing(); IGregTechTileEntity igt; - IMetaTileEntity imt=aBaseMetaTileEntity.getMetaTileEntity(); + IMetaTileEntity imt = aBaseMetaTileEntity.getMetaTileEntity(); int x, y, z, a, b, c, pointer; //a,b,c - relative to block face! @@ -155,26 +180,51 @@ public class Util { for (char block : __structure.toCharArray()) {//left to right if (block > '@') {//characters allow to skip check a-1 skip, b-2 skips etc. a += block - '@'; - //} else if (block < '+') {//used to mark THINGS - // a++; + //} else if (block < '+') {//used to mark THINGS + // a++; } else { //get x y z from rotation switch (facing) {//translation - case 4: x = aBaseMetaTileEntity.getXCoord()+c; z = aBaseMetaTileEntity.getZCoord()+a; y = aBaseMetaTileEntity.getYCoord()+b; break; - case 3: x = aBaseMetaTileEntity.getXCoord()+a; z = aBaseMetaTileEntity.getZCoord()-c; y = aBaseMetaTileEntity.getYCoord()+b; break; - case 5: x = aBaseMetaTileEntity.getXCoord()-c; z = aBaseMetaTileEntity.getZCoord()-a; y = aBaseMetaTileEntity.getYCoord()+b; break; - case 2: x = aBaseMetaTileEntity.getXCoord()-a; z = aBaseMetaTileEntity.getZCoord()+c; y = aBaseMetaTileEntity.getYCoord()+b; break; + case 4: + x = aBaseMetaTileEntity.getXCoord() + c; + z = aBaseMetaTileEntity.getZCoord() + a; + y = aBaseMetaTileEntity.getYCoord() + b; + break; + case 3: + x = aBaseMetaTileEntity.getXCoord() + a; + z = aBaseMetaTileEntity.getZCoord() - c; + y = aBaseMetaTileEntity.getYCoord() + b; + break; + case 5: + x = aBaseMetaTileEntity.getXCoord() - c; + z = aBaseMetaTileEntity.getZCoord() - a; + y = aBaseMetaTileEntity.getYCoord() + b; + break; + case 2: + x = aBaseMetaTileEntity.getXCoord() - a; + z = aBaseMetaTileEntity.getZCoord() + c; + y = aBaseMetaTileEntity.getYCoord() + b; + break; //Things get odd if the block faces up or down... - case 1: x = aBaseMetaTileEntity.getXCoord()+a; z = aBaseMetaTileEntity.getZCoord()+b; y = aBaseMetaTileEntity.getYCoord()-c; break;//similar to 3 - case 0: x = aBaseMetaTileEntity.getXCoord()-a; z = aBaseMetaTileEntity.getZCoord()-b; y = aBaseMetaTileEntity.getYCoord()+c; break;//similar to 2 - default: return false; + case 1: + x = aBaseMetaTileEntity.getXCoord() + a; + z = aBaseMetaTileEntity.getZCoord() + b; + y = aBaseMetaTileEntity.getYCoord() - c; + break;//similar to 3 + case 0: + x = aBaseMetaTileEntity.getXCoord() - a; + z = aBaseMetaTileEntity.getZCoord() - b; + y = aBaseMetaTileEntity.getYCoord() + c; + break;//similar to 2 + default: + return false; } //that must be here since in some cases other axis (b,c) controls y - if(y<0 || y>=256) return false; + if (y < 0 || y >= 256) return false; //Check block - if (world.blockExists(x,y,z)) {//this actually checks if the chunk is loaded at this pos + if (world.blockExists(x, y, z)) {//this actually checks if the chunk is loaded at this pos switch (block) { case '-'://must be air if (world.getBlock(x, y, z).getMaterial() != Material.air) @@ -185,7 +235,7 @@ public class Util { return false; break; default://check for block (countable) - if((pointer = block - '0') >= 0) { + if ((pointer = block - '0') >= 0) { //countable air -> net.minecraft.block.BlockAir if (world.getBlock(x, y, z) != blockType[pointer]) { if (TecTechConfig.DEBUG_MODE) @@ -197,10 +247,10 @@ public class Util { TecTech.Logger.info("Struct-meta-id-error " + x + " " + y + " " + z + " / " + a + " " + b + " " + c + " / " + world.getBlockMetadata(x, y, z) + " " + blockM |
