mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-09 20:30:28 +01:00
Update EntityChangeBlockEvent to new BlockData API
This commit is contained in:
parent
49ac8a7446
commit
ca1af9368b
@ -24,6 +24,7 @@ import org.bukkit.craftbukkit.CraftStatistic;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
@ -704,9 +705,8 @@ public class CraftEventFactory {
|
||||
|
||||
public static EntityChangeBlockEvent callEntityChangeBlockEvent(Entity entity, BlockPosition position, IBlockData newBlock, boolean cancelled) {
|
||||
Block block = entity.world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
|
||||
Material material = CraftMagicNumbers.getMaterial(newBlock).getItemType();
|
||||
|
||||
EntityChangeBlockEvent event = new EntityChangeBlockEvent(entity.getBukkitEntity(), block, material, (byte) 0);
|
||||
EntityChangeBlockEvent event = new EntityChangeBlockEvent(entity.getBukkitEntity(), block, CraftBlockData.fromData(newBlock));
|
||||
event.setCancelled(cancelled);
|
||||
event.getEntity().getServer().getPluginManager().callEvent(event);
|
||||
return event;
|
||||
|
Loading…
Reference in New Issue
Block a user