Paper/nms-patches/BlockFireAbstract.patch

45 lines
2.1 KiB
Diff
Raw Normal View History

2020-06-25 02:00:00 +02:00
--- a/net/minecraft/server/BlockFireAbstract.java
+++ b/net/minecraft/server/BlockFireAbstract.java
@@ -41,7 +41,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.g);
@@ -53,9 +60,10 @@
@Override
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
if (!iblockdata1.a(iblockdata.getBlock())) {
- if (world.getDimensionKey() != World.OVERWORLD && world.getDimensionKey() != World.THE_NETHER || !BlockPortal.a((GeneratorAccess) world, blockposition)) {
+ // CraftBukkit - getTypeKey()
2020-07-01 06:17:48 +02:00
+ if (world.getTypeKey() != DimensionManager.OVERWORLD && world.getTypeKey() != DimensionManager.THE_NETHER || !BlockPortal.a((GeneratorAccess) world, blockposition)) {
2020-06-25 02:00:00 +02:00
if (!iblockdata.canPlace(world, blockposition)) {
- world.a(blockposition, false);
+ fireExtinguished(world, blockposition); // CraftBukkit - fuel block broke
}
}
@@ -92,4 +100,12 @@
return true;
}
+
+ // 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
}