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


Java EntityMinecartChest类代码示例

本文整理汇总了Java中cn.nukkit.entity.item.EntityMinecartChest的典型用法代码示例。如果您正苦于以下问题:Java EntityMinecartChest类的具体用法?Java EntityMinecartChest怎么用?Java EntityMinecartChest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onActivate

import cn.nukkit.entity.item.EntityMinecartChest; //导入依赖的package包/类
@Override
public boolean onActivate(Level level, Player player, Block block, Block target, BlockFace face, double fx, double fy, double fz) {
    Block secret = level.getBlock(block.add(0, -1, 0));
    // TODO: 2016/1/30 check if blockId of secret is a rail
    EntityMinecartChest minecart = new EntityMinecartChest(
            level.getChunk(block.getFloorX() >> 4, block.getFloorZ() >> 4), new CompoundTag("")
            .putList(new ListTag<DoubleTag>("Pos")
                    .add(new DoubleTag("", block.getX() + 0.5))
                    .add(new DoubleTag("", block.getY()))
                    .add(new DoubleTag("", block.getZ() + 0.5)))
            .putList(new ListTag<DoubleTag>("Motion")
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0)))
            .putList(new ListTag<FloatTag>("Rotation")
                    .add(new FloatTag("", 0))
                    .add(new FloatTag("", 0)))
    );
    minecart.spawnToAll();

    // TODO: 2016/1/30 if player is survival, item in hand count--

    return true;
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:25,代码来源:ItemMinecartChest.java

示例2: onActivate

import cn.nukkit.entity.item.EntityMinecartChest; //导入依赖的package包/类
@Override
public boolean onActivate(Level level, Player player, Block block, Block target, int face, double fx, double fy, double fz) {
    Block secret = level.getBlock(block.add(0, -1, 0));
    // TODO: 2016/1/30 check if blockId of secret is a rail
    EntityMinecartChest minecart = new EntityMinecartChest(
            level.getChunk(block.getFloorX() >> 4, block.getFloorZ() >> 4), new CompoundTag("")
            .putList(new ListTag<DoubleTag>("Pos")
                    .add(new DoubleTag("", block.getX() + 0.5))
                    .add(new DoubleTag("", block.getY()))
                    .add(new DoubleTag("", block.getZ() + 0.5)))
            .putList(new ListTag<DoubleTag>("Motion")
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0)))
            .putList(new ListTag<FloatTag>("Rotation")
                    .add(new FloatTag("", 0))
                    .add(new FloatTag("", 0)))
    );
    minecart.spawnToAll();

    // TODO: 2016/1/30 if player is survival, item in hand count--

    return true;
}
 
开发者ID:NycuRO,项目名称:Apollo-OLD,代码行数:25,代码来源:ItemMinecartChest.java

示例3: onActivate

import cn.nukkit.entity.item.EntityMinecartChest; //导入依赖的package包/类
@Override
public boolean onActivate(Level level, Player player, Block block, Block target, BlockFace face, double fx, double fy, double fz) {
    if (Rail.isRailBlock(target)) {
        Rail.Orientation type = ((BlockRail) target).getOrientation();
        double adjacent = 0.0D;
        if (type.isAscending()) {
            adjacent = 0.5D;
        }
        EntityMinecartChest minecart = new EntityMinecartChest(
                level.getChunk(target.getFloorX() >> 4, target.getFloorZ() >> 4), new CompoundTag("")
                .putList(new ListTag<>("Pos")
                        .add(new DoubleTag("", target.getX() + 0.5))
                        .add(new DoubleTag("", target.getY() + 0.0625D + adjacent))
                        .add(new DoubleTag("", target.getZ() + 0.5)))
                .putList(new ListTag<>("Motion")
                        .add(new DoubleTag("", 0))
                        .add(new DoubleTag("", 0))
                        .add(new DoubleTag("", 0)))
                .putList(new ListTag<>("Rotation")
                        .add(new FloatTag("", 0))
                        .add(new FloatTag("", 0)))
        );
        minecart.spawnToAll();
        count -= 1;
        return true;
    }
    return false;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:29,代码来源:ItemMinecartChest.java


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