Jump to content

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


Recommended Posts

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)

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


Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

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.

  • Create New...

Important Information

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