Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ItemMergeEvent, ExpBottleEvent, CreeperPowerEvent (#922) #925

Merged
merged 5 commits into from May 27, 2018
Merged

Conversation

VaiTon
Copy link
Contributor

@VaiTon VaiTon commented May 27, 2018

No description provided.

@CLAassistant
Copy link

CLAassistant commented May 27, 2018

CLA assistant check
All committers have signed the CLA.

@@ -59,7 +63,15 @@ protected Sound getHurtSound() {
public void damage(double amount, Entity source, DamageCause cause) {
super.damage(amount, source, cause);
if (DamageCause.LIGHTNING.equals(cause)) {
Copy link
Member

Choose a reason for hiding this comment

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

Off-topic, but could you add a check for !isPowered() in this if statement?

@@ -28,6 +31,8 @@ public void collide(LivingEntity entity) {

private void spawnOrb() {
int xp = ThreadLocalRandom.current().nextInt(9) + 3;
ExpBottleEvent event = EventFactory.getInstance()
.callEvent(new ExpBottleEvent(this, xp));
Copy link
Member

Choose a reason for hiding this comment

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

Set the xp variable to the result of event.getExperience()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But xp has to be calculated before calling the new event

Copy link
Member

Choose a reason for hiding this comment

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

I mean after the event is fired. The event object is mutable by plugins, which can use setExperience to change the behaviour.

So, after event is called, use xp = event.getExperience(); and keep the rest as is.

@aramperes aramperes merged commit 0f76fe2 into GlowstoneMC:dev May 27, 2018
@aramperes aramperes mentioned this pull request May 27, 2018
97 tasks
@aramperes
Copy link
Member

Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants