Jump to content

Recommended Posts

Posted

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:

 

vKvA3.png

 

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.

  • 2 weeks later...
Posted

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

Posted

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?

Posted

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

Posted

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.

Posted

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

Posted

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.