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    7596

diesieben07

diesieben07    7596

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7596
  • 55098 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    7596

diesieben07

diesieben07    7596

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7596
  • 55098 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

    • DaemonUmbra
      tempête de Neige primal winter

      By DaemonUmbra · Posted 4 minutes ago

      Please keep this forum in English. Are you a developer for the mod or are you a player?
    • DaemonUmbra
      3rd party hosted Server wont launch

      By DaemonUmbra · Posted 6 minutes ago

      This is coming out of Linux, not Forge. Apparently the system you're using has hit its limit for file watches, and given that the default on my Linux instance is 524288 I'm inclined to believe that your hosting provide has either set a limit that's much lower, or is cramming tons of servers onto one machine. Either way this sounds to me like you need a better hosting provider.
    • iHamster
      Stuck with block movement

      By iHamster · Posted 27 minutes ago

      I take it as a type of suggestion one can't decline  
    • Draco18s
      Stuck with block movement

      By Draco18s · Posted 41 minutes ago

      Why the fauk does your renderer change what blocks are in the world? That's not the job of a renderer.
    • DaemonUmbra
      awsfte

      By DaemonUmbra · Posted 49 minutes ago

      Please provide debug.log (more info on where it is and how to provide it in my signature below, just expand the spoiler) Edit: Do not hijack other people's threads, response moved.
  • Topics

    • Ronshark
      1
      tempête de Neige primal winter

      By Ronshark
      Started 2 hours ago

    • BoGuBoy
      1
      3rd party hosted Server wont launch

      By BoGuBoy
      Started 3 hours ago

    • iHamster
      12
      Stuck with block movement

      By iHamster
      Started January 6

    • awsfte
      2
      awsfte

      By awsfte
      Started 1 hour ago

    • Malkar
      1
      Java install not complete

      By Malkar
      Started 3 hours ago

  • Who's Online (See full list)

    • diesieben07
    • Antimus
    • szymulewsky
    • DaemonUmbra
    • Warsade
    • metword
    • ozi
    • mistical12
    • Qolem
    • TheidenHD
    • iHamster
    • Leronus
    • Linky132
  • 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