本文整理汇总了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;
}
示例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;
}
示例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;
}