EnchantItemEvent#1954
Conversation
liach
left a comment
There was a problem hiding this comment.
Beyond all these issues, you need to remove the implnotes from the api.
| EnchantmentList with(int seed, int slot, int level, boolean treasure); | ||
| // redo random vanilla calculation - with treasure enchantments | ||
| // EnchantmentHelper.buildEnchantmentList | ||
| EnchantmentList withTreasure(boolean treasure); |
There was a problem hiding this comment.
Can curse be optional as well?
There was a problem hiding this comment.
Look like curses are treasure enchantments.
Not allowing curses would require us to write our own version for getting random enchantments.
There was a problem hiding this comment.
Treasure and Curse are separate - there are only two curses (binding_curse, vanishing_curse), while there are 4 treasures (binding_curse, frost_walker, mending, vanishing_curse).
There was a problem hiding this comment.
EnchantmentHelper#buildEnchantmentList(Random randomIn, ItemStack itemStackIn, int level, boolean allowTreasure) doesn't allow filtering curses.
We can still add it to the API if its doable.
a4141e6 to
933d922
Compare
59390ab to
487764c
Compare
487764c to
ace77ed
Compare
2faacf2 to
6c067b3
Compare
| * | ||
| * @return the slot of the enchanting item. | ||
| */ | ||
| Slot getEnchantingSlot(); |
There was a problem hiding this comment.
getOutputSlot instead? How do we want to word these? Other Tiles that have logic could have similar events (like the Anvil one we already do)
There was a problem hiding this comment.
Its the also the input slot.
| /** | ||
| * Triggers when the item was enchanted. | ||
| */ | ||
| interface EnchantItem extends EnchantItemEvent, ChangeInventoryEvent { |
There was a problem hiding this comment.
Maybe call this Post? The docs imply the action occurred, the name of the event implies it is about to occur.
|
|
||
| // Utility functions to generate enchantment lists | ||
|
|
||
| /** |
There was a problem hiding this comment.
The below two methods feel like they belong elsewhere. What if I want to build an EnchantmentList but in my code I don't have an EnchantmentList already on hand? How would I do this?
There was a problem hiding this comment.
Atm. you cant do it.
I guess if you wanted to emulate an enchanting table somewhere else you might need this.
We would have to expose it in some kind of builder class then?
6c067b3 to
b43aeaf
Compare
b43aeaf to
c3e8e16
Compare
d7d0ab8 to
4da8348
Compare
4da8348 to
46ac2d4
Compare
46ac2d4 to
81fca20
Compare
SpongeAPI | SpongeCommon
3 new Events:
EnchantItemEvent.CalculateLevelRequirementfirst event ; calculates the level requirement for each enchantEnchantItemEvent.CalculateEnchantmentsecond event ; calculates the list of enchantments to apply - fires twice - once for the preview then again when actually enchanting - plugins should return the same list for the same inputEnchantItemEvent.Postthe final event ; contains the slot transactions of the enchanted item getting changed and the lapis used.For reference:
#1303