本文整理汇总了Java中cn.nukkit.nbt.tag.CompoundTag.getInt方法的典型用法代码示例。如果您正苦于以下问题:Java CompoundTag.getInt方法的具体用法?Java CompoundTag.getInt怎么用?Java CompoundTag.getInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.nbt.tag.CompoundTag
的用法示例。
在下文中一共展示了CompoundTag.getInt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BlockEntityMovingBlock
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
public BlockEntityMovingBlock(FullChunk chunk, CompoundTag nbt) {
super(chunk, nbt);
if (nbt.contains("movingBlockData") && nbt.contains("movingBlockId")) {
this.block = Block.get(nbt.getInt("movingBlockId"), nbt.getInt("movingBlockData"));
} else {
this.close();
}
if (nbt.contains("pistonPosX") && nbt.contains("pistonPosY") && nbt.contains("pistonPosZ")) {
this.piston = new BlockVector3(nbt.getInt("pistonPosX"), nbt.getInt("pistonPosY"), nbt.getInt("pistonPosZ"));
} else {
this.close();
}
this.isMovable = nbt.getBoolean("isMovable");
}
示例2: getColor
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
/**
* Get color of Leather Item
*
* @return - BlockColor, or null if item has no color
*/
public BlockColor getColor() {
if (!this.hasCompoundTag()) return null;
CompoundTag tag = this.getNamedTag();
if (!tag.exist("customColor")) return null;
int rgb = tag.getInt("customColor");
return new BlockColor(rgb);
}
示例3: BlockEntityPistonArm
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
public BlockEntityPistonArm(FullChunk chunk, CompoundTag nbt) {
super(chunk, nbt);
if (nbt.contains("Progress")) {
this.progress = nbt.getFloat("Progress");
}
if (nbt.contains("LastProgress")) {
this.lastProgress = (float) nbt.getInt("LastProgress");
}
if (nbt.contains("Sticky")) {
this.sticky = nbt.getBoolean("Sticky");
}
if (nbt.contains("Extending")) {
this.extending = nbt.getBoolean("Extending");
}
if (nbt.contains("powered")) {
this.powered = nbt.getBoolean("powered");
}
if (nbt.contains("AttachedBlocks")) {
ListTag blocks = nbt.getList("AttachedBlocks", IntTag.class);
if (blocks != null && blocks.size() > 0) {
this.attachedBlock = new Vector3((double) ((IntTag) blocks.get(0)).getData().intValue(), (double) ((IntTag) blocks.get(1)).getData().intValue(), (double) ((IntTag) blocks.get(2)).getData().intValue());
}
} else {
nbt.putList(new ListTag("AttachedBlocks"));
}
}
示例4: BlockEntityComparator
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
public BlockEntityComparator(FullChunk chunk, CompoundTag nbt) {
super(chunk, nbt);
if (!nbt.contains("OutputSignal")) {
nbt.putInt("OutputSignal", 0);
}
this.outputSignal = nbt.getInt("OutputSignal");
}
示例5: getCustomColor
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
public int getCustomColor(){
if(!this.hasCompoundTag()) return 0;
CompoundTag tag = this.getNamedTag();
if(tag.contains("customColor")){
return tag.getInt("customColor");
}
return 0;
}
示例6: BlockEntityPistonArm
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
public BlockEntityPistonArm(FullChunk chunk, CompoundTag nbt) {
super(chunk, nbt);
if (nbt.contains("Progress")) {
this.progress = nbt.getFloat("Progress");
}
if (nbt.contains("LastProgress")) {
this.lastProgress = nbt.getInt("LastProgress");
}
if (nbt.contains("Sticky")) {
this.sticky = nbt.getBoolean("Sticky");
}
if (nbt.contains("Extending")) {
this.extending = nbt.getBoolean("Extending");
}
if (nbt.contains("AttachedBlocks")) {
ListTag<IntTag> blocks = nbt.getList("AttachedBlocks", IntTag.class);
if (blocks != null && blocks.size() > 0) {
this.attachedBlock = new Vector3(blocks.get(0).getData(), blocks.get(1).getData(), blocks.get(2).getData());
}
} else {
nbt.putList(new ListTag<IntTag>("AttachedBlocks"));
}
}