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

项目:LuckyBlocksBukkit    文件:LuckyBlocksActionController.java   
public void MagicChest(BlockBreakEvent event){
    Location loc = event.getBlock().getLocation();
    World world = loc.getWorld();
    event.setCancelled(true);
    Block block = event.getBlock();
    block.setType(Material.CHEST);
    DirectionalContainer chestData = (DirectionalContainer) block.getState().getData();
    BlockFace directionInfo = new LuckyBlocksInvokeMethodClass().getCardinalDirection(event.getPlayer());
    chestData.setFacingDirection(directionInfo);
    //Next Line makes use of a Deprecated Method
    block.setData(chestData.getData(),true);
    Chest chest = (Chest) block.getState();
    world.playEffect(loc,Effect.ENDER_SIGNAL,50);
    int RandomSelection = (int) (Math.random()*100);
    if (RandomSelection < 50) {
        ItemStack goldenApples = new ItemStack(Material.GOLDEN_APPLE);
        goldenApples.setAmount(5);
        chest.getInventory().addItem(goldenApples);
    }
    else if (RandomSelection >= 50) isUnluckyChestActivated = 1;

}
项目:LuckyBlocksBukkit    文件:LuckyBlocksActionController.java   
public void MagicChest(BlockBreakEvent event){
    Location loc = event.getBlock().getLocation();
    World world = loc.getWorld();
    event.setCancelled(true);
    Block block = event.getBlock();
    block.setType(Material.CHEST);
    DirectionalContainer chestData = (DirectionalContainer) block.getState().getData();
    BlockFace directionInfo = new LuckyBlocksInvokeMethodClass().getCardinalDirection(event.getPlayer());
    chestData.setFacingDirection(directionInfo);
    //Next Line makes use of a Deprecated Method
    block.setData(chestData.getData(),true);
    Chest chest = (Chest) block.getState();
    world.playEffect(loc,Effect.ENDER_SIGNAL,50);
    int RandomSelection = (int) (Math.random()*100);
    if (RandomSelection < 50) {
        ItemStack goldenApples = new ItemStack(Material.GOLDEN_APPLE);
        goldenApples.setAmount(5);
        chest.getInventory().addItem(goldenApples);
    }
    else if (RandomSelection >= 50) isUnluckyChestActivated = 1;

}
项目:BedrockAPI    文件:DirectionalContainer.java   
@Deprecated public DirectionalContainer(int type) {
}
项目:BedrockAPI    文件:DirectionalContainer.java   
public DirectionalContainer() {
    // TODO
}
项目:BedrockAPI    文件:DirectionalContainer.java   
public DirectionalContainer(Material type) {
}
项目:BedrockAPI    文件:DirectionalContainer.java   
@Deprecated public DirectionalContainer(int type, byte data) {
}
项目:BedrockAPI    文件:DirectionalContainer.java   
@Deprecated public DirectionalContainer(Material type, byte data) {
}
项目:BedrockAPI    文件:DirectionalContainer.java   
public DirectionalContainer clone() {
    return null;
}