mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-04 06:31:35 +01:00
Update EntityChangeBlockEvent to new BlockData API
By: md_5 <git@md-5.net>
This commit is contained in:
parent
6826aaee8f
commit
e5c63f2b0c
@ -24,6 +24,7 @@ import org.bukkit.craftbukkit.CraftStatistic;
|
|||||||
import org.bukkit.craftbukkit.CraftWorld;
|
import org.bukkit.craftbukkit.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||||
|
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
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) {
|
public static EntityChangeBlockEvent callEntityChangeBlockEvent(Entity entity, BlockPosition position, IBlockData newBlock, boolean cancelled) {
|
||||||
Block block = entity.world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
|
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.setCancelled(cancelled);
|
||||||
event.getEntity().getServer().getPluginManager().callEvent(event);
|
event.getEntity().getServer().getPluginManager().callEvent(event);
|
||||||
return event;
|
return event;
|
||||||
|
Loading…
Reference in New Issue
Block a user