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.

Is it possible to modify tags of a block in world (for example - when clicked)

Featured Replies

Posted

I'd like to modify a tag when a block is (not just a block within my mod - ie vanilla block, other mod blocks, etc)

I'm still digging through the codebase but I'm new to Forge modding so was hoping for a pointer or two on what I should look into. Happy to do the research, just looking for a little guidance if possible.

Specifically, I'm using an item on a block: code example below (also I assume I'll need to use level.setBlock once modified)

@Override
public InteractionResult useOn(UseOnContext context) {
    // This will get me the tags on the block... 
	// context.getLevel().getBlockState(context.getClickedPos()).getTags();
}

 

  • Author

ah, ok so I’d need another approach.

Overall goal would be to click any block with an item and do two things - consume item (which I can do) and mark that block as non spawnable.

It seems like I’ll have to just use a set, or map and keep track of these separately… unless there’s someway to “wrap” every block at registration time with a new blockstate that includes an added property but that didn’t seem possible either not the right approach to me naïvely

Edited by DasHutch
clarified language

  • Author

just that particular block position (and any additional block positions that are clicked with the same item)

Edited by DasHutch
clarity

  • Author

Ah, ok so I’ll dig into capabilities. Thank you so much for the assistance! looking forward to learning more about these systems today and seeing where I end up. Have a great day!

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.