Skip to content

Instantly share code, notes, and snippets.

@cmoore
Created November 23, 2014 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmoore/144d2f09bb584d90d8dc to your computer and use it in GitHub Desktop.
Save cmoore/144d2f09bb584d90d8dc to your computer and use it in GitHub Desktop.
private void show_tags(CompoundTag ctag, Player player) {
ctag.keySet().forEach(new Consumer<String>() {
@Override
public void accept(String s) {
player.notice("S: " + s + " V: " + ctag.get(s).toString());
}});
}
}
// And later...
TileEntity tile_entity = the_block.getTileEntity();
CompoundTag ctag = tile_entity.getDataTag();
ctag.put("CustomName", "FARTAHONTAS");
ctag.put("CustomNameVisible", true);
tile_entity.writeToTag(ctag);
tile_entity.update();
the_block.update();
ctag = the_block.getTileEntity().getDataTag();
player.notice("After Write");
show_tags(ctag, player);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment