Hi,
my mod uses an ore distribution to determine with which block it should replace.
Currently I use as a default this table where each entry in the matrix is probability adding to 100% for each y-lvl except where my mod does not replace the block::stone
y - level | coal | iron | gold | lapis | redstone | diamond
>110 0 0 0 0 0 0
>60 1 0 0 0 0 0
>30 50 50 0 0 0 0
>15 25 50 15 10 0 0
>5 20 40 15 7 13 5
>0 0 0 0 0 0 0
For my config I want to be able to edit this matrix where the y-level border is, the blocks and the probability linked to them.
Using nightconfig and ForgeConfigSpec (.define(String path/name, T defaultValue, Predicate<Object> validator))
I would implement my Data Structure T as an
HashMap<Integer,List<HashMap<String,Float>>>
with
HashMap<y-level,List<HashMap<ResourceLocationofBlock,probability>>>
(ResourceLocationofBlock as "namespace:block" like "minecraft:coal_ore")
,a custom Supplier giving the table above and a custom Predicate checking the ResourceLocationofBlock, the probabilty and wether all y-values are coverd.
My Questions:
Can I use a HashMap? in other words do I need to use a HashTable for thread safety
Can I use ResourceLocation.isResouceNameValid(String) when my Config loads? (Using CLIENT_BUILDER since @OnlyIn(Dist.CLIENT))
Is there another way to allow an user to add custom blocks to my config? (My way would be an Array/List which is typed in the Config)
Is this ForgeConfigSpec the way to do Config in Forge 1.15?
Edit: changed y-level to Integer instead of String