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
  • How do I read the NBT Tag Data of a map on a server?
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
TheHook

How do I read the NBT Tag Data of a map on a server?

By TheHook, October 25, 2020 in Modder Support

  • Start new topic

Recommended Posts

TheHook    0

TheHook

TheHook    0

  • Tree Puncher
  • TheHook
  • Members
  • 0
  • 12 posts
Posted October 25, 2020

As the title suggests, I am trying to gather NBT Tag data from a map that is in my inventory on a server. The map has an image on it that I am trying to convert into an external Base64 format, or PNG file. But that part is not really important. The main question is given a filled map item on a server, how would I acquire the information I need? Some starter code that I tried returned java.lang.NullPointerException obviously because maps don't store their data in the item, so the keys that I'm using as arguments don't exist.

 

minecraft.player.inventory.getStackInSlot(0).getTagCompund().getCompoundTag("data").getByteArray("colors");

 

I attached the NBT hierarchy of a map item if that helps.

Screen Shot 2020-10-24 at 11.15.43 PM.png

Share this post


Link to post
Share on other sites

diesieben07    7597

diesieben07

diesieben07    7597

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7597
  • 55115 posts
Posted October 26, 2020

Map data is not stored as NBT in memory. Look at the MapData class.

Share this post


Link to post
Share on other sites

TheHook    0

TheHook

TheHook    0

  • Tree Puncher
  • TheHook
  • Members
  • 0
  • 12 posts
Posted October 26, 2020 (edited)

I forgot to mention that this project is being in in version 1.12.2 of Minecraft. I'm not too sure how to use the class, how would I construct it? What is "mapName" in the game?

Edited October 26, 2020 by TheHook
more precise question

Share this post


Link to post
Share on other sites

diesieben07    7597

diesieben07

diesieben07    7597

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7597
  • 55115 posts
Posted October 26, 2020

1.12 is no longer supported on this forum.

Please update to a modern version of Minecraft to receive support.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Ben Newman
      [1.16.1] [SOLVED] Block drops not respecting harvest level and tooltype

      By Ben Newman · Posted 1 minute ago

      Where do I add the setRequiresTools i really need to know as I cannot find where to code it. Many thanks. 
    • GenElectrovise
      What is the method to left click?

      By GenElectrovise · Posted 34 minutes ago

      There's probably something in or nearby to PlayerEntity (as a movement controller or something similar?) I'd start with searching my workspace for something along the lines of KeystrokeHandler or PlayerMovementController
    • Luis_ST
      [1.16.5] GameOverlay

      By Luis_ST · Posted 34 minutes ago

      I just want to render a overlay (i have creat a spyglass likt that from 1.17) and now i want to render the Overlay this is the code of the event i used: @SubscribeEvent(priority = EventPriority.HIGHEST) public static void RenderSpyglassOverlay(RenderGameOverlayEvent event) { PlayerEntity player = Minecraft.getInstance().player; int posX = event.getWindow().getScaledWidth() / 2; int posY = event.getWindow().getScaledHeight() / 2; if (player.getActiveItemStack().getItem() == CaveItems.SPYGLASS.get()) { RenderSystem.disableDepthTest(); RenderSystem.depthMask(false); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.disableAlphaTest(); Minecraft.getInstance().getTextureManager().bindTexture(new ResourceLocation("cave:textures/misc/spyglass_scope.png")); Minecraft.getInstance().ingameGUI.blit(event.getMatrixStack(), posX - 128, posY - 128, 0, 0, posX * 2, posY * 2, 256, 256); RenderSystem.depthMask(true); RenderSystem.enableDepthTest(); RenderSystem.enableAlphaTest(); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); } } but the overlay looks like this: https://drive.google.com/file/d/15llZaiIqNWK7WRqcihIJY7oaAszkFKnn/view?usp=sharing so my question: 1 .how to render the game overlay translucent 2. how to set the outside of the overlay to black
    • GenElectrovise
      Server doesnt start

      By GenElectrovise · Posted 39 minutes ago

      Never heard of an error like this but what's your version.
    • Potatoe
      Minecraft server

      By Potatoe · Posted 1 hour ago

      ok
  • Topics

    • StefanDeSterke
      6
      [1.16.1] [SOLVED] Block drops not respecting harvest level and tooltype

      By StefanDeSterke
      Started July 20, 2020

    • Gubipe
      5
      What is the method to left click?

      By Gubipe
      Started 14 hours ago

    • Luis_ST
      0
      [1.16.5] GameOverlay

      By Luis_ST
      Started 34 minutes ago

    • BinAufGoogle
      3
      Server doesnt start

      By BinAufGoogle
      Started 18 hours ago

    • Potatoe
      4
      Minecraft server

      By Potatoe
      Started Sunday at 10:13 AM

  • Who's Online (See full list)

    • GenElectrovise
    • MHT121
    • MHT
    • Linky132
    • Qolem
    • Luis_ST
    • yumeji
    • Leronus
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • How do I read the NBT Tag Data of a map on a server?
  • Theme

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