mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 20:46:59 +01:00
SPIGOT-2387: Magma does not provide a block for EntityDamageEvent.
This commit is contained in:
parent
3ae3ea08f2
commit
d5ecbd0e93
@ -21,13 +21,11 @@
|
|||||||
world.setTypeAndData(blockposition, iblockdata1, 4);
|
world.setTypeAndData(blockposition, iblockdata1, 4);
|
||||||
iblockdata1.doPhysics(world, blockposition1, this);
|
iblockdata1.doPhysics(world, blockposition1, this);
|
||||||
} else {
|
} else {
|
||||||
@@ -87,7 +90,9 @@
|
@@ -87,6 +90,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
|
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
|
||||||
+ CraftEventFactory.blockDamage = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); // CraftBukkit
|
+ CraftEventFactory.blockDamage = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); // CraftBukkit
|
||||||
entity.damageEntity(DamageSource.CACTUS, 1.0F);
|
entity.damageEntity(DamageSource.CACTUS, 1.0F);
|
||||||
+ CraftEventFactory.blockDamage = null; // CraftBukkit
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBlockData fromLegacyData(int i) {
|
|
||||||
|
10
nms-patches/BlockMagma.patch
Normal file
10
nms-patches/BlockMagma.patch
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
--- a/net/minecraft/server/BlockMagma.java
|
||||||
|
+++ b/net/minecraft/server/BlockMagma.java
|
||||||
|
@@ -17,6 +17,7 @@
|
||||||
|
|
||||||
|
public void stepOn(World world, BlockPosition blockposition, Entity entity) {
|
||||||
|
if (!entity.isFireProof() && entity instanceof EntityLiving && !EnchantmentManager.j((EntityLiving) entity)) {
|
||||||
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); // CraftBukkit
|
||||||
|
entity.damageEntity(DamageSource.HOT_FLOOR, 1.0F);
|
||||||
|
}
|
||||||
|
|
@ -483,8 +483,8 @@ public class CraftEventFactory {
|
|||||||
event.getEntity().setLastDamageCause(event);
|
event.getEntity().setLastDamageCause(event);
|
||||||
}
|
}
|
||||||
return event;
|
return event;
|
||||||
} else if (source == DamageSource.LAVA || source == DamageSource.HOT_FLOOR) {
|
} else if (source == DamageSource.LAVA) {
|
||||||
EntityDamageEvent event = callEvent(new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), (source == DamageSource.LAVA) ? DamageCause.LAVA : DamageCause.HOT_FLOOR, modifiers, modifierFunctions));
|
EntityDamageEvent event = callEvent(new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.LAVA, modifiers, modifierFunctions));
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
event.getEntity().setLastDamageCause(event);
|
event.getEntity().setLastDamageCause(event);
|
||||||
}
|
}
|
||||||
@ -495,6 +495,8 @@ public class CraftEventFactory {
|
|||||||
blockDamage = null;
|
blockDamage = null;
|
||||||
if (source == DamageSource.CACTUS) {
|
if (source == DamageSource.CACTUS) {
|
||||||
cause = DamageCause.CONTACT;
|
cause = DamageCause.CONTACT;
|
||||||
|
} else if (source == DamageSource.HOT_FLOOR) {
|
||||||
|
cause = DamageCause.HOT_FLOOR;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException(String.format("Unhandled damage of %s by %s from %s", entity, damager, source.translationIndex));
|
throw new IllegalStateException(String.format("Unhandled damage of %s by %s from %s", entity, damager, source.translationIndex));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user