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 update my code from 1.19.3 to 1.19.4 but am having trouble adapting the NbtUtils.readBlockState method - this function used to just take one CompoundTag parameter but now it takes the CompoundTag and a HolderGetter<Block> pBlockGetter parameter. Where am I supposed to get pBlockGetter from?

I primarily use this method for reading NBT structure data from my mod's resource files. The player can create structures which are saved into both client and server sides (so this method can run on both sides).

My code for the method is here:

https://github.com/SoLegendary/reignofnether/blob/1.19.4/src/main/java/com/solegendary/reignofnether/building/BuildingBlockData.java#L67-L74

In the future is there a guide for how to update methods like this on a new Minecraft version?

  • 2 weeks later...

currently i im in the same predicament whit the same functionย 

the only i can thing of is to somehow get the block name and mod id fromย paletteNbt.getCompound(i)ย  and used to get the block from the ForgeRegistries.BLOCKS listย 
just to pass it hereย 

ย 

ย 

ย 

	// ########## ########## ########## ########## ########## ##########
public ArrayList<BlockState> getBuildingPalette(CompoundTag nbt) {
ArrayList<BlockState> palette = new ArrayList<>();
// load in palette (list of unique blockstates)
ListTag paletteNbt = nbt.getList("palette", 10);
CompoundTag pblk;
Block block = null;
for (int i = 0; i < paletteNbt.size(); i++)
pblk = paletteNbt.getCompound(i);



String name = pblk.getString("Name");
block = ForgeRegistries.BLOCKS. .getValue(name);

//palette.add(NbtUtils.readBlockState( paletteNbt.getCompound(i) ) );


return palette;
}
	

ย 

Spoiler

				
			
		{ "DataVersion": 3337,
		ย  "blocks" ย  ย  : list<TAG_Compound>[3] [
		ย  ย  { "pos" ย : list<TAG_Int>[3] [
		ย  ย  ย  ย  0,
		ย  ย  ย  ย  0,
		ย  ย  ย  ย  0
		ย  ย  ย  ],
		ย  ย  ย  "state": 0
		ย  ย  },
		ย  ย  { "pos" ย : list<TAG_Int>[3] [
		ย  ย  ย  ย  1,
		ย  ย  ย  ย  0,
		ย  ย  ย  ย  0
		ย  ย  ย  ],
		ย  ย  ย  "state": 1
		ย  ย  },
		ย  ย  { "pos" ย : list<TAG_Int>[3] [
		ย  ย  ย  ย  2,
		ย  ย  ย  ย  0,
		ย  ย  ย  ย  0
		ย  ย  ย  ],
		ย  ย  ย  "state": 2
		ย  ย  }
		ย  ],
		ย  "entities" ย  : list<undefined>[0] [],
		ย  "palette" ย  ย : list<TAG_Compound>[3] [
		ย  ย  { "Name" ย  ย  ย : "mercblk:manhole_dirt_path_east_slab",
		ย  ย  ย  "Properties": {
		ย  ย  ย  ย  "age" ย  ย  ย  ย : "0",
		ย  ย  ย  ย  "type" ย  ย  ย  : "top",
		ย  ย  ย  ย  "waterlogged": "false"
		ย  ย  ย  }
		ย  ย  },
		ย  ย  { "Name" ย  ย  ย : "mercblk:stone_bricks_panel",
		ย  ย  ย  "Properties": {
		ย  ย  ย  ย  "facing" ย  ย  : "east",
		ย  ย  ย  ย  "waterlogged": "false"
		ย  ย  ย  }
		ย  ย  },
		ย  ย  { "Name" ย  ย  ย : "mercblk:manhole_dirt_path_west_slab",
		ย  ย  ย  "Properties": {
		ย  ย  ย  ย  "age" ย  ย  ย  ย : "7",
		ย  ย  ย  ย  "type" ย  ย  ย  : "top",
		ย  ย  ย  ย  "waterlogged": "false"
		ย  ย  ย  }
		ย  ย  }
		ย  ],
		ย  "size" ย  ย  ย  : list<TAG_Int>[3] [
		ย  ย  3,
		ย  ย  1,
		ย  ย  1
		ย  ]
		}				
			

ย 

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.