How to convert a String like “minecraft:planks[variant=spruce]” to a ItemStack?
either make a method that processes it into an itemstack, or check if ItemStack is serializable as a string. if it is, make the conversion through that.
Kinda the same thing as this:
Only the above is a bit more relevant . You want the string as a BlockType and create a new ItemStack of that .
ItemType. how the string should be given and how it is processed to be returned is based upon the implementation.
Does that work with the variant part?
I think it “should” be something like this:
BlockType blocktype = game.getRegistry(). getType(BlockType.class, "minecraft:planks[variant=spruce]").get(); ItemBlock itemblock = blocktype.getHeldItem().get() ItemStack itemstack = game.getRegistry().getItemBuilder(). itemType(itemblock).quantity(20).build();
But the current implementation. Doesn’t seem to like that .
I think a BlockType only holds the data from the blocktype, and doesn’t save the variant.
“minecraft:planks” also doesn’t work .
time for an issue?