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 am trying to store the player that placed down the block as soon as it gets placed down so whenever a player interacts with the block it will check if that player is the owner or not. Is there anyway to add data to the Block Entity and have it saved in that block to be checked whenever anyone interacts with it?

20 minutes ago, ItzPray said:

Is there anyway to add data to the Block Entity and have it saved in that block to be checked whenever anyone interacts with it?

You can use a Capability, take a look at this FCW page for more infos

  • Author
44 minutes ago, Luis_ST said:

You can use a Capability, take a look at this FCW page for more infos

I looked at it for a while and I tried to implement it but it cant figure out how to get it to work. Is there anyway you can give me an example of how I can do this with Capabilities? It would be greatly appreciated.

You only need a capability if you want to do it for other people's block entities.

 

If its your BlockEntity, you can just store the player's UUID in your block entity

You can see how ConduitBlockEntity does this to remember its "destroy target".

For actually changing the data in your block entity at placement see something like: AbstractBannerBlock.setPlacedBy()

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

  • Author
20 minutes ago, warjort said:

You only need a capability if you want to do it for other people's block entities.

 

If its your BlockEntity, you can just store the player's UUID in your block entity

You can see how ConduitBlockEntity does this to remember its "destroy target".

For actually changing the data in your block entity at placement see something like: AbstractBannerBlock.setPlacedBy()

Yes I am trying to set the data in my BlockEntity. I am trying to store the players UUID in my block Entity on place. Is it just as simple as setting a variable in that block entity to the players uuid or is there more too it? If you could show an example i would love that.

Quote

 

 Is it just as simple as setting a variable in that block entity to the players uuid

 

Yes.

You also need to load/save it, see the Conduit block. That's why you use the UUID, you can store that in NBT.

 

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

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.