3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 04:20:08 +01:00

SPIGOT-2387: Magma does not provide a block for EntityDamageEvent.

Dieser Commit ist enthalten in:
md_5 2016-06-11 16:11:51 +10:00
Ursprung 3ae3ea08f2
Commit d5ecbd0e93
3 geänderte Dateien mit 15 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -21,13 +21,11 @@
world.setTypeAndData(blockposition, iblockdata1, 4);
iblockdata1.doPhysics(world, blockposition1, this);
} else {
@@ -87,7 +90,9 @@
@@ -87,6 +90,7 @@
}
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
+ CraftEventFactory.blockDamage = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); // CraftBukkit
entity.damageEntity(DamageSource.CACTUS, 1.0F);
+ CraftEventFactory.blockDamage = null; // CraftBukkit
}
public IBlockData fromLegacyData(int i) {

10
nms-patches/BlockMagma.patch Normale Datei
Datei anzeigen

@ -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);
}

Datei anzeigen

@ -483,8 +483,8 @@ public class CraftEventFactory {
event.getEntity().setLastDamageCause(event);
}
return event;
} else if (source == DamageSource.LAVA || source == DamageSource.HOT_FLOOR) {
EntityDamageEvent event = callEvent(new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), (source == DamageSource.LAVA) ? DamageCause.LAVA : DamageCause.HOT_FLOOR, modifiers, modifierFunctions));
} else if (source == DamageSource.LAVA) {
EntityDamageEvent event = callEvent(new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.LAVA, modifiers, modifierFunctions));
if (!event.isCancelled()) {
event.getEntity().setLastDamageCause(event);
}
@ -495,6 +495,8 @@ public class CraftEventFactory {
blockDamage = null;
if (source == DamageSource.CACTUS) {
cause = DamageCause.CONTACT;
} else if (source == DamageSource.HOT_FLOOR) {
cause = DamageCause.HOT_FLOOR;
} else {
throw new IllegalStateException(String.format("Unhandled damage of %s by %s from %s", entity, damager, source.translationIndex));
}