Closed Jahfry closed 2 years ago
And ... if there is a way to get nbt parameter to be checked in CTM ... just tell me I screwed up and maybe give me an example :)
(added Use Case 1 to further explain the usage, moved more niche case to number 2)
Blocks don't have NBTs, they only have blockstate/coordinates and the corresponding properties that can be obtained from the world (biome, light, etc). Block entities internally don't have NBTs. The NBT is only used to create or save the block entity. At runtime they have a bunch of fields that are specific to the block entity type. Random Entites can use some general fields (like name), but they are not sent to the client when loading the world unless needed for rendering. For example the chest name is only sent to the client when opening the chest GUI. Entities are similar, they only use NBT to create the entity or to save it. The live entities have a bunch of specific properties, but no general way to access them. Generating an NBT every time a check is needed would be too slow.
Closing.
For posterity, if anyone comes here looking for a similar solution, this is what I ended up with that worked (not the same mechanism I was hoping for but good enough):
1) Create a writable_book ("Book and Quill") 2) Sign the Book, giving it a title that you want to use to match for texture (example below ... title = A) 3) Use this to match it in the properties file:
type=item
items=minecraft:written_book
texture=cap_A.png
nbt.title=ipattern:A
Good things:
Not-great things:
/give @s minecraft:written_book{title:"A"}
/give @s item_frame{EntityTag:{Item:{id:"minecraft:written_book",Count:1b,tag:{title:"A"}},Invisible:1b,Fixed:1b}}
Note: related to #406 but with some extra defintion of use case
Request: allow NBT parameter on custom block textures.
Notes:
I realize the NBT will only be available in certain cases, where the block references an item (like a Lectern or Furnace). Allowing NBT as a parameter, then passively failing on a normal block, is fine. Just add a note about "nbt will only work with blocks that refer to entities" would be needed.
This may be a case where nbt works but looking up tagged items (lectern's writable_book) is failing, but from what I can see it looks like that data is all propogated back up to the lectern nbt when the writable_book is placed?
Use case 1:
(this is one I consider a bit more generic and useful for others)
Using NBT to change CTM texture mode to be altered based on the NBT data (easiest method would be using the item name, but more complex option shown in second use case).
Example: converting any nameable entity with a placed block model (or adding a custom entity) to a Bookshelf texture. Then using the NBT name to define whether a specific bookshelf block is ctm_compact, horizontal, vertical, horizontal+vertical, or vertical+horizontal.
This would allow very precise block texturing while only changing or adding a single block to have all ctm mode options for that texture set.
Some textures this could be useful for for complex designs:
Use case 2:
(I realize this is a niche use case, but I can see many other ways in which being able to do a NBT lookup on a block CTM would be valuable. I'm just giving my specific use case to explain 1 case where it might be used)
I wanted to have a system where I could add a full text font displayed on specific sides of a cube in-game (so I can use a single block as a letter rather than needing an array of blocks to make a letter character) using textures.
I was trying to use a Lectern (remodeled to using parent: cube_all) to mimic a standard block. This part is working fine.
I then applied a CTM fixed texture to the lectern, which worked great, defined with "faces=" to pick which side to display the letter on.
Placed a book on the lectern with text on a page, which can be referred to via nbt as "Book.tag.pages[0]"
The next part I needed to make this work was applying a
nbt.Book.tag.pages[0]=A
to display the "A" texture on that face,nbt.Book.tag.pages[0]=B
to display "B" texture, etc.The last part above is what isn't working. The texture applies regardless of the nbt parameter, so I assume the CTM methods simply don't allow NBT data to be checked.
Basically what I need is either a CIT-like mechanism for blocks, or a nbt mechanism in CTM.
PS. Not expecting this to get done, or at least not soon enough for my project, I'm looking at an alternate method using Custom Item Textures and invisible item_frames.