Skip to content

UpdateAnvilEvent#1898

Merged
Faithcaio merged 1 commit into
stable-7from
feature/anvilupdateevent
Nov 28, 2018
Merged

UpdateAnvilEvent#1898
Faithcaio merged 1 commit into
stable-7from
feature/anvilupdateevent

Conversation

@Faithcaio

@Faithcaio Faithcaio commented Aug 18, 2018

Copy link
Copy Markdown
Contributor

SpongeAPI | SpongeCommon

Adds an event to handle anvil results and costs.

The event fires before vanilla is doing its computation but after forge mods had a chance to set the values.

As such there is no initial level/material cost and the result is empty by default.
Only when the result is set by the plugin costs will be applied.

No result set => Vanilla Behaviour
Result set => Override Costs and Result
Cancel => Empty Result

@gabizou gabizou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor changes.

Comment thread src/main/java/org/spongepowered/api/event/item/inventory/AnvilUpdateEvent.java Outdated
Comment thread src/main/java/org/spongepowered/api/event/item/inventory/AnvilUpdateEvent.java Outdated
Comment thread src/main/java/org/spongepowered/api/event/item/inventory/AnvilUpdateEvent.java Outdated
@Faithcaio Faithcaio force-pushed the feature/anvilupdateevent branch from ca16fc4 to 5e850f1 Compare August 19, 2018 07:59
@Faithcaio Faithcaio changed the title AnvilUpdateEvent UpdateAnvilEvent Aug 19, 2018
@Faithcaio Faithcaio force-pushed the feature/anvilupdateevent branch from 5e850f1 to c22b6af Compare August 29, 2018 19:33
Comment thread src/main/java/org/spongepowered/api/event/item/inventory/UpdateAnvilEvent.java Outdated
Comment thread src/main/java/org/spongepowered/api/event/item/inventory/UpdateAnvilEvent.java Outdated

@gabizou gabizou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty much done, just move the other two groups of methods into a transaction and you're pretty much set.

Comment thread src/main/java/org/spongepowered/api/event/item/inventory/UpdateAnvilEvent.java Outdated
Comment thread src/main/java/org/spongepowered/api/event/item/inventory/UpdateAnvilEvent.java Outdated
@Faithcaio Faithcaio removed this from the Release 7.1 milestone Sep 7, 2018
@Faithcaio Faithcaio force-pushed the feature/anvilupdateevent branch from 3708d00 to 1eb983e Compare October 31, 2018 20:21
@Faithcaio Faithcaio force-pushed the feature/anvilupdateevent branch from 1eb983e to 5247372 Compare November 17, 2018 13:58
/**
* The level and material costs for an anvil usage.
*/
interface Cost extends DataSerializable {

@Cybermaxke Cybermaxke Nov 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer this class to be immutable with a builder. That way is the transaction also completely immutable, so you cannot modify the original costs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about immutable without a builder like it is now?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't notice that it returns a new object. Javadoc is missing @return

Ant it's a common practice to use builders in sponge, not sure if it's worth adding one for this.

@Faithcaio Faithcaio force-pushed the feature/anvilupdateevent branch from 5247372 to 7d7bc93 Compare November 18, 2018 00:18
Comment thread src/main/java/org/spongepowered/api/event/item/inventory/UpdateAnvilEvent.java Outdated
@Faithcaio Faithcaio force-pushed the feature/anvilupdateevent branch from 7d7bc93 to 3a082eb Compare November 18, 2018 09:15
Comment thread src/main/java/org/spongepowered/api/event/item/inventory/UpdateAnvilEvent.java Outdated
@Faithcaio Faithcaio force-pushed the feature/anvilupdateevent branch 2 times, most recently from df469f3 to 23fa671 Compare November 24, 2018 18:48
@Faithcaio Faithcaio force-pushed the feature/anvilupdateevent branch from 23fa671 to bd923a6 Compare November 24, 2018 19:53
@Faithcaio Faithcaio merged commit 6eb292f into stable-7 Nov 28, 2018
@Faithcaio Faithcaio deleted the feature/anvilupdateevent branch November 28, 2018 11:54
@ImMorpheus ImMorpheus mentioned this pull request Aug 24, 2020
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants