#Details about "event.recipes"

21 messages · Page 1 of 1 (latest)

placid birch
#

The event in the listener of ServerEvents.recipes has a hashmap attribute recipes. From which datatype to which datatype is the mapping taking place?

visual birchBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

chrome heath
#

Also, that's not an attribute, that's a bean.
AKA - KubeJS transformed getRecipes method into a JS accessor property containing only a getter for recipes.

#

From the code, the type you get is Map<String, Object>, so String keys and any Java object values

placid birch
#

I see, thank you. That means, I'll need some casting shenanigans :3

chrome heath
#

Because that may be an XY problem

burnt roverBOT
#

The XY problem is when you really want to do X, and you think that Y can achieve X. However, you can't get Y to work, and so ask for help exclusively about Y.

This can lead to a lot of confusion from the people trying to help you, as Y can seem like a very random thing to want to do, and a lot of the time isn't the best way to achieve X anyway.

Its fine to ask about Y, just always include some context about X so you can be put on the right track if Y won't do X well, or there is an easier way to do X.

placid birch
#

the problem boiled down to getting a Consumer<FinishedRecipe> to work at a specific point

chrome heath
#

The recipes getter gives a map of known, documented recipes, so as a part of a call like this:

event.recipes.create.mechanical_crafting()
placid birch
#

meaning, that I can add a key-value pair to that map where the recipe is the value and have it added?

#

probably not 😂

#

what I did now, is printing the values of the map given by event.recipes. this gave prints like gtceu:chemical_reactor

#

looks like a resource location of a recipe type to me

#

will try what the keys and values of event.recipes.gtceu.chemical_reactor() look like

#

I can't because the map is null

#

although the object itself is not null

placid birch
#

it might work, if I would have access to the map Map<ResourceLocation, Recipe<?>> recipesByName which is passed to the injectRuntimeRecipes method of kjs plugins