Mykindos / BetterPvP

18 stars 23 forks source link

Figure out why creating some custom recipes work and other do not #1306

Open StudentAlleg opened 3 days ago

StudentAlleg commented 3 days ago

I was messing around trying to figure out how to make a custom recipe, using the system I made a couple of months ago. I was unable to make a custom recipe for purification potion (as a test), but it would trigger CraftItemEvent with the correct result.

The confusing thing is, is that the recipe would show up in the recipe book (the default one you can open while in a crafting table). It would also show up in my custom recipe viewer. Other custom recipes, created using different methods, worked.

For purification, everything showed correctly, even showing that based off of the items I had, it was craftable. This did not appear to be the case for a wooden axe made out of compacted tree logs (that had higher damage). My guess is that it is something to do with the itemstack (the other recipes only use materials), but I do not know. Calling itemHandler#updateNames did not change the outcome.

I don't understand why it is not working. Spending time on this now isn't super important, but if the system cannot even haphazardly make recipes with other custom items, then it is going to be hard to expand things like progression in the future. I'm unsure of how to even troubleshoot this.

For anyone trying to go through this, here are some pitfalls I had to navigate around:

Mykindos commented 3 days ago

Did you unregister any recipes that could have taken that slot? It's done automatically in createShapedRecipe so it should be fine

https://github.com/Mykindos/BetterPvP/blob/65d30fc109f2ce555a0866534c684d800e3cc4aa/champions/src/main/java/me/mykindos/betterpvp/champions/weapons/impl/vanilla/weapons/DiamondSword.java#L11-L26

probably the best example, but note that there is also this

https://github.com/Mykindos/BetterPvP/blob/326292664d7c5552c09b284884dd680666cedd89/core/src/main/resources/configs/config.yml#L295-L306

https://github.com/Mykindos/BetterPvP/blob/064410257e6a14dddc5e1f2571d7be5821f8df26/core/src/main/java/me/mykindos/betterpvp/core/recipes/RecipeHandler.java#L14-L31

Which could be why

StudentAlleg commented 1 day ago

Had not done this at the time, tried it now, no change. See: https://github.com/Mykindos/BetterPvP/blob/fce3f520ea09a40a29d747cca2931136695a8405/champions/src/main/java/me/mykindos/betterpvp/champions/weapons/impl/PurificationPotion.java#L46-L71

https://prnt.sc/w2MM-2I5htoB https://prnt.sc/-ICb_tJMAyla https://prnt.sc/vbhxDVPvFkr4 (console shows result from ItemCraftEvent)