diff options
author | Raven Szewczyk <git@eigenraven.me> | 2022-08-27 10:19:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-27 11:19:57 +0200 |
commit | 6f31720697bcc351421a4d86ba3bf749375dd12c (patch) | |
tree | 3adf8f318f22c892d74cd7c9d30b6dd3f11f11bd /src/main/java/gregtech/common/blocks | |
parent | c3eac50decd33ee2be8703dfb2ecf9cdc31c2b67 (diff) | |
download | GT5-Unofficial-6f31720697bcc351421a4d86ba3bf749375dd12c.tar.gz GT5-Unofficial-6f31720697bcc351421a4d86ba3bf749375dd12c.tar.bz2 GT5-Unofficial-6f31720697bcc351421a4d86ba3bf749375dd12c.zip |
Update buildscript & apply spotless (#1306)
* Update dependencies
* Update buildscript, apply spotless
Diffstat (limited to 'src/main/java/gregtech/common/blocks')
31 files changed, 1047 insertions, 503 deletions
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings1.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings1.java index 5ed40ec1a3..cbd2d86093 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings1.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings1.java @@ -9,21 +9,19 @@ import net.minecraft.world.IBlockAccess; public class GT_Block_Casings1 extends GT_Block_Casings_Abstract { - /** - * Texture Index Information - * Textures.BlockIcons.casingTexturePages[0][0-63] - Gregtech - * Textures.BlockIcons.casingTexturePages[0][64-127] - GT++ - * Textures.BlockIcons.casingTexturePages[1][0-127] - Gregtech - * Textures.BlockIcons.casingTexturePages[2][0-127] - Free - * Textures.BlockIcons.casingTexturePages[3][0-127] - Free - * Textures.BlockIcons.casingTexturePages[4][0-127] - Free - * Textures.BlockIcons.casingTexturePages[5][0-127] - Free - * Textures.BlockIcons.casingTexturePages[6][0-127] - Free - * Textures.BlockIcons.casingTexturePages[7][0-127] - Free - * Textures.BlockIcons.casingTexturePages[8][0-127] - TecTech - */ - - + /** + * Texture Index Information + * Textures.BlockIcons.casingTexturePages[0][0-63] - Gregtech + * Textures.BlockIcons.casingTexturePages[0][64-127] - GT++ + * Textures.BlockIcons.casingTexturePages[1][0-127] - Gregtech + * Textures.BlockIcons.casingTexturePages[2][0-127] - Free + * Textures.BlockIcons.casingTexturePages[3][0-127] - Free + * Textures.BlockIcons.casingTexturePages[4][0-127] - Free + * Textures.BlockIcons.casingTexturePages[5][0-127] - Free + * Textures.BlockIcons.casingTexturePages[6][0-127] - Free + * Textures.BlockIcons.casingTexturePages[7][0-127] - Free + * Textures.BlockIcons.casingTexturePages[8][0-127] - TecTech + */ public GT_Block_Casings1() { super(GT_Item_Casings1.class, "gt.blockcasings", GT_Material_Casings.INSTANCE, 16); @@ -39,7 +37,8 @@ public class GT_Block_Casings1 extends GT_Block_Casings_Abstract { GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "UHV Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".10.name", "Bronze Plated Bricks"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".11.name", "Heat Proof Machine Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".12.name", "Dimensionally Transcendent Casing"); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + ".12.name", "Dimensionally Transcendent Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".13.name", "Dimensional Injection Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".14.name", "Dimensional Bridge"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".15.name", "Superconducting Coil Block"); @@ -96,6 +95,10 @@ public class GT_Block_Casings1 extends GT_Block_Casings_Abstract { @Override public int colorMultiplier(IBlockAccess aWorld, int aX, int aY, int aZ) { - return aWorld.getBlockMetadata(aX, aY, aZ) > 9 ? super.colorMultiplier(aWorld, aX, aY, aZ) : gregtech.api.enums.Dyes.MACHINE_METAL.mRGBa[0] << 16 | gregtech.api.enums.Dyes.MACHINE_METAL.mRGBa[1] << 8 | gregtech.api.enums.Dyes.MACHINE_METAL.mRGBa[2]; + return aWorld.getBlockMetadata(aX, aY, aZ) > 9 + ? super.colorMultiplier(aWorld, aX, aY, aZ) + : gregtech.api.enums.Dyes.MACHINE_METAL.mRGBa[0] << 16 + | gregtech.api.enums.Dyes.MACHINE_METAL.mRGBa[1] << 8 + | gregtech.api.enums.Dyes.MACHINE_METAL.mRGBa[2]; } } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java index 1b6ac42ee2..7ee9472308 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java @@ -16,8 +16,12 @@ import net.minecraftforge.common.util.ForgeDirection; public class GT_Block_Casings2 extends GT_Block_Casings_Abstract { public GT_Block_Casings2() { super(GT_Item_Casings2.class, "gt.blockcasings2", GT_Material_Casings.INSTANCE, 96); - //Special handler for Pyrolyse Oven Casing on hatches... - Textures.BlockIcons.casingTexturePages[0][22] = TextureFactory.of(Block.getBlockFromItem(ItemList.Casing_ULV.get(1).getItem()), 0, ForgeDirection.UNKNOWN, Dyes.MACHINE_METAL.mRGBa); + // Special handler for Pyrolyse Oven Casing on hatches... + Textures.BlockIcons.casingTexturePages[0][22] = TextureFactory.of( + Block.getBlockFromItem(ItemList.Casing_ULV.get(1).getItem()), + 0, + ForgeDirection.UNKNOWN, + Dyes.MACHINE_METAL.mRGBa); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Solid Steel Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Frost Proof Machine Casing"); @@ -98,7 +102,10 @@ public class GT_Block_Casings2 extends GT_Block_Casings_Abstract { } @Override - public float getExplosionResistance(Entity aTNT, World aWorld, int aX, int aY, int aZ, double eX, double eY, double eZ) { - return aWorld.getBlockMetadata(aX, aY, aZ) == 8 ? Blocks.bedrock.getExplosionResistance(aTNT) : super.getExplosionResistance(aTNT, aWorld, aX, aY, aZ, eX, eY, eZ); + public float getExplosionResistance( + Entity aTNT, World aWorld, int aX, int aY, int aZ, double eX, double eY, double eZ) { + return aWorld.getBlockMetadata(aX, aY, aZ) == 8 + ? Blocks.bedrock.getExplosionResistance(aTNT) + : super.getExplosionResistance(aTNT, aWorld, aX, aY, aZ, eX, eY, eZ); } } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings3.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings3.java index cc9bbd25f8..677c457678 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings3.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings3.java @@ -78,11 +78,17 @@ public class GT_Block_Casings3 extends GT_Block_Casings_Abstract { case 12: return Textures.BlockIcons.MACHINE_CASING_RADIATIONPROOF.getIcon(); case 13: - return aSide > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_BRONZE.getIcon() : Textures.BlockIcons.MACHINE_BRONZEPLATEDBRICKS.getIcon(); + return aSide > 1 + ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_BRONZE.getIcon() + : Textures.BlockIcons.MACHINE_BRONZEPLATEDBRICKS.getIcon(); case 14: - return aSide > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_STEEL.getIcon() : Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); + return aSide > 1 + ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_STEEL.getIcon() + : Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); case 15: - return aSide > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_TUNGSTENSTEEL.getIcon() : Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon(); + return aSide > 1 + ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_TUNGSTENSTEEL.getIcon() + : Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon(); } return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java index 90f568b73f..f5618c23b4 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java @@ -22,24 +22,45 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract { * The exact meaning of these numbers are like black magic. Read the original getIcon implementation to understand why * it is 0, 1, etc, if that if ladder is even intelligible. */ - private static final int[][] mapping = new int[][]{ - {7, 7, 7, 7, 0, 7, 0, 7, 1, 7, 1, 7, 8, 7, 8, 7, 0, 7, 0, 7, 0, 7, 0, 7, 9, 7, 9, 7, 3, 7, 3, 7, 1, 7, 1, 7, 11, 7, 11, 7, 1, 7, 1, 7, 2, 7, 2, 7, 10, 7, 10, 7, 5, 7, 5, 7, 4, 7, 4, 7, 6, 7, 6, 7}, - {7, 7, 7, 7, 0, 0, 7, 7, 1, 1, 7, 7, 8, 8, 7, 7, 0, 0, 7, 7, 0, 0, 7, 7, 9, 9, 7, 7, 3, 3, 7, 7, 1, 1, 7, 7, 11, 11, 7, 7, 1, 1, 7, 7, 2, 2, 7, 7, 10, 10, 7, 7, 5, 5, 7, 7, 4, 4, 7, 7, 6, 6, 7, 7}, - {7, 1, 1, 1, 0, 9, 10, 4, 7, 1, 1, 1, 0, 9, 10, 4, 0, 8, 11, 2, 0, 3, 5, 6, 0, 8, 11, 2, 0, 3, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, - {7, 1, 1, 1, 0, 8, 11, 2, 7, 7, 7, 7, 7, 7, 7, 7, 0, 9, 10, 4, 0, 3, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 1, 1, 1, 0, 8, 11, 2, 7, 7, 7, 7, 7, 7, 7, 7, 0, 9, 10, 4, 0, 3, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7}, - {7, 1, 1, 1, 7, 1, 1, 1, 0, 8, 11, 2, 0, 8, 11, 2, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 9, 10, 4, 0, 9, 10, 4, 0, 3, 5, 6, 0, 3, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, - {7, 1, 1, 1, 7, 7, 7, 7, 0, 9, 10, 4, 7, 7, 7, 7, 7, 1, 1, 1, 7, 7, 7, 7, 0, 9, 10, 4, 7, 7, 7, 7, 0, 8, 11, 2, 7, 7, 7, 7, 0, 3, 5, 6, 7, 7, 7, 7, 0, 8, 11, 2, 7, 7, 7, 7, 0, 3, 5, 6, 7, 7, 7, 7}, + private static final int[][] mapping = new int[][] { + { + 7, 7, 7, 7, 0, 7, 0, 7, 1, 7, 1, 7, 8, 7, 8, 7, 0, 7, 0, 7, 0, 7, 0, 7, 9, 7, 9, 7, 3, 7, 3, 7, 1, 7, 1, 7, + 11, 7, 11, 7, 1, 7, 1, 7, 2, 7, 2, 7, 10, 7, 10, 7, 5, 7, 5, 7, 4, 7, 4, 7, 6, 7, 6, 7 + }, + { + 7, 7, 7, 7, 0, 0, 7, 7, 1, 1, 7, 7, 8, 8, 7, 7, 0, 0, 7, 7, 0, 0, 7, 7, 9, 9, 7, 7, 3, 3, 7, 7, 1, 1, 7, 7, + 11, 11, 7, 7, 1, 1, 7, 7, 2, 2, 7, 7, 10, 10, 7, 7, 5, 5, 7, 7, 4, 4, 7, 7, 6, 6, 7, 7 + }, + { + 7, 1, 1, 1, 0, 9, 10, 4, 7, 1, 1, 1, 0, 9, 10, 4, 0, 8, 11, 2, 0, 3, 5, 6, 0, 8, 11, 2, 0, 3, 5, 6, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 + }, + { + 7, 1, 1, 1, 0, 8, 11, 2, 7, 7, 7, 7, 7, 7, 7, 7, 0, 9, 10, 4, 0, 3, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 1, 1, + 1, 0, 8, 11, 2, 7, 7, 7, 7, 7, 7, 7, 7, 0, 9, 10, 4, 0, 3, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7 + }, + { + 7, 1, 1, 1, 7, 1, 1, 1, 0, 8, 11, 2, 0, 8, 11, 2, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 9, 10, + 4, 0, 9, 10, 4, 0, 3, 5, 6, 0, 3, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 + }, + { + 7, 1, 1, 1, 7, 7, 7, 7, 0, 9, 10, 4, 7, 7, 7, 7, 7, 1, 1, 1, 7, 7, 7, 7, 0, 9, 10, 4, 7, 7, 7, 7, 0, 8, 11, + 2, 7, 7, 7, 7, 0, 3, 5, 6, 7, 7, 7, 7, 0, 8, 11, 2, 7, 7, 7, 7, 0, 3, 5, 6, 7, 7, 7, 7 + }, }; + public static boolean mConnectedMachineTextures = true; public GT_Block_Casings4() { super(GT_Item_Casings4.class, "gt.blockcasings4", GT_Material_Casings.INSTANCE, 16); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Robust Tungstensteel Machine Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Clean Stainless Steel Machine Casing"); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + ".0.name", "Robust Tungstensteel Machine Casing"); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + ".1.name", "Clean Stainless Steel Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Stable Titanium Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Titanium Firebox Casing"); -// GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "Fusion Casing"); -// GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "Fusion Casing"); + // GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "Fusion Casing"); + // GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "Fusion Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Fusion Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Fusion Coil Block"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Fusion Machine Casing MK II"); @@ -88,12 +109,14 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract { case 11: return Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon(); case 3: - return aSide > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_TITANIUM.getIcon() : Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon(); + return aSide > 1 + ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_TITANIUM.getIcon() + : Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon(); case 4: - //Do not overwrite! + // Do not overwrite! return Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW.getIcon(); case 5: - //Do not overwrite! + // Do not overwrite! return Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS.getIcon(); case 6: return Textures.BlockIcons.MACHINE_CASING_FUSION.getIcon(); @@ -117,26 +140,50 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract { public IIcon getTurbineCasing(int meta, int iconIndex, boolean active) { switch (meta) { case 10: - return active ? Textures.BlockIcons.TURBINE_ACTIVE1[iconIndex].getIcon() : Textures.BlockIcons.TURBINE1[iconIndex].getIcon(); + return active + ? Textures.BlockIcons.TURBINE_ACTIVE1[iconIndex].getIcon() + : Textures.BlockIcons.TURBINE1[iconIndex].getIcon(); case 11: - return active ? Textures.BlockIcons.TURBINE_ACTIVE2[iconIndex].getIcon() : Textures.BlockIcons.TURBINE2[iconIndex].getIcon(); + return active + ? Textures.BlockIcons.TURBINE_ACTIVE2[iconIndex].getIcon() + : Textures.BlockIcons.TURBINE2[iconIndex].getIcon(); case 12: - return active ? Textures.BlockIcons.TURBINE_ACTIVE3[iconIndex].getIcon() : Textures.BlockIcons.TURBINE3[iconIndex].getIcon(); + return active + ? Textures.BlockIcons.TURBINE_ACTIVE3[iconIndex].getIcon() + : Textures.BlockIcons.TURBINE3[iconIndex].getIcon(); default: - return active ? Textures.BlockIcons.TURBINE_ACTIVE[iconIndex].getIcon() : Textures.BlockIcons.TURBINE[iconIndex].getIcon(); + return active + ? Textures.BlockIcons.TURBINE_ACTIVE[iconIndex].getIcon() + : Textures.BlockIcons.TURBINE[iconIndex].getIcon(); } } public IIcon getTurbineCasing(int meta, int iconIndex, boolean active, boolean hasTurbine) { switch (meta) { case 10: - return active ? Textures.BlockIcons.TURBINE_ACTIVE1[iconIndex].getIcon() : hasTurbine ? Textures.BlockIcons.TURBINE1[iconIndex].getIcon() : Textures.BlockIcons.TURBINE_EMPTY1[iconIndex].getIcon(); + return active + ? Textures.BlockIcons.TURBINE_ACTIVE1[iconIndex].getIcon() + : hasTurbine + ? Textures.BlockIcons.TURBINE1[iconIndex].getIcon() + : Textures.BlockIcons.TURBINE_EMPTY1[iconIndex].getIcon(); case 11: - return active ? Textures.BlockIcons.TURBINE_ACTIVE2[iconIndex].getIcon() : hasTurbine ? Textures.BlockIcons.TURBINE2[iconIndex].getIcon() : Textures.BlockIcons.TURBINE_EMPTY2[iconIndex].getIcon(); + return active + ? Textures.BlockIcons.TURBINE_ACTIVE2[iconIndex].getIcon() + : hasTurbine + ? Textures.BlockIcons.TURBINE2[iconIndex].getIcon() + : Textures.BlockIcons.TURBINE_EMPTY2[iconIndex].getIcon(); case 12: - return active ? Textures.BlockIcons.TURBINE_ACTIVE3[iconIndex].getIcon() : hasTurbine ? Textures.BlockIcons.TURBINE3[iconIndex].getIcon() : Textures.BlockIcons.TURBINE_EMPTY3[iconIndex].getIcon(); + return active + ? Textures.BlockIcons.TURBINE_ACTIVE3[iconIndex].getIcon() + : hasTurbine + ? Textures.BlockIcons.TURBINE3[iconIndex].getIcon() + : Textures.BlockIcons.TURBINE_EMPTY3[iconIndex].getIcon(); default: - return active ? Textures.BlockIcons.TURBINE_ACTIVE[iconIndex].getIcon() : hasTurbine ? Textures.BlockIcons.TURBINE[iconIndex].getIcon() : Textures.BlockIcons.TURBINE_EMPTY[iconIndex].getIcon(); + return active + ? Textures.BlockIcons.TURBINE_ACTIVE[iconIndex].getIcon() + : hasTurbine + ? Textures.BlockIcons.TURBINE[iconIndex].getIcon() + : Textures.BlockIcons.TURBINE_EMPTY[iconIndex].getIcon(); } } @@ -156,7 +203,8 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract { public IIcon getIcon(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide) { aWorld = GT_RenderingWorld.getInstance(aWorld); int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); - if (tMeta != 6 && tMeta != 8 && tMeta != 9 && tMeta != 10 && tMeta != 11 && tMeta != 12 || !mConnectedMachineTextures) { + if (tMeta != 6 && tMeta != 8 && tMeta != 9 && tMeta != 10 && tMeta != 11 && tMeta != 12 + || !mConnectedMachineTextures) { return getIcon(aSide, tMeta); } if (tMeta > 8 && tMeta < 13) { @@ -165,10 +213,10 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract { case 0: for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { - if (i == 0 && j == 0) - continue; + if (i == 0 && j == 0) continue; int tState; - if ((tState = isTurbineControllerWithSide(aWorld, xCoord + j, yCoord, zCoord + i, aSide)) != 0) { + if ((tState = isTurbineControllerWithSide(aWorld, xCoord + j, yCoord, zCoord + i, aSide)) + != 0) { return getTurbineCasing(tMeta, 4 - i * 3 - j, tState == 1, tState == 2); } } @@ -177,11 +225,12 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract { case 1: for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { - if (i == 0 && j == 0) - continue; + if (i == 0 && j == 0) continue; int tState; - if ((tState = isTurbineControllerWithSide(aWorld, xCoord + j, yCoord + i, zCoord, aSide)) != 0) { - return getTurbineCasing(tMeta, 4 + i * 3 - j * tInvertLeftRightMod, tState == 1, tState == 2); + if ((tState = isTurbineControllerWithSide(aWorld, xCoord + j, yCoord + i, zCoord, aSide)) + != 0) { + return getTurbineCasing( + tMeta, 4 + i * 3 - j * tInvertLeftRightMod, tState == 1, tState == 2); } } } @@ -189,11 +238,12 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract { case 2: for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { - if (i == 0 && j == 0) - continue; + if (i == 0 && j == 0) continue; int tState; - if ((tState = isTurbineControllerWithSide(aWorld, xCoord, yCoord + i, zCoord + j, aSide)) != 0) { - return getTurbineCasing(tMeta, 4 + i * 3 + j * tInvertLeftRightMod, tState == 1, tState == 2); + if ((tState = isTurbineControllerWithSide(aWorld, xCoord, yCoord + i, zCoord + j, aSide)) + != 0) { + return getTurbineCasing( + tMeta, 4 + i * 3 + j * tInvertLeftRightMod, tState == 1, tState == 2); } } } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java index 4de58c3a35..a3ef59de4f 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java @@ -1,5 +1,7 @@ package gregtech.common.blocks; +import static gregtech.api.enums.HeatingCoilLevel.*; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.HeatingCoilLevel; @@ -7,13 +9,10 @@ import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; import gregtech.api.interfaces.IHeatingCoil; import gregtech.api.util.GT_LanguageManager; +import java.util.function.Consumer; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import java.util.function.Consumer; - -import static gregtech.api.enums.HeatingCoilLevel.*; - public class GT_Block_Casings5 extends GT_Block_Casings_Abstract implements IHeatingCoil { public GT_Block_Casings5() { @@ -33,7 +32,6 @@ public class GT_Block_Casings5 extends GT_Block_Casings_Abstract implements IHea GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".12.name", "Hypogen Coil Block"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".13.name", "Eternal Coil Block"); - ItemList.Casing_Coil_Cupronickel.set(new ItemStack(this, 1, 0)); ItemList.Casing_Coil_Kanthal.set(new ItemStack(this, 1, 1)); ItemList.Casing_Coil_Nichrome.set(new ItemStack(this, 1, 2)); @@ -52,7 +50,7 @@ public class GT_Block_Casings5 extends GT_Block_Casings_Abstract implements IHea @Override public int getTextureIndex(int aMeta) { - return (1 << 7 ) | aMeta; + return (1 << 7) | aMeta; } @Override @@ -163,8 +161,6 @@ public class GT_Block_Casings5 extends GT_Block_Casings_Abstract implements IHea } } - - @Override public HeatingCoilLevel getCoilHeat(int meta) { getOnCoilCheck().accept(this); diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings6.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings6.java index 30b8751406..0b6b89198a 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings6.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings6.java @@ -96,6 +96,8 @@ public class GT_Block_Casings6 extends GT_Block_Casings_Abstract { @Override public int colorMultiplier(IBlockAccess aWorld, int aX, int aY, int aZ) { - return gregtech.api.enums.Dyes.MACHINE_METAL.mRGBa[0] << 16 | gregtech.api.enums.Dyes.MACHINE_METAL.mRGBa[1] << 8 | gregtech.api.enums.Dyes.MACHINE_METAL.mRGBa[2]; + return gregtech.api.enums.Dyes.MACHINE_METAL.mRGBa[0] << 16 + | gregtech.api.enums.Dyes.MACHINE_METAL.mRGBa[1] << 8 + | gregtech.api.enums.Dyes.MACHINE_METAL.mRGBa[2]; } } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java index e8ccc47b3d..65583eaa28 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java @@ -16,7 +16,7 @@ import net.minecraft.world.IBlockAccess; public class GT_Block_Casings8 extends GT_Block_Casings_Abstract { public static boolean mConnectedMachineTextures = true; - //WATCH OUT FOR TEXTURE ID's + // WATCH OUT FOR TEXTURE ID's public GT_Block_Casings8() { super(GT_Item_Casings8.class, "gt.blockcasings8", GT_Material_Casings.INSTANCE, 10); /* @@ -29,9 +29,12 @@ public class GT_Block_Casings8 extends GT_Block_Casings_Abstract { GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Mining Neutronium Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Mining Black Plutonium Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "Extreme Engine Intake Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "Europium Reinforced Radiation Proof Machine Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Advanced Rhodium Plated Palladium Machine Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Advanced Iridium Plated Machine Casing"); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + ".5.name", "Europium Reinforced Radiation Proof Machine Casing"); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + ".6.name", "Advanced Rhodium Plated Palladium Machine Casing"); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + ".7.name", "Advanced Iridium Plated Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Magical Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "HSS-S Turbine Casing"); @@ -56,26 +59,27 @@ public class GT_Block_Casings8 extends GT_Block_Casings_Abstract { @SideOnly(Side.CLIENT) public IIcon getIcon(int aSide, int aMeta) { switch (aMeta) { - case 0: - return Textures.BlockIcons.MACHINE_CASING_CHEMICALLY_INERT.getIcon(); - case 1: - return Textures.BlockIcons.MACHINE_CASING_PIPE_POLYTETRAFLUOROETHYLENE.getIcon(); - case 2: - return Textures.BlockIcons.MACHINE_CASING_MINING_NEUTRONIUM.getIcon(); - case 3: - return Textures.BlockIcons.MACHINE_CASING_MINING_BLACKPLUTONIUM.getIcon(); - case 4: - return Textures.BlockIcons.MACHINE_CASING_EXTREME_ENGINE_INTAKE.getIcon();//changed color in a terrible way - case 5: - return Textures.BlockIcons.MACHINE_CASING_ADVANCEDRADIATIONPROOF.getIcon(); - case 6: - return Textures.BlockIcons.MACHINE_CASING_RHODIUM_PALLADIUM.getIcon(); - case 7: - return Textures.BlockIcons.MACHINE_CASING_IRIDIUM.getIcon(); - case 8: - return Textures.BlockIcons.MACHINE_CASING_MAGICAL.getIcon(); - case 9: - return Textures.BlockIcons.MACHINE_CASING_ADVANCEDGAS.getIcon(); + case 0: + return Textures.BlockIcons.MACHINE_CASING_CHEMICALLY_INERT.getIcon(); + case 1: + return Textures.BlockIcons.MACHINE_CASING_PIPE_POLYTETRAFLUOROETHYLENE.getIcon(); + case 2: + return Textures.BlockIcons.MACHINE_CASING_MINING_NEUTRONIUM.getIcon(); + case 3: + return Textures.BlockIcons.MACHINE_CASING_MINING_BLACKPLUTONIUM.getIcon(); + case 4: + return Textures.BlockIcons.MACHINE_CASING_EXTREME_ENGINE_INTAKE + .getIcon(); // changed color in a terrible way + case 5: + return Textures.BlockIcons.MACHINE_CASING_ADVANCEDRADIATIONPROOF.getIcon(); + case 6: + return Textures.BlockIcons.MACHINE_CASING_RHODIUM_PALLADIUM.getIcon(); + case 7: + return Textures.BlockIcons.MACHINE_CASING_IRIDIUM.getIcon(); + case 8: + return Textures.BlockIcons.MACHINE_CASING_MAGICAL.getIcon(); + case 9: + return Textures.BlockIcons.MACHINE_CASING_ADVANCEDGAS.getIcon(); } return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon(); } @@ -84,18 +88,30 @@ public class GT_Block_Casings8 extends GT_Block_Casings_Abstract { public IIcon getTurbineCasing(int meta, int iconIndex, boolean active) { switch (meta) { case 9: - return active ? Textures.BlockIcons.TURBINE_ADVGASACTIVE[iconIndex].getIcon() : Textures.BlockIcons.TURBINEADVGAS[iconIndex].getIcon(); + return active + ? Textures.BlockIcons.TURBINE_ADVGASACTIVE[iconIndex].getIcon() + : Textures.BlockIcons.TURBINEADVGAS[iconIndex].getIcon(); default: - return active ? Textures.BlockIcons.TURBINE_ACTIVE[iconIndex].getIcon() : Textures.BlockIcons.TURBINE[iconIndex].getIcon(); + return active + ? Textures.BlockIcons.TURBINE_ACTIVE[iconIndex].getIcon() + : Textures.BlockIcons.TURBINE[iconIndex].getIcon(); } } public IIcon getTurbineCasing(int meta, int iconIndex, boolean active, boolean hasTurbine) { switch (meta) { case 9: - return active ? Textures.BlockIcons.TURBINE_ADVGASACTIVE[iconIndex].getIcon() : hasTurbine ? Textures.BlockIcons.TURBINEADVGAS[iconIndex].getIcon() : Textures.BlockIcons.TURBINE_ADVGASEMPTY[iconIndex].getIcon(); + return active + ? Textures.BlockIcons.TURBINE_ADVGASACTIVE[iconIndex].getIcon() + : hasTurbine + ? Textures.BlockIcons.TURBINEADVGAS[iconIndex].getIcon() + : Textures.BlockIcons.TURBINE_ADVGASEMPTY[iconIndex].getIcon(); default: - return active ? Textures.BlockIcons.TURBINE_ACTIVE[iconIndex].getIcon() : hasTurbine ? Textures.BlockIcons.TURBINE[iconIndex].getIcon() : Textures.BlockIcons.TURBINE_EMPTY[iconIndex].getIcon(); + return active + ? Textures.BlockIcons.TURBINE_ACTIVE[iconIndex].getIcon() + : hasTurbine + ? Textures.BlockIcons.TURBINE[iconIndex].getIcon() + : Textures.BlockIcons.TURBINE_EMPTY[iconIndex].getIcon(); } } @@ -124,10 +140,10 @@ public class GT_Block_Casings8 extends GT_Block_Casings_Abstract { case 0: for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { - if (i == 0 && j == 0) - continue; + if (i == 0 && j == 0) continue; int tState; - if ((tState = isTurbineControllerWithSide(aWorld, xCoord + j, yCoord, zCoord + i, aSide)) != 0) { + if ((tState = isTurbineControllerWithSide(aWorld, xCoord + j, yCoord, zCoord + i, aSide)) + != 0) { return getTurbineCasing(tMeta, 4 - i * 3 - j, tState == 1, tState == 2); } } @@ -136,11 +152,12 @@ public class GT_Block_Casings8 extends GT_Block_Casings_Abstract { case 1: for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { - if (i == 0 && j == 0) - continue; + if (i == 0 && j == 0) continue; int tState; - if ((tState = isTurbineControllerWithSide(aWorld, xCoord + j, yCoord + i, zCoord, aSide)) != 0) { - return getTurbineCasing(tMeta, 4 + i * 3 - j * tInvertLeftRightMod, tState == 1, tState == 2); + if ((tState = isTurbineControllerWithSide(aWorld, xCoord + j, yCoord + i, zCoord, aSide)) + != 0) { + return getTurbineCasing( + tMeta, 4 + i * 3 - j * tInvertLeftRightMod, tState == 1, tState == 2); } } } @@ -148,11 +165,12 @@ public class GT_Block_Casings8 extends GT_Block_Casings_Abstract { case 2: for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { - if (i == 0 && j == 0) - continue; + if (i == 0 && j == 0) continue; int tState; - if ((tState = isTurbineControllerWithSide(aWorld, xCoord, yCoord + i, zCoord + j, aSide)) != 0) { - return getTurbineCasing(tMeta, 4 + i * 3 + j * tInvertLeftRightMod, tState == 1, tState == 2); + if ((tState = isTurbineControllerWithSide(aWorld, xCoord, yCoord + i, zCoord + j, aSide)) + != 0) { + return getTurbineCasing( + tMeta, 4 + i * 3 + j * tInvertLeftRightMod, tState == 1, tState == 2); } } } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings_Abstract.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings_Abstract.java index 7045949920..452ed16d44 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings_Abstract.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings_Abstract.java @@ -7,6 +7,7 @@ import gregtech.api.enums.Textures; import gregtech.api.items.GT_Generic_Block; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_LanguageManager; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -21,9 +22,8 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; - -public abstract class GT_Block_Casings_Abstract extends GT_Generic_Block implements gregtech.api.interfaces.IHasIndexedTexture { +public abstract class GT_Block_Casings_Abstract extends GT_Generic_Block + implements gregtech.api.interfaces.IHasIndexedTexture { public GT_Block_Casings_Abstract(Class<? extends ItemBlock> aItemClass, String aName, Material aMaterial) { super(aItemClass, aName, aMaterial); setStepSound(soundTypeMetal); @@ -32,7 +32,8 @@ public abstract class GT_Block_Casings_Abstract extends GT_Generic_Block impleme GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + 32767 + ".name", "Any Sub Block of this"); } - public GT_Block_Casings_Abstract(Class<? extends ItemBlock> aItemClass, String aName, Material aMaterial, int aMaxMeta) { + public GT_Block_Casings_Abstract( + Class<? extends ItemBlock> aItemClass, String aName, Material aMaterial, int aMaxMeta) { this(aItemClass, aName, aMaterial); for (int i = 0; i < aMaxMeta; i++) { Textures.BlockIcons.setCasingTextureForId(getTextureIndex(i), TextureFactory.of(this, i)); @@ -115,8 +116,7 @@ public abstract class GT_Block_Casings_Abstract extends GT_Generic_Block impleme @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister aIconRegister) { - } + public void registerBlockIcons(IIconRegister aIconRegister) {} @Override @SideOnly(Side.CLIENT) diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Concretes.java b/src/main/java/gregtech/common/blocks/GT_Block_Concretes.java index 0c98bab9c0..7debd01173 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Concretes.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Concretes.java @@ -11,11 +11,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class GT_Block_Concretes extends GT_Block_Stones_Abstract implements IBlockOnWalkOver{ +public class GT_Block_Concretes extends GT_Block_Stones_Abstract implements IBlockOnWalkOver { public GT_Block_Concretes() { super(GT_Item_Concretes.class, "gt.blockconcretes"); setResistance(20.0F); - //this.slipperiness = 0.9F; + // this.slipperiness = 0.9F; GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Dark Concrete"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Dark Concrete Cobblestone"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Mossy Dark Concrete Cobblestone"); @@ -70,9 +70,13 @@ public class GT_Block_Concretes extends GT_Block_Stones_Abstract implements IBlo @Override public void onWalkOver(EntityLivingBase aEntity, World aWorld, int aX, int aY, int aZ) { - if ((aEntity.motionX != 0 || aEntity.motionZ != 0) && !aEntity.isInWater() && !aEntity.isWet() && !aEntity.isSneaking()) { - double tSpeed = (aWorld.getBlock(aX, aY-1, aZ).slipperiness >= 0.8 ? 1.5 : 1.2); - aEntity.motionX *= tSpeed; aEntity.motionZ *= tSpeed; + if ((aEntity.motionX != 0 || aEntity.motionZ != 0) + && !aEntity.isInWater() + && !aEntity.isWet() + && !aEntity.isSneaking()) { + double tSpeed = (aWorld.getBlock(aX, aY - 1, aZ).slipperiness >= 0.8 ? 1.5 : 1.2); + aEntity.motionX *= tSpeed; + aEntity.motionZ *= tSpeed; } } } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java index 63626928bf..ea1df39932 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java @@ -1,4 +1,7 @@ package gregtech.common.blocks; + +import static gregtech.GT_Mod.GT_FML_LOGGER; +import static gregtech.api.enums.GT_Values.SIDE_UP; import static gregtech.api.objects.XSTR.XSTR_INSTANCE; import com.cricketcraft.chisel.api.IFacade; @@ -23,6 +26,10 @@ import gregtech.api.util.GT_Utility; import gregtech.common.render.GT_Renderer_Block; import gregtech.common.tileentities.storage.GT_MetaTileEntity_QuantumChest; import gregtech.common.tileentities.storage.GT_MetaTileEntity_SuperChest; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.client.renderer.texture.IIconRegister; @@ -39,22 +46,12 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.IIcon; -import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector; import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Random; - -import static gregtech.GT_Mod.GT_FML_LOGGER; -import static gregtech.api.enums.GT_Values.SIDE_UP; -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; - @Optional.Interface(iface = "com.cricketcraft.chisel.api.IFacade", modid = "ChiselAPI") public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlock, ITileEntityProvider, IFacade { private static final ThreadLocal<IGregTechTileEntity> mTemporaryTileEntity = new ThreadLocal<>(); @@ -231,8 +228,8 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo public void addCollisionBoxesToList( World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List outputAABB, Entity collider) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity && - ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) { + if (tTileEntity instanceof IGregTechTileEntity + && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) { ((IGregTechTileEntity) tTileEntity) .addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); return; @@ -243,8 +240,8 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity && - ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) { + if (tTileEntity instanceof IGregTechTileEntity + && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) { return ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); } return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); @@ -254,19 +251,21 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo @SideOnly(Side.CLIENT) public AxisAlignedBB getSelectedBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity && - ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) { + if (tTileEntity instanceof IGregTechTileEntity + && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) { return ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); } return super.getSelectedBoundingBoxFromPool(aWorld, aX, aY, aZ); } - @Override //THIS + @Override // THIS public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int aX, int aY, int aZ) { final TileEntity tTileEntity = blockAccess.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) { - final AxisAlignedBB bbb = ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(((IGregTechTileEntity) tTileEntity).getWorld(), 0, 0, 0); - minX = bbb.minX; //This essentially sets block bounds + if (tTileEntity instanceof IGregTechTileEntity + && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) { + final AxisAlignedBB bbb = ((IGregTechTileEntity) tTileEntity) + .getCollisionBoundingBoxFromPool(((IGregTechTileEntity) tTileEntity).getWorld(), 0, 0, 0); + minX = bbb.minX; // This essentially sets block bounds minY = bbb.minY; minZ = bbb.minZ; maxX = bbb.maxX; @@ -285,8 +284,8 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo @Override public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity && - ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) { + if (tTileEntity instanceof IGregTechTileEntity + && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) { ((IGregTechTileEntity) tTileEntity).onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider); return; } @@ -334,27 +333,35 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo @Override public float getPlayerRelativeBlockHardness(EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof BaseMetaTileEntity && - ((BaseMetaTileEntity) tTileEntity).privateAccess() && - !((BaseMetaTileEntity) tTileEntity).playerOwnsThis(aPlayer, true) ? - -1.0F : super.getPlayerRelativeBlockHardness(aPlayer, aWorld, aX, aY, aZ); - } - - @Override - public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int aSide, float aOffsetX, float aOffsetY, float aOffsetZ) { + return tTileEntity instanceof BaseMetaTileEntity + && ((BaseMetaTileEntity) tTileEntity).privateAccess() + && !((BaseMetaTileEntity) tTileEntity).playerOwnsThis(aPlayer, true) + ? -1.0F + : super.getPlayerRelativeBlockHardness(aPlayer, aWorld, aX, aY, aZ); + } + + @Override + public boolean onBlockActivated( + World aWorld, + int aX, + int aY, + int aZ, + EntityPlayer aPlayer, + int aSide, + float aOffsetX, + float aOffsetY, + float aOffsetZ) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (tTileEntity == null) { return false; } if (aPlayer.isSneaking()) { final ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); - if ( - tCurrentItem != null && - !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList) && - !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList) && - !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList) && - !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList) - ) return false; + if (tCurrentItem != null + && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList) + && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList) + && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList) + && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)) return false; } if ((tTileEntity instanceof IGregTechTileEntity)) { if (((IGregTechTileEntity) tTileEntity).getTimer() < 50L) { @@ -363,7 +370,8 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo if ((!aWorld.isRemote) && !((IGregTechTileEntity) tTileEntity).isUseableByPlayer(aPlayer)) { return true; } - return ((IGregTechTileEntity) tTileEntity).onRightclick(aPlayer, (byte) aSide, aOffsetX, aOffsetY, aOffsetZ); + return ((IGregTechTileEntity) tTileEntity) + .onRightclick(aPlayer, (byte) aSide, aOffsetX, aOffsetY, aOffsetZ); } return false; } @@ -389,7 +397,9 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo public void onBlockExploded(World aWorld, int aX, int aY, int aZ, Explosion aExplosion) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (tTileEntity instanceof BaseMetaTileEntity) { - GT_Log.exp.printf("Explosion at : %d | %d | %d DIMID: %s due to near explosion!%n", aX, aY, aZ, aWorld.provider.dimensionId); + GT_Log.exp.printf( + "Explosion at : %d | %d | %d DIMID: %s due to near explosion!%n", + aX, aY, aZ, aWorld.provider.dimensionId); ((BaseMetaTileEntity) tTileEntity).doEnergyExplosion(); } super.onBlockExploded(aWorld, aX, aY, aZ, aExplosion); @@ -402,18 +412,20 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo if (tTileEntity instanceof IGregTechTileEntity) { final IGregTechTileEntity tGregTechTileEntity = (IGregTechTileEntity) tTileEntity; mTemporaryTileEntity.set(tGregTechTileEntity); - if (!(tGregTechTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_SuperChest || tGregTechTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_QuantumChest)) { + if (!(tGregTechTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_SuperChest + || tGregTechTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_QuantumChest)) { for (int i = 0; i < tGregTechTileEntity.getSizeInventory(); i++) { final ItemStack tItem = tGregTechTileEntity.getStackInSlot(i); if ((tItem != null) && (tItem.stackSize > 0) && (tGregTechTileEntity.isValidSlot(i))) { final EntityItem tItemEntity = new EntityItem( - aWorld, - aX + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, - aY + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, - aZ + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, - new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage())); + aWorld, + aX + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, + aY + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, + aZ + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, + new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage())); if (tItem.hasTagCompound()) { - tItemEntity.getEntityItem().setTagCompound((NBTTagCompound) tItem.getTagCompound().copy()); + tItemEntity.getEntityItem().setTagCompound((NBTTagCompound) + tItem.getTagCompound().copy()); } tItemEntity.motionX = (XSTR_INSTANCE.nextGaussian() * 0.05D); tItemEntity.motionY = (XSTR_INSTANCE.nextGaussian() * 0.25D); @@ -492,12 +504,14 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo } @Override - public void dropBlockAsItemWithChance(World aWorld, int aX, int aY, int aZ, int aMetadata, float chance, int aFortune) { + public void dropBlockAsItemWithChance( + World aWorld, int aX, int aY, int aZ, int aMetadata, float chance, int aFortune) { if (!aWorld.isRemote) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (tTileEntity != null && (chance < 1.0F)) { if (tTileEntity instanceof BaseMetaTileEntity && (GregTech_API.sMachineNonWrenchExplosions)) { - GT_Log.exp.printf("Explosion at : %d | %d | %d DIMID: %s NonWrench picking/Rain!%n", + GT_Log.exp.printf( + "Explosion at : %d | %d | %d DIMID: %s NonWrench picking/Rain!%n", aX, aY, aZ, aWorld.provider.dimensionId); ((BaseMetaTileEntity) tTileEntity).doEnergyExplosion(); } @@ -517,12 +531,12 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo if (tTileEntity instanceof BaseMetaTileEntity) { return true; } - if (tTileEntity instanceof BaseMetaPipeEntity && - (((BaseMetaPipeEntity) tTileEntity).mConnections & 0xFFFFFFC0) != 0) { + if (tTileEntity instanceof BaseMetaPipeEntity + && (((BaseMetaPipeEntity) tTileEntity).mConnections & 0xFFFFFFC0) != 0) { return true; } - return tTileEntity instanceof ICoverable && - ((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide.ordinal()) != 0; + return tTileEntity instanceof ICoverable + && ((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide.ordinal()) != 0; } return false; } @@ -537,8 +551,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo */ @SideOnly(Side.CLIENT) @Override - public float getAmbientOcclusionLightValue() - { + public float getAmbientOcclusionLightValue() { return this.renderAsNormalBlock() ? 0.2F : 0.5F; } @@ -582,8 +595,14 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo @Override public float getExplosionResistance( - Entity entity, World aWorld, int aX, int aY, int aZ, - double explosionX, double explosionY, double explosionZ) { + Entity entity, + World aWorld, + int aX, + int aY, + int aZ, + double explosionX, + double explosionY, + double explosionZ) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (tTileEntity instanceof IGregTechTileEntity) { return ((IGregTechTileEntity) tTileEntity).getBlastResistance((byte) 6); @@ -607,7 +626,8 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (!(tTileEntity instanceof IGregTechTileEntity)) return; final IGregTechTileEntity iGregTechTileEntity = (IGregTechTileEntity) tTileEntity; - iGregTechTileEntity.setFrontFacing(BaseTileEntity.getSideForPlayerPlacing(aPlayer, SIDE_UP, iGregTechTileEntity.getValidFacings())); + iGregTechTileEntity.setFrontFacing( + BaseTileEntity.getSideForPlayerPlacing(aPlayer, SIDE_UP, iGregTechTileEntity.getValidFacings())); } @Override @@ -639,13 +659,16 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo final byte aSide = (byte) side; final CoverableTileEntity tile = (CoverableTileEntity) tTileEntity; if (side != -1) { - final Block facadeBlock = tile.getCoverBehaviorAtSideNew(aSide).getFacadeBlock(aSide, tile.getCoverIDAtSide(aSide), tile.getComplexCoverDataAtSide(aSide), tile); + final Block facadeBlock = tile.getCoverBehaviorAtSideNew(aSide) + .getFacadeBlock( + aSide, tile.getCoverIDAtSide(aSide), tile.getComplexCoverDataAtSide(aSide), tile); if (facadeBlock != null) return facadeBlock; } else { // we do not allow more than one type of facade per block, so no need to check every side // see comment in gregtech.common.covers.GT_Cover_FacadeBase.isCoverPlaceable for (byte i = 0; i < 6; i++) { - final Block facadeBlock = tile.getCoverBehaviorAtSideNew(i).getFacadeBlock(i, tile.getCoverIDAtSide(i), tile.getComplexCoverDataAtSide(i), tile); + final Block facadeBlock = tile.getCoverBehaviorAtSideNew(i) + .getFacadeBlock(i, tile.getCoverIDAtSide(i), tile.getComplexCoverDataAtSide(i), tile); if (facadeBlock != null) { return facadeBlock; } @@ -662,16 +685,22 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo final byte aSide = (byte) side; final CoverableTileEntity tile = (CoverableTileEntity) tTileEntity; if (side != -1) { - final Block facadeBlock = tile.getCoverBehaviorAtSideNew(aSide).getFacadeBlock(aSide, tile.getCoverIDAtSide(aSide), tile.getComplexCoverDataAtSide(aSide), tile); + final Block facadeBlock = tile.getCoverBehaviorAtSideNew(aSide) + .getFacadeBlock( + aSide, tile.getCoverIDAtSide(aSide), tile.getComplexCoverDataAtSide(aSide), tile); if (facadeBlock != null) - return tile.getCoverBehaviorAtSideNew(aSide).getFacadeMeta(aSide, tile.getCoverIDAtSide(aSide), tile.getComplexCoverDataAtSide(aSide), tile); + return tile.getCoverBehaviorAtSideNew(aSide) + .getFacadeMeta( + aSide, tile.getCoverIDAtSide(aSide), tile.getComplexCoverDataAtSide(aSide), tile); } else { // we do not allow more than one type of facade per block, so no need to check every side // see comment in gregtech.common.covers.GT_Cover_FacadeBase.isCoverPlaceable for (byte i = 0; i < 6; i++) { - final Block facadeBlock = tile.getCoverBehaviorAtSideNew(i).getFacadeBlock(i, tile.getCoverIDAtSide(i), tile.getComplexCoverDataAtSide(i), tile); + final Block facadeBlock = tile.getCoverBehaviorAtSideNew(i) + .getFacadeBlock(i, tile.getCoverIDAtSide(i), tile.getComplexCoverDataAtSide(i), tile); if (facadeBlock != null) { - return tile.getCoverBehaviorAtSideNew(i).getFacadeMeta(i, tile.getCoverIDAtSide(i), tile.getComplexCoverDataAtSide(i), tile); + return tile.getCoverBehaviorAtSideNew(i) + .getFacadeMeta(i, tile.getCoverIDAtSide(i), tile.getComplexCoverDataAtSide(i), tile); } } } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Metal.java b/src/main/java/gregtech/common/blocks/GT_Block_Metal.java index 7fcfd7a29a..2bb703a2f9 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Metal.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Metal.java @@ -26,11 +26,13 @@ public class GT_Block_Metal extends GT_Block_Storage { for (int i = 0; i < aMats.length; i++) { if (aMats[i].mMetaItemSubID > 0 && aMats[i].mHasParentMod) { - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + i + ".name", "Block of " + (GT_LanguageManager.i18nPlaceholder ? "%material" : aMats[i].mDefaultLocalName)); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + "." + i + ".name", + "Block of " + (GT_LanguageManager.i18nPlaceholder ? "%material" : aMats[i].mDefaultLocalName)); GT_OreDictUnificator.registerOre(aPrefix, aMats[i], new ItemStack(this, 1, i)); } } - if (aMats.length<16 && mNEIisLoaded) { + if (aMats.length < 16 && mNEIisLoaded) { for (int i = aMats.length; i < 16; i++) codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i)); } } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores.java index 3af861e167..3f0c829b50 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Ores.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores.java @@ -1,5 +1,10 @@ package gregtech.common.blocks; +import static gregtech.api.enums.Textures.BlockIcons.BASALT_STONE; +import static gregtech.api.enums.Textures.BlockIcons.GRANITE_BLACK_STONE; +import static gregtech.api.enums.Textures.BlockIcons.GRANITE_RED_STONE; +import static gregtech.api.enums.Textures.BlockIcons.MARBLE_STONE; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.GT_Mod; @@ -8,6 +13,7 @@ import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.ITexture; import gregtech.api.render.TextureFactory; +import java.util.Arrays; import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; @@ -16,13 +22,6 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.Arrays; - -import static gregtech.api.enums.Textures.BlockIcons.BASALT_STONE; -import static gregtech.api.enums.Textures.BlockIcons.GRANITE_BLACK_STONE; -import static gregtech.api.enums.Textures.BlockIcons.GRANITE_RED_STONE; -import static gregtech.api.enums.Textures.BlockIcons.MARBLE_STONE; - public class GT_Block_Ores extends GT_Block_Ores_Abstract { private static final String UNLOCALIZED_NAME = "gt.blockores"; @@ -36,8 +35,18 @@ public class GT_Block_Ores extends GT_Block_Ores_Abstract { } @Override - public OrePrefixes[] getProcessingPrefix() { //Must have 8 entries; an entry can be null to disable automatic recipes. - return new OrePrefixes[]{OrePrefixes.ore, OrePrefixes.oreNetherrack, OrePrefixes.oreEndstone, OrePrefixes.oreBlackgranite, OrePrefixes.oreRedgranite, OrePrefixes.oreMarble, OrePrefixes.oreBasalt, null}; + public OrePrefixes[] + getProcessingPrefix() { // Must have 8 entries; an entry can be null to disable automatic recipes. + return new OrePrefixes[] { + OrePrefixes.ore, + OrePrefixes.oreNetherrack, + OrePrefixes.oreEndstone, + OrePrefixes.oreBlackgranite, + OrePrefixes.oreRedgranite, + OrePrefixes.oreMarble, + OrePrefixes.oreBasalt, + null + }; } @Override @@ -100,25 +109,49 @@ public class GT_Block_Ores extends GT_Block_Ores_Abstract { } @Override - public Materials[] getDroppedDusts() { //Must have 8 entries; can be null. - return new Materials[]{Materials.Stone, Materials.Netherrack, Materials.Endstone, Materials.GraniteBlack, Materials.GraniteRed, Materials.Marble, Materials.Basalt, Materials.Stone}; + public Materials[] getDroppedDusts() { // Must have 8 entries; can be null. + return new Materials[] { + Materials.Stone, + Materials.Netherrack, + Materials.Endstone, + Materials.GraniteBlack, + Materials.GraniteRed, + Materials.Marble, + Materials.Basalt, + Materials.Stone + }; } @Override public boolean[] getEnabledMetas() { - return new boolean[]{true, true, true, GT_Mod.gregtechproxy.enableBlackGraniteOres, GT_Mod.gregtechproxy.enableRedGraniteOres, GT_Mod.gregtechproxy.enableMarbleOres, GT_Mod.gregtechproxy.enableBasaltOres, true}; + return new boolean[] { + true, + true, + true, + GT_Mod.gregtechproxy.enableBlackGraniteOres, + GT_Mod.gregtechproxy.enableRedGraniteOres, + GT_Mod.gregtechproxy.enableMarbleOres, + GT_Mod.gregtechproxy.enableBasaltOres, + true + }; } @Override public ITexture[] getTextureSet() { - final ITexture[] rTextures = new ITexture[16]; //Must have 16 entries. + final ITexture[] rTextures = new ITexture[16]; // Must have 16 entries. Arrays.fill(rTextures, TextureFactory.of(Blocks.stone)); rTextures[1] = TextureFactory.of(Blocks.netherrack); rTextures[2] = TextureFactory.of(Blocks.end_stone); - rTextures[3] = TextureFactory.builder().addIcon(GRANITE_BLACK_STONE).stdOrient().build(); - rTextures[4] = TextureFactory.builder().addIcon(GRANITE_RED_STONE).stdOrient().build(); - rTextures[5] = TextureFactory.builder().addIcon(MARBLE_STONE).stdOrient().build(); - rTextures[6] = TextureFactory.builder().addIcon(BASALT_STONE).stdOrient().build(); + rTextures[3] = TextureFactory.builder() + .addIcon(GRANITE_BLACK_STONE) + .stdOrient() + .build(); + rTextures[4] = + TextureFactory.builder().addIcon(GRANITE_RED_STONE).stdOrient().build(); + rTextures[5] = + TextureFactory.builder().addIcon(MARBLE_STONE).stdOrient().build(); + rTextures[6] = + TextureFactory.builder().addIcon(BASALT_STONE).stdOrient().build(); return rTextures; } } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java index 3a7f231761..93aa9992ea 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java @@ -14,6 +14,10 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import gregtech.common.render.GT_Renderer_Block; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; @@ -33,11 +37,6 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements ITileEntityProvider { private static final String DOT_NAME = ".name"; public static ThreadLocal<GT_TileEntity_Ores> mTemporaryTileEntity = new ThreadLocal<>(); @@ -45,7 +44,8 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements public static boolean tHideOres; public static Set<Materials> aBlockedOres = new HashSet<>(); - protected GT_Block_Ores_Abstract(String aUnlocalizedName, int aOreMetaCount, boolean aHideFirstMeta, Material aMaterial) { + protected GT_Block_Ores_Abstract( + String aUnlocalizedName, int aOreMetaCount, boolean aHideFirstMeta, Material aMaterial) { super(GT_Item_Ores.class, aUnlocalizedName, aMaterial); this.isBlockContainer = true; setStepSound(soundTypeStone); @@ -60,10 +60,24 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements if (GregTech_API.sGeneratedMaterials[i] != null) { for (int j = 0; j < aOreMetaCount; j++) { if (!this.getEnabledMetas()[j]) continue; - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + (j * 1000)) + DOT_NAME, GT_LanguageManager.i18nPlaceholder ? getLocalizedNameFormat(GregTech_API.sGeneratedMaterials[i]) : getLocalizedName(GregTech_API.sGeneratedMaterials[i])); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + ((i + 16000) + (j * 1000)) + DOT_NAME, "Small " + (GT_LanguageManager.i18nPlaceholder ? getLocalizedNameFormat(GregTech_API.sGeneratedMaterials[i]) : getLocalizedName(GregTech_API.sGeneratedMaterials[i]))); - if ((GregTech_API.sGeneratedMaterials[i].mTypes & 0x8) != 0 && !aBlockedOres.contains(GregTech_API.sGeneratedMaterials[i])) { - GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[j] != null ? this.getProcessingPrefix()[j].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + (j * 1000))); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + "." + (i + (j * 1000)) + DOT_NAME, + GT_LanguageManager.i18nPlaceholder + ? getLocalizedNameFormat(GregTech_API.sGeneratedMaterials[i]) + : getLocalizedName(GregTech_API.sGeneratedMaterials[i])); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + "." + ((i + 16000) + (j * 1000)) + DOT_NAME, + "Small " + + (GT_LanguageManager.i18nPlaceholder + ? getLocalizedNameFormat(GregTech_API.sGeneratedMaterials[i]) + : getLocalizedName(GregTech_API.sGeneratedMaterials[i]))); + if ((GregTech_API.sGeneratedMaterials[i].mTypes & 0x8) != 0 + && !aBlockedOres.contains(GregTech_API.sGeneratedMaterials[i])) { + GT_OreDictUnificator.registerOre( + this.getProcessingPrefix()[j] != null + ? this.getProcessingPrefix()[j].get(GregTech_API.sGeneratedMaterials[i]) + : "", + new ItemStack(this, 1, i + (j * 1000))); if (tHideOres) { if (!(j == 0 && !aHideFirstMeta)) { codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + (j * 1000))); @@ -138,7 +152,16 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements } @Override - public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int aSide, float aOffsetX, float aOffsetY, float aOffsetZ) { + public boolean onBlockActivated( + World aWorld, + int aX, + int aY, + int aZ, + EntityPlayer aPlayer, + int aSide, + float aOffsetX, + float aOffsetY, + float aOffsetZ) { if (!aPlayer.isSneaking() || !aPlayer.capabilities.isCreativeMode) { return false; } @@ -154,7 +177,8 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements } @Override - public boolean onBlockEventReceived(World p_149696_1_, int p_149696_2_, int p_149696_3_, int p_149696_4_, int p_149696_5_, int p_149696_6_) { + public boolean onBlockEventReceived( + World p_149696_1_, int p_149696_2_, int p_149696_3_, int p_149696_4_, int p_149696_5_, int p_149696_6_) { super.onBlockEventReceived(p_149696_1_, p_149696_2_, p_149696_3_, p_149696_4_, p_149696_5_, p_149696_6_); TileEntity tileentity = p_149696_1_.getTileEntity(p_149696_2_, p_149696_3_, p_149696_4_); return tileentity != null && tileentity.receiveClientEvent(p_149696_5_, p_149696_6_); @@ -181,7 +205,15 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements } @Override - public float getExplosionResistance(Entity entity, World aWorld, int aX, int aY, int aZ, double explosionX, double explosionY, double explosionZ) { + public float getExplosionResistance( + Entity entity, + World aWorld, + int aX, + int aY, + int aZ, + double explosionX, + double explosionY, + double explosionZ) { return 1.0F + getHarvestLevel(aWorld.getBlockMetadata(aX, aY, aZ)) * 1.0F; } @@ -240,13 +272,13 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister aIconRegister) { - } + public void registerBlockIcons(IIconRegister aIconRegister) {} @Override @SideOnly(Side.CLIENT) public boolean addHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) { - GT_Renderer_Block.addHitEffects(effectRenderer, this, worldObj, target.blockX, target.blockY, target.blockZ, target.sideHit); + GT_Renderer_Block.addHitEffects( + effectRenderer, this, worldObj, target.blockX, target.blockY, target.blockZ, target.sideHit); return true; } @@ -276,13 +308,14 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements aWorld.removeTileEntity(aX, aY, aZ); } - public abstract OrePrefixes[] getProcessingPrefix(); //Must have 8 entries; an entry can be null to disable automatic recipes. + public abstract OrePrefixes[] + getProcessingPrefix(); // Must have 8 entries; an entry can be null to disable automatic recipes. - public abstract boolean[] getEnabledMetas(); //Must have 8 entries. + public abstract boolean[] getEnabledMetas(); // Must have 8 entries. public abstract Block getDroppedBlock(); - public abstract Materials[] getDroppedDusts(); //Must have 8 entries; can be null. + public abstract Materials[] getDroppedDusts(); // Must have 8 entries; can be null. @Override public ArrayList<ItemStack> getDrops(World aWorld, int aX, int aY, int aZ, int aMeta, int aFortune) { @@ -290,7 +323,9 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements if ((tTileEntity instanceof GT_TileEntity_Ores)) { return ((GT_TileEntity_Ores) tTileEntity).getDrops(getDroppedBlock(), aFortune); } - return mTemporaryTileEntity.get() == null ? new ArrayList<>() : mTemporaryTileEntity.get().getDrops(getDroppedBlock(), aFortune); + return mTemporaryTileEntity.get() == null + ? new ArrayList<>() + : mTemporaryTileEntity.get().getDrops(getDroppedBlock(), aFortune); } @Override @@ -298,7 +333,7 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements return new GT_TileEntity_Ores(); } - public abstract ITexture[] getTextureSet(); //Must have 16 entries. + public abstract ITexture[] getTextureSet(); // Must have 16 entries. @SuppressWarnings({"unchecked"}) @Override diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB1.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB1.java index f749b8ac5b..73fe674fbe 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB1.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB1.java @@ -25,10 +25,19 @@ public class GT_Block_Ores_UB1 extends GT_Block_Ores_Abstract { } @Override - public OrePrefixes[] getProcessingPrefix() { //Must have 8 entries. - return new OrePrefixes[]{OrePrefixes.oreRedgranite, OrePrefixes.oreBlackgranite, OrePrefixes.ore, OrePrefixes.ore, OrePrefixes.ore, OrePrefixes.oreBasalt, OrePrefixes.ore, OrePrefixes.ore}; + public OrePrefixes[] getProcessingPrefix() { // Must have 8 entries. + return new OrePrefixes[] { + OrePrefixes.oreRedgranite, + OrePrefixes.oreBlackgranite, + OrePrefixes.ore, + OrePrefixes.ore, + OrePrefixes.ore, + OrePrefixes.oreBasalt, + OrePrefixes.ore, + OrePrefixes.ore + }; } - + @Override public IIcon getIcon(int side, int meta) { return aUBBlock.getIcon(side, (meta / 1000) % 8); @@ -45,17 +54,43 @@ public class GT_Block_Ores_UB1 extends GT_Block_Ores_Abstract { } @Override - public Materials[] getDroppedDusts() { //Must have 8 entries; can be null. - return new Materials[]{Materials.Stone, Materials.Stone, Materials.Stone, Materials.Stone, Materials.Stone, Materials.Stone, Materials.Stone, Materials.Stone}; + public Materials[] getDroppedDusts() { // Must have 8 entries; can be null. + return new Materials[] { + Materials.Stone, + Materials.Stone, + Materials.Stone, + Materials.Stone, + Materials.Stone, + Materials.Stone, + Materials.Stone, + Materials.Stone + }; } @Override public boolean[] getEnabledMetas() { - return new boolean[]{true, true, true, true, true, true, true, true}; + return new boolean[] {true, true, true, true, true, true, true, true}; } @Override - public ITexture[] getTextureSet() { //Must have 16 entries. - return new ITexture[]{TextureFactory.of(aUBBlock, 0), TextureFactory.of(aUBBlock, 1), TextureFactory.of(aUBBlock, 2), TextureFactory.of(aUBBlock, 3), TextureFactory.of(aUBBlock, 4), TextureFactory.of(aUBBlock, 5), TextureFactory.of(aUBBlock, 6), TextureFactory.of(aUBBlock, 7), TextureFactory.of(aUBBlock, 0), TextureFactory.of(aUBBlock, 1), TextureFactory.of(aUBBlock, 2), TextureFactory.of(aUBBlock, 3), TextureFactory.of(aUBBlock, 4), TextureFactory.of(aUBBlock, 5), TextureFactory.of(aUBBlock, 6), TextureFactory.of(aUBBlock, 7)}; + public ITexture[] getTextureSet() { // Must have 16 entries. + return new ITexture[] { + TextureFactory.of(aUBBlock, 0), + TextureFactory.of(aUBBlock, 1), + TextureFactory.of(aUBBlock, 2), + TextureFactory.of(aUBBlock, 3), + TextureFactory.of(aUBBlock, 4), + TextureFactory.of(aUBBlock, 5), + TextureFactory.of(aUBBlock, 6), + TextureFactory.of(aUBBlock, 7), + TextureFactory.of(aUBBlock, 0), + TextureFactory.of(aUBBlock, 1), + TextureFactory.of(aUBBlock, 2), + TextureFactory.of(aUBBlock, 3), + TextureFactory.of(aUBBlock, 4), + TextureFactory.of(aUBBlock, 5), + TextureFactory.of(aUBBlock, 6), + TextureFactory.of(aUBBlock, 7) + }; } } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB2.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB2.java index a1e0f69637..0d7e2c3428 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB2.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB2.java @@ -25,10 +25,20 @@ public class GT_Block_Ores_UB2 extends GT_Block_Ores_Abstract { } @Override - public OrePrefixes[] getProcessingPrefix() { //Must have 8 entries; an entry can be null to disable automatic recipes. - return new OrePrefixes[]{OrePrefixes.ore, OrePrefixes.ore, OrePrefixes.oreMarble, OrePrefixes.ore, OrePrefixes.ore, OrePrefixes.ore, OrePrefixes.ore, OrePrefixes.ore}; + public OrePrefixes[] + getProcessingPrefix() { // Must have 8 entries; an entry can be null to disable automatic recipes. + return new OrePrefixes[] { + OrePrefixes.ore, + OrePrefixes.ore, + OrePrefixes.oreMarble, + OrePrefixes.ore, + OrePrefixes.ore, + OrePrefixes.ore, + OrePrefixes.ore, + OrePrefixes.ore + }; } - + @Override public IIcon getIcon(int side, int meta) { return aUBBlock.getIcon(side, (meta / 1000) % 8); @@ -45,17 +55,43 @@ public class GT_Block_Ores_UB2 extends GT_Block_Ores_Abstract { } @Override - public Materials[] getDroppedDusts() { //Must have 8 entries; can be null. - return new Materials[]{Materials.Stone, Materials.Stone, Materials.Stone, Materials.Stone, Materials.Stone, Materials.Stone, Materials.Stone, Materials.Stone}; + public Materials[] getDroppedDusts() { // Must have 8 entries; can be null. + return new Materials[] { + Materials.Stone, + Materials.Stone, + Materials.Stone, + Materials.Stone, + Materials.Stone, + Materials.Stone, + Materials.Stone, + Materials.Stone + }; } @Override public boolean[] getEnabledMetas() { - return new boolean[]{true, true, true, true, true, true, true, true}; + return new boolean[] {true, true, true, true, true, true, true, true}; } @Override - public ITexture[] getTextureSet() { //Must have 16 entries. - return new ITexture[]{TextureFactory.of(aUBBlock, 0), TextureFactory.of(aUBBlock, 1), TextureFactory.of(aUBBlock, 2), TextureFactory.of(aUBBlock, 3), TextureFactory.of(aUBBlock, 4), TextureFactory.of(aUBBlock, 5), TextureFactory.of(aUBBlock, 6), TextureFactory.of(aUBBlock, 7), TextureFactory.of(aUBBlock, 0), TextureFactory.of(aUBBlock, 1), TextureFactory.of(aUBBlock, 2), TextureFactory.of(aUBBlock, 3), TextureFactory.of(aUBBlock, 4), TextureFactory.of(aUBBlock, 5), TextureFactory.of(aUBBlock, 6), TextureFactory.of(aUBBlock, 7)}; + public ITexture[] getTextureSet() { // Must have 16 entries. + return new ITexture[] { + TextureFactory.of(aUBBlock, 0), + TextureFactory.of(aUBBlock, 1), + TextureFactory.of(aUBBlock, 2), + TextureFactory.of(aUBBlock, 3), + TextureFactory.of(aUBBlock, 4), + TextureFactory.of(aUBBlock, 5), + TextureFactory.of(aUBBlock, 6), + TextureFactory.of(aUBBlock, 7), + TextureFactory.of(aUBBlock, 0), + TextureFactory.of(aUBBlock, 1), + TextureFactory.of(aUBBlock, 2), + TextureFactory.of(aUBBlock, 3), + TextureFactory.of(aUBBlock, 4), + TextureFactory.of(aUBBlock, 5), + TextureFactory.of(aUBBlock, 6), + TextureFactory.of(aUBBlock, 7) + }; } } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB3.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB3.java index 280b6450df..5754f87454 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB3.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB3.java @@ -25,10 +25,20 @@ public class GT_Block_Ores_UB3 extends GT_Block_Ores_Abstract { } @Override - public OrePrefixes[] getProcessingPrefix() { //Must have 8 entries; an entry can be null to disable automatic recipes. - return new OrePrefixes[]{OrePrefixes.ore, OrePrefixes.ore, OrePrefixes.ore, OrePrefixes.ore, OrePrefixes.ore, OrePrefixes.ore, OrePrefixes.ore, OrePrefixes.ore}; + public OrePrefixes[] + getProcessingPrefix() { // Must have 8 entries; an entry can be null to disable automatic recipes. + return new OrePrefixes[] { + OrePrefixes.ore, + OrePrefixes.ore, + OrePrefixes.ore, + OrePrefixes.ore, + OrePrefixes.ore, + OrePrefixes.ore, + OrePrefixes.ore, + OrePrefixes.ore + }; } - + @Override public IIcon getIcon(int side, int meta) { return aUBBlock.getIcon(side, (meta / 1000) % 8); @@ -45,17 +55,43 @@ public class GT_Block_Ores_UB3 extends GT_Block_Ores_Abstract { } @Override - public Materials[] getDroppedDusts() { //Must have 8 entries; can be null. - return new Materials[]{Materials.Stone, Materials.Stone, Materials.Stone, Materials.Stone, Materials.Stone, Materials.Stone, Materials.Stone, Materials.Stone}; + public Materials[] getDroppedDusts() { // Must have 8 entries; can be null. + return new Materials[] { + Materials.Stone, + Materials.Stone, + Materials.Stone, + Materials.Stone, + Materials.Stone, + Materials.Stone, + Materials.Stone, + Materials.Stone + }; } @Override public boolean[] getEnabledMetas() { - return new boolean[]{true, true, true, true, true, true, true, true}; + return new boolean[] {true, true, true, true, true, true, true, true}; } @Override - public ITexture[] getTextureSet() { //Must have 16 entries. - return new ITexture[]{TextureFactory.of(aUBBlock, 0), TextureFactory.of(aUBBlock, 1), TextureFactory.of(aUBBlock, 2), TextureFactory.of(aUBBlock, 3), TextureFactory.of(aUBBlock, 4), TextureFactory.of(aUBBlock, 5), TextureFactory.of(aUBBlock, 6), TextureFactory.of(aUBBlock, 7), TextureFactory.of(aUBBlock, 0), TextureFactory.of(aUBBlock, 1), TextureFactory.of(aUBBlock, 2), TextureFactory.of(aUBBlock, 3), TextureFactory.of(aUBBlock, 4), TextureFactory.of(aUBBlock, 5), TextureFactory.of(aUBBlock, 6), TextureFactory.of(aUBBlock, 7)}; + public ITexture[] getTextureSet() { // Must have 16 entries. + return new ITexture[] { + TextureFactory.of(aUBBlock, 0), + TextureFactory.of(aUBBlock, 1), + TextureFactory.of(aUBBlock, 2), + TextureFactory.of(aUBBlock, 3), + TextureFactory.of(aUBBlock, 4), + TextureFactory.of(aUBBlock, 5), + TextureFactory.of(aUBBlock, 6), + TextureFactory.of(aUBBlock, 7), + TextureFactory.of(aUBBlock, 0), + TextureFactory.of(aUBBlock, 1), + TextureFactory.of(aUBBlock, 2), + TextureFactory.of(aUBBlock, 3), + TextureFactory.of(aUBBlock, 4), + TextureFactory.of(aUBBlock, 5), + TextureFactory.of(aUBBlock, 6), + TextureFactory.of(aUBBlock, 7) + }; } } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java index 776580f77b..37887ac5f6 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java @@ -1,5 +1,7 @@ package gregtech.common.blocks; +import static gregtech.api.objects.XSTR.XSTR_INSTANCE; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; @@ -9,6 +11,7 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.WorldSpawnedEventBuilder; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -27,10 +30,6 @@ import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; - -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; - public class GT_Block_Reinforced extends GT_Generic_Block { public GT_Block_Reinforced(String aName) { @@ -54,9 +53,11 @@ public class GT_Block_Reinforced extends GT_Generic_Block { GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".11.name", "Neutronium Reinforced Block"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".12.name", "Raw Deep Dark Portal Block"); ItemList.Block_BronzePlate.set(new ItemStack(this.setHardness(60.0f).setResistance(150.0f), 1, 0)); - ItemList.Block_IridiumTungstensteel.set(new ItemStack(this.setHardness(400.0f).setResistance(600.0f), 1, 1)); + ItemList.Block_IridiumTungstensteel.set( + new ItemStack(this.setHardness(400.0f).setResistance(600.0f), 1, 1)); ItemList.Block_Plascrete.set(new ItemStack(this.setHardness(5.0f).setResistance(6.0f), 1, 2)); - ItemList.Block_TungstenSteelReinforced.set(new ItemStack(this.setHardness(250.0f).setResistance(400.0f), 1, 3)); + ItemList.Block_TungstenSteelReinforced.set( + new ItemStack(this.setHardness(250.0f).setResistance(400.0f), 1, 3)); ItemList.Block_BrittleCharcoal.set(new ItemStack(this.setHardness(0.5f).setResistance(8.0f), 1, 4)); ItemList.Block_Powderbarrel.set(new ItemStack(this.setHardness(2.5f).setResistance(2.0f), 1, 5)); ItemList.Block_SSFUEL.set(new ItemStack(this.setHardness(2.5f).setResistance(2.0f), 1, 6)); @@ -64,11 +65,24 @@ public class GT_Block_Reinforced extends GT_Generic_Block { ItemList.Block_SteelPlate.set(new ItemStack(this.setHardness(150.0f).setResistance(200.0f), 1, 8)); ItemList.Block_TitaniumPlate.set(new ItemStack(this.setHardness(200.0f).setResistance(300.0f), 1, 9)); ItemList.Block_NaquadahPlate.set(new ItemStack(this.setHardness(500.0f).setResistance(1000.0f), 1, 10)); - ItemList.Block_NeutroniumPlate.set(new ItemStack(this.setHardness(750.0f).setResistance(2500.0f), 1, 11)); - ItemList.Block_BedrockiumCompressed.set(new ItemStack(this.setHardness(1500.0f).setResistance(5000.0f), 1, 12)); - GT_ModHandler.addShapelessCraftingRecipe(new ItemStack(Items.coal, 1, 1), new Object[]{ItemList.Block_BrittleCharcoal.get(1)}); - GT_ModHandler.addCraftingRecipe(ItemList.Block_Powderbarrel.get(1L),GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"WSW","GGG","WGW", 'W', OrePrefixes.plate.get(Materials.Wood), 'G', new ItemStack(Items.gunpowder,1),'S',new ItemStack(Items.string,1)}); - + ItemList.Block_NeutroniumPlate.set( + new ItemStack(this.setHardness(750.0f).setResistance(2500.0f), 1, 11)); + ItemList.Block_BedrockiumCompressed.set( + new ItemStack(this.setHardness(1500.0f).setResistance(5000.0f), 1, 12)); + GT_ModHandler.addShapelessCraftingRecipe( + new ItemStack(Items.coal, 1, 1), new Object[] {ItemList.Block_BrittleCharcoal.get(1)}); + GT_ModHandler.addCraftingRecipe( + ItemList.Block_Powderbarrel.get(1L), GT_ModHandler.RecipeBits.REVERSIBLE, new Object[] { + "WSW", + "GGG", + "WGW", + 'W', + OrePrefixes.plate.get(Materials.Wood), + 'G', + new ItemStack(Items.gunpowder, 1), + 'S', + new ItemStack(Items.string, 1) + }); } @Override @@ -80,10 +94,10 @@ public class GT_Block_Reinforced extends GT_Generic_Block { @Override public int getHarvestLevel(int aMeta) { - if (aMeta == 4||aMeta == 5 || aMeta == 6 || aMeta == 7) return 1; + if (aMeta == 4 || aMeta == 5 || aMeta == 6 || aMeta == 7) return 1; if (aMeta == 2) return 2; - if (aMeta == 9||aMeta == 3 || aMeta == 1) return 5; - if (aMeta == 10||aMeta == 11) return 7; + if (aMeta == 9 || aMeta == 3 || aMeta == 1) return 5; + if (aMeta == 10 || aMeta == 11) return 7; return 4; } @@ -102,11 +116,11 @@ public class GT_Block_Reinforced extends GT_Generic_Block { case 4: return Blocks.coal_block.getIcon(0, 0); case 5: - return Textures.BlockIcons.COVER_WOOD_PLATE.getIcon(); + return Textures.BlockIcons.COVER_WOOD_PLATE.getIcon(); case 6: - return Blocks.coal_block.getIcon(0, 0); + return Blocks.coal_block.getIcon(0, 0); case 7: - return Blocks.coal_block.getIcon(0, 0); + return Blocks.coal_block.getIcon(0, 0); case 8: return Textures.BlockIcons.BLOCK_STEELPREIN.getIcon(); case 9: @@ -143,7 +157,7 @@ public class GT_Block_Reinforced extends GT_Generic_Block { if (tMeta == 3) { return 250.0F; } - if (tMeta == 4||tMeta == 5 || tMeta == 6 || tMeta == 7) { + if (tMeta == 4 || tMeta == 5 || tMeta == 6 || tMeta == 7) { return 0.5F; } if (tMeta == 8) { @@ -162,7 +176,8 @@ public class GT_Block_Reinforced extends GT_Generic_Block { } @Override - public float getExplosionResistance(Entity entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) { + public float getExplosionResistance( + Entity entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) { if (world == null) { return 0.0F; } @@ -196,7 +211,6 @@ public class GT_Block_Reinforced extends GT_Generic_Block { } if (tMeta == 11) { return 2500.0F; - } return super.getExplosionResistance(entity, world, x, y, z, explosionX, explosionY, explosionZ); } @@ -237,7 +251,8 @@ public class GT_Block_Reinforced extends GT_Generic_Block { } @Override - public void dropBlockAsItemWithChance(World aWorld, int aX, int aY, int aZ, int aMetadata, float chance, int aFortune) { + public void dropBlockAsItemWithChance( + World aWorld, int aX, int aY, int aZ, int aMetadata, float chance, int aFortune) { if (aMetadata == 4) { this.dropBlockAsItem(aWorld, aX, aY, aZ, new ItemStack(Items.coal, XSTR_INSTANCE.nextInt(2) + 1, 1)); } else { @@ -246,67 +261,73 @@ public class GT_Block_Reinforced extends GT_Generic_Block { } @Override - public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) - { - if(!world.isRemote && world.getBlockMetadata(x, y, z)==5){ - EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, x + 0.5F, y + 0.5F, z + 0.5F, player); - world.spawnEntityInWorld(entitytntprimed); - new WorldSpawnedEventBuilder.SoundAtEntityEventBuilder() - .setPitch(1f) - .setVolume(1f) - .setIdentifier(SoundResource.GAME_TNT_PRIMED) - .setEntity(entitytntprimed) - .setWorld(world) - .run(); - world.setBlockToAir(x, y, z); - return false; - } - return super.removedByPlayer(world, player, x, y, z); + public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) { + if (!world.isRemote && world.getBlockMetadata(x, y, z) == 5) { + EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, x + 0.5F, y + 0.5F, z + 0.5F, player); + world.spawnEntityInWorld(entitytntprimed); + new WorldSpawnedEventBuilder.SoundAtEntityEventBuilder() + .setPitch(1f) + .setVolume(1f) + .setIdentifier(SoundResource.GAME_TNT_PRIMED) + .setEntity(entitytntprimed) + .setWorld(world) + .run(); + world.setBlockToAir(x, y, z); + return false; + } + return super.removedByPlayer(world, player, x, y, z); } @Override - public void onBlockAdded(World world, int x, int y, int z) - { - super.onBlockAdded(world, x, y, z); - if (world.isBlockIndirectlyGettingPowered(x, y, z)&&world.getBlockMetadata(x, y, z)==5) { - removedByPlayer(world, null, x, y, z); - } + public void onBlockAdded(World world, int x, int y, int z) { + super.onBlockAdded(world, x, y, z); + if (world.isBlockIndirectlyGettingPowered(x, y, z) && world.getBlockMetadata(x, y, z) == 5) { + removedByPlayer(world, null, x, y, z); + } } @Override - public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) - { - if (world.isBlockIndirectlyGettingPowered(x, y, z)&&world.getBlockMetadata(x, y, z)==5) { - removedByPlayer(world, null, x, y, z); - } + public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) { + if (world.isBlockIndirectlyGettingPowered(x, y, z) && world.getBlockMetadata(x, y, z) == 5) { + removedByPlayer(world, null, x, y, z); + } } @Override public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) { - if (!world.isRemote && world.getBlockMetadata(x, y, z)==5){ - EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, x + 0.5F, y + 0.5F, z + 0.5F, explosion.getExplosivePlacedBy()); - entitytntprimed.fuse = (world.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8); - world.spawnEntityInWorld(entitytntprimed); - } - super.onBlockExploded(world, x, y, z, explosion); + if (!world.isRemote && world.getBlockMetadata(x, y, z) == 5) { + EntityTNTPrimed entitytntprimed = + new EntityTNTPrimed(world, x + 0.5F, y + 0.5F, z + 0.5F, explosion.getExplosivePlacedBy()); + entitytntprimed.fuse = (world.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8); + world.spawnEntityInWorld(entitytntprimed); + } + super.onBlockExploded(world, x, y, z, explosion); } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float xOffset, float yOffset, float zOffset) - { - if ((player.getCurrentEquippedItem() != null) && (player.getCurrentEquippedItem().getItem() == Items.flint_and_steel)&&world.getBlockMetadata(x, y, z)==5) - { - removedByPlayer(world, player, x, y, z); + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int side, + float xOffset, + float yOffset, + float zOffset) { + if ((player.getCurrentEquippedItem() != null) + && (player.getCurrentEquippedItem().getItem() == Items.flint_and_steel) + && world.getBlockMetadata(x, y, z) == 5) { + removedByPlayer(world, player, x, y, z); - return true; - } - return super.onBlockActivated(world, x, y, z, player, side, xOffset, yOffset, zOffset); + return true; + } + return super.onBlockActivated(world, x, y, z, player, side, xOffset, yOffset, zOffset); } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister aIconRegister) { - } + public void registerBlockIcons(IIconRegister aIconRegister) {} @Override @SideOnly(Side.CLIENT) diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Stones.java b/src/main/java/gregtech/common/blocks/GT_Block_Stones.java index 3838f30f0b..1ee8e6df50 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Stones.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Stones.java @@ -29,10 +29,14 @@ public class GT_Block_Stones extends GT_Block_Stones_Abstract { GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".13.name", "Mossy Basalt Bricks"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".14.name", "Chiseled Basalt"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".15.name", "Smooth Basalt"); - for(int i = 0;i<16;i++){ - GT_OreDictUnificator.registerOre(OrePrefixes.stone, i < 8 ? Materials.Marble : Materials.Basalt, new ItemStack(this, 1, i)); - GT_OreDictUnificator.registerOre(OrePrefixes.block, i < 8 ? Materials.Marble : Materials.Basalt, new ItemStack(this, 1, i)); - GT_OreDictUnificator.registerOre((i < 8 ? Materials.Marble.mName.toLowerCase() : Materials.Basalt.mName.toLowerCase()), new ItemStack(this, 1, i)); + for (int i = 0; i < 16; i++) { + GT_OreDictUnificator.registerOre( + OrePrefixes.stone, i < 8 ? Materials.Marble : Materials.Basalt, new ItemStack(this, 1, i)); + GT_OreDictUnificator.registerOre( + OrePrefixes.block, i < 8 ? Materials.Marble : Materials.Basalt, new ItemStack(this, 1, i)); + GT_OreDictUnificator.registerOre( + (i < 8 ? Materials.Marble.mName.toLowerCase() : Materials.Basalt.mName.toLowerCase()), + new ItemStack(this, 1, i)); } } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Stones_Abstract.java b/src/main/java/gregtech/common/blocks/GT_Block_Stones_Abstract.java index b3c0a1811c..f40a6b8173 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Stones_Abstract.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Stones_Abstract.java @@ -8,6 +8,7 @@ import gregtech.api.interfaces.IOreRecipeRegistrator; import gregtech.api.items.GT_Generic_Block; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; +import java.util.List; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -21,8 +22,6 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; - public class GT_Block_Stones_Abstract extends GT_Generic_Block implements IOreRecipeRegistrator { public GT_Block_Stones_Abstract(Class<? extends ItemBlock> aItemClass, String aName) { super(aItemClass, aName, Material.rock); @@ -45,59 +44,118 @@ public class GT_Block_Stones_Abstract extends GT_Generic_Block implements IOreRe GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 13), new ItemStack(this, 1, 8)); GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 14), new ItemStack(this, 1, 8)); GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 15), new ItemStack(this, 1, 8)); - GT_Values.RA.addAssemblerRecipe(new ItemStack(this, 1, 0), ItemList.Circuit_Integrated.getWithDamage(0L, 4L, new Object[0]), new ItemStack(this, 1, 3), 50, 4); - GT_Values.RA.addAssemblerRecipe(new ItemStack(this, 1, 8), ItemList.Circuit_Integrated.getWithDamage(0L, 4L, new Object[0]), new ItemStack(this, 1, 11), 50, 4); - GT_ModHandler.addCraftingRecipe(new ItemStack(this, 1, 6), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"f", "X", 'X', new ItemStack(this, 1, 7)}); - GT_ModHandler.addCraftingRecipe(new ItemStack(this, 1, 14), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"f", "X", 'X', new ItemStack(this, 1, 15)}); - GT_ModHandler.addCraftingRecipe(new ItemStack(this, 1, 4), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"h", "X", 'X', new ItemStack(this, 1, 3)}); - GT_ModHandler.addCraftingRecipe(new ItemStack(this, 1, 12), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"h", "X", 'X', new ItemStack(this, 1, 11)}); - GT_ModHandler.addCraftingRecipe(new ItemStack(this, 1, 1), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"h", "X", 'X', new ItemStack(this, 1, 0)}); - GT_ModHandler.addCraftingRecipe(new ItemStack(this, 1, 9), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"h", "X", 'X', new ItemStack(this, 1, 8)}); + GT_Values.RA.addAssemblerRecipe( + new ItemStack(this, 1, 0), + ItemList.Circuit_Integrated.getWithDamage(0L, 4L, new Object[0]), + new ItemStack(this, 1, 3), + 50, + 4); + GT_Values.RA.addAssemblerRecipe( + new ItemStack(this, 1, 8), + ItemList.Circuit_Integrated.getWithDamage(0L, 4L, new Object[0]), + new ItemStack(this, 1, 11), + 50, + 4); + GT_ModHandler.addCraftingRecipe( + new ItemStack(this, 1, 6), + GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[] {"f", "X", 'X', new ItemStack(this, 1, 7)}); + GT_ModHandler.addCraftingRecipe( + new ItemStack(this, 1, 14), + GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[] {"f", "X", 'X', new ItemStack(this, 1, 15)}); + GT_ModHandler.addCraftingRecipe( + new ItemStack(this, 1, 4), + GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[] {"h", "X", 'X', new ItemStack(this, 1, 3)}); + GT_ModHandler.addCraftingRecipe( + new ItemStack(this, 1, 12), + GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[] {"h", "X", 'X', new ItemStack(this, 1, 11)}); + GT_ModHandler.addCraftingRecipe( + new ItemStack(this, 1, 1), + GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[] {"h", "X", 'X', new ItemStack(this, 1, 0)}); + GT_ModHandler.addCraftingRecipe( + new ItemStack(this, 1, 9), + GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[] {"h", "X", 'X', new ItemStack(this, 1, 8)}); GT_Values.RA.addForgeHammerRecipe(new ItemStack(this, 1, 3), new ItemStack(this, 1, 4), 16, 10); GT_Values.RA.addForgeHammerRecipe(new ItemStack(this, 1, 11), new ItemStack(this, 1, 12), 16, 10); GT_Values.RA.addForgeHammerRecipe(new ItemStack(this, 1, 0), new ItemStack(this, 1, 1), 16, 10); GT_Values.RA.addForgeHammerRecipe(new ItemStack(this, 1, 8), new ItemStack(this, 1, 9), 16, 10); - GT_ModHandler.addCraftingRecipe(new ItemStack(this, 4, 3), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"XX", "XX", 'X', new ItemStack(this, 4, 0)}); - GT_ModHandler.addCraftingRecipe(new ItemStack(this, 4, 11), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"XX", "XX", 'X', new ItemStack(this, 4, 8)}); - GT_ModHandler.addCraftingRecipe(new ItemStack(this, 4, 3), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"XX", "XX", 'X', new ItemStack(this, 4, 7)}); - GT_ModHandler.addCraftingRecipe(new ItemStack(this, 4, 11), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"XX", "XX", 'X', new ItemStack(this, 4, 15)}); + GT_ModHandler.addCraftingRecipe( + new ItemStack(this, 4, 3), + GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[] {"XX", "XX", 'X', new ItemStack(this, 4, 0)}); + GT_ModHandler.addCraftingRecipe( + new ItemStack(this, 4, 11), + GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[] {"XX", "XX", 'X', new ItemStack(this, 4, 8)}); + GT_ModHandler.addCraftingRecipe( + new ItemStack(this, 4, 3), + GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[] {"XX", "XX", 'X', new ItemStack(this, 4, 7)}); + GT_ModHandler.addCraftingRecipe( + new ItemStack(this, 4, 11), + GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[] {"XX", "XX", 'X', new ItemStack(this, 4, 15)}); } @Override - public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { + public void registerOre( + OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { if (aOreDictName.equals(OreDictNames.craftingLensWhite.toString())) { - GT_Values.RA.addLaserEngraverRecipe(new ItemStack(this, 1, 7), GT_Utility.copyAmount(0L, new Object[]{aStack}), new ItemStack(this, 1, 6), 50, 16); - GT_Values.RA.addLaserEngraverRecipe(new ItemStack(this, 1, 15), GT_Utility.copyAmount(0L, new Object[]{aStack}), new ItemStack(this, 1, 14), 50, 16); + GT_Values.RA.addLaserEngraverRecipe( + new ItemStack(this, 1, 7), + GT_Utility.copyAmount(0L, new Object[] {aStack}), + new ItemStack(this, 1, 6), + 50, + 16); + GT_Values.RA.addLaserEngraverRecipe( + new ItemStack(this, 1, 15), + GT_Utility.copyAmount(0L, new Object[] {aStack}), + new ItemStack(this, 1, 14), + 50, + 16); } } + @Override public String getHarvestTool(int aMeta) { return "pickaxe"; } + @Override public int getHarvestLevel(int aMeta) { return 1; } + @Override public float getBlockHardness(World aWorld, int aX, int aY, int aZ) { return this.blockHardness = Blocks.stone.getBlockHardness(aWorld, aX, aY, aZ) * 3.0F; } + @Override public String getUnlocalizedName() { return this.mUnlocalizedName; } + @Override public String getLocalizedName() { return StatCollector.translateToLocal(this.mUnlocalizedName + ".name"); } + @Override public boolean canBeReplacedByLeaves(IBlockAccess aWorld, int aX, int aY, int aZ) { return false; } + @Override public boolean isNormalCube(IBlockAccess aWorld, int aX, int aY, int aZ) { return true; } + @Override public IIcon getIcon(int aSide, int aMeta) { if ((aMeta >= 0) && (aMeta < 16)) { @@ -110,10 +168,12 @@ public class GT_Block_Stones_Abstract extends GT_Generic_Block implements IOreRe public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) { return world.getBlockMetadata(x, y, z) % 8 < 3; } + @Override public int damageDropped(int metadata) { return metadata % 8 == 0 ? metadata + 1 : metadata; } + @Override public int getDamageValue(World aWorld, int aX, int aY, int aZ) { return aWorld.getBlockMetadata(aX, aY, aZ); @@ -121,8 +181,7 @@ public class GT_Block_Stones_Abstract extends GT_Generic_Block implements IOreRe @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister aIconRegister) { - } + public void registerBlockIcons(IIconRegister aIconRegister) {} @Override @SideOnly(Side.CLIENT) diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Storage.java b/src/main/java/gregtech/common/blocks/GT_Block_Storage.java index 7cb495a3d9..f318eab8ff 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Storage.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Storage.java @@ -4,6 +4,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; import gregtech.api.items.GT_Generic_Block; +import java.util.List; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -17,8 +18,6 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; - public class GT_Block_Storage extends GT_Generic_Block { protected GT_Block_Storage(Class<? extends ItemBlock> aItemClass, String aName, Material aMaterial) { @@ -89,8 +88,7 @@ public class GT_Block_Storage extends GT_Generic_Block { @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister aIconRegister) { - } + public void registerBlockIcons(IIconRegister aIconRegister) {} @Override @SideOnly(Side.CLIENT) diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Casings1.java b/src/main/java/gregtech/common/blocks/GT_Item_Casings1.java index f61f8360fa..70748d5f1a 100644 --- a/src/main/java/gregtech/common/blocks/GT_Item_Casings1.java +++ b/src/main/java/gregtech/common/blocks/GT_Item_Casings1.java @@ -1,13 +1,6 @@ package gregtech.common.blocks; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import java.util.List; public class GT_Item_Casings1 extends GT_Item_Casings_Abstract { public GT_Item_Casings1(Block block) { diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Casings2.java b/src/main/java/gregtech/common/blocks/GT_Item_Casings2.java index 11a3aed3af..5e77ace15d 100644 --- a/src/main/java/gregtech/common/blocks/GT_Item_Casings2.java +++ b/src/main/java/gregtech/common/blocks/GT_Item_Casings2.java @@ -1,11 +1,10 @@ package gregtech.common.blocks; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import java.util.List; - public class GT_Item_Casings2 extends GT_Item_Casings_Abstract { public GT_Item_Casings2(Block block) { super(block); diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Casings5.java b/src/main/java/gregtech/common/blocks/GT_Item_Casings5.java index a0890ce154..7486d25ec5 100644 --- a/src/main/java/gregtech/common/blocks/GT_Item_Casings5.java +++ b/src/main/java/gregtech/common/blocks/GT_Item_Casings5.java @@ -4,19 +4,20 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.HeatingCoilLevel; import gregtech.api.util.GT_LanguageManager; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import java.util.List; - public class GT_Item_Casings5 extends GT_Item_Casings_Abstract { public GT_Item_Casings5(Block block) { super(block); } - protected static final String mCoilHeatTooltip = GT_LanguageManager.addStringLocalization("gt.coilheattooltip", "Base Heating Capacity = "); - protected static final String mCoilUnitTooltip = GT_LanguageManager.addStringLocalization("gt.coilunittooltip", " Kelvin"); + protected static final String mCoilHeatTooltip = + GT_LanguageManager.addStringLocalization("gt.coilheattooltip", "Base Heating Capacity = "); + protected static final String mCoilUnitTooltip = + GT_LanguageManager.addStringLocalization("gt.coilunittooltip", " Kelvin"); @Override @SideOnly(Side.CLIENT) diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Casings_Abstract.java b/src/main/java/gregtech/common/blocks/GT_Item_Casings_Abstract.java index 33b428772d..bca2de6eb6 100644 --- a/src/main/java/gregtech/common/blocks/GT_Item_Casings_Abstract.java +++ b/src/main/java/gregtech/common/blocks/GT_Item_Casings_Abstract.java @@ -2,29 +2,40 @@ package gregtech.common.blocks; import gregtech.api.GregTech_API; import gregtech.api.util.GT_LanguageManager; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import java.util.List; - public abstract class GT_Item_Casings_Abstract extends ItemBlock { - protected final String mNoMobsToolTip = GT_LanguageManager.addStringLocalization("gt.nomobspawnsonthisblock", "Mobs cannot Spawn on this Block"); - protected final String mNoTileEntityToolTip = GT_LanguageManager.addStringLocalization("gt.notileentityinthisblock", "This is NOT a TileEntity!"); - protected final String mCoil01Tooltip = GT_LanguageManager.addStringLocalization("gt.coil01tooltip", "Base Heating Capacity = 1800 Kelvin"); - protected final String mCoil02Tooltip = GT_LanguageManager.addStringLocalization("gt.coil02tooltip", "Base Heating Capacity = 2700 Kelvin"); - protected final String mCoil03Tooltip = GT_LanguageManager.addStringLocalization("gt.coil03tooltip", "Base Heating Capacity = 3600 Kelvin"); - protected final String mCoil04Tooltip = GT_LanguageManager.addStringLocalization("gt.coil04tooltip", "Base Heating Capacity = 4500 Kelvin"); - protected final String mCoil05Tooltip = GT_LanguageManager.addStringLocalization("gt.coil05tooltip", "Base Heating Capacity = 5400 Kelvin"); - protected final String mCoil06Tooltip = GT_LanguageManager.addStringLocalization("gt.coil06tooltip", "Base Heating Capacity = 7200 Kelvin"); - protected final String mCoil07Tooltip = GT_LanguageManager.addStringLocalization("gt.coil07tooltip", "Base Heating Capacity = 9001 Kelvin"); - protected final String mCoil08Tooltip = GT_LanguageManager.addStringLocalization("gt.coil08tooltip", "Base Heating Capacity = 9900 Kelvin"); - protected final String mCoil09Tooltip = GT_LanguageManager.addStringLocalization("gt.coil09tooltip", "Base Heating Capacity = 10800 Kelvin"); - protected final String mBlastProofTooltip = GT_LanguageManager.addStringLocalization("gt.blastprooftooltip", "This Block is Blast Proof"); + protected final String mNoMobsToolTip = + GT_LanguageManager.addStringLocalization("gt.nomobspawnsonthisblock", "Mobs cannot Spawn on this Block"); + protected final String mNoTileEntityToolTip = + GT_LanguageManager.addStringLocalization("gt.notileentityinthisblock", "This is NOT a TileEntity!"); + protected final String mCoil01Tooltip = + GT_LanguageManager.addStringLocalization("gt.coil01tooltip", "Base Heating Capacity = 1800 Kelvin"); + protected final String mCoil02Tooltip = + GT_LanguageManager.addStringLocalization("gt.coil02tooltip", "Base Heating Capacity = 2700 Kelvin"); + protected final String mCoil03Tooltip = + GT_LanguageManager.addStringLocalization("gt.coil03tooltip", "Base Heating Capacity = 3600 Kelvin"); + protected final String mCoil04Tooltip = + GT_LanguageManager.addStringLocalization("gt.coil04tooltip", "Base Heating Capacity = 4500 Kelvin"); + protected final String mCoil05Tooltip = + GT_LanguageManager.addStringLocalization("gt.coil05tooltip", "Base Heating Capacity = 5400 Kelvin"); + protected final String mCoil06Tooltip = + GT_LanguageManager.addStringLocalization("gt.coil06tooltip", "Base Heating Capacity = 7200 Kelvin"); + protected final String mCoil07Tooltip = + GT_LanguageManager.addStringLocalization("gt.coil07tooltip", "Base Heating Capacity = 9001 Kelvin"); + protected final String mCoil08Tooltip = + GT_LanguageManager.addStringLocalization("gt.coil08tooltip", "Base Heating Capacity = 9900 Kelvin"); + protected final String mCoil09Tooltip = + GT_LanguageManager.addStringLocalization("gt.coil09tooltip", "Base Heating Capacity = 10800 Kelvin"); + protected final String mBlastProofTooltip = + GT_LanguageManager.addStringLocalization("gt.blastprooftooltip", "This Block is Blast Proof"); public GT_Item_Casings_Abstract(Block block) { - super(block ); + super(block); setMaxDamage(0); setHasSubtypes(true); setCreativeTab(GregTech_API.TAB_GREGTECH_MATERIALS); diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Concretes.java b/src/main/java/gregtech/common/blocks/GT_Item_Concretes.java index 1417aa4c39..0ee92868e8 100644 --- a/src/main/java/gregtech/common/blocks/GT_Item_Concretes.java +++ b/src/main/java/gregtech/common/blocks/GT_Item_Concretes.java @@ -1,14 +1,14 @@ package gregtech.common.blocks; import gregtech.api.util.GT_LanguageManager; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import java.util.List; - public class GT_Item_Concretes extends GT_Item_Stones_Abstract { - private final String mRunFasterToolTip = GT_LanguageManager.addStringLocalization("gt.runfastertooltip", "You can walk faster on this Block"); + private final String mRunFasterToolTip = + GT_LanguageManager.addStringLocalization("gt.runfastertooltip", "You can walk faster on this Block"); public GT_Item_Concretes(Block block) { super(block); diff --git a/src/main/java/gregtech/common/blocks/GT_Item_LongDistancePipe.java b/src/main/java/gregtech/common/blocks/GT_Item_LongDistancePipe.java index c63f10b8f4..eda3c9b01b 100644 --- a/src/main/java/gregtech/common/blocks/GT_Item_LongDistancePipe.java +++ b/src/main/java/gregtech/common/blocks/GT_Item_LongDistancePipe.java @@ -2,16 +2,17 @@ package gregtech.common.blocks; import gregtech.api.GregTech_API; import gregtech.api.util.GT_LanguageManager; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import java.util.List; - public class GT_Item_LongDistancePipe extends ItemBlock { - protected final String mNoMobsToolTip = GT_LanguageManager.addStringLocalization("gt.nomobspawnsonthisblock", "Mobs cannot Spawn on this Block"); - protected final String mNoTileEntityToolTip = GT_LanguageManager.addStringLocalization("gt.notileentityinthisblock", "This is NOT a TileEntity!"); + protected final String mNoMobsToolTip = + GT_LanguageManager.addStringLocalization("gt.nomobspawnsonthisblock", "Mobs cannot Spawn on this Block"); + protected final String mNoTileEntityToolTip = + GT_LanguageManager.addStringLocalization("gt.notileentityinthisblock", "This is NOT a TileEntity!"); public GT_Item_LongDistancePipe(Block block) { super(block); diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java index 9cf4029934..95de8da0c2 100644 --- a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java +++ b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java @@ -1,5 +1,7 @@ package gregtech.common.blocks; +import static gregtech.GT_Mod.GT_FML_LOGGER; + import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; @@ -8,18 +10,16 @@ import gregtech.api.interfaces.metatileentity.IConnectable; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.CoverableTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Cable; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Frame; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Item; -import gregtech.api.util.GT_CoverBehaviorBase; import gregtech.api.util.GT_ItsNotMyFaultException; import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; -import gregtech.api.util.ISerializableObject; import gregtech.common.tileentities.storage.*; +import java.util.List; +import javax.annotation.Nullable; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -34,11 +34,6 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; -import javax.annotation.Nullable; -import java.util.List; - -import static gregtech.GT_Mod.GT_FML_LOGGER; - public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { public GT_Item_Machines(Block block) { super(block); @@ -47,15 +42,12 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { setCreativeTab(GregTech_API.TAB_GREGTECH); } - public static IMetaTileEntity getMetaTileEntity(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) - return null; - if (!(aStack.getItem() instanceof GT_Item_Machines)) - return null; - if (aStack.getItemDamage() < 0 || aStack.getItemDamage() > GregTech_API.METATILEENTITIES.length) - return null; - return GregTech_API.METATILEENTITIES[aStack.getItemDamage()]; - } + public static IMetaTileEntity getMetaTileEntity(ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack)) return null; + if (!(aStack.getItem() instanceof GT_Item_Machines)) return null; + if (aStack.getItemDamage() < 0 || aStack.getItemDamage() > GregTech_API.METATILEENTITIES.length) return null; + return GregTech_API.METATILEENTITIES[aStack.getItemDamage()]; + } @Override @SuppressWarnings("unchecked") @@ -68,45 +60,84 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { if (GregTech_API.METATILEENTITIES[tDamage] != null) { final IGregTechTileEntity tTileEntity = GregTech_API.METATILEENTITIES[tDamage].getBaseMetaTileEntity(); - if (!GregTech_API.sPostloadFinished && tTileEntity.getMetaTileEntity() instanceof ISecondaryDescribable) { - final String[] tSecondaryDescription = ((ISecondaryDescribable) tTileEntity.getMetaTileEntity()).getSecondaryDescription(); + if (!GregTech_API.sPostloadFinished + && tTileEntity.getMetaTileEntity() instanceof ISecondaryDescribable) { + final String[] tSecondaryDescription = + ((ISecondaryDescribable) tTileEntity.getMetaTileEntity()).getSecondaryDescription(); addDescription(null, tSecondaryDescription, tDamage, "_Secondary", true); } { final IMetaTileEntity tMetaTileEntity = tTileEntity.getMetaTileEntity(); - final String tSuffix = (tMetaTileEntity instanceof ISecondaryDescribable && ((ISecondaryDescribable) tMetaTileEntity).isDisplaySecondaryDescription()) ? "_Secondary" : ""; - addDescription(aList, tTileEntity.getDescription(), tDamage, tSuffix, !GregTech_API.sPostloadFinished); + final String tSuffix = (tMetaTileEntity instanceof ISecondaryDescribable + && ((ISecondaryDescribable) tMetaTileEntity).isDisplaySecondaryDescription()) + ? "_Secondary" + : ""; + addDescription( + aList, tTileEntity.getDescription(), tDamage, tSuffix, !GregTech_API.sPostloadFinished); } if (tTileEntity.getEUCapacity() > 0L) { if (tTileEntity.getInputVoltage() > 0L) { final int inputTier = GT_Utility.getTier(tTileEntity.getInputVoltage()); - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_IN", "Voltage IN: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(tTileEntity.getInputVoltage()) + " (" + GT_Values.TIER_COLORS[inputTier] + GT_Values.VN[inputTier] + EnumChatFormatting.GREEN +")" + EnumChatFormatting.GRAY); + aList.add(GT_LanguageManager.addStringLocalization( + "TileEntity_EUp_IN", "Voltage IN: ", !GregTech_API.sPostloadFinished) + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(tTileEntity.getInputVoltage()) + + " (" + GT_Values.TIER_COLORS[inputTier] + GT_Values.VN[inputTier] + + EnumChatFormatting.GREEN + ")" + EnumChatFormatting.GRAY); } if (tTileEntity.getOutputVoltage() > 0L) { final int outputTier = GT_Utility.getTier(tTileEntity.getOutputVoltage()); - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_OUT", "Voltage OUT: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(tTileEntity.getOutputVoltage()) + " (" + GT_Values.TIER_COLORS[outputTier] + GT_Values.VN[outputTier] + EnumChatFormatting.GREEN + ")" + EnumChatFormatting.GRAY); + aList.add(GT_LanguageManager.addStringLocalization( + "TileEntity_EUp_OUT", "Voltage OUT: ", !GregTech_API.sPostloadFinished) + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(tTileEntity.getOutputVoltage()) + + " (" + GT_Values.TIER_COLORS[outputTier] + GT_Values.VN[outputTier] + + EnumChatFormatting.GREEN + ")" + EnumChatFormatting.GRAY); } if (tTileEntity.getOutputAmperage() > 1L) { - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_AMOUNT", "Amperage: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(tTileEntity.getOutputAmperage()) + EnumChatFormatting.GRAY); + aList.add(GT_LanguageManager.addStringLocalization( + "TileEntity_EUp_AMOUNT", "Amperage: ", !GregTech_API.sPostloadFinished) + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(tTileEntity.getOutputAmperage()) + + EnumChatFormatting.GRAY); } - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE", "Capacity: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.BLUE + GT_Utility.formatNumbers(tTileEntity.getEUCapacity()) + EnumChatFormatting.GRAY + " EU"); + aList.add(GT_LanguageManager.addStringLocalization( + "TileEntity_EUp_STORE", "Capacity: ", !GregTech_API.sPostloadFinished) + + EnumChatFormatting.BLUE + GT_Utility.formatNumbers(tTileEntity.getEUCapacity()) + + EnumChatFormatting.GRAY + " EU"); } - if (GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_QuantumTank || GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_SuperTank) { + if (GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_QuantumTank + || GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_SuperTank) { if (aStack.hasTagCompound() && aStack.stackTagCompound.hasKey("mFluid")) { - final FluidStack tContents = FluidStack.loadFluidStackFromNBT(aStack.stackTagCompound.getCompoundTag("mFluid")); + final FluidStack tContents = + FluidStack.loadFluidStackFromNBT(aStack.stackTagCompound.getCompoundTag("mFluid")); if (tContents != null && tContents.amount > 0) { - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_TANK_INFO", "Contains Fluid: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.YELLOW + tContents.getLocalizedName() + EnumChatFormatting.GRAY); - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_TANK_AMOUNT", "Fluid Amount: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(tContents.amount) + " L" + EnumChatFormatting.GRAY); + aList.add(GT_LanguageManager.addStringLocalization( + "TileEntity_TANK_INFO", "Contains Fluid: ", !GregTech_API.sPostloadFinished) + + EnumChatFormatting.YELLOW + + tContents.getLocalizedName() + + EnumChatFormatting.GRAY); + aList.add(GT_LanguageManager.addStringLocalization( + "TileEntity_TANK_AMOUNT", "Fluid Amount: ", !GregTech_API.sPostloadFinished) + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(tContents.amount) + " L" + + EnumChatFormatting.GRAY); } } } if (GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_DigitalChestBase) { if (aStack.hasTagCompound() && aStack.stackTagCompound.hasKey("mItemStack")) { - final ItemStack tContents = ItemStack.loadItemStackFromNBT(aStack.stackTagCompound.getCompoundTag("mItemStack")); + final ItemStack tContents = + ItemStack.loadItemStackFromNBT(aStack.stackTagCompound.getCompoundTag("mItemStack")); final int tSize = aStack.stackTagCompound.getInteger("mItemCount"); if (tContents != null && tSize > 0) { - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_CHEST_INFO", "Contains Item: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.YELLOW + tContents.getDisplayName() + EnumChatFormatting.GRAY); - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_CHEST_AMOUNT", "Item Amount: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(tSize) + EnumChatFormatting.GRAY); + aList.add(GT_LanguageManager.addStringLocalization( + "TileEntity_CHEST_INFO", "Contains Item: ", !GregTech_API.sPostloadFinished) + + EnumChatFormatting.YELLOW + + tContents.getDisplayName() + + EnumChatFormatting.GRAY); + aList.add(GT_LanguageManager.addStringLocalization( + "TileEntity_CHEST_AMOUNT", "Item Amount: ", !GregTech_API.sPostloadFinished) + + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(tSize) + + EnumChatFormatting.GRAY); } } } @@ -114,14 +145,20 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { final NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { if (aNBT.getBoolean("mMuffler")) { - aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_MUFFLER", "has Muffler Upgrade", !GregTech_API.sPostloadFinished )); + aList.add(GT_LanguageManager.addStringLocalization( + "GT_TileEntity_MUFFLER", "has Muffler Upgrade", !GregTech_API.sPostloadFinished)); } if (aNBT.getBoolean("mSteamConverter")) { - aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMCONVERTER", "has Steam Upgrade", !GregTech_API.sPostloadFinished )); + aList.add(GT_LanguageManager.addStringLocalization( + "GT_TileEntity_STEAMCONVERTER", "has Steam Upgrade", !GregTech_API.sPostloadFinished)); } int tAmount = 0; if ((tAmount = aNBT.getByte("mSteamTanks")) > 0) { - aList.add(tAmount + " " + GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMTANKS", "Steam Tank Upgrades", !GregTech_API.sPostloadFinished )); + aList.add(tAmount + " " + + GT_LanguageManager.addStringLocalization( + "GT_TileEntity_STEAMTANKS", + "Steam Tank Upgrades", + !GregTech_API.sPostloadFinished)); } CoverableTileEntity.addInstalledCoversInformation(aNBT, aList); @@ -131,7 +168,12 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { } } - private void addDescription(@Nullable List<String> aList, @Nullable String[] aDescription, int aDamage, String aSuffix, boolean aWriteIntoLangFile) { + private void addDescription( + @Nullable List<String> aList, + @Nullable String[] aDescription, + int aDamage, + String aSuffix, + boolean aWriteIntoLangFile) { if (aDescription == null) return; for (int i = 0, tLength = aDescription.length; i < tLength; i++) { String tDescLine = aDescription[i]; @@ -148,7 +190,9 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { tBuffer.append(" %s"); tRep[j / 2] = tSplitStrings[j]; } - final String tTranslated = String.format(GT_LanguageManager.addStringLocalization(tKey, tBuffer.toString(), aWriteIntoLangFile), (Object[]) tRep); + final String tTranslated = String.format( + GT_LanguageManager.addStringLocalization(tKey, tBuffer.toString(), aWriteIntoLangFile), + (Object[]) tRep); if (aList != null) aList.add(tTranslated); } else { String tTranslated = GT_LanguageManager.addStringLocalization(tKey, tDescLine, aWriteIntoLangFile); @@ -158,7 +202,17 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { } @Override - public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { + public boolean onItemUseFirst( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float hitX, + float hitY, + float hitZ) { return false; } @@ -176,37 +230,52 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { @Override public String getItemStackDisplayName(ItemStack aStack) { - String aName = super.getItemStackDisplayName(aStack); - final short aDamage = (short) getDamage(aStack); - if (aDamage >= 0 && aDamage < GregTech_API.METATILEENTITIES.length && GregTech_API.METATILEENTITIES[aDamage] != null) { + String aName = super.getItemStackDisplayName(aStack); + final short aDamage = (short) getDamage(aStack); + if (aDamage >= 0 + && aDamage < GregTech_API.METATILEENTITIES.length + && GregTech_API.METATILEENTITIES[aDamage] != null) { Materials aMaterial = null; if (GregTech_API.METATILEENTITIES[aDamage] instanceof GT_MetaPipeEntity_Item) { - aMaterial = ((GT_MetaPipeEntity_Item) GregTech_API.METATILEENTITIES[aDamage]).mMaterial; + aMaterial = ((GT_MetaPipeEntity_Item) GregTech_API.METATILEENTITIES[aDamage]).mMaterial; } else if (GregTech_API.METATILEENTITIES[aDamage] instanceof GT_MetaPipeEntity_Fluid) { - aMaterial = ((GT_MetaPipeEntity_Fluid) GregTech_API.METATILEENTITIES[aDamage]).mMaterial; + aMaterial = ((GT_MetaPipeEntity_Fluid) GregTech_API.METATILEENTITIES[aDamage]).mMaterial; } else if (GregTech_API.METATILEENTITIES[aDamage] instanceof GT_MetaPipeEntity_Cable) { - aMaterial = ((GT_MetaPipeEntity_Cable) GregTech_API.METATILEENTITIES[aDamage]).mMaterial; + aMaterial = ((GT_MetaPipeEntity_Cable) GregTech_API.METATILEENTITIES[aDamage]).mMaterial; } else if (GregTech_API.METATILEENTITIES[aDamage] instanceof GT_MetaPipeEntity_Frame) { - aMaterial = ((GT_MetaPipeEntity_Frame) GregTech_API.METATILEENTITIES[aDamage]).mMaterial; + aMaterial = ((GT_MetaPipeEntity_Frame) GregTech_API.METATILEENTITIES[aDamage]).mMaterial; } if (aMaterial != null) { - aName = aMaterial.getLocalizedNameForItem(aName); + aName = aMaterial.getLocalizedNameForItem(aName); } } - return aName; + return aName; } @Override public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { super.onCreated(aStack, aWorld, aPlayer); final short tDamage = (short) getDamage(aStack); - if ((tDamage < 0) || ((tDamage >= GregTech_API.METATILEENTITIES.length) && (GregTech_API.METATILEENTITIES[tDamage] != null))) { + if ((tDamage < 0) + || ((tDamage >= GregTech_API.METATILEENTITIES.length) + && (GregTech_API.METATILEENTITIES[tDamage] != null))) { GregTech_API.METATILEENTITIES[tDamage].onCreated(aStack, aWorld, aPlayer); } } @Override - public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int side, float hitX, float hitY, float hitZ, int aMeta) { + public boolean placeBlockAt( + ItemStack aStack, + EntityPlayer aPlayer, + World aWorld, + int aX, + int aY, + int aZ, + int side, + float hitX, + float hitY, + float hitZ, + int aMeta) { final short tDamage = (short) getDamage(aStack); if (tDamage > 0) { if (GregTech_API.METATILEENTITIES[tDamage] == null) { @@ -217,10 +286,12 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { return false; } if (aWorld.getBlock(aX, aY, aZ) != this.field_150939_a) { - throw new GT_ItsNotMyFaultException("Failed to place Block even though World.setBlock returned true. It COULD be MCPC/Bukkit causing that. In case you really have that installed, don't report this Bug to me, I don't know how to fix it."); + throw new GT_ItsNotMyFaultException( + "Failed to place Block even though World.setBlock returned true. It COULD be MCPC/Bukkit causing that. In case you really have that installed, don't report this Bug to me, I don't know how to fix it."); } if (aWorld.getBlockMetadata(aX, aY, aZ) != tMetaData) { - throw new GT_ItsNotMyFaultException("Failed to set the MetaValue of the Block even though World.setBlock returned true. It COULD be MCPC/Bukkit causing that. In case you really have that installed, don't report this Bug to me, I don't know how to fix it."); + throw new GT_ItsNotMyFaultException( + "Failed to set the MetaValue of the Block even though World.setBlock returned true. It COULD be MCPC/Bukkit causing that. In case you really have that installed, don't report this Bug to me, I don't know how to fix it."); } final IGregTechTileEntity tTileEntity = (IGregTechTileEntity) aWorld.getTileEntity(aX, aY, aZ); if (tTileEntity != null) { @@ -233,12 +304,12 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { final byte aSide = GT_Utility.getOppositeSide(side); if (tTileEntity.getMetaTileEntity() instanceof IConnectable) { // If we're connectable, try connecting to whatever we're up against - ((IConnectable) tTileEntity.getMetaTileEntity()).connect(aSide); + ((IConnectable) tTileEntity.getMetaTileEntity()).connect(aSide); } else if (aPlayer != null && aPlayer.isSneaking()) { // If we're being placed against something that is connectable, try telling it to connect to us final IGregTechTileEntity aTileEntity = tTileEntity.getIGregTechTileEntityAtSide(aSide); if (aTileEntity != null && aTileEntity.getMetaTileEntity() instanceof IConnectable) { - ((IConnectable) aTileEntity.getMetaTileEntity()).connect((byte)side); + ((IConnectable) aTileEntity.getMetaTileEntity()).connect((byte) side); } } } @@ -257,18 +328,19 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { super.onUpdate(aStack, aWorld, aPlayer, aTimer, aIsInHand); final short tDamage = (short) getDamage(aStack); final EntityLivingBase tPlayer = (EntityPlayer) aPlayer; - if (GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_SuperChest || - GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_QuantumChest || - GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_SuperTank || - GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_QuantumTank) { + if (GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_SuperChest + || GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_QuantumChest + || GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_SuperTank + || GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_QuantumTank) { final NBTTagCompound tNBT = aStack.stackTagCompound; if (tNBT == null) return; if (tNBT.hasNoTags()) { aStack.setTagCompound(null); return; } - if ((tNBT.hasKey("mItemCount") && tNBT.getInteger("mItemCount") > 0) || - (tNBT.hasKey("mFluid") && FluidStack.loadFluidStackFromNBT(tNBT.getCompoundTag("mFluid")).amount > 64000)) { + if ((tNBT.hasKey("mItemCount") && tNBT.getInteger("mItemCount") > 0) + || (tNBT.hasKey("mFluid") + && FluidStack.loadFluidStackFromNBT(tNBT.getCompoundTag("mFluid")).amount > 64000)) { final FluidStack tFluid = FluidStack.loadFluidStackFromNBT(tNBT.getCompoundTag("mFluid")); int tLasing = 1200; if (tFluid != null) { @@ -303,8 +375,7 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { if (container != null) { final int tDamage = container.getItemDamage(); final IMetaTileEntity tMetaTile = GregTech_API.METATILEENTITIES[tDamage]; - if (tMetaTile != null) - return tMetaTile.getCapacity(); + if (tMetaTile != null) return tMetaTile.getCapacity(); } return 0; } @@ -314,7 +385,8 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { if (container != null && resource != null) { final int tDamage = container.getItemDamage(); final IMetaTileEntity tMetaTile = GregTech_API.METATILEENTITIES[tDamage]; - if (!(tMetaTile instanceof GT_MetaTileEntity_QuantumTank || tMetaTile instanceof GT_MetaTileEntity_SuperTank)) { + if (!(tMetaTile instanceof GT_MetaTileEntity_QuantumTank + || tMetaTile instanceof GT_MetaTileEntity_SuperTank)) { return 0; } if (container.stackTagCompound == null) container.stackTagCompound = new NBTTagCompound(); @@ -346,7 +418,8 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { if (container != null && container.hasTagCompound()) { final int tDamage = container.getItemDamage(); final IMetaTileEntity tMetaTile = GregTech_API.METATILEENTITIES[tDamage]; - if (!(tMetaTile instanceof GT_MetaTileEntity_QuantumTank || tMetaTile instanceof GT_MetaTileEntity_SuperTank)) { + if (!(tMetaTile instanceof GT_MetaTileEntity_QuantumTank + || tMetaTile instanceof GT_MetaTileEntity_SuperTank)) { return null; } final FluidStack tStoredFluid = getFluid(container); @@ -357,8 +430,7 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { if (doDrain) { if (tNewFluid.amount <= 0) { container.stackTagCompound.removeTag("mFluid"); - if (container.stackTagCompound.hasNoTags()) - container.setTagCompound(null); + if (container.stackTagCompound.hasNoTags()) container.setTagCompound(null); } else { container.stackTagCompound.setTag("mFluid", tNewFluid.writeToNBT(new NBTTagCompound())); } diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Ores.java b/src/main/java/gregtech/common/blocks/GT_Item_Ores.java index 63c3babfbb..bcf088a621 100644 --- a/src/main/java/gregtech/common/blocks/GT_Item_Ores.java +++ b/src/main/java/gregtech/common/blocks/GT_Item_Ores.java @@ -17,7 +17,17 @@ public class GT_Item_Ores extends ItemBlock { } @Override - public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { + public boolean onItemUseFirst( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float hitX, + float hitY, + float hitZ) { return false; } @@ -28,18 +38,37 @@ public class GT_Item_Ores extends ItemBlock { @Override public String getItemStackDisplayName(ItemStack aStack) { - String aName = super.getItemStackDisplayName(aStack); - if (this.field_150939_a instanceof GT_Block_Ores_Abstract) { - aName = Materials.getLocalizedNameForItem(aName, aStack.getItemDamage() % 1000); - } - return aName; + String aName = super.getItemStackDisplayName(aStack); + if (this.field_150939_a instanceof GT_Block_Ores_Abstract) { + aName = Materials.getLocalizedNameForItem(aName, aStack.getItemDamage() % 1000); + } + return aName; } @Override - public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int side, float hitX, float hitY, float hitZ, int aMeta) { + public boolean placeBlockAt( + ItemStack aStack, + EntityPlayer aPlayer, + World aWorld, + int aX, + int aY, + int aZ, + int side, + float hitX, + float hitY, + float hitZ, + int aMeta) { short tDamage = (short) getDamage(aStack); if (tDamage > 0) { - if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, GT_TileEntity_Ores.getHarvestData(tDamage, ((GT_Block_Ores_Abstract) field_150939_a).getBaseBlockHarvestLevel(aMeta % 16000 / 1000)), 3)) { + if (!aWorld.setBlock( + aX, + aY, + aZ, + this.field_150939_a, + GT_TileEntity_Ores.getHarvestData( + tDamage, + ((GT_Block_Ores_Abstract) field_150939_a).getBaseBlockHarvestLevel(aMeta % 16000 / 1000)), + 3)) { return false; } GT_TileEntity_Ores tTileEntity = (GT_TileEntity_Ores) aWorld.getTileEntity(aX, aY, aZ); diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Stones_Abstract.java b/src/main/java/gregtech/common/blocks/GT_Item_Stones_Abstract.java index b75743e110..b62c7c0232 100644 --- a/src/main/java/gregtech/common/blocks/GT_Item_Stones_Abstract.java +++ b/src/main/java/gregtech/common/blocks/GT_Item_Stones_Abstract.java @@ -2,15 +2,15 @@ package gregtech.common.blocks; import gregtech.api.GregTech_API; import gregtech.api.util.GT_LanguageManager; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import java.util.List; - public class GT_Item_Stones_Abstract extends ItemBlock { - private final String mNoMobsToolTip = GT_LanguageManager.addStringLocalization("gt.nomobspawnsonthisblock", "Mobs cannot Spawn on this Block"); + private final String mNoMobsToolTip = + GT_LanguageManager.addStringLocalization("gt.nomobspawnsonthisblock", "Mobs cannot Spawn on this Block"); public GT_Item_Stones_Abstract(Block block) { super(block); diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Storage.java b/src/main/java/gregtech/common/blocks/GT_Item_Storage.java index 10cc3ea1ac..55c19ae48c 100644 --- a/src/main/java/gregtech/common/blocks/GT_Item_Storage.java +++ b/src/main/java/gregtech/common/blocks/GT_Item_Storage.java @@ -1,13 +1,12 @@ package gregtech.common.blocks; import gregtech.api.GregTech_API; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import java.util.List; - public class GT_Item_Storage extends ItemBlock { public GT_Item_Storage(Block block) { super(block); @@ -23,14 +22,14 @@ public class GT_Item_Storage extends ItemBlock { @Override public String getItemStackDisplayName(ItemStack aStack) { - String aName = super.getItemStackDisplayName(aStack); - if (this.field_150939_a instanceof GT_Block_Metal) { - int aDamage = aStack.getItemDamage(); - if (aDamage >= 0 && aDamage < ((GT_Block_Metal) this.field_150939_a).mMats.length) { - aName = ((GT_Block_Metal) this.field_150939_a).mMats[aDamage].getLocalizedNameForItem(aName); - } - } - return aName; + String aName = super.getItemStackDisplayName(aStack); + if (this.field_150939_a instanceof GT_Block_Metal) { + int aDamage = aStack.getItemDamage(); + if (aDamage >= 0 && aDamage < ((GT_Block_Metal) this.field_150939_a).mMats.length) { + aName = ((GT_Block_Metal) this.field_150939_a).mMats[aDamage].getLocalizedNameForItem(aName); + } + } + return aName; } @Override diff --git a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java index 4885910877..452e9db5d4 100644 --- a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java +++ b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java @@ -1,5 +1,7 @@ package gregtech.common.blocks; +import static gregtech.api.enums.TextureSet.SET_NONE; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; @@ -11,6 +13,8 @@ import gregtech.api.objects.XSTR; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -19,11 +23,6 @@ import net.minecraft.network.Packet; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.Random; - -import static gregtech.api.enums.TextureSet.SET_NONE; - public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntity { public short mMetaData = 0; public boolean mNatural = false; @@ -31,9 +30,19 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit public static byte getHarvestData(short aMetaData, int aBaseBlockHarvestLevel) { Materials aMaterial = GregTech_API.sGeneratedMaterials[(aMetaData % 1000)]; - byte tByte = aMaterial == null ? 0 : (byte) Math.max(aBaseBlockHarvestLevel, Math.min(7, aMaterial.mToolQuality - (aMetaData < 16000 ? 0 : 1))); + byte tByte = aMaterial == null + ? 0 + : (byte) Math.max( + aBaseBlockHarvestLevel, Math.min(7, aMaterial.mToolQuality - (aMetaData < 16000 ? 0 : 1))); if (GT_Mod.gregtechproxy.mChangeHarvestLevels) { - tByte = aMaterial == null ? 0 : (byte) Math.max(aBaseBlockHarvestLevel, Math.min(GT_Mod.gregtechproxy.mMaxHarvestLevel, GT_Mod.gregtechproxy.mHarvestLevel[aMaterial.mMetaItemSubID] - (aMetaData < 16000 ? 0 : 1))); + tByte = aMaterial == null + ? 0 + : (byte) Math.max( + aBaseBlockHarvestLevel, + Math.min( + GT_Mod.gregtechproxy.mMaxHarvestLevel, + GT_Mod.gregtechproxy.mHarvestLevel[aMaterial.mMetaItemSubID] + - (aMetaData < 16000 ? 0 : 1))); } return tByte; } @@ -42,7 +51,8 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit return setOreBlock(aWorld, aX, aY, aZ, aMetaData, isSmallOre, true); } - public static boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean isSmallOre, boolean air) { + public static boolean setOreBlock( + World aWorld, int aX, int aY, int aZ, int aMetaData, boolean isSmallOre, boolean air) { if (!air) { aY = Math.min(aWorld.getActualHeight(), Math.max(aY, 1)); } @@ -53,8 +63,8 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit aMetaData += isSmallOre ? 16000 : 0; if ((aMetaData > 0) && ((tBlock != Blocks.air) || air)) { if (tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) { - //Do nothing, stone background is default background. - //Do this comparison first since stone is most common + // Do nothing, stone background is default background. + // Do this comparison first since stone is most common } else if (tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.netherrack)) { aMetaData += 1000; } else if (tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.end_stone)) { @@ -83,25 +93,33 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit if (GregTech_API.sBlockOresUb1 != null) { tOreBlock = GregTech_API.sBlockOresUb1; aMetaData += (BlockMeta * 1000); - //GT_FML_LOGGER.info("Block changed to UB1"); + // GT_FML_LOGGER.info("Block changed to UB1"); } } else if (BlockName.equals("tile.metamorphicStone")) { if (GregTech_API.sBlockOresUb2 != null) { tOreBlock = GregTech_API.sBlockOresUb2; aMetaData += (BlockMeta * 1000); - //GT_FML_LOGGER.info("Block changed to UB2"); + // GT_FML_LOGGER.info("Block changed to UB2"); } } else if (BlockName.equals("tile.sedimentaryStone")) { if (GregTech_API.sBlockOresUb3 != null) { tOreBlock = GregTech_API.sBlockOresUb3; aMetaData += (BlockMeta * 1000); - //GT_FML_LOGGER.info("Block changed to UB3"); + // GT_FML_LOGGER.info("Block changed to UB3"); } } else { return false; } - //GT_FML_LOGGER.info(tOreBlock); - aWorld.setBlock(aX, aY, aZ, tOreBlock, getHarvestData((short) aMetaData, ((GT_Block_Ores_Abstract) tOreBlock).getBaseBlockHarvestLevel(aMetaData % 16000 / 1000)), 0); + // GT_FML_LOGGER.info(tOreBlock); + aWorld.setBlock( + aX, + aY, + aZ, + tOreBlock, + getHarvestData( + (short) aMetaData, + ((GT_Block_Ores_Abstract) tOreBlock).getBaseBlockHarvestLevel(aMetaData % 16000 / 1000)), + 0); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if ((tTileEntity instanceof GT_TileEntity_Ores)) { ((GT_TileEntity_Ores) tTileEntity).mMetaData = ((short) aMetaData); @@ -129,22 +147,28 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit public void onUpdated() { if ((!this.worldObj.isRemote) && (this.mBlocked)) { this.mBlocked = false; - GT_Values.NW.sendPacketToAllPlayersInRange(this.worldObj, new GT_Packet_Ores(this.xCoord, (short) this.yCoord, this.zCoord, this.mMetaData), this.xCoord, this.zCoord); + GT_Values.NW.sendPacketToAllPlayersInRange( + this.worldObj, + new GT_Packet_Ores(this.xCoord, (short) this.yCoord, this.zCoord, this.mMetaData), + this.xCoord, + this.zCoord); } } @Override public Packet getDescriptionPacket() { if (!this.worldObj.isRemote) { - if (!(this.mBlocked = ( - GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord + 1, this.yCoord, this.zCoord) && - GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord - 1, this.yCoord, this.zCoord) && - GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord, this.yCoord + 1, this.zCoord) && - GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord, this.yCoord - 1, this.zCoord) && - GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord, this.yCoord, this.zCoord + 1) && - GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord, this.yCoord, this.zCoord - 1) - ))) { - GT_Values.NW.sendPacketToAllPlayersInRange(this.worldObj, new GT_Packet_Ores(this.xCoord, (short) this.yCoord, this.zCoord, this.mMetaData), this.xCoord, this.zCoord); + if (!(this.mBlocked = (GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord + 1, this.yCoord, this.zCoord) + && GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord - 1, this.yCoord, this.zCoord) + && GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord, this.yCoord + 1, this.zCoord) + && GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord, this.yCoord - 1, this.zCoord) + && GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord, this.yCoord, this.zCoord + 1) + && GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord, this.yCoord, this.zCoord - 1)))) { + GT_Values.NW.sendPacketToAllPlayersInRange( + this.worldObj, + new GT_Packet_Ores(this.xCoord, (short) this.yCoord, this.zCoord, this.mMetaData), + this.xCoord, + this.zCoord); } } return null; @@ -153,11 +177,14 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit public void overrideOreBlockMaterial(Block aOverridingStoneBlock, byte aOverridingStoneMeta) { if (this.worldObj == null || blockType == null) return; this.mMetaData = ((short) (int) (this.mMetaData % 1000L + this.mMetaData / 16000L * 16000L)); - if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, Blocks.netherrack)) { + if (aOverridingStoneBlock.isReplaceableOreGen( + this.worldObj, this.xCoord, this.yCoord, this.zCoord, Blocks.netherrack)) { this.mMetaData = ((short) (this.mMetaData + 1000)); - } else if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, Blocks.end_stone)) { + } else if (aOverridingStoneBlock.isReplaceableOreGen( + this.worldObj, this.xCoord, this.yCoord, this.zCoord, Blocks.end_stone)) { this.mMetaData = ((short) (this.mMetaData + 2000)); - } else if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, GregTech_API.sBlockGranites)) { + } else if (aOverridingStoneBlock.isReplaceableOreGen( + this.worldObj, this.xCoord, this.yCoord, this.zCoord, GregTech_API.sBlockGranites)) { if (aOverridingStoneBlock == GregTech_API.sBlockGranites) { if (aOverridingStoneMeta < 8) { this.mMetaData = ((short) (this.mMetaData + 3000)); @@ -167,7 +194,8 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit } else { this.mMetaData = ((short) (this.mMetaData + 3000)); } - } else if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, GregTech_API.sBlockStones)) { + } else if (aOverridingStoneBlock.isReplaceableOreGen( + this.worldObj, this.xCoord, this.yCoord, this.zCoord, GregTech_API.sBlockStones)) { if (aOverridingStoneBlock == GregTech_API.sBlockStones) { if (aOverridingStoneMeta < 8) { this.mMetaData = ((short) (this.mMetaData + 5000)); @@ -178,7 +206,14 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit this.mMetaData = ((short) (this.mMetaData + 5000)); } } - this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, getHarvestData(this.mMetaData, ((GT_Block_Ores_Abstract) blockType).getBaseBlockHarvestLevel(mMetaData % 16000 / 1000)), 0); + this.worldObj.setBlockMetadataWithNotify( + this.xCoord, + this.yCoord, + this.zCoord, + getHarvestData( + this.mMetaData, + ((GT_Block_Ores_Abstract) blockType).getBaseBlockHarvestLevel(mMetaData % 16000 / 1000)), + 0); } public void convertOreBlock(World aWorld, int aX, int aY, int aZ) { @@ -187,7 +222,15 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (tTileEntity instanceof GT_TileEntity_Ores) { ((GT_TileEntity_Ores) tTileEntity).mMetaData = aMeta; - this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, getHarvestData(aMeta, ((GT_Block_Ores_Abstract) tTileEntity.blockType).getBaseBlockHarvestLevel(aMeta % 16000 / 1000)), 0); + this.worldObj.setBlockMetadataWithNotify( + this.xCoord, + this.yCoord, + this.zCoord, + getHarvestData( + aMeta, + ((GT_Block_Ores_Abstract) tTileEntity.blockType) + .getBaseBlockHarvestLevel(aMeta % 16000 / 1000)), + 0); } } @@ -223,13 +266,15 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit Materials aMaterial = aOreMaterial.mOreReplacement; - ItemStack tStack = GT_OreDictUnificator.get(OrePrefixes.gemExquisite, aMaterial, GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 1L), 1L); + ItemStack tStack = GT_OreDictUnificator.get( + OrePrefixes.gemExquisite, aMaterial, GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 1L), 1L); if (tStack != null) { for (int i = 0; i < 1; i++) { tSelector.add(tStack); } } - tStack = GT_OreDictUnificator.get(OrePrefixes.gemFlawless, aMaterial, GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 1L), 1L); + tStack = GT_OreDictUnificator.get( + OrePrefixes.gemFlawless, aMaterial, GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 1L), 1L); if (tStack != null) { for (int i = 0; i < 2; i++) { tSelector.add(tStack); @@ -241,7 +286,8 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit tSelector.add(tStack); } } - tStack = GT_OreDictUnificator.get(OrePrefixes.gemFlawed, aMaterial, GT_OreDictUnificator.get(OrePrefixes.crushed, aMaterial, 1L), 1L); + tStack = GT_OreDictUnificator.get( + OrePrefixes.gemFlawed, aMaterial, GT_OreDictUnificator.get(OrePrefixes.crushed, aMaterial, 1L), 1L); if (tStack != null) { for (int i = 0; i < 5; i++) { tSelector.add(tStack); @@ -253,7 +299,11 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit tSelector.add(tStack); } } - tStack = GT_OreDictUnificator.get(OrePrefixes.gemChipped, aMaterial, GT_OreDictUnificator.get(OrePrefixes.dustImpure, aMaterial, 1L), 1L); + tStack = GT_OreDictUnificator.get( + OrePrefixes.gemChipped, + aMaterial, + GT_OreDictUnificator.get(OrePrefixes.dustImpure, aMaterial, 1L), + 1L); if (tStack != null) { for (int i = 0; i < 5; i++) { tSelector.add(tStack); @@ -267,14 +317,22 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit } if (!tSelector.isEmpty()) { int i = 0; - for (int j = Math.max(1, aMaterial.mOreMultiplier + (aFortune > 0 ? tRandom.nextInt(1 + aFortune * aMaterial.mOreMultiplier) : 0) / 2); i < j; i++) { + for (int j = Math.max( + 1, + aMaterial.mOreMultiplier + + (aFortune > 0 ? tRandom.nextInt(1 + aFortune * aMaterial.mOreMultiplier) : 0) + / 2); + i < j; + i++) { rList.add(GT_Utility.copyAmount(1L, tSelector.get(tRandom.nextInt(tSelector.size())))); } } if (tRandom.nextInt(3 + aFortune) > 1) { - Materials dustMat = ((GT_Block_Ores_Abstract) aDroppedOre).getDroppedDusts()[this.mMetaData / 1000 % 16]; + Materials dustMat = + ((GT_Block_Ores_Abstract) aDroppedOre).getDroppedDusts()[this.mMetaData / 1000 % 16]; if (dustMat != null) - rList.add(GT_OreDictUnificator.get(tRandom.nextInt(3) > 0 ? OrePrefixes.dustImpure : OrePrefixes.dust, dustMat, 1L)); + rList.add(GT_OreDictUnificator.get( + tRandom.nextInt(3) > 0 ? OrePrefixes.dustImpure : OrePrefixes.dust, dustMat, 1L)); } } return rList; @@ -285,20 +343,27 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit Materials aMaterial = GregTech_API.sGeneratedMaterials[(this.mMetaData % 1000)]; if ((aMaterial != null) && (this.mMetaData < 32000)) { ITexture iTexture = TextureFactory.builder() - .addIcon(aMaterial.mIconSet.mTextures[this.mMetaData / 16000 == 0 ? - OrePrefixes.ore.mTextureIndex : - OrePrefixes.oreSmall.mTextureIndex]) + .addIcon(aMaterial + .mIconSet + .mTextures[ + this.mMetaData / 16000 == 0 + ? OrePrefixes.ore.mTextureIndex + : OrePrefixes.oreSmall.mTextureIndex]) .setRGBA(aMaterial.mRGBa) .stdOrient() .build(); if (aBlock instanceof GT_Block_Ores_Abstract) { - return new ITexture[]{ - ((GT_Block_Ores_Abstract) aBlock).getTextureSet()[((this.mMetaData / 1000) % 16)], iTexture}; + return new ITexture[] { + ((GT_Block_Ores_Abstract) aBlock).getTextureSet()[((this.mMetaData / 1000) % 16)], iTexture + }; } } - return new ITexture[]{ - TextureFactory.of(Blocks.stone, 0), - TextureFactory.builder().addIcon(SET_NONE.mTextures[OrePrefixes.ore.mTextureIndex]).stdOrient().build() + return new ITexture[] { + TextureFactory.of(Blocks.stone, 0), + TextureFactory.builder() + .addIcon(SET_NONE.mTextures[OrePrefixes.ore.mTextureIndex]) + .stdOrient() + .build() }; } } |