1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
--- a/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java
+++ b/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java
@@ -13,38 +13,44 @@
public class ThrownExperienceBottle extends ThrowableItemProjectile {
- public ThrownExperienceBottle(EntityType<? extends ThrownExperienceBottle> entitytype, Level level) {
- super(entitytype, level);
+ public ThrownExperienceBottle(EntityType<? extends ThrownExperienceBottle> entityType, Level level) {
+ super(entityType, level);
}
- public ThrownExperienceBottle(Level level, LivingEntity livingentity) {
- super(EntityType.EXPERIENCE_BOTTLE, livingentity, level);
+ public ThrownExperienceBottle(Level level, LivingEntity shooter) {
+ super(EntityType.EXPERIENCE_BOTTLE, shooter, level);
}
- public ThrownExperienceBottle(Level level, double d0, double d1, double d2) {
- super(EntityType.EXPERIENCE_BOTTLE, d0, d1, d2, level);
+ public ThrownExperienceBottle(Level level, double x, double d1, double y) {
+ super(EntityType.EXPERIENCE_BOTTLE, x, d1, y, level);
}
@Override
- @Override
protected Item getDefaultItem() {
return Items.EXPERIENCE_BOTTLE;
}
@Override
- @Override
protected float getGravity() {
return 0.07F;
}
@Override
- @Override
- protected void onHit(HitResult hitresult) {
- super.onHit(hitresult);
+ protected void onHit(HitResult result) {
+ super.onHit(result);
if (this.level() instanceof ServerLevel) {
- this.level().levelEvent(2002, this.blockPosition(), PotionUtils.getColor(Potions.WATER));
+ // CraftBukkit - moved to after event
+ // this.level().levelEvent(2002, this.blockPosition(), PotionUtil.getColor(Potions.WATER));
int i = 3 + this.level().random.nextInt(5) + this.level().random.nextInt(5);
+ // CraftBukkit start
+ org.bukkit.event.entity.ExpBottleEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callExpBottleEvent(this, result, i);
+ i = event.getExperience();
+ if (event.getShowEffect()) {
+ this.level().levelEvent(2002, this.blockPosition(), PotionUtils.getColor(Potions.WATER));
+ }
+ // CraftBukkit end
+
ExperienceOrb.award((ServerLevel) this.level(), this.position(), i);
this.discard();
}
|