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
Conversation
@@ -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)) { |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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()
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Thank you for your contribution! |
No description provided.