本文整理汇总了Java中cn.nukkit.nbt.tag.CompoundTag.putInt方法的典型用法代码示例。如果您正苦于以下问题:Java CompoundTag.putInt方法的具体用法?Java CompoundTag.putInt怎么用?Java CompoundTag.putInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.nbt.tag.CompoundTag
的用法示例。
在下文中一共展示了CompoundTag.putInt方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BlockEntityFlowerPot
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
public BlockEntityFlowerPot(FullChunk chunk, CompoundTag nbt) {
super(chunk, nbt);
if (!nbt.contains("item")) {
nbt.putShort("item", 0);
}
if (!nbt.contains("data")) {
if (nbt.contains("mData")) {
nbt.putInt("data", nbt.getInt("mData"));
nbt.remove("mData");
} else {
nbt.putInt("data", 0);
}
}
this.namedTag = nbt;
}
示例2: 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");
}
示例3: BlockEntityMobSpawner
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
public BlockEntityMobSpawner(FullChunk chunk, CompoundTag nbt) {
super(chunk, nbt);
if (!nbt.contains("EntityId")) {
nbt.putInt("EntityId", 0);
}
if (!nbt.contains("SpawnCount")) {
nbt.putInt("SpawnCount", 4);
}
if (!nbt.contains("SpawnRange")) {
nbt.putInt("SpawnRange", 4);
}
if (!nbt.contains("MinSpawnDelay")) {
nbt.putInt("MinSpawnDelay", 200);
}
if (!nbt.contains("MaxSpawnDelay")) {
nbt.putInt("MaxSpawnDelay", 799);
}
if (!nbt.contains("Delay")) {
nbt.putInt("Delay", NukkitMath.randomRange(new NukkitRandom(), nbt.getInt("MinSpawnDelay"), nbt.getInt("MaxSpawnDelay")));
}
if (this.getNetworkId() > 0) {
this.scheduleUpdate();
}
}
示例4: BlockEntityCommandBlock
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
public BlockEntityCommandBlock(FullChunk chunk, CompoundTag nbt) {
super(chunk, nbt);
if (!nbt.contains("CustomName")) {
nbt.putString("CustomName", "");
}
if (!nbt.contains("commandBlockMode")) {
nbt.putInt("commandBlockMode", 0);
}
if (!nbt.contains("Command")) {
nbt.putString("Command", "");
}
if (!nbt.contains("LastOutput")) {
nbt.putString("LastOutput", "");
}
if (!nbt.contains("powered")) {
nbt.putBoolean("powered", false);
}
if (!nbt.contains("auto")) {
nbt.putBoolean("auto", false);
}
if (!nbt.contains("conditionalMode")) {
nbt.putBoolean("conditionalMode", false);
}
this.perm = new PermissibleBase(this);
this.scheduleUpdate();
}
示例5: BlockEntityBanner
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
public BlockEntityBanner(FullChunk chunk, CompoundTag nbt) {
super(chunk, nbt);
if (!nbt.contains("Base")) {
nbt.putInt("Base", 0);
}
if (!nbt.contains("Patterns")) {
nbt.putList(new ListTag<>("Patterns"));
}
}
示例6: correctNBT
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
@Override
protected void correctNBT(CompoundTag nbt) {
nbt.putInt("PotionId", this.meta);
}
示例7: toBinary
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
@Override
public byte[] toBinary() {
CompoundTag nbt = this.getNBT().copy();
nbt.putInt("xPos", this.x);
nbt.putInt("zPos", this.z);
if (this.isGenerated()) {
nbt.putByteArray("Blocks", this.getBlockIdArray());
nbt.putByteArray("Data", this.getBlockDataArray());
nbt.putByteArray("SkyLight", this.getBlockSkyLightArray());
nbt.putByteArray("BlockLight", this.getBlockLightArray());
nbt.putIntArray("BiomeColors", this.getBiomeColorArray());
nbt.putIntArray("HeightMap", this.getHeightMapArray());
}
ArrayList<CompoundTag> entities = new ArrayList<>();
for (Entity entity : this.getEntities().values()) {
if (!(entity instanceof Player) && !entity.closed) {
entity.saveNBT();
entities.add(entity.namedTag);
}
}
ListTag<CompoundTag> entityListTag = new ListTag<>("Entities");
entityListTag.setAll(entities);
nbt.putList(entityListTag);
ArrayList<CompoundTag> tiles = new ArrayList<>();
for (BlockEntity blockEntity : this.getBlockEntities().values()) {
blockEntity.saveNBT();
tiles.add(blockEntity.namedTag);
}
ListTag<CompoundTag> tileListTag = new ListTag<>("TileEntities");
tileListTag.setAll(tiles);
nbt.putList(tileListTag);
BinaryStream extraData = new BinaryStream();
Map<Integer, Integer> extraDataArray = this.getBlockExtraDataArray();
extraData.putInt(extraDataArray.size());
for (Integer key : extraDataArray.keySet()) {
extraData.putInt(key);
extraData.putShort(extraDataArray.get(key));
}
nbt.putByteArray("ExtraData", extraData.getBuffer());
CompoundTag chunk = new CompoundTag("");
chunk.putCompound("Level", nbt);
try {
return Zlib.deflate(NBTIO.write(chunk, ByteOrder.BIG_ENDIAN), RegionLoader.COMPRESSION_LEVEL);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例8: correctNBT
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
protected void correctNBT(CompoundTag nbt) {
nbt.putInt("PotionId", this.meta);
}
示例9: setColor
import cn.nukkit.nbt.tag.CompoundTag; //导入方法依赖的package包/类
/**
* Set leather armor color
*
* @param r - red
* @param g - green
* @param b - blue
* @return - Return colored item
*/
public ItemColorArmor setColor(int r, int g, int b) {
int rgb = r << 16 | g << 8 | b;
CompoundTag tag = this.hasCompoundTag() ? this.getNamedTag() : new CompoundTag();
tag.putInt("customColor", rgb);
this.setNamedTag(tag);
return this;
}