proalt Posted September 28, 2014 Posted September 28, 2014 hello there i need help with simple block that is giving me HUGE/MASSIVE problems i dont even know why. So i want to create block that drops it self for example: I create Ruby block and when you destroy it i want that Ruby block is dropped and not an item but a block. Here are my current codes: THIS IS MY BLOCK FILE: public class BlockRubyBlock extends Block { public BlockRubyBlock (Material material) { super(material); } private IIcon[] icons = new IIcon[6]; @Override public void registerBlockIcons(IIconRegister iconRegister) { for (int i = 0; i < icons.length; i++) { icons[i] = iconRegister.registerIcon(wtf.modid + ":" + "BlockRubyBlock" + i); } } @Override public IIcon getIcon(int side, int meta) { return icons[side]; } /** * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity */ public void onEntityCollidedWithBlock(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity p_149670_5_) { p_149670_5_.setInWeb(); } /** * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been * cleared to be reused) */ public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { return null; } } This is codes from original file: public static Block BlockRubyBlock; BlockRubyBlock = new BlockRubyBlock(Material.web).setHardness(0.05F).setBlockName("BlockRubyBlock").setBlockTextureName(modid + ":" + "BlockRubyBlock"); GameRegistry.registerBlock(BlockRubyBlock, "BlockRubyBlock"); ~~~~FIX My materal was web so it didnt drop anything becouse i needed special tool to get it. Changed it to grass and it can be dropped by just hitting it with hands. Quote
Christofmeg Posted September 28, 2014 Posted September 28, 2014 Okay I can see that you have a problem with the dropping of blocks in 1.7.2 so I have some examples for you that could help you out: [Notice] You must replace the <> //If the block's drop is an item. public Item getItemDropped1(int metadata, Random random, int fortune) { return YOURMOD.YOURMOD; } //If the block's drop is a block. public Item getItemDropped(int metadata, Random random, int fortune) { return Item.getItemFromBlock(YOURMOD.TESTBLOCK); } //If the block's drop is a vanilla item. public Item getItemDropped(int metadata, Random random, int fortune) { return Item.getItemById(<ItemID>); } //If the block's drop is a vanilla block. public Item getItemDropped(int metadata, Random random, int fortune) { return Item.getItemFromBlock(Block.getBlockById(<BlockID>)); } Quote
proalt Posted September 28, 2014 Author Posted September 28, 2014 Okay so i have added this: //If the block's drop is a block. public Item getItemDropped(int metadata, Random random, int fortune) { return Item.getItemFromBlock(wtf.BlockRubyBlock); } ~~~ And nothing happens, it doesnt drop a thing or anything i also tried the other one for the item and it didnt work i am not sure what is wrong at that point. I have tried everything... Quote
MultiMote Posted September 28, 2014 Posted September 28, 2014 Because your material is web. It requires special tool to break this block. Quote
proalt Posted September 28, 2014 Author Posted September 28, 2014 Just before you wrote this i fixed it. Yeah it was that, i changed it to grass and it works good now. Thank you. ~ Other question how can i change that even if its web, can i make it that hands can destroy the block. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.