diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core/block')
20 files changed, 1588 insertions, 1511 deletions
diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java index 69ecb9ed5b..3b6f061ca7 100644 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java @@ -1,60 +1,60 @@ package gtPlusPlus.core.block; -import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.block.general.LightGlass; import gtPlusPlus.core.block.machine.Machine_Workbench; import gtPlusPlus.core.block.machine.Machine_WorkbenchAdvanced; import gtPlusPlus.core.fluids.FluidRegistryHandler; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks2; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraftforge.fluids.Fluid; +import cpw.mods.fml.common.registry.GameRegistry; 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 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 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"); - ModBlocks.registerBlocks(); + registerBlocks(); } - public static void registerBlocks() { + public static void registerBlocks(){ Utils.LOG_INFO("Registering Blocks."); - GameRegistry.registerBlock( - ModBlocks.MatterFabricatorEffectBlock = new LightGlass(Material.glass, false).setHardness(0.1F) - .setBlockTextureName(CORE.MODID + ":" + "blockMFEffect").setStepSound(Block.soundTypeGlass), - "blockMFEffect"); + GameRegistry.registerBlock(MatterFabricatorEffectBlock = new LightGlass(Material.glass, false).setHardness(0.1F).setBlockTextureName(CORE.MODID + ":" + "blockMFEffect").setStepSound(Block.soundTypeGlass), "blockMFEffect"); - // Fluids + //Fluids FluidRegistryHandler.registerFluids(); - // Workbench - ModBlocks.blockWorkbench = new Machine_Workbench().setHardness(1.5F); - ModBlocks.blockWorkbenchAdvanced = new Machine_WorkbenchAdvanced().setHardness(2.5F); + //Workbench + blockWorkbench = new Machine_Workbench().setHardness(1.5F); + 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 0160da883f..b7ac24a71b 100644 --- a/src/Java/gtPlusPlus/core/block/base/AdvancedBlock.java +++ b/src/Java/gtPlusPlus/core/block/base/AdvancedBlock.java @@ -9,25 +9,23 @@ import net.minecraft.world.World; public class AdvancedBlock extends Block { - 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; - } + 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; + } } diff --git a/src/Java/gtPlusPlus/core/block/base/BasicBlock.java b/src/Java/gtPlusPlus/core/block/base/BasicBlock.java index 64ee68224e..c95f37d9c5 100644 --- a/src/Java/gtPlusPlus/core/block/base/BasicBlock.java +++ b/src/Java/gtPlusPlus/core/block/base/BasicBlock.java @@ -8,43 +8,45 @@ import net.minecraft.block.material.Material; public class BasicBlock extends Block { - 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); - } - + 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; + } + + } + } diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java index f389f5bf32..a2d2589f5e 100644 --- a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java +++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java @@ -1,9 +1,5 @@ package gtPlusPlus.core.block.base; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.item.base.itemblock.ItemBlockGtBlock; import gtPlusPlus.core.item.base.itemblock.ItemBlockGtFrameBox; import gtPlusPlus.core.lib.CORE; @@ -12,142 +8,142 @@ import gtPlusPlus.core.util.math.MathUtils; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.world.IBlockAccess; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; -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(final String unlocalizedName, final String blockMaterial, final BlockTypes blockType, - final int colour) { - super(blockType.getTexture() + unlocalizedName, Material.iron); + public BlockBaseModular(String unlocalizedName, String blockMaterial, BlockTypes blockType, 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(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("=========================================="); + 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("=========================================="); } - - 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); + + if (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 (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 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 { LanguageRegistry.addName(this, blockMaterial); - // Utils.LOG_INFO("Registered Block in Language Registry as: - // "+blockMaterial); - } - - // 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); + //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); } - 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 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"); } 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 - public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4) { - - if (this.blockColour == 0) { - return MathUtils.generateSingularRandomHexValue(); + @SideOnly(Side.CLIENT) + public int getRenderBlockPass() + { + if (thisBlock == BlockTypes.FRAME){ + return 1; } - - return this.blockColour; + return 0; } + + /*@Override + public String getLocalizedName() { + String tempIngot; + if (thisBlock == BlockTypes.STANDARD){ + tempIngot = "Block of "+thisBlockMaterial; + } + else if (thisBlock == BlockTypes.FRAME){ + tempIngot = thisBlockMaterial + " Frame Box"; + } + else { - /* - * @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; } - */ - + tempIngot = getUnlocalizedName().replace("tile.blockGt", "ingot"); + } + return tempIngot; + }*/ + public String GetProperName() { - String tempIngot; - if (this.thisBlock == BlockTypes.STANDARD) { - tempIngot = "Block of " + this.thisBlockMaterial; + String tempIngot; + if (thisBlock == BlockTypes.STANDARD){ + tempIngot = "Block of "+thisBlockMaterial; } - else if (this.thisBlock == BlockTypes.FRAME) { - tempIngot = this.thisBlockMaterial + " Frame Box"; + else if (thisBlock == BlockTypes.FRAME){ + tempIngot = thisBlockMaterial + " Frame Box"; } else { - tempIngot = this.getUnlocalizedName().replace("tile.blockGt", "ingot"); + tempIngot = getUnlocalizedName().replace("tile.blockGt", "ingot"); } return tempIngot; } - /** - * Returns which pass should this block be rendered on. 0 for solids and 1 - * for alpha - */ + @Override + public boolean isOpaqueCube() + { + return false; + } + @Override @SideOnly(Side.CLIENT) - public int getRenderBlockPass() { - if (this.thisBlock == BlockTypes.FRAME) { - return 1; - } - return 0; + public void registerBlockIcons(IIconRegister iIcon) + { + this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + thisBlock.getTexture()); } @Override - public int getRenderColor(final int aMeta) { - if (this.blockColour == 0) { + public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4){ + + 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()); - } + + @Override + public int getRenderColor(int aMeta) { + if (this.blockColour == 0){ + return MathUtils.generateSingularRandomHexValue(); + } + + return this.blockColour; + } } diff --git a/src/Java/gtPlusPlus/core/block/base/MetaBlock.java b/src/Java/gtPlusPlus/core/block/base/MetaBlock.java index 3763b71448..4009c36726 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(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 + 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 diff --git a/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java b/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java index 9953dfa991..4f022bae6d 100644 --- a/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java +++ b/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java @@ -7,29 +7,30 @@ 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(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); - } - } + + 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]; + } }
\ 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 9b4d8bf1b8..5aa9f5b818 100644 --- a/src/Java/gtPlusPlus/core/block/general/LightGlass.java +++ b/src/Java/gtPlusPlus/core/block/general/LightGlass.java @@ -1,27 +1,30 @@ package gtPlusPlus.core.block.general; -import java.util.Random; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; + +import java.util.Random; + import net.minecraft.block.BlockBreakable; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; -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 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 LightGlass(final Material mat, final boolean bool) { + public LightGlass(Material mat, boolean bool) + { super("blockMFEffect", mat, bool); this.setCreativeTab(AddToCreativeTab.tabBlock); this.setBlockName("blockMFEffect"); @@ -32,99 +35,94 @@ public class LightGlass extends BlockBreakable { } /** - * Return true if a player with Silk Touch can harvest this block directly, - * and not its normal drops. + * Returns the quantity of items to drop on block destruction. */ @Override - 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; + public int quantityDropped(Random rand) + { + return 0; } /** - * 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; } /** - * Returns the quantity of items to drop on block destruction. + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) */ @Override - public int quantityDropped(final Random rand) { - return 0; + public boolean renderAsNormalBlock() + { + return true; } /** - * A randomly called display update to be able to add particles or other - * items for display + * Return true if a player with Silk Touch can harvest this block directly, and not its normal drops. */ @Override - @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"); - + protected boolean canSilkHarvest() + { + return false; } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister iIcon) { + public void registerBlockIcons(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; + } + /** - * If this block doesn't render as an ordinary block it will return False - * (examples: signs, buttons, stairs, etc) + * A randomly called display update to be able to add particles or other items for display */ @Override - public boolean renderAsNormalBlock() { - return true; + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World world, int posX, int posY, int posZ, Random random){ + Utils.spawnFX(world, posX, posY, posZ, "smoke", "cloud"); + } }
\ 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 2f659b7806..7fa890b6c8 100644 --- a/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java +++ b/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java @@ -1,15 +1,14 @@ package gtPlusPlus.core.block.general.antigrief; -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 static gtPlusPlus.core.block.ModBlocks.blockGriefSaver; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.general.TileEntityReverter; import gtPlusPlus.core.util.Utils; + +import java.util.List; +import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -24,241 +23,254 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class TowerDevice extends Block { - 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 = par1Worl |
