当前位置: 首页>>代码示例>>Java>>正文


Java CraftBlock.notchToBlockFace方法代码示例

本文整理汇总了Java中org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace方法的典型用法代码示例。如果您正苦于以下问题:Java CraftBlock.notchToBlockFace方法的具体用法?Java CraftBlock.notchToBlockFace怎么用?Java CraftBlock.notchToBlockFace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.craftbukkit.block.CraftBlock的用法示例。


在下文中一共展示了CraftBlock.notchToBlockFace方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPlayerBucketEvent

import org.bukkit.craftbukkit.block.CraftBlock; //导入方法依赖的package包/类
private static PlayerEvent getPlayerBucketEvent(boolean isFilling, EntityHuman who, int clickedX, int clickedY, int clickedZ, int clickedFace, ItemStack itemstack, net.minecraft.server.Item item) {
    Player player = (who == null) ? null : (Player) who.getBukkitEntity();
    CraftItemStack itemInHand = CraftItemStack.asNewCraftStack(item);
    Material bucket = CraftMagicNumbers.getMaterial(itemstack.getItem());

    CraftWorld craftWorld = (CraftWorld) player.getWorld();
    CraftServer craftServer = (CraftServer) player.getServer();

    Block blockClicked = craftWorld.getBlockAt(clickedX, clickedY, clickedZ);
    BlockFace blockFace = CraftBlock.notchToBlockFace(clickedFace);

    PlayerEvent event = null;
    if (isFilling) {
        event = new PlayerBucketFillEvent(player, blockClicked, blockFace, bucket, itemInHand);
        ((PlayerBucketFillEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
    } else {
        event = new PlayerBucketEmptyEvent(player, blockClicked, blockFace, bucket, itemInHand);
        ((PlayerBucketEmptyEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
    }

    craftServer.getPluginManager().callEvent(event);

    return event;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:25,代码来源:CraftEventFactory.java

示例2: getPlayerBucketEvent

import org.bukkit.craftbukkit.block.CraftBlock; //导入方法依赖的package包/类
private static PlayerEvent getPlayerBucketEvent(boolean isFilling, EntityHuman who, int clickedX, int clickedY, int clickedZ, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.server.Item item) {
    Player player = (who == null) ? null : (Player) who.getBukkitEntity();
    CraftItemStack itemInHand = CraftItemStack.asNewCraftStack(item);
    Material bucket = CraftMagicNumbers.getMaterial(itemstack.getItem());

    CraftWorld craftWorld = (CraftWorld) player.getWorld();
    CraftServer craftServer = (CraftServer) player.getServer();

    Block blockClicked = craftWorld.getBlockAt(clickedX, clickedY, clickedZ);
    BlockFace blockFace = CraftBlock.notchToBlockFace(clickedFace);

    PlayerEvent event = null;
    if (isFilling) {
        event = new PlayerBucketFillEvent(player, blockClicked, blockFace, bucket, itemInHand);
        ((PlayerBucketFillEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
    } else {
        event = new PlayerBucketEmptyEvent(player, blockClicked, blockFace, bucket, itemInHand);
        ((PlayerBucketEmptyEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
    }

    craftServer.getPluginManager().callEvent(event);

    return event;
}
 
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:25,代码来源:CraftEventFactory.java

示例3: getPlayerBucketEvent

import org.bukkit.craftbukkit.block.CraftBlock; //导入方法依赖的package包/类
private static PlayerEvent getPlayerBucketEvent(boolean isFilling, EntityHuman who, int clickedX, int clickedY, int clickedZ, int clickedFace, ItemStack itemstack, net.minecraft.server.Item item) {
    Player player = (who == null) ? null : (Player) who.getBukkitEntity();
    CraftItemStack itemInHand = CraftItemStack.asNewCraftStack(item);
    Material bucket = Material.getMaterial(itemstack.id);

    CraftWorld craftWorld = (CraftWorld) player.getWorld();
    CraftServer craftServer = (CraftServer) player.getServer();

    Block blockClicked = craftWorld.getBlockAt(clickedX, clickedY, clickedZ);
    BlockFace blockFace = CraftBlock.notchToBlockFace(clickedFace);

    PlayerEvent event = null;
    if (isFilling) {
        event = new PlayerBucketFillEvent(player, blockClicked, blockFace, bucket, itemInHand);
        ((PlayerBucketFillEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
    } else {
        event = new PlayerBucketEmptyEvent(player, blockClicked, blockFace, bucket, itemInHand);
        ((PlayerBucketEmptyEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
    }

    craftServer.getPluginManager().callEvent(event);

    return event;
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:25,代码来源:CraftEventFactory.java

示例4: e

import org.bukkit.craftbukkit.block.CraftBlock; //导入方法依赖的package包/类
private void e(World world, BlockPosition blockposition, IBlockData iblockdata) {
    EnumDirection enumdirection = (EnumDirection) iblockdata.get(BlockPiston.FACING);
    boolean flag = this.a(world, blockposition, enumdirection);

    if (flag && !((Boolean) iblockdata.get(BlockPiston.EXTENDED)).booleanValue()) {
        if ((new PistonExtendsChecker(world, blockposition, enumdirection, true)).a()) {
            world.playBlockAction(blockposition, this, 0, enumdirection.a());
        }
    } else if (!flag && ((Boolean) iblockdata.get(BlockPiston.EXTENDED)).booleanValue()) {
        // CraftBukkit start
        if (!this.sticky) {
            org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
            BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, ImmutableList.<org.bukkit.block.Block>of(), CraftBlock.notchToBlockFace(enumdirection));
            world.getServer().getPluginManager().callEvent(event);

            if (event.isCancelled()) {
                return;
            }
        }
        // PAIL: checkME - what happened to setTypeAndData?
        // CraftBukkit end
        world.playBlockAction(blockposition, this, 1, enumdirection.a());
    }

}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:26,代码来源:BlockPiston.java

示例5: callPlayerInteractEvent

import org.bukkit.craftbukkit.block.CraftBlock; //导入方法依赖的package包/类
public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, int clickedX, int clickedY, int clickedZ, int clickedFace, ItemStack itemstack) {
    Player player = (who == null) ? null : (Player) who.getBukkitEntity();
    CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack);

    CraftWorld craftWorld = (CraftWorld) player.getWorld();
    CraftServer craftServer = (CraftServer) player.getServer();

    Block blockClicked = craftWorld.getBlockAt(clickedX, clickedY, clickedZ);
    BlockFace blockFace = CraftBlock.notchToBlockFace(clickedFace);

    if (clickedY > 255) {
        blockClicked = null;
        switch (action) {
        case LEFT_CLICK_BLOCK:
            action = Action.LEFT_CLICK_AIR;
            break;
        case RIGHT_CLICK_BLOCK:
            action = Action.RIGHT_CLICK_AIR;
            break;
        }
    }

    if (itemInHand.getType() == Material.AIR || itemInHand.getAmount() == 0) {
        itemInHand = null;
    }

    PlayerInteractEvent event = new PlayerInteractEvent(player, action, itemInHand, blockClicked, blockFace);
    craftServer.getPluginManager().callEvent(event);

    return event;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:32,代码来源:CraftEventFactory.java

示例6: callPlayerInteractEvent

import org.bukkit.craftbukkit.block.CraftBlock; //导入方法依赖的package包/类
public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, BlockPosition position, EnumDirection direction, ItemStack itemstack, boolean cancelledBlock) {
    Player player = (who == null) ? null : (Player) who.getBukkitEntity();
    CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack);

    CraftWorld craftWorld = (CraftWorld) player.getWorld();
    CraftServer craftServer = (CraftServer) player.getServer();

    Block blockClicked = craftWorld.getBlockAt(position.getX(), position.getY(), position.getZ());
    BlockFace blockFace = CraftBlock.notchToBlockFace(direction);

    if (position.getY() > 255) {
        blockClicked = null;
        switch (action) {
        case LEFT_CLICK_BLOCK:
            action = Action.LEFT_CLICK_AIR;
            break;
        case RIGHT_CLICK_BLOCK:
            action = Action.RIGHT_CLICK_AIR;
            break;
        }
    }

    if (itemInHand.getType() == Material.AIR || itemInHand.getAmount() == 0) {
        itemInHand = null;
    }

    PlayerInteractEvent event = new PlayerInteractEvent(player, action, itemInHand, blockClicked, blockFace);
    if (cancelledBlock) {
        event.setUseInteractedBlock(Event.Result.DENY);
    }
    craftServer.getPluginManager().callEvent(event);

    return event;
}
 
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:35,代码来源:CraftEventFactory.java

示例7: callPlayerInteractEvent

import org.bukkit.craftbukkit.block.CraftBlock; //导入方法依赖的package包/类
public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, BlockPosition position, EnumDirection direction, ItemStack itemstack, boolean cancelledBlock, EnumHand hand) {
    Player player = (who == null) ? null : (Player) who.getBukkitEntity();
    CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack);

    CraftWorld craftWorld = (CraftWorld) player.getWorld();
    CraftServer craftServer = (CraftServer) player.getServer();

    Block blockClicked = craftWorld.getBlockAt(position.getX(), position.getY(), position.getZ());
    BlockFace blockFace = CraftBlock.notchToBlockFace(direction);

    if (position.getY() > 255) {
        blockClicked = null;
        switch (action) {
        case LEFT_CLICK_BLOCK:
            action = Action.LEFT_CLICK_AIR;
            break;
        case RIGHT_CLICK_BLOCK:
            action = Action.RIGHT_CLICK_AIR;
            break;
        }
    }

    if (itemInHand.getType() == Material.AIR || itemInHand.getAmount() == 0) {
        itemInHand = null;
    }

    PlayerInteractEvent event = new PlayerInteractEvent(player, action, itemInHand, blockClicked, blockFace, (hand == null) ? null : ((hand == EnumHand.OFF_HAND) ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND));
    if (cancelledBlock) {
        event.setUseInteractedBlock(Event.Result.DENY);
    }
    craftServer.getPluginManager().callEvent(event);

    return event;
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:35,代码来源:CraftEventFactory.java


注:本文中的org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。