#Recipe Choices
1 messages ยท Page 1 of 1 (latest)
first: can you use recipe choices for items with no choices (ex: DIAMOND_BLOCK)?
it will look like this:
'W' -> new MaterialChoice(Material.OAK_WOOD, Material.SPRUCE_WOOD, Material.ACACIA_WOOD, ...);
'D' -> new MaterialChoice(Material.DIAMOND);
second: for things like the JUKEBOX, does the size of the material list of the recpiechoice stay constant for all items or is it different sized for the diamond and wood
yes
ok
the ChoiceMap of a diamondblock will look like this:
'D' -> new MaterialChoice(Material.DIAMOND");
kk
RecipeChoice diamonds = diamondBlockRecipe.getChoiceMap().get('D');
if(diamonds instanceof RecipeChoice.MaterialChoice) {
RecipeChoice.MaterialChoice diamondMaterials = (RecipeChoice.MaterialChoice) diamonds;
List<Material> list = diamondMaterials.getChoices();
// list.get(0) == Material.DIAMOND
// The list doesn't container other entries
}
ok thats what i was going to do
but im still confused to why you need to cast
and there's no direct method
also im pretty sure chars in shaped recipe are unique, cause maps have unique keys
they are
ugh
abc, def, ghi
beause diamonds could also be an ExactChoice
even if they are the same
How will you know that at compile time??
okay ๐
idk something like getMaterialChoice and it returns null if its an exact? ok now i see why thats a bad idea
ty
you're not thinking in objects and abstraction enough yet^^
like, the map can contain both (in theory), 'D' could be a MaterialChoice and 'F' could be an ExactChoice
but they all have to fit into one Map
so there's the interface that connects them
which is the RecipeChoice
Just imagine you have a table in your kitchen and you have cutlery on it
5 knifes and 5 forks
now you can do kitchenTable.getCutlery() and some of those will be Knife, others will be fork
alright ๐
for some reason i was thinking that exactchoices werent a thing
since they arent used in vanilla
so
that would mean that all recipechoices are material choices
so then why would there be no direct method
yeah but plugins could use them^^