Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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...

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

  • 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?

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

  • 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.

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

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?

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.