From 0669f5eb9d5029a8b94ec552171b0837605f7747 Mon Sep 17 00:00:00 2001 From: draknyte1 Date: Fri, 4 Nov 2016 15:23:26 +1000 Subject: $ Cleaned up the entire project. > Much neat, very nices. --- .../gtPlusPlus/core/block/base/AdvancedBlock.java | 38 +++-- .../gtPlusPlus/core/block/base/BasicBlock.java | 80 +++++---- .../core/block/base/BlockBaseModular.java | 188 +++++++++++---------- src/Java/gtPlusPlus/core/block/base/MetaBlock.java | 36 ++-- .../core/block/base/MultiTextureBlock.java | 47 +++--- 5 files changed, 196 insertions(+), 193 deletions(-) (limited to 'src/Java/gtPlusPlus/core/block/base') diff --git a/src/Java/gtPlusPlus/core/block/base/AdvancedBlock.java b/src/Java/gtPlusPlus/core/block/base/AdvancedBlock.java index b7ac24a71b..0160da883f 100644 --- a/src/Java/gtPlusPlus/core/block/base/AdvancedBlock.java +++ b/src/Java/gtPlusPlus/core/block/base/AdvancedBlock.java @@ -9,23 +9,25 @@ import net.minecraft.world.World; public class AdvancedBlock extends Block { - protected AdvancedBlock(String unlocalizedName, Material material, CreativeTabs x, float blockHardness, float blockResistance, float blockLightLevel, - String blockHarvestTool, int blockHarvestLevel, SoundType BlockSound) { - super(material); - this.setBlockName(unlocalizedName); - this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); - this.setCreativeTab(x); - this.setHardness(blockHardness); //block Hardness - this.setResistance(blockResistance); - this.setLightLevel(blockLightLevel); - this.setHarvestLevel(blockHarvestTool, blockHarvestLevel); - this.setStepSound(BlockSound); - } - - @Override - public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) - { - return false; - } + protected AdvancedBlock(final String unlocalizedName, final Material material, final CreativeTabs x, + final float blockHardness, final float blockResistance, final float blockLightLevel, + final String blockHarvestTool, final int blockHarvestLevel, final SoundType BlockSound) { + super(material); + this.setBlockName(unlocalizedName); + this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); + this.setCreativeTab(x); + this.setHardness(blockHardness); // block Hardness + this.setResistance(blockResistance); + this.setLightLevel(blockLightLevel); + this.setHarvestLevel(blockHarvestTool, blockHarvestLevel); + this.setStepSound(BlockSound); + } + + @Override + public boolean onBlockActivated(final World p_149727_1_, final int p_149727_2_, final int p_149727_3_, + final int p_149727_4_, final EntityPlayer p_149727_5_, final int p_149727_6_, final float p_149727_7_, + final float p_149727_8_, final float p_149727_9_) { + return false; + } } diff --git a/src/Java/gtPlusPlus/core/block/base/BasicBlock.java b/src/Java/gtPlusPlus/core/block/base/BasicBlock.java index c95f37d9c5..64ee68224e 100644 --- a/src/Java/gtPlusPlus/core/block/base/BasicBlock.java +++ b/src/Java/gtPlusPlus/core/block/base/BasicBlock.java @@ -8,45 +8,43 @@ import net.minecraft.block.material.Material; public class BasicBlock extends Block { - public BasicBlock(final String unlocalizedName, final Material material) { - super(material); - this.setBlockName(Utils.sanitizeString(unlocalizedName)); - this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabBlock); - this.setHardness(2.0F); - this.setResistance(6.0F); - this.setLightLevel(0.0F); - this.setHarvestLevel("pickaxe", 2); - this.setStepSound(soundTypeMetal); - } - - - public static enum BlockTypes { - STANDARD("blockBlock", "pickaxe", soundTypeStone), - FRAME("blockFrameGt", "wrench", soundTypeMetal); - - private String TEXTURE_NAME; - private String HARVEST_TOOL; - private SoundType soundOfBlock; - private BlockTypes (final String textureName, final String harvestTool, final SoundType blockSound) - { - this.TEXTURE_NAME = textureName; - this.HARVEST_TOOL = harvestTool; - this.soundOfBlock = blockSound; - } - - public String getTexture() { - return TEXTURE_NAME; - } - - public String getHarvestTool(){ - return HARVEST_TOOL; - } - - public SoundType getBlockSoundType(){ - return soundOfBlock; - } - - } - + public static enum BlockTypes { + STANDARD("blockBlock", "pickaxe", Block.soundTypeStone), FRAME("blockFrameGt", "wrench", Block.soundTypeMetal); + + private String TEXTURE_NAME; + private String HARVEST_TOOL; + private SoundType soundOfBlock; + + private BlockTypes(final String textureName, final String harvestTool, final SoundType blockSound) { + this.TEXTURE_NAME = textureName; + this.HARVEST_TOOL = harvestTool; + this.soundOfBlock = blockSound; + } + + public SoundType getBlockSoundType() { + return this.soundOfBlock; + } + + public String getHarvestTool() { + return this.HARVEST_TOOL; + } + + public String getTexture() { + return this.TEXTURE_NAME; + } + + } + + public BasicBlock(final String unlocalizedName, final Material material) { + super(material); + this.setBlockName(Utils.sanitizeString(unlocalizedName)); + this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); + this.setCreativeTab(AddToCreativeTab.tabBlock); + this.setHardness(2.0F); + this.setResistance(6.0F); + this.setLightLevel(0.0F); + this.setHarvestLevel("pickaxe", 2); + this.setStepSound(Block.soundTypeMetal); + } + } diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java index 5d003fc2a3..f389f5bf32 100644 --- a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java +++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java @@ -13,137 +13,141 @@ import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.world.IBlockAccess; -public class BlockBaseModular extends BasicBlock{ +public class BlockBaseModular extends BasicBlock { - protected int blockColour; - protected BlockTypes thisBlock; - protected String thisBlockMaterial; - protected final String thisBlockType; + protected int blockColour; + protected BlockTypes thisBlock; + protected String thisBlockMaterial; + protected final String thisBlockType; - public BlockBaseModular(String unlocalizedName, String blockMaterial, BlockTypes blockType, int colour) { - super(blockType.getTexture()+unlocalizedName, Material.iron); + public BlockBaseModular(final String unlocalizedName, final String blockMaterial, final BlockTypes blockType, + final int colour) { + super(blockType.getTexture() + unlocalizedName, Material.iron); this.setHarvestLevel(blockType.getHarvestTool(), 2); - this.setBlockTextureName(CORE.MODID+":"+blockType.getTexture()); + this.setBlockTextureName(CORE.MODID + ":" + blockType.getTexture()); this.blockColour = colour; this.thisBlock = blockType; this.thisBlockMaterial = blockMaterial; this.thisBlockType = blockType.name().toUpperCase(); - this.setBlockName(GetProperName()); - - if (!CORE.DEBUG){ - //Utils.LOG_INFO("=============Block Info Dump============="); - //Utils.LOG_INFO("thisBlock.name().toLowerCase() - "+thisBlock.name().toLowerCase()); - //Utils.LOG_INFO("This Blocks Type - "+thisBlockType); - //Utils.LOG_INFO("BlockTypes.STANDARD.name().toLowerCase() - "+BlockTypes.STANDARD.name().toLowerCase()); - //Utils.LOG_INFO("BlockTypes.FRAME.name().toLowerCase() - "+BlockTypes.FRAME.name().toLowerCase()); - //Utils.LOG_INFO("blockMaterial - "+blockMaterial); - //Utils.LOG_INFO("=========================================="); + this.setBlockName(this.GetProperName()); + + if (!CORE.DEBUG) { + // Utils.LOG_INFO("=============Block Info Dump============="); + // Utils.LOG_INFO("thisBlock.name().toLowerCase() - + // "+thisBlock.name().toLowerCase()); + // Utils.LOG_INFO("This Blocks Type - "+thisBlockType); + // Utils.LOG_INFO("BlockTypes.STANDARD.name().toLowerCase() - + // "+BlockTypes.STANDARD.name().toLowerCase()); + // Utils.LOG_INFO("BlockTypes.FRAME.name().toLowerCase() - + // "+BlockTypes.FRAME.name().toLowerCase()); + // Utils.LOG_INFO("blockMaterial - "+blockMaterial); + // Utils.LOG_INFO("=========================================="); } - - if (thisBlockType == BlockTypes.STANDARD.name().toUpperCase()){ - LanguageRegistry.addName(this, "Block of "+blockMaterial); - //Utils.LOG_INFO("Registered Block in Language Registry as: "+"Block of "+blockMaterial); + + if (this.thisBlockType == BlockTypes.STANDARD.name().toUpperCase()) { + LanguageRegistry.addName(this, "Block of " + blockMaterial); + // Utils.LOG_INFO("Registered Block in Language Registry as: + // "+"Block of "+blockMaterial); } - else if (thisBlockType == BlockTypes.FRAME.name().toUpperCase()){ - LanguageRegistry.addName(this, blockMaterial+ " Frame Box"); - //Utils.LOG_INFO("Registered Block in Language Registry as: "+blockMaterial+ " Frame Box"); + else if (this.thisBlockType == BlockTypes.FRAME.name().toUpperCase()) { + LanguageRegistry.addName(this, blockMaterial + " Frame Box"); + // Utils.LOG_INFO("Registered Block in Language Registry as: + // "+blockMaterial+ " Frame Box"); } else { LanguageRegistry.addName(this, blockMaterial); - //Utils.LOG_INFO("Registered Block in Language Registry as: "+blockMaterial); - } - - //setOreDict(unlocalizedName, blockType); - if (thisBlockType == BlockTypes.STANDARD.name().toUpperCase()){ - GameRegistry.registerBlock(this, ItemBlockGtBlock.class, Utils.sanitizeString(blockType.getTexture()+unlocalizedName)); - //Utils.LOG_INFO("Registered Block in Block Registry as: "+"Block of "+blockMaterial); + // Utils.LOG_INFO("Registered Block in Language Registry as: + // "+blockMaterial); } - else if (thisBlockType == BlockTypes.FRAME.name().toUpperCase()){ - GameRegistry.registerBlock(this, ItemBlockGtFrameBox.class, Utils.sanitizeString(blockType.getTexture()+unlocalizedName)); - //Utils.LOG_INFO("Registered Block in Block Registry as: "+blockMaterial+" Frame Box"); + + // setOreDict(unlocalizedName, blockType); + if (this.thisBlockType == BlockTypes.STANDARD.name().toUpperCase()) { + GameRegistry.registerBlock(this, ItemBlockGtBlock.class, + Utils.sanitizeString(blockType.getTexture() + unlocalizedName)); + // Utils.LOG_INFO("Registered Block in Block Registry as: "+"Block + // of "+blockMaterial); + } + else if (this.thisBlockType == BlockTypes.FRAME.name().toUpperCase()) { + GameRegistry.registerBlock(this, ItemBlockGtFrameBox.class, + Utils.sanitizeString(blockType.getTexture() + unlocalizedName)); + // Utils.LOG_INFO("Registered Block in Block Registry as: + // "+blockMaterial+" Frame Box"); } else { - GameRegistry.registerBlock(this, ItemBlockGtBlock.class, Utils.sanitizeString(blockType.getTexture()+unlocalizedName)); - //Utils.LOG_INFO("Registered Block in Block Registry as: "+blockMaterial); + GameRegistry.registerBlock(this, ItemBlockGtBlock.class, + Utils.sanitizeString(blockType.getTexture() + unlocalizedName)); + // Utils.LOG_INFO("Registered Block in Block Registry as: + // "+blockMaterial); } - - + } - /** - * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha - */ @Override - @SideOnly(Side.CLIENT) - public int getRenderBlockPass() - { - if (thisBlock == BlockTypes.FRAME){ - return 1; + public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4) { + + if (this.blockColour == 0) { + return MathUtils.generateSingularRandomHexValue(); } - return 0; + + return this.blockColour; } - - /*@Override - public String getLocalizedName() { - String tempIngot; - if (thisBlock == BlockTypes.STANDARD){ - tempIngot = "Block of "+thisBlockMaterial; - } - else if (thisBlock == BlockTypes.FRAME){ - tempIngot = thisBlockMaterial + " Frame Box"; - } - else { - tempIngot = getUnlocalizedName().replace("tile.blockGt", "ingot"); - } - return tempIngot; - }*/ - + /* + * @Override public String getLocalizedName() { String tempIngot; if + * (thisBlock == BlockTypes.STANDARD){ tempIngot = "Block of " + * +thisBlockMaterial; } else if (thisBlock == BlockTypes.FRAME){ tempIngot + * = thisBlockMaterial + " Frame Box"; } else { + * + * tempIngot = getUnlocalizedName().replace("tile.blockGt", "ingot"); } + * return tempIngot; } + */ + public String GetProperName() { - String tempIngot; - if (thisBlock == BlockTypes.STANDARD){ - tempIngot = "Block of "+thisBlockMaterial; + String tempIngot; + if (this.thisBlock == BlockTypes.STANDARD) { + tempIngot = "Block of " + this.thisBlockMaterial; } - else if (thisBlock == BlockTypes.FRAME){ - tempIngot = thisBlockMaterial + " Frame Box"; + else if (this.thisBlock == BlockTypes.FRAME) { + tempIngot = this.thisBlockMaterial + " Frame Box"; } else { - tempIngot = getUnlocalizedName().replace("tile.blockGt", "ingot"); + tempIngot = this.getUnlocalizedName().replace("tile.blockGt", "ingot"); } return tempIngot; } - @Override - public boolean isOpaqueCube() - { - return false; - } - + /** + * Returns which pass should this block be rendered on. 0 for solids and 1 + * for alpha + */ @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iIcon) - { - this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + thisBlock.getTexture()); + public int getRenderBlockPass() { + if (this.thisBlock == BlockTypes.FRAME) { + return 1; + } + return 0; } @Override - public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4){ - - if (this.blockColour == 0){ + public int getRenderColor(final int aMeta) { + if (this.blockColour == 0) { return MathUtils.generateSingularRandomHexValue(); } - + return this.blockColour; } - - @Override - public int getRenderColor(int aMeta) { - if (this.blockColour == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - - return this.blockColour; - } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(final IIconRegister iIcon) { + this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + this.thisBlock.getTexture()); + } } diff --git a/src/Java/gtPlusPlus/core/block/base/MetaBlock.java b/src/Java/gtPlusPlus/core/block/base/MetaBlock.java index 4009c36726..3763b71448 100644 --- a/src/Java/gtPlusPlus/core/block/base/MetaBlock.java +++ b/src/Java/gtPlusPlus/core/block/base/MetaBlock.java @@ -7,22 +7,22 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class MetaBlock extends MultiTextureBlock { +public class MetaBlock extends MultiTextureBlock { - protected MetaBlock(String unlocalizedName, Material material, SoundType soundType) { - super(unlocalizedName, material, soundType); - } - - @Override - public int damageDropped(int meta) { - return meta; - } - - @Override - public void getSubBlocks(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 6; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - -} \ No newline at end of file + protected MetaBlock(final String unlocalizedName, final Material material, final SoundType soundType) { + super(unlocalizedName, material, soundType); + } + + @Override + public int damageDropped(final int meta) { + return meta; + } + + @Override + public void getSubBlocks(final Item item, final CreativeTabs tab, final List list) { + for (int i = 0; i < 6; i++) { + list.add(new ItemStack(item, 1, i)); + } + } + +} \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java b/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java index 4f022bae6d..9953dfa991 100644 --- a/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java +++ b/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java @@ -7,30 +7,29 @@ import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; -public class MultiTextureBlock extends Block { +public class MultiTextureBlock extends Block { public IIcon[] icons = new IIcon[6]; - - protected MultiTextureBlock(String unlocalizedName, Material material, SoundType blockSound) - { - super(material); - this.setBlockName(unlocalizedName); - this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabBlock); - this.setHardness(2.0F); - this.setResistance(6.0F); - this.setStepSound(blockSound); - } - - @Override - public void registerBlockIcons(IIconRegister reg) { - for (int i = 0; i < 6; i ++) { - this.icons[i] = reg.registerIcon(this.textureName + "_" + i); - } - } - - @Override - public IIcon getIcon(int side, int meta) { - return this.icons[side]; - } + + protected MultiTextureBlock(final String unlocalizedName, final Material material, final SoundType blockSound) { + super(material); + this.setBlockName(unlocalizedName); + this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); + this.setCreativeTab(AddToCreativeTab.tabBlock); + this.setHardness(2.0F); + this.setResistance(6.0F); + this.setStepSound(blockSound); + } + + @Override + public IIcon getIcon(final int side, final int meta) { + return this.icons[side]; + } + + @Override + public void registerBlockIcons(final IIconRegister reg) { + for (int i = 0; i < 6; i++) { + this.icons[i] = reg.registerIcon(this.textureName + "_" + i); + } + } } \ No newline at end of file -- cgit