本文整理汇总了Java中cn.nukkit.nbt.tag.CompoundTag.putByte方法的典型用法代码示例。如果您正苦于以下问题:Java CompoundTag.putByte方法的具体用法?Java CompoundTag.putByte怎么用?Java CompoundTag.putByte使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.nbt.tag.CompoundTag
的用法示例。
在下文中一共展示了CompoundTag.putByte方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: putItemHelper
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
public static CompoundTag putItemHelper(Item item, Integer slot) {
CompoundTag tag = new CompoundTag(null)
.putShort("id", item.getId())
.putByte("Count", item.getCount())
.putShort("Damage", item.getDamage());
if (slot != null) {
tag.putByte("Slot", slot);
}
if (item.hasCompoundTag()) {
tag.putCompound("tag", item.getNamedTag());
}
return tag;
}
示例2: createChunkSection
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
public static ChunkSection createChunkSection(int y) {
CompoundTag nbt = new CompoundTag();
nbt.putByte("Y", y);
nbt.putByteArray("Blocks", new byte[4096]);
nbt.putByteArray("Data", new byte[2048]);
byte[] sl = new byte[2048];
Arrays.fill(sl, (byte) 0xff);
nbt.putByteArray("SkyLight", sl);
nbt.putByteArray("BlockLight", new byte[2048]);
return new ChunkSection(nbt);
}
示例3: BlockEntityItemFrame
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
public BlockEntityItemFrame(FullChunk chunk, CompoundTag nbt) {
super(chunk, nbt);
if (!nbt.contains("Item")) {
nbt.putCompound("Item", NBTIO.putItemHelper(new ItemBlock(new BlockAir())));
}
if (!nbt.contains("ItemRotation")) {
nbt.putByte("ItemRotation", 0);
}
if (!nbt.contains("ItemDropChance")) {
nbt.putFloat("ItemDropChance", 1.0f);
}
this.level.updateComparatorOutputLevel(this);
}
示例4: BlockEntitySkull
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
public BlockEntitySkull(FullChunk chunk, CompoundTag nbt) {
super(chunk, nbt);
if (!nbt.contains("SkullType")) {
nbt.putByte("SkullType", 0);
}
if (!nbt.contains("Rot")) {
nbt.putByte("Rot", 0);
}
this.namedTag = nbt;
}
示例5: save
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
public void save(boolean async) {
if (this.closed) {
throw new IllegalStateException("Tried to save closed player");
}
super.saveNBT();
if (this.level != null) {
this.namedTag.putString("Level", this.level.getFolderName());
if (this.spawnPosition != null && this.spawnPosition.getLevel() != null) {
this.namedTag.putString("SpawnLevel", this.spawnPosition.getLevel().getFolderName());
this.namedTag.putInt("SpawnX", (int) this.spawnPosition.x);
this.namedTag.putInt("SpawnY", (int) this.spawnPosition.y);
this.namedTag.putInt("SpawnZ", (int) this.spawnPosition.z);
}
CompoundTag achievements = new CompoundTag();
for (String achievement : this.achievements) {
achievements.putByte(achievement, 1);
}
this.namedTag.putCompound("Achievements", achievements);
this.namedTag.putInt("playerGameType", this.gamemode);
this.namedTag.putLong("lastPlayed", System.currentTimeMillis() / 1000);
this.namedTag.putString("lastIP", this.getAddress());
this.namedTag.putInt("EXP", this.getExperience());
this.namedTag.putInt("expLevel", this.getExperienceLevel());
this.namedTag.putInt("foodLevel", this.getFoodData().getLevel());
this.namedTag.putFloat("foodSaturationLevel", this.getFoodData().getFoodSaturationLevel());
if (!"".equals(this.username) && this.namedTag != null) {
this.server.saveOfflinePlayerData(this.username, this.namedTag, async);
}
}
}
示例6: createBlockEntity
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
private void createBlockEntity(Vector3 pos, int color) {
CompoundTag nbt = BlockEntity.getDefaultCompound(pos, BlockEntity.BED);
nbt.putByte("color", color);
new BlockEntityBed(this.level.getChunk(pos.getFloorX() >> 4, pos.getFloorZ() >> 4), nbt);
}