Add Moving Piston API

This commit is contained in:
Owen1212055 2021-12-04 13:29:36 -05:00
parent 8c11cd85e3
commit 7c891287ed

View file

@ -4,7 +4,7 @@ import net.minecraft.world.level.block.piston.PistonMovingBlockEntity;
import org.bukkit.Location;
import org.bukkit.World;
public class CraftMovingPiston extends CraftBlockEntityState<PistonMovingBlockEntity> {
public class CraftMovingPiston extends CraftBlockEntityState<PistonMovingBlockEntity> implements io.papermc.paper.block.MovingPiston { // Paper - Add Moving Piston API
public CraftMovingPiston(World world, PistonMovingBlockEntity tileEntity) {
super(world, tileEntity);
@ -23,4 +23,26 @@ public class CraftMovingPiston extends CraftBlockEntityState<PistonMovingBlockEn
public CraftMovingPiston copy(Location location) {
return new CraftMovingPiston(this, location);
}
// Paper start - Add Moving Piston API
@Override
public org.bukkit.block.data.BlockData getMovingBlock() {
return org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(this.getTileEntity().getMovedState());
}
@Override
public org.bukkit.block.BlockFace getDirection() {
return org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(this.getTileEntity().getDirection());
}
@Override
public boolean isExtending() {
return this.getTileEntity().isExtending();
}
@Override
public boolean isPistonHead() {
return this.getTileEntity().isSourcePiston();
}
// Paper end - Add Moving Piston API
}