@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/server/EntityPotion.java
|
||||
+++ b/net/minecraft/server/EntityPotion.java
|
||||
@@ -6,6 +6,13 @@
|
||||
@@ -4,6 +4,13 @@
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import javax.annotation.Nullable;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
+// CraftBukkit start
|
||||
+import java.util.HashMap;
|
||||
+import java.util.Map;
|
||||
@@ -12,9 +12,9 @@
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+// CraftBukkit end
|
||||
|
||||
public class EntityPotion extends EntityProjectile {
|
||||
public class EntityPotion extends EntityProjectileThrowable {
|
||||
|
||||
@@ -79,7 +86,7 @@
|
||||
@@ -69,7 +76,7 @@
|
||||
|
||||
if (flag) {
|
||||
this.splash();
|
||||
@@ -23,7 +23,7 @@
|
||||
if (this.isLingering()) {
|
||||
this.a(itemstack, potionregistry);
|
||||
} else {
|
||||
@@ -116,6 +123,7 @@
|
||||
@@ -106,6 +113,7 @@
|
||||
private void a(List<MobEffect> list, @Nullable Entity entity) {
|
||||
AxisAlignedBB axisalignedbb = this.getBoundingBox().grow(4.0D, 2.0D, 4.0D);
|
||||
List<EntityLiving> list1 = this.world.a(EntityLiving.class, axisalignedbb);
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
if (!list1.isEmpty()) {
|
||||
Iterator iterator = list1.iterator();
|
||||
@@ -133,21 +141,46 @@
|
||||
@@ -123,21 +131,46 @@
|
||||
d1 = 1.0D;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,20 @@
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
||||
- while (iterator1.hasNext()) {
|
||||
- MobEffect mobeffect = (MobEffect) iterator1.next();
|
||||
- MobEffectList mobeffectlist = mobeffect.getMobEffect();
|
||||
-
|
||||
- if (mobeffectlist.isInstant()) {
|
||||
- mobeffectlist.applyInstantEffect(this, this.getShooter(), entityliving, mobeffect.getAmplifier(), d1);
|
||||
- } else {
|
||||
- int i = (int) (d1 * (double) mobeffect.getDuration() + 0.5D);
|
||||
-
|
||||
- if (i > 20) {
|
||||
- entityliving.addEffect(new MobEffect(mobeffectlist, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isShowParticles()));
|
||||
- }
|
||||
- }
|
||||
+ org.bukkit.event.entity.PotionSplashEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPotionSplashEvent(this, affected);
|
||||
+ if (!event.isCancelled() && list != null && !list.isEmpty()) { // do not process effects if there are no effects to process
|
||||
+ for (LivingEntity victim : event.getAffectedEntities()) {
|
||||
@@ -68,20 +81,7 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
- while (iterator1.hasNext()) {
|
||||
- MobEffect mobeffect = (MobEffect) iterator1.next();
|
||||
- MobEffectList mobeffectlist = mobeffect.getMobEffect();
|
||||
-
|
||||
- if (mobeffectlist.isInstant()) {
|
||||
- mobeffectlist.applyInstantEffect(this, this.getShooter(), entityliving, mobeffect.getAmplifier(), d1);
|
||||
- } else {
|
||||
- int i = (int) (d1 * (double) mobeffect.getDuration() + 0.5D);
|
||||
-
|
||||
- if (i > 20) {
|
||||
- entityliving.addEffect(new MobEffect(mobeffectlist, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isShowParticles()));
|
||||
- }
|
||||
- }
|
||||
+
|
||||
+ if (mobeffectlist.isInstant()) {
|
||||
+ mobeffectlist.applyInstantEffect(this, this.getShooter(), entityliving, mobeffect.getAmplifier(), d1);
|
||||
+ } else {
|
||||
@@ -92,7 +92,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -179,7 +212,14 @@
|
||||
@@ -173,7 +206,14 @@
|
||||
entityareaeffectcloud.setColor(nbttagcompound.getInt("CustomPotionColor"));
|
||||
}
|
||||
|
||||
@@ -108,22 +108,24 @@
|
||||
}
|
||||
|
||||
public boolean isLingering() {
|
||||
@@ -191,10 +231,18 @@
|
||||
Block block = iblockdata.getBlock();
|
||||
@@ -184,11 +224,19 @@
|
||||
IBlockData iblockdata = this.world.getType(blockposition);
|
||||
|
||||
if (block == Blocks.FIRE) {
|
||||
- this.world.douseFire((EntityHuman) null, blockposition.shift(enumdirection), enumdirection.opposite());
|
||||
if (iblockdata.a((Tag) TagsBlock.FIRE)) {
|
||||
- this.world.a(blockposition, false);
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition.shift(enumdirection), Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ this.world.douseFire((EntityHuman) null, blockposition.shift(enumdirection), enumdirection.opposite());
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ this.world.a(blockposition, false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (block == Blocks.CAMPFIRE && (Boolean) iblockdata.get(BlockCampfire.b)) {
|
||||
} else if (BlockCampfire.g(iblockdata)) {
|
||||
- this.world.a((EntityHuman) null, 1009, blockposition, 0);
|
||||
- BlockCampfire.c((GeneratorAccess) this.world, blockposition, iblockdata);
|
||||
- this.world.setTypeUpdate(blockposition, (IBlockData) iblockdata.set(BlockCampfire.b, false));
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, iblockdata.set(BlockCampfire.b, false)).isCancelled()) { // PAIL rename LIT
|
||||
+ this.world.a((EntityHuman) null, 1009, blockposition, 0);
|
||||
+ BlockCampfire.c((GeneratorAccess) this.world, blockposition, iblockdata);
|
||||
+ this.world.setTypeUpdate(blockposition, (IBlockData) iblockdata.set(BlockCampfire.b, false));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
Reference in New Issue
Block a user