mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Add Moving Piston API
This commit is contained in:
parent
8c11cd85e3
commit
7c891287ed
@ -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 New Issue
Block a user