Jump to content

[1.20.1] Creating a custom blockentity from interaction with vanilla block


Recommended Posts

Posted

Hi all, I have a pretty basic question here that I'll try to lay out as concisely as possible:

I am currently working on this: On right clicking a banner with a name tag, the banner will generate an invisible radius around it, and the player will be alerted everytime they cross in and out of this radius under a generic message "Leaving/entering name tag's territory". I have already created an event to handle the right clicking on a banner block with a name tag, my current issue is finding the best way to spawn a custom block entity (if this is the appropriate method to implement this) into the world which can act as the centre point for this radius (being the banner) from wherein I can implement all of the code logic.

I just need to be pointed in the right direction on how the best way to spawn this entity/blockentity. I have already tried to make a custom banner entity, or to override the vanilla banner block + entity, but I cannot see that as being the best way to go about this. If anyone has any suggestions on how to proceed, it would be greatly appreciated. Thanks.
 

  • 2 weeks later...
Posted

In my mod, i tried to make a special block that "hurt" any living things that is around.
I used an entity block to do so. That entityBlock, every X tick, check if there is any living around.  If there is one, the block "hit" the entity.

You can make a ticking blockEntity linked to your banner that checks every "X" ticks if a player is around. If he detects someone as player,  you can "tag" him  like " he is in" and when he leaves , untag him (with a chat message each tagging/untagging for example). 

I think that's a good way to do it.

Posted

Hi, thanks for the reply!

That seems like the best way to do it, my question is, how would you go about "linking"a block entity to a vanilla object in that way? I see for your example if you had a custom block you would have no issue in using your own CustomBlockBlockEntity associated with the custom block, however for me, banners already have a block entity, so unless I want to completely overwrite this vanilla BlockEntity, I am not sure on how to override or add methods to the BannerBlockEntity. Any suggestions?

Thanks again!

Posted

My not create your own BannerType Block  ?
Like that you can do whatever you want with it :)
And you can also take some code from the vanilla banner so make things work the same as a regular banner... except you had your custom things in addition .

 

  • 5 months later...
Posted

Hey can you send me pls the event interaction with the banner ?

and if possible can u tell me if i can do it with a custom Item and a custom block.

 

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.