mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
0437aeebb7
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing CraftBukkit Changes: 3797d93e3 SPIGOT-6492: PortalCreateEvent#getBlocks() returns not all blocks by reason fire
135 lines
8.3 KiB
Diff
135 lines
8.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Mariell Hoversholm <proximyst@proximyst.com>
|
|
Date: Fri, 21 Aug 2020 20:57:54 +0200
|
|
Subject: [PATCH] PortalCreateEvent needs to know its entity
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
@@ -0,0 +0,0 @@ public final class ItemStack {
|
|
IBlockData block = world.getType(newblockposition);
|
|
|
|
if (!(block.getBlock() instanceof BlockTileEntity)) { // Containers get placed automatically
|
|
- block.getBlock().onPlace(block, world, newblockposition, oldBlock, true);
|
|
+ block.getBlock().onPlace(block, world, newblockposition, oldBlock, true, itemactioncontext); // Paper - pass itemactioncontext
|
|
}
|
|
|
|
world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getType(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockFire.java b/src/main/java/net/minecraft/world/level/block/BlockFire.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockFire.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockFire.java
|
|
@@ -0,0 +0,0 @@ import net.minecraft.core.EnumDirection;
|
|
import net.minecraft.server.MCUtil;
|
|
import net.minecraft.server.level.WorldServer;
|
|
import net.minecraft.world.item.context.BlockActionContext;
|
|
+import net.minecraft.world.item.context.ItemActionContext;
|
|
import net.minecraft.world.level.GameRules;
|
|
import net.minecraft.world.level.GeneratorAccess;
|
|
import net.minecraft.world.level.IBlockAccess;
|
|
@@ -0,0 +0,0 @@ public class BlockFire extends BlockFireAbstract {
|
|
}
|
|
|
|
@Override
|
|
- public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
|
|
- super.onPlace(iblockdata, world, blockposition, iblockdata1, flag);
|
|
+ // Paper start - ItemActionContext param
|
|
+ public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag, ItemActionContext itemActionContext) {
|
|
+ super.onPlace(iblockdata, world, blockposition, iblockdata1, flag, itemActionContext);
|
|
+ // Paper end
|
|
world.getBlockTickList().a(blockposition, this, a(world.random));
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockFireAbstract.java b/src/main/java/net/minecraft/world/level/block/BlockFireAbstract.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockFireAbstract.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockFireAbstract.java
|
|
@@ -0,0 +0,0 @@ import net.minecraft.world.damagesource.DamageSource;
|
|
import net.minecraft.world.entity.Entity;
|
|
import net.minecraft.world.entity.player.EntityHuman;
|
|
import net.minecraft.world.item.context.BlockActionContext;
|
|
+import net.minecraft.world.item.context.ItemActionContext;
|
|
import net.minecraft.world.level.GeneratorAccess;
|
|
import net.minecraft.world.level.IBlockAccess;
|
|
import net.minecraft.world.level.World;
|
|
@@ -0,0 +0,0 @@ public abstract class BlockFireAbstract extends Block {
|
|
super.a(iblockdata, world, blockposition, entity);
|
|
}
|
|
|
|
+ // Paper start - ItemActionContext param
|
|
+ @Override public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) { this.onPlace(iblockdata, world, blockposition, iblockdata1, flag, null); }
|
|
@Override
|
|
- public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
|
|
+ public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag, ItemActionContext itemActionContext) {
|
|
+ // Paper end
|
|
if (!iblockdata1.a(iblockdata.getBlock())) {
|
|
if (a(world)) {
|
|
Optional<BlockPortalShape> optional = BlockPortalShape.a((GeneratorAccess) world, blockposition, EnumDirection.EnumAxis.X);
|
|
|
|
if (optional.isPresent()) {
|
|
- ((BlockPortalShape) optional.get()).createPortal();
|
|
+ ((BlockPortalShape) optional.get()).createPortal(itemActionContext); // Paper - pass ItemActionContext param
|
|
return;
|
|
}
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
|
|
@@ -0,0 +0,0 @@ import net.minecraft.world.item.EnumColor;
|
|
import net.minecraft.world.item.Item;
|
|
import net.minecraft.world.item.ItemStack;
|
|
import net.minecraft.world.item.context.BlockActionContext;
|
|
+import net.minecraft.world.item.context.ItemActionContext;
|
|
import net.minecraft.world.level.BlockAccessAir;
|
|
import net.minecraft.world.level.GeneratorAccess;
|
|
import net.minecraft.world.level.IBlockAccess;
|
|
@@ -0,0 +0,0 @@ public abstract class BlockBase {
|
|
PacketDebug.a(world, blockposition);
|
|
}
|
|
|
|
+ // Paper start - add ItemActionContext param
|
|
+ @Deprecated
|
|
+ public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag, ItemActionContext itemActionContext) {
|
|
+ this.onPlace(iblockdata, world, blockposition, iblockdata1, flag);
|
|
+ }
|
|
+ // Paper end
|
|
@Deprecated
|
|
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
|
|
org.spigotmc.AsyncCatcher.catchOp("block onPlace"); // Spigot
|
|
diff --git a/src/main/java/net/minecraft/world/level/portal/BlockPortalShape.java b/src/main/java/net/minecraft/world/level/portal/BlockPortalShape.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/portal/BlockPortalShape.java
|
|
+++ b/src/main/java/net/minecraft/world/level/portal/BlockPortalShape.java
|
|
@@ -0,0 +0,0 @@ import net.minecraft.tags.Tag;
|
|
import net.minecraft.tags.TagsBlock;
|
|
import net.minecraft.util.MathHelper;
|
|
import net.minecraft.world.entity.EntitySize;
|
|
+import net.minecraft.world.item.context.ItemActionContext;
|
|
import net.minecraft.world.level.GeneratorAccess;
|
|
import net.minecraft.world.level.block.BlockPortal;
|
|
import net.minecraft.world.level.block.Blocks;
|
|
@@ -0,0 +0,0 @@ public class BlockPortalShape {
|
|
}
|
|
|
|
// CraftBukkit start - return boolean
|
|
- public boolean createPortal() {
|
|
+ // Paper start - ItemActionContext param
|
|
+ @Deprecated public boolean createPortal() { return this.createPortal(null); }
|
|
+ public boolean createPortal(ItemActionContext itemActionContext) {
|
|
+ // Paper end
|
|
org.bukkit.World bworld = this.b.getMinecraftWorld().getWorld();
|
|
|
|
// Copy below for loop
|
|
@@ -0,0 +0,0 @@ public class BlockPortalShape {
|
|
BlockPosition.a(this.position, this.position.shift(EnumDirection.UP, this.height - 1).shift(this.d, this.width - 1)).forEach((blockposition) -> {
|
|
blocks.setTypeAndData(blockposition, iblockdata, 18);
|
|
});
|
|
-
|
|
- PortalCreateEvent event = new PortalCreateEvent((java.util.List<org.bukkit.block.BlockState>) (java.util.List) blocks.getList(), bworld, null, PortalCreateEvent.CreateReason.FIRE);
|
|
+ PortalCreateEvent event = new PortalCreateEvent((java.util.List<org.bukkit.block.BlockState>) (java.util.List) blocks.getList(), bworld, itemActionContext == null || itemActionContext.getEntity() == null ? null : itemActionContext.getEntity().getBukkitEntity(), PortalCreateEvent.CreateReason.FIRE); // Paper - pass entity param
|
|
this.b.getMinecraftWorld().getMinecraftServer().server.getPluginManager().callEvent(event);
|
|
|
|
if (event.isCancelled()) {
|