mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-07 08:47:35 +01:00
[BREAKING] EntityChangeBlockEvent can be non-living. Adds BUKKIT-3078
Non-living entities can change blocks, specifically falling blocks. This change is a small source break, but mainly a byte-code break (requires plugins to recompile). By: Wesley Wolfe <weswolf@aol.com>
This commit is contained in:
parent
89d79e64db
commit
f545b84e46
@ -12,6 +12,11 @@ import org.bukkit.entity.LivingEntity;
|
||||
*/
|
||||
public class EntityBreakDoorEvent extends EntityChangeBlockEvent {
|
||||
public EntityBreakDoorEvent(final LivingEntity entity, final Block targetBlock) {
|
||||
super(entity, targetBlock, Material.AIR);
|
||||
super(entity, targetBlock, Material.AIR, (byte) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LivingEntity getEntity() {
|
||||
return (LivingEntity) entity;
|
||||
}
|
||||
}
|
||||
|
@ -2,14 +2,13 @@ package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a LivingEntity changes a block
|
||||
*
|
||||
* This event specifically excludes player entities
|
||||
* Called when any Entity, excluding players, changes a block.
|
||||
*/
|
||||
public class EntityChangeBlockEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@ -18,11 +17,26 @@ public class EntityChangeBlockEvent extends EntityEvent implements Cancellable {
|
||||
private final Material to;
|
||||
private final byte data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param what the LivingEntity causing the change
|
||||
* @param block the block (before the change)
|
||||
* @param to the future material being changed to
|
||||
* @deprecated Provided as a backward compatibility before the data byte was provided, and type increased to all entities
|
||||
*/
|
||||
@Deprecated
|
||||
public EntityChangeBlockEvent(final LivingEntity what, final Block block, final Material to) {
|
||||
this (what, block, to, (byte) 0);
|
||||
}
|
||||
|
||||
public EntityChangeBlockEvent(final LivingEntity what, final Block block, final Material to, final byte data) {
|
||||
/**
|
||||
*
|
||||
* @param what the Entity causing the change
|
||||
* @param block the block (before the change)
|
||||
* @param to the future material being changed to
|
||||
* @param data the future block data
|
||||
*/
|
||||
public EntityChangeBlockEvent(final Entity what, final Block block, final Material to, final byte data) {
|
||||
super(what);
|
||||
this.block = block;
|
||||
this.cancel = false;
|
||||
@ -30,11 +44,6 @@ public class EntityChangeBlockEvent extends EntityEvent implements Cancellable {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LivingEntity getEntity() {
|
||||
return (LivingEntity) entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the block the entity is changing
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user