From 4d0e0e8de72bda8543a888082a93b1e56f13856b Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Sat, 8 Feb 2014 03:03:22 +0200 Subject: Added a new block and implemented an on/off "switch" for the rings that give buffs, also working on balancing the rings --- .../darkknight/jewelrycraft/block/BlockGlow.java | 39 ++++++++++ .../darkknight/jewelrycraft/block/BlockList.java | 11 +-- .../darkknight/jewelrycraft/block/BlockShadow.java | 87 ++++++++++++++++++---- 3 files changed, 119 insertions(+), 18 deletions(-) create mode 100644 common/darkknight/jewelrycraft/block/BlockGlow.java (limited to 'common/darkknight/jewelrycraft/block') diff --git a/common/darkknight/jewelrycraft/block/BlockGlow.java b/common/darkknight/jewelrycraft/block/BlockGlow.java new file mode 100644 index 0000000..9a34552 --- /dev/null +++ b/common/darkknight/jewelrycraft/block/BlockGlow.java @@ -0,0 +1,39 @@ +package darkknight.jewelrycraft.block; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; + +public class BlockGlow extends Block +{ + protected BlockGlow(int par1) + { + super(par1, Material.air); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int i) + { + return null; + } + + public boolean isCollidable() + { + return false; + } + + public boolean isOpaqueCube() + { + return false; + } + + public boolean renderAsNormalBlock() + { + return false; + } + + public int getRenderType() + { + return -1; + } +} diff --git a/common/darkknight/jewelrycraft/block/BlockList.java b/common/darkknight/jewelrycraft/block/BlockList.java index 66631aa..09a8dbc 100644 --- a/common/darkknight/jewelrycraft/block/BlockList.java +++ b/common/darkknight/jewelrycraft/block/BlockList.java @@ -6,10 +6,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; import darkknight.jewelrycraft.JewelrycraftMod; import darkknight.jewelrycraft.config.ConfigHandler; -import darkknight.jewelrycraft.tileentity.TileEntityDisplayer; -import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable; -import darkknight.jewelrycraft.tileentity.TileEntityMolder; -import darkknight.jewelrycraft.tileentity.TileEntitySmelter; +import darkknight.jewelrycraft.tileentity.*; public class BlockList { @@ -19,6 +16,7 @@ public class BlockList public static Block molder; public static Block displayer; public static Block jewelCraftingTable; + public static Block shadowBlock; private static boolean isInitialized = false; @@ -27,13 +25,15 @@ public class BlockList if (!isInitialized) { shadowOre = new Block(ConfigHandler.idShadowOre, Material.rock).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep).setTextureName("jewelrycraft:oreShadow").setUnlocalizedName("Jewelrycraft.oreShadow").setCreativeTab(JewelrycraftMod.jewelrycraft); - glow = new BlockShadow(ConfigHandler.idGlow).setUnlocalizedName("Jewelrycraft.glow").setLightValue(1F); + glow = new BlockGlow(ConfigHandler.idGlow).setUnlocalizedName("Jewelrycraft.glow").setLightValue(1F); smelter = new BlockSmelter(ConfigHandler.idSmelter, Material.rock).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("Jewelrycraft.smelter").setCreativeTab(JewelrycraftMod.jewelrycraft); molder = new BlockMolder(ConfigHandler.idMolder, Material.rock).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("Jewelrycraft.molder").setCreativeTab(JewelrycraftMod.jewelrycraft); displayer = new BlockDisplayer(ConfigHandler.idDisplayer, Material.iron).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundMetalFootstep).setUnlocalizedName("Jewelrycraft.displayer").setCreativeTab(JewelrycraftMod.jewelrycraft); jewelCraftingTable = new BlockJewelrsCraftingTable(ConfigHandler.idJewelCraftingTable, Material.rock).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("Jewelrycraft.jewelCraftingTable").setCreativeTab(JewelrycraftMod.jewelrycraft); + shadowBlock = new BlockShadow(ConfigHandler.idShadowBlock).setHardness(5.0F).setResistance(7.0F).setStepSound(Block.soundMetalFootstep).setTextureName("jewelrycraft:blockShadow").setUnlocalizedName("Jewelrycraft.blockShadow").setCreativeTab(JewelrycraftMod.jewelrycraft); GameRegistry.registerBlock(shadowOre, "shadowOre"); + GameRegistry.registerBlock(shadowBlock, "shadowBlock"); GameRegistry.registerBlock(smelter, "Smelter"); GameRegistry.registerBlock(molder, "Molder"); GameRegistry.registerBlock(jewelCraftingTable, "jewelCraftingTable"); @@ -43,6 +43,7 @@ public class BlockList GameRegistry.registerTileEntity(TileEntityMolder.class, "31"); GameRegistry.registerTileEntity(TileEntityJewelrsCraftingTable.class, "32"); GameRegistry.registerTileEntity(TileEntityDisplayer.class, "33"); + GameRegistry.registerTileEntity(TileEntityBlockShadow.class, "34"); isInitialized = true; } diff --git a/common/darkknight/jewelrycraft/block/BlockShadow.java b/common/darkknight/jewelrycraft/block/BlockShadow.java index ea811ee..9aeb82a 100644 --- a/common/darkknight/jewelrycraft/block/BlockShadow.java +++ b/common/darkknight/jewelrycraft/block/BlockShadow.java @@ -1,39 +1,100 @@ package darkknight.jewelrycraft.block; -import net.minecraft.block.Block; +import darkknight.jewelrycraft.tileentity.TileEntityBlockShadow; +import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.Icon; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeDirection; -public class BlockShadow extends Block +public class BlockShadow extends BlockContainer { - protected BlockShadow(int par1) + private Icon[] iconArray; + + public BlockShadow(int par1) { - super(par1, Material.air); + super(par1, Material.iron); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } - public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int i) + public int getRenderBlockPass() { - return null; + return 1; } - - public boolean isCollidable() + + public boolean isBeaconBase(World worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) { - return false; + return true; } - + public boolean isOpaqueCube() { return false; } - + public boolean renderAsNormalBlock() { return false; } + + public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side) + { + return true; + } + + public static boolean isNormalCube(int par0) + { + return true; + } + + @Override + public TileEntity createNewTileEntity(World world) + { + return new TileEntityBlockShadow(); + } + + public void registerIcons(IconRegister par1IconRegister) + { + this.iconArray = new Icon[16]; + + for (int i = 0; i < this.iconArray.length; ++i) + { + this.iconArray[i] = par1IconRegister.registerIcon(this.getTextureName() + (15 - i)); + } + } - public int getRenderType() + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) + { + if(world.getBlockMetadata(x, y, z) == 15) return null; + return super.getCollisionBoundingBoxFromPool(world, x, y, z); + } + + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return true; + } + + public boolean hasComparatorInputOverride() + { + return true; + } + + public int getComparatorInputOverride(World world, int x, int y, int z, int meta) + { + return world.getBlockMetadata(x, y, z); + } + + public Icon getIcon(int par1, int par2) { - return -1; + return this.iconArray[par2]; } } -- cgit v1.2.3