Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
SPIGOT-5566: Doused campfires & fires should call EntityChangeBlockEvent
Dieser Commit ist enthalten in:
Ursprung
41712eddeb
Commit
a1a705ee9a
@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/server/EntityPotion.java
|
--- a/net/minecraft/server/EntityPotion.java
|
||||||
+++ b/net/minecraft/server/EntityPotion.java
|
+++ b/net/minecraft/server/EntityPotion.java
|
||||||
@@ -6,6 +6,12 @@
|
@@ -6,6 +6,13 @@
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@ -8,12 +8,13 @@
|
|||||||
+import java.util.HashMap;
|
+import java.util.HashMap;
|
||||||
+import java.util.Map;
|
+import java.util.Map;
|
||||||
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||||
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||||
+import org.bukkit.entity.LivingEntity;
|
+import org.bukkit.entity.LivingEntity;
|
||||||
+// CraftBukkit end
|
+// CraftBukkit end
|
||||||
|
|
||||||
public class EntityPotion extends EntityProjectile {
|
public class EntityPotion extends EntityProjectile {
|
||||||
|
|
||||||
@@ -79,7 +85,7 @@
|
@@ -79,7 +86,7 @@
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
this.splash();
|
this.splash();
|
||||||
@ -22,7 +23,7 @@
|
|||||||
if (this.isLingering()) {
|
if (this.isLingering()) {
|
||||||
this.a(itemstack, potionregistry);
|
this.a(itemstack, potionregistry);
|
||||||
} else {
|
} else {
|
||||||
@@ -116,6 +122,7 @@
|
@@ -116,6 +123,7 @@
|
||||||
private void a(List<MobEffect> list, @Nullable Entity entity) {
|
private void a(List<MobEffect> list, @Nullable Entity entity) {
|
||||||
AxisAlignedBB axisalignedbb = this.getBoundingBox().grow(4.0D, 2.0D, 4.0D);
|
AxisAlignedBB axisalignedbb = this.getBoundingBox().grow(4.0D, 2.0D, 4.0D);
|
||||||
List<EntityLiving> list1 = this.world.a(EntityLiving.class, axisalignedbb);
|
List<EntityLiving> list1 = this.world.a(EntityLiving.class, axisalignedbb);
|
||||||
@ -30,7 +31,7 @@
|
|||||||
|
|
||||||
if (!list1.isEmpty()) {
|
if (!list1.isEmpty()) {
|
||||||
Iterator iterator = list1.iterator();
|
Iterator iterator = list1.iterator();
|
||||||
@@ -133,21 +140,46 @@
|
@@ -133,21 +141,46 @@
|
||||||
d1 = 1.0D;
|
d1 = 1.0D;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,20 +49,7 @@
|
|||||||
+ if (!(victim instanceof CraftLivingEntity)) {
|
+ if (!(victim instanceof CraftLivingEntity)) {
|
||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
- 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()));
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
+ EntityLiving entityliving = ((CraftLivingEntity) victim).getHandle();
|
+ EntityLiving entityliving = ((CraftLivingEntity) victim).getHandle();
|
||||||
+ double d1 = event.getIntensity(victim);
|
+ double d1 = event.getIntensity(victim);
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
@ -80,7 +68,20 @@
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // 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()) {
|
+ if (mobeffectlist.isInstant()) {
|
||||||
+ mobeffectlist.applyInstantEffect(this, this.getShooter(), entityliving, mobeffect.getAmplifier(), d1);
|
+ mobeffectlist.applyInstantEffect(this, this.getShooter(), entityliving, mobeffect.getAmplifier(), d1);
|
||||||
+ } else {
|
+ } else {
|
||||||
@ -91,7 +92,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -179,7 +211,14 @@
|
@@ -179,7 +212,14 @@
|
||||||
entityareaeffectcloud.setColor(nbttagcompound.getInt("CustomPotionColor"));
|
entityareaeffectcloud.setColor(nbttagcompound.getInt("CustomPotionColor"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,3 +108,25 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLingering() {
|
public boolean isLingering() {
|
||||||
|
@@ -191,10 +231,18 @@
|
||||||
|
Block block = iblockdata.getBlock();
|
||||||
|
|
||||||
|
if (block == Blocks.FIRE) {
|
||||||
|
- this.world.douseFire((EntityHuman) null, blockposition.shift(enumdirection), enumdirection.opposite());
|
||||||
|
+ // CraftBukkit start
|
||||||
|
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition.shift(enumdirection), Blocks.AIR.getBlockData()).isCancelled()) {
|
||||||
|
+ this.world.douseFire((EntityHuman) null, blockposition.shift(enumdirection), enumdirection.opposite());
|
||||||
|
+ }
|
||||||
|
+ // CraftBukkit end
|
||||||
|
} else if (block == Blocks.CAMPFIRE && (Boolean) iblockdata.get(BlockCampfire.b)) {
|
||||||
|
- this.world.a((EntityHuman) null, 1009, blockposition, 0);
|
||||||
|
- 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);
|
||||||
|
+ this.world.setTypeUpdate(blockposition, (IBlockData) iblockdata.set(BlockCampfire.b, false));
|
||||||
|
+ }
|
||||||
|
+ // CraftBukkit end
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren