Java 类org.bukkit.material.PistonBaseMaterial 实例源码

项目:MachineFactory    文件:OreGinListener.java   
/**
 * Stop Piston from pulling an OreGin or it's light
 */
@EventHandler
public void oreGinPistonPull(BlockPistonRetractEvent event)
{
    MaterialData materialData = event.getBlock().getState().getData();
    BlockFace blockFace;
    Block movedBlock;

    if (materialData instanceof PistonBaseMaterial) 
    {
        blockFace = ((PistonBaseMaterial) materialData).getFacing();
        movedBlock = event.getBlock().getRelative(blockFace, 2);

        if (event.isSticky() && movedBlock != null)
        {
            if (oreGinMan.machineExistsAt(movedBlock.getLocation())
                    || oreGinMan.oreGinLightExistsAt(movedBlock.getLocation()))
            {
                event.setCancelled(true);
            }
        }
    }
}
项目:Skellett    文件:ExprPistonPower.java   
@Override
@Nullable
protected Boolean[] get(Event e) {
    MaterialData piston = block.getSingle(e).getState().getData();
    if (piston instanceof PistonBaseMaterial) {
        return new Boolean[]{((PistonBaseMaterial)piston).isPowered()};
    }
    return null;
}
项目:Skellett    文件:ExprPistonPower.java   
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
    if (mode == ChangeMode.SET) {
        BlockState state = block.getSingle(e).getState();
        MaterialData piston = state.getData();
        if (piston instanceof PistonBaseMaterial) {
            ((PistonBaseMaterial)piston).setPowered((Boolean)delta[0]);
            state.setData(piston);
            state.update(true, false);
            Bukkit.getLogger().info(((PistonBaseMaterial)piston).isPowered() + " TEST1");
            Bukkit.getLogger().info(((PistonBaseMaterial)block.getSingle(e).getState().getData()).isPowered() + " TEST2");
        }
    }
}
项目:Skellett    文件:CondIsSticky.java   
public boolean check(Event e) {
    MaterialData piston = block.getSingle(e).getState().getData();
    if (!(piston instanceof PistonBaseMaterial)) {
        return false;
    }
    if (((PistonBaseMaterial)piston).isSticky()) {
        return isNegated();
    } else {
        return !isNegated();
    }
}
项目:BedrockAPI    文件:PistonBaseMaterial.java   
@Deprecated public PistonBaseMaterial(int type) {
}
项目:BedrockAPI    文件:PistonBaseMaterial.java   
public PistonBaseMaterial(Material type) {
}
项目:BedrockAPI    文件:PistonBaseMaterial.java   
@Deprecated public PistonBaseMaterial(int type, byte data) {
}
项目:BedrockAPI    文件:PistonBaseMaterial.java   
@Deprecated public PistonBaseMaterial(Material type, byte data) {
}
项目:BedrockAPI    文件:PistonBaseMaterial.java   
public PistonBaseMaterial clone() {
    return null;
}