diff options
| author | draknyte1 <draknyte1@hotmail.com> | 2016-11-04 15:23:26 +1000 |
|---|---|---|
| committer | draknyte1 <draknyte1@hotmail.com> | 2016-11-04 15:23:26 +1000 |
| commit | 0669f5eb9d5029a8b94ec552171b0837605f7747 (patch) | |
| tree | 6b40e64c04d51b7a33cf2f0b35f7232cf37c4247 /src/Java/gtPlusPlus/core/block | |
| parent | 3654052fb63a571c5eaca7f20714b87c17f7e966 (diff) | |
| download | GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.gz GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.bz2 GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.zip | |
$ Cleaned up the entire project.
> Much neat, very nices.
Diffstat (limited to 'src/Java/gtPlusPlus/core/block')
20 files changed, 1466 insertions, 1533 deletions
diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java index 2e6a7c3e07..69ecb9ed5b 100644 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java @@ -13,47 +13,48 @@ import net.minecraftforge.fluids.Fluid; public final class ModBlocks { - public static Block blockWorkbench; - public static Block blockWorkbenchAdvanced; - //Blocks - //public static Block blockBloodSteel; - //public static Block blockStaballoy; + public static Block blockWorkbench; + public static Block blockWorkbenchAdvanced; + // Blocks + // public static Block blockBloodSteel; + // public static Block blockStaballoy; // WIP TODO public static Block blockToolBuilder; - public static Block blockGriefSaver; - public static Block blockCasingsMisc; - public static Block blockMetaTileEntity; - public static Block blockHeliumGenerator; - public static Block blockNHG; - public static Block blockCharger; - - public static Block MatterFabricatorEffectBlock; - - public static Fluid fluidJackDaniels = new Fluid("fluidJackDaniels"); - public static Block blockFluidJackDaniels; - public static Block blockCasings2Misc; + public static Block blockGriefSaver; + public static Block blockCasingsMisc; + public static Block blockMetaTileEntity; + public static Block blockHeliumGenerator; + public static Block blockNHG; + public static Block blockCharger; + public static Block MatterFabricatorEffectBlock; + public static Fluid fluidJackDaniels = new Fluid("fluidJackDaniels"); + public static Block blockFluidJackDaniels; + public static Block blockCasings2Misc; public static void init() { Utils.LOG_INFO("Initializing Blocks."); - //blockGriefSaver = new TowerDevice().setBlockName("blockGriefSaver").setCreativeTab(AddToCreativeTab.tabBlock).setBlockTextureName("blockDefault"); + // blockGriefSaver = new + // TowerDevice().setBlockName("blockGriefSaver").setCreativeTab(AddToCreativeTab.tabBlock).setBlockTextureName("blockDefault"); - registerBlocks(); + ModBlocks.registerBlocks(); } - public static void registerBlocks(){ + public static void registerBlocks() { Utils.LOG_INFO("Registering Blocks."); - GameRegistry.registerBlock(MatterFabricatorEffectBlock = new LightGlass(Material.glass, false).setHardness(0.1F).setBlockTextureName(CORE.MODID + ":" + "blockMFEffect").setStepSound(Block.soundTypeGlass), "blockMFEffect"); + GameRegistry.registerBlock( + ModBlocks.MatterFabricatorEffectBlock = new LightGlass(Material.glass, false).setHardness(0.1F) + .setBlockTextureName(CORE.MODID + ":" + "blockMFEffect").setStepSound(Block.soundTypeGlass), + "blockMFEffect"); - //Fluids + // Fluids FluidRegistryHandler.registerFluids(); - //Workbench - blockWorkbench = new Machine_Workbench().setHardness(1.5F); - blockWorkbenchAdvanced = new Machine_WorkbenchAdvanced().setHardness(2.5F); + // Workbench + ModBlocks.blockWorkbench = new Machine_Workbench().setHardness(1.5F); + ModBlocks.blockWorkbenchAdvanced = new Machine_WorkbenchAdvanced().setHardness(2.5F); - } }
\ No newline at end of file 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 diff --git a/src/Java/gtPlusPlus/core/block/general/LightGlass.java b/src/Java/gtPlusPlus/core/block/general/LightGlass.java index 873752d8a3..9b4d8bf1b8 100644 --- a/src/Java/gtPlusPlus/core/block/general/LightGlass.java +++ b/src/Java/gtPlusPlus/core/block/general/LightGlass.java @@ -13,17 +13,15 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class LightGlass extends BlockBreakable -{ - private int state = 0; - private int a = 255; - private int r = 255; - private int g = 0; - private int b = 0; - private int hex; +public class LightGlass extends BlockBreakable { + private int state = 0; + private final int a = 255; + private int r = 255; + private int g = 0; + private int b = 0; + private int hex; - public LightGlass(Material mat, boolean bool) - { + public LightGlass(final Material mat, final boolean bool) { super("blockMFEffect", mat, bool); this.setCreativeTab(AddToCreativeTab.tabBlock); this.setBlockName("blockMFEffect"); @@ -34,94 +32,99 @@ public class LightGlass extends BlockBreakable } /** - * Returns the quantity of items to drop on block destruction. + * Return true if a player with Silk Touch can harvest this block directly, + * and not its normal drops. */ @Override - public int quantityDropped(Random rand) - { - return 0; + protected boolean canSilkHarvest() { + return false; + } + + @Override + // http://stackoverflow.com/questions/31784658/how-can-i-loop-through-all-rgb-combinations-in-rainbow-order-in-java + public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4) { + if (this.state == 0) { + this.g++; + if (this.g == 255) { + this.state = 1; + } + } + if (this.state == 1) { + this.r--; + if (this.r == 0) { + this.state = 2; + } + } + if (this.state == 2) { + this.b++; + if (this.b == 255) { + this.state = 3; + } + } + if (this.state == 3) { + this.g--; + if (this.g == 0) { + this.state = 4; + } + } + if (this.state == 4) { + this.r++; + if (this.r == 255) { + this.state = 5; + } + } + if (this.state == 5) { + this.b--; + if (this.b == 0) { + this.state = 0; + } + } + this.hex = (this.a << 24) + (this.r << 16) + (this.g << 8) + this.b; + return this.hex; } /** - * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha + * Returns which pass should this block be rendered on. 0 for solids and 1 + * for alpha */ @Override @SideOnly(Side.CLIENT) - public int getRenderBlockPass() - { + public int getRenderBlockPass() { return 0; } /** - * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + * Returns the quantity of items to drop on block destruction. */ @Override - public boolean renderAsNormalBlock() - { - return true; + public int quantityDropped(final Random rand) { + return 0; } /** - * Return true if a player with Silk Touch can harvest this block directly, and not its normal drops. + * A randomly called display update to be able to add particles or other + * items for display */ @Override - protected boolean canSilkHarvest() - { - return false; + @SideOnly(Side.CLIENT) + public void randomDisplayTick(final World world, final int posX, final int posY, final int posZ, + final Random random) { + Utils.spawnFX(world, posX, posY, posZ, "smoke", "cloud"); + } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iIcon) - { + public void registerBlockIcons(final IIconRegister iIcon) { this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + "blockMFEffect"); } - @Override - //http://stackoverflow.com/questions/31784658/how-can-i-loop-through-all-rgb-combinations-in-rainbow-order-in-java - public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) - { - if(state == 0){ - g++; - if(g == 255) - state = 1; - } - if(state == 1){ - r--; - if(r == 0) - state = 2; - } - if(state == 2){ - b++; - if(b == 255) - state = 3; - } - if(state == 3){ - g--; - if(g == 0) - state = 4; - } - if(state == 4){ - r++; - if(r == 255) - state = 5; - } - if(state == 5){ - b--; - if(b == 0) - state = 0; - } - hex = (a << 24) + (r << 16) + (g << 8) + (b); - return hex; - } - /** - * A randomly called display update to be able to add particles or other items for display + * If this block doesn't render as an ordinary block it will return False + * (examples: signs, buttons, stairs, etc) */ @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, int posX, int posY, int posZ, Random random){ - Utils.spawnFX(world, posX, posY, posZ, "smoke", "cloud"); - + public boolean renderAsNormalBlock() { + return true; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java b/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java index ab5417a0e5..2f659b7806 100644 --- a/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java +++ b/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java @@ -1,12 +1,11 @@ package gtPlusPlus.core.block.general.antigrief; -import static gtPlusPlus.core.block.ModBlocks.blockGriefSaver; - import java.util.List; import java.util.Random; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.general.TileEntityReverter; @@ -27,250 +26,239 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class TowerDevice extends Block { - private static IIcon TEX_ANTIBUILDER; - public static final int META_ANTIBUILDER = 9; - private boolean bUnbreakable; - - public TowerDevice() - { - super(Material.wood); - setHardness(10.0F); - setResistance(35.0F); - setStepSound(Block.soundTypeWood); - setCreativeTab(AddToCreativeTab.tabMachines); - } - - public int tickRate() - { - return 15; - } - - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setBoolean("bUnbreakable", bUnbreakable); + private static IIcon TEX_ANTIBUILDER; + public static final int META_ANTIBUILDER = 9; + public static boolean areNearbyLockBlocks(final World world, final int x, final int y, final int z) { + boolean locked = false; + for (int dx = x - 2; dx <= x + 2; dx++) { + for (int dy = y - 2; dy <= y + 2; dy++) { + for (int dz = z - 2; dz <= z + 2; dz++) { + if (world.getBlock(dx, dy, dz) == ModBlocks.blockGriefSaver + && world.getBlockMetadata(dx, dy, dz) == 4) { + locked = true; + } + } + } + } + return locked; + } + + public static void changeToActiveVanishBlock(final World par1World, final int x, final int y, final int z, + final int meta) { + TowerDevice.changeToBlockMeta(par1World, x, y, z, meta); + par1World.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "random.pop", 0.3F, 0.6F); + + final Block thereBlockID = par1World.getBlock(x, y, z); + par1World.scheduleBlockUpdate(x, y, z, thereBlockID, + TowerDevice.getTickRateFor(thereBlockID, meta, par1World.rand)); + } + + private stat |
