mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Add Moving Piston API
This commit is contained in:
parent
8c11cd85e3
commit
7c891287ed
1 changed files with 23 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue