This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
Quote from 123pandaman I am trying to make a torch like block but i cant find out how to make it so that the item looks like the block. Please help.
package net.minecraft.src; import java.util.Random; public class BlockSprinkeler extends Block { /** Whether this lamp block is the powered version. */ private final boolean powered; public BlockSprinkeler(int par1, boolean par2, Material Material) { super(par1, /**This Is Where It Asks For The Block Index In Tecture*/, "/Sprinkeler/sprinkeler.png"), Material); powered = par2; } public boolean renderAsNormalBlock(){ return false; } public int getRenderType(){ return 2; } public boolean isOpaqueCube() { return false; } public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int i) { return null; } public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3D par5Vec3D, Vec3D par6Vec3D) { int i = par1World.getBlockMetadata(par2, par3, par4) & 7; float f = 0.15F; if (i == 1) { setBlockBounds(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f); } else if (i == 2) { setBlockBounds(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f); } else if (i == 3) { setBlockBounds(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F); } else if (i == 4) { setBlockBounds(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F); } else { float f1 = 0.1F; setBlockBounds(0.5F - f1, 0.0F, 0.5F - f1, 0.5F + f1, 0.6F, 0.5F + f1); } return super.collisionRayTrace(par1World, par2, par3, par4, par5Vec3D, par6Vec3D); } /** * Called whenever the block is added into the world. Args: world, x, y, z */ public void onBlockAdded(World par1World, int par2, int par3, int par4) { if (!par1World.isRemote) { if (powered && !par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) { par1World.scheduleBlockUpdate(par2, par3, par4, blockID, 4); } else if (!powered && par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) { par1World.setBlockWithNotify(par2, par3, par4, mod_Sprinkeler.sprinkelerActive.blockID); } } } /** * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are * their own) Args: x, y, z, neighbor blockID */ public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) { if (!par1World.isRemote) { if (powered && !par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) { par1World.scheduleBlockUpdate(par2, par3, par4, blockID, 4); } else if (!powered && par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) { par1World.setBlockWithNotify(par2, par3, par4, mod_Sprinkeler.sprinkelerActive.blockID); } } } /** * Ticks the block if it's been scheduled */ public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (!par1World.isRemote && powered && !par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) { par1World.setBlockWithNotify(par2, par3, par4, mod_Sprinkeler.sprinkelerIdle.blockID); } } public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { if (par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true)) { return true; } if (par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true)) { return true; } if (par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true)) { return true; } if (par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true)) { return true; } return canPlaceSprinkelerOn(par1World, par2, par3 - 1, par4); } private boolean canPlaceSprinkelerOn(World par1World, int par2, int par3, int par4) { if (par1World.isBlockNormalCubeDefault(par2, par3, par4, true)) { return true; } int i = par1World.getBlockId(par2, par3, par4); if (i == Block.dirt.blockID || i == Block.grass.blockID || i == Block.sand.blockID) { return true; } if (Block.blocksList[i] != null && (Block.blocksList[i] instanceof BlockStairs)) { int j = par1World.getBlockMetadata(par2, par3, par4); if ((4 & j) != 0) { return true; } } return false; } /** * Returns the ID of the items to drop on destruction. */ public int idDropped(int par1, Random par2Random, int par3) { return mod_Sprinkeler.sprinkelerIdle.blockID; } public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (!powered) { return; } int i = par1World.getBlockMetadata(par2, par3, par4); double d = (double)((float)par2 + 0.5F) + (double)(par5Random.nextFloat() - 0.5F) * 0.20000000000000001D; double d1 = (double)((float)par3 + 0.7F) + (double)(par5Random.nextFloat() - 0.5F) * 0.20000000000000001D; double d2 = (double)((float)par4 + 0.5F) + (double)(par5Random.nextFloat() - 0.5F) * 0.20000000000000001D; double d3 = 0.2199999988079071D; double d4 = 0.27000001072883606D; if (i == 1) { par1World.spawnParticle("splash", d - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D); par1World.spawnParticle("splash", d - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D); } else if (i == 2) { par1World.spawnParticle("splash", d + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D); par1World.spawnParticle("splash", d + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D); } else if (i == 3) { par1World.spawnParticle("splash", d, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D); par1World.spawnParticle("splash", d, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D); } else if (i == 4) { par1World.spawnParticle("splash", d, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D); par1World.spawnParticle("splash", d, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D); } else { par1World.spawnParticle("splash", d, d1, d2, 0.0D, 0.0D, 0.0D); par1World.spawnParticle("splash", d, d1, d2, 0.0D, 0.0D, 0.0D); } } }
Please help.
"whatever you do don't die"
do you mean make it look like a torch or like an actual block?
"whatever you do don't die"