Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.16.4] Get NBT of a TileEntity
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
krypciak

[1.16.4] Get NBT of a TileEntity

By krypciak, November 20, 2020 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

krypciak    0

krypciak

krypciak    0

  • Tree Puncher
  • krypciak
  • Members
  • 0
  • 15 posts
Posted November 20, 2020

Hi, I want to get NBT of a TileEntity. How do I do it?

I already have a TileEntity variable.

Thanks for help!

  • Quote

Share this post


Link to post
Share on other sites

hohserg    3

hohserg

hohserg    3

  • Tree Puncher
  • hohserg
  • Members
  • 3
  • 39 posts
Posted November 20, 2020

Something like that:

public static CompoundNBT getNbtOfTile(TileEntity tile) {
  CompoundNBT nbt = new CompoundNBT();
  tile.write(nbt);
  return nbt;
}

 

  • Quote

Share this post


Link to post
Share on other sites

krypciak    0

krypciak

krypciak    0

  • Tree Puncher
  • krypciak
  • Members
  • 0
  • 15 posts
Posted November 20, 2020

Well, it works like tile.serializeNBT()

When I check chest NBT, it shows Items tag as empty, when there are items inside chest.

So your function is not the solution for me.

 

  • Quote

Share this post


Link to post
Share on other sites

hohserg    3

hohserg

hohserg    3

  • Tree Puncher
  • hohserg
  • Members
  • 3
  • 39 posts
Posted November 20, 2020

Maybe, your check perform on client? And tile on client is not synchronized with server. Try to open chest for sync.

  • Quote

Share this post


Link to post
Share on other sites

krypciak    0

krypciak

krypciak    0

  • Tree Puncher
  • krypciak
  • Members
  • 0
  • 15 posts
Posted November 20, 2020

I tried this function on singleplayer, it didnt work even when I opend the chest

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7610

diesieben07

diesieben07    7610

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7610
  • 55159 posts
Posted November 20, 2020

The question is: Why? You should never manually have to access the NBT data.

What are you trying to achieve?

  • Quote

Share this post


Link to post
Share on other sites

krypciak    0

krypciak

krypciak    0

  • Tree Puncher
  • krypciak
  • Members
  • 0
  • 15 posts
Posted November 20, 2020

Theres no specific reason, I just wanted to get it shown at screen. If it isnt possible, sure I dont need it.

BTW, can I do the same thing but with entities?

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7610

diesieben07

diesieben07    7610

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7610
  • 55159 posts
Posted November 20, 2020

Most data that is needed for a proper NBT representation is not available on the client.

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • blubb
      My forge server wont make a mods folder

      By blubb · Posted 1 hour ago

      I got it working Im not sure why but if I had to guess its because I cleaned up my desktop into 2 neat folders and suddenly it works
    • blubb
      My forge server wont make a mods folder

      By blubb · Posted 1 hour ago

      No
    • DaemonUmbra
      My forge server wont make a mods folder

      By DaemonUmbra · Posted 1 hour ago

      Are you renaming any files after reinstalling?
    • blubb
      My forge server wont make a mods folder

      By blubb · Posted 2 hours ago

      Also after that I looked and they where all gone and I tried again but still didn't work
    • blubb
      My forge server wont make a mods folder

      By blubb · Posted 2 hours ago

      Sorry for the late reply but I did that and it was the same thing for all of them
  • Topics

    • blubb
      36
      My forge server wont make a mods folder

      By blubb
      Started 5 hours ago

    • ZDOG22
      0
      [1.16.4] Remove Minecraft Pitch Limit

      By ZDOG22
      Started 4 hours ago

    • Eridani
      0
      Best way to create a new dye.

      By Eridani
      Started 4 hours ago

    • djsweely
      1
      SERVER CRASH

      By djsweely
      Started 5 hours ago

    • Luis_ST
      1
      [1.16.5] Help with custom Glass Block

      By Luis_ST
      Started Friday at 07:35 AM

  • Who's Online (See full list)

    • blubb
    • DaemonUmbra
    • Choonster
    • sarkozi
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.16.4] Get NBT of a TileEntity
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community