13
0
geforkt von Mirrors/Paper
Paper/paper-server/nms-patches/BlockFireAbstract.patch

62 Zeilen
2.4 KiB
Diff

--- a/net/minecraft/server/BlockFireAbstract.java
+++ b/net/minecraft/server/BlockFireAbstract.java
@@ -36,7 +36,14 @@
if (!entity.isFireProof()) {
entity.setFireTicks(entity.getFireTicks() + 1);
if (entity.getFireTicks() == 0) {
- entity.setOnFire(8);
+ // CraftBukkit start
+ org.bukkit.event.entity.EntityCombustEvent event = new org.bukkit.event.entity.EntityCombustByBlockEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition), entity.getBukkitEntity(), 8);
+ world.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ entity.setOnFire(event.getDuration(), false);
+ }
+ // CraftBukkit end
}
entity.damageEntity(DamageSource.FIRE, this.b);
@@ -58,14 +65,14 @@
}
if (!iblockdata.canPlace(world, blockposition)) {
- world.a(blockposition, false);
+ fireExtinguished(world, blockposition); // CraftBukkit - fuel block broke
}
}
}
private static boolean a(World world) {
- return world.getDimensionKey() == World.OVERWORLD || world.getDimensionKey() == World.THE_NETHER;
+ return world.getTypeKey() == DimensionManager.OVERWORLD || world.getTypeKey() == DimensionManager.THE_NETHER; // CraftBukkit - getTypeKey()
}
@Override
@@ -83,6 +90,12 @@
}
private static boolean b(World world, BlockPosition blockposition, EnumDirection enumdirection) {
+ // CraftBukkit start - SPIGOT-6311: Do not calculate portals for up/down directions
+ if (enumdirection == EnumDirection.UP || enumdirection == EnumDirection.DOWN) {
+ return false;
+ }
+ // CraftBukkit end
+
if (!a(world)) {
return false;
} else {
@@ -103,4 +116,12 @@
return flag && BlockPortalShape.a((GeneratorAccess) world, blockposition, enumdirection.h().n()).isPresent();
}
}
+
+ // CraftBukkit start
+ protected void fireExtinguished(GeneratorAccess world, BlockPosition position) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, position, Blocks.AIR.getBlockData()).isCancelled()) {
+ world.a(position, false);
+ }
+ }
+ // CraftBukkit end
}