The CustomModelData / "custom_model_data" tag for data packs with resource packs currently uses an integer value (which shouldn't be bigger than the max 24 bit value of a float, which is a bit over 16 million)
The actual number as-is doesn't have to be anything specific in theory, but I would rather pick a value that's meaningful in some way to the data pack, such that it doesn't accidentally match a value used in another resource pack from someone else who might have won the lottery.
I have created a bit of java code for converting any arbitrary plain-text string to an Integer and scaling it to a positive-only 24 bit value:
public int convert(String input){
return (int)Math.abs((long)Math.scalb(input.hashCode(), 24)/(long)Integer.MAX_VALUE);
}
This way, for example, I could use the arbitrary string "netherite_nugget" as my CustomModelData tag for a gold nugget, and the game stores it as 9746077 which is perfectly legal.
Please sign in to leave a comment.
0 Comments