本文整理汇总了Java中cn.nukkit.entity.item.EntityMinecartChest.spawnToAll方法的典型用法代码示例。如果您正苦于以下问题:Java EntityMinecartChest.spawnToAll方法的具体用法?Java EntityMinecartChest.spawnToAll怎么用?Java EntityMinecartChest.spawnToAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.entity.item.EntityMinecartChest
的用法示例。
在下文中一共展示了EntityMinecartChest.spawnToAll方法的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;
}