Posted October 12, 201213 yr I'm sorry for the vague thread title, I don't really know how to explain what I am trying to achieve. Ok, I am trying to make a certain item able to divide blocks, it want it to look somewhat like this: The area the mouse is currently on will become gray, and when right clicked only the selected area will disappear, making the block then "broken". How could this be achieved? Aesthetically, and coding wise. Help would be greatly appreciated.
October 12, 201213 yr So, sort of like the Micro blocks for redpower 2? Get Techcraft at: http://blackholegaming.com/downloads http://www.minecraftforge.net/forum/index.php/topic,2965.0.html http://www.minecraftforum.net/topic/1543949-142-techcraft-ssplan-smp-minecraft-forge-version-601/ latest public build: 0.0.1.5 alpha pre release (MC:1.4.2)
October 24, 201213 yr you could make a method in your tool that is public boolean tryPlaceIntoWorld(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6)) { return false; } else { UseHoeEvent event = new UseHoeEvent(par2EntityPlayer, par1ItemStack, par3World, par4, par5, par6); if (MinecraftForge.EVENT_BUS.post(event)) { return false; } if (event.isHandeled()) { par1ItemStack.damageItem(1, par2EntityPlayer);//If you want the Item damaged return true; } int var11 = par3World.getBlockId(par4, par5, par6); if ((par7 == 0 || var11 != Block.BlocksAbleToBeCut)) { return false; } else { Block var13 = Block.BlockToBecome; if (par3World.isRemote) { return true; } else { par3World.setBlockWithNotify(par4, par5, par6, var13.blockID); par1ItemStack.damageItem(1, par2EntityPlayer);//If you want it damaged return true; } } } } Hope this helps, If you need clarification just ask! The Korecraft Mod
October 24, 201213 yr Author you could make a method in your tool that is public boolean tryPlaceIntoWorld(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6)) { return false; } else { UseHoeEvent event = new UseHoeEvent(par2EntityPlayer, par1ItemStack, par3World, par4, par5, par6); if (MinecraftForge.EVENT_BUS.post(event)) { return false; } if (event.isHandeled()) { par1ItemStack.damageItem(1, par2EntityPlayer);//If you want the Item damaged return true; } int var11 = par3World.getBlockId(par4, par5, par6); if ((par7 == 0 || var11 != Block.BlocksAbleToBeCut)) { return false; } else { Block var13 = Block.BlockToBecome; if (par3World.isRemote) { return true; } else { par3World.setBlockWithNotify(par4, par5, par6, var13.blockID); par1ItemStack.damageItem(1, par2EntityPlayer);//If you want it damaged return true; } } } } Hope this helps, If you need clarification just ask! Thanks! this part is pretty much covered, the thing I'm currently struggling with is with how to create a 'divided visual bounding box', do you have any idea how that could be done?
October 25, 201213 yr Alright, so do you mean having multiple bounding boxes? or do you mean the texturing Thanks! this part is pretty much covered, the thing I'm currently struggling with is with how to create a 'divided visual bounding box', do you have any idea how that could be done? The Korecraft Mod
October 26, 201213 yr Author Alright, so do you mean having multiple bounding boxes? or do you mean the texturing Thanks! this part is pretty much covered, the thing I'm currently struggling with is with how to create a 'divided visual bounding box', do you have any idea how that could be done? Multiple bounding boxes.
October 26, 201213 yr I have not tested this completely, but you may need to make a BlockPartLeft and in the consructor put this.setBlockBounds(); and also include a get texture from side one, and in the code that I sent you, you might have to get the direction you are looking and spawn in 3 of the 4 quarter blocks Hope this made sense! Please +1 Karma if it helped you! The Korecraft Mod
October 27, 201213 yr That wouldn't make multiple hitboxes at all. Edit: Btw, don't Eloraam's microblocks have hitboxes like you're looking for? Either ask 'em how or take a look at the code?
October 28, 201213 yr what im saying is when he right clicks with his tool, then it will delete the block and spawn 3 quarter blocks in that block so that it looks like 1/4 was removed Edit: Also, I think that you could check the position of the block you right click, and then get the texture based on ID, then put in the ID as the metadata so that you can drop the item with correct texture when destroyed The Korecraft Mod
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.