SPIGOT-5731: PortalCreateEvent#getEntity returns null for nether portals ignited by flint and steel

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-07-28 08:54:10 +10:00
parent 1a0dce328a
commit 8317d4c799
4 changed files with 80 additions and 17 deletions

View File

@@ -1,6 +1,17 @@
--- a/net/minecraft/world/level/block/BlockFireAbstract.java
+++ b/net/minecraft/world/level/block/BlockFireAbstract.java
@@ -127,7 +127,14 @@
@@ -19,6 +19,10 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
+// CraftBukkit start
+import net.minecraft.world.item.context.ItemActionContext;
+// CraftBukkit end
+
public abstract class BlockFireAbstract extends Block {
private static final int SECONDS_ON_FIRE = 8;
@@ -127,7 +131,14 @@
if (!entity.fireImmune()) {
entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1);
if (entity.getRemainingFireTicks() == 0) {
@@ -16,7 +27,21 @@
}
}
@@ -148,14 +155,14 @@
@@ -136,26 +147,26 @@
}
@Override
- protected void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
+ protected void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag, ItemActionContext context) { // CraftBukkit - context
if (!iblockdata1.is(iblockdata.getBlock())) {
if (inPortalDimension(world)) {
Optional<BlockPortalShape> optional = BlockPortalShape.findEmptyPortalShape(world, blockposition, EnumDirection.EnumAxis.X);
if (optional.isPresent()) {
- ((BlockPortalShape) optional.get()).createPortalBlocks();
+ ((BlockPortalShape) optional.get()).createPortalBlocks((context == null) ? null : context.getPlayer()); // CraftBukkit - player
return;
}
}
if (!iblockdata.canSurvive(world, blockposition)) {
@@ -33,7 +58,7 @@
}
@Override
@@ -203,4 +210,12 @@
@@ -203,4 +214,12 @@
}
}
}