本文整理汇总了Java中net.minecraft.nbt.NBTTagCompound.setByteArray方法的典型用法代码示例。如果您正苦于以下问题:Java NBTTagCompound.setByteArray方法的具体用法?Java NBTTagCompound.setByteArray怎么用?Java NBTTagCompound.setByteArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.nbt.NBTTagCompound
的用法示例。
在下文中一共展示了NBTTagCompound.setByteArray方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeToNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public NBTTagCompound writeToNBT() {
NBTTagCompound c = new NBTTagCompound();
c.setByteArray(NBT_STACK, stack);
c.setByteArray(NBT_REGISTERS, registers);
c.setLong(NBT_FLAGS, packFlags());
if (error != null) {
c.setString(NBT_ERROR, error);
}
NBTTagList programTag = new NBTTagList();
for (byte[] b : program) {
programTag.appendTag(new NBTTagByteArray(b));
}
c.setTag(NBT_PROGRAM, programTag);
NBTTagList labelTag = new NBTTagList();
for (Label label : labels) {
labelTag.appendTag(label.toNbt());
}
c.setTag(NBT_LABELS, labelTag);
return c;
}
示例2: getSchematic
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* Write to schematic tags
* @return Control tag
*/
private NBTTagCompound getSchematic() {
NBTTagCompound tag = new NBTTagCompound();
tag.setString("Materials", "Alpha");
tag.setShort("Width", (short) getWidth());
tag.setShort("Height", (short) getHeight());
tag.setShort("Length", (short) getLength());
tag.setByteArray("AddBlocks", new byte[0]);
byte[] blocksID = new byte[getBlocks().length];
for (int i = 0; i < getBlocks().length; ++i) {
blocksID[i] = (byte) getBlock(i);
}
tag.setByteArray("Blocks", blocksID);
tag.setByteArray("AddBlocks", getAddBlocks(getBlocks()));
tag.setByteArray("Data", getMetas());
NBTTagList tileEntities = new NBTTagList();
for (NBTTagCompound tile : getTiles()) {
if (tile != null) {
tileEntities.appendTag(tile);
}
}
tag.setTag("TileEntities", tileEntities);
return tag;
}
示例3: writeToNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
int posarray[] = new int[cleanAir.size() * 3];
byte airarray[] = new byte[cleanAir.size()];
int idx = 0;
for (Map.Entry<Long, Byte> entry : cleanAir.entrySet()) {
BlockPos pos = BlockPos.fromLong(entry.getKey());
airarray[idx] = entry.getValue();
posarray[idx*3+0] = pos.getX();
posarray[idx*3+1] = pos.getY();
posarray[idx*3+2] = pos.getZ();
idx++;
}
compound.setIntArray("airpos", posarray);
compound.setByteArray("airval", airarray);
return null;
}
示例4: writeUpdateTag
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void writeUpdateTag(NBTTagCompound tag)
{
//tag.setInteger("DustID",this.dustType.getID());
tag.setByteArray("Symbols",getByteArrayFromList(dustList));
NBTTagList list = new NBTTagList();
for (int i = 0; i < this.getSizeInventory(); ++i) {
if (this.getStackInSlot(i) != null) {
NBTTagCompound stackTag = new NBTTagCompound();
stackTag.setByte("Slot", (byte) i);
this.getStackInSlot(i).writeToNBT(stackTag);
list.appendTag(stackTag);
}
}
tag.setTag("Items",list);
if (this.hasCustomName()) {
tag.setString("CustomName", this.getCustomName());
}
}
示例5: saveServerList
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void saveServerList()
{
prepare();
super.saveServerList();
int numOfServers = countServers();
byte[] serverBytes = new byte[numOfServers];
for (int i = 0; i < numOfServers; i++)
{
boolean editStatus = i < servers.size() && servers.get(i);
serverBytes[i] = editStatus ? (byte) 1 : (byte) 0;
}
try
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setByteArray("servers", serverBytes);
CompressedStreamTools.safeWrite(nbttagcompound, new File(this.mc.mcDataDir, "mtservers.dat"));
}
catch (Exception exception)
{
//logger.error("Couldn\'t save server list", exception);
}
}
示例6: saveData
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* Save file to file
* @throws IOException If data failed to save
* */
private void saveData() throws IOException {
NBTTagCompound tag = new NBTTagCompound();
tag.setByteArray("Skin", Utils.toByteArray(getSkin()));
tag.setByteArray("Melt", Utils.toByteArray(getMelt()));
Utils.writeTags(getFileData(), tag);
}
示例7: writeToNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
compound.setBoolean("ignore_blocks", this.ignoreBlocks);
compound.setInteger("location_id", isLocation() ? location.getId() : -1);
compound.setTag("inner_stack", (this.stack == null ? ItemStack.EMPTY : this.stack).serializeNBT());
compound.setByteArray("hit_result", HarshenUtils.serialize(hitResult));
return super.writeToNBT(compound);
}
示例8: writeToNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* write data to NBTTagCompound from this MapDataBase, similar to Entities and TileEntities
*/
public void writeToNBT(NBTTagCompound nbt)
{
nbt.setByte("dimension", this.dimension);
nbt.setInteger("xCenter", this.xCenter);
nbt.setInteger("zCenter", this.zCenter);
nbt.setByte("scale", this.scale);
nbt.setShort("width", (short)128);
nbt.setShort("height", (short)128);
nbt.setByteArray("colors", this.colors);
}
示例9: serializeMin
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public NBTTagCompound serializeMin(NBTTagCompound compound)
{
compound.setTag("items", handler.serializeNBT());
if (getText() != null)
compound.setString("text", getText());
if (getHash() != null)
compound.setByteArray("hash", getHash());
compound.setBoolean("unlocked", isUnlocked());
return compound;
}
示例10: writeToNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public NBTTagCompound writeToNBT(NBTTagCompound compound)
{
compound.setByte("dimension", this.dimension);
compound.setInteger("xCenter", this.xCenter);
compound.setInteger("zCenter", this.zCenter);
compound.setByte("scale", this.scale);
compound.setShort("width", (short)128);
compound.setShort("height", (short)128);
compound.setByteArray("colors", this.colors);
compound.setBoolean("trackingPosition", this.trackingPosition);
compound.setBoolean("unlimitedTracking", this.field_191096_f);
return compound;
}
示例11: serializeNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public NBTTagCompound serializeNBT() {
NBTTagCompound tag = new NBTTagCompound();
//tag.setBoolean("Uber", this.owner.getDataManager().get(TF2EventBusListener.ENTITY_UBER));
NBTTagCompound bossInfo = new NBTTagCompound();
for (Entry<Class<? extends Entity>, Short> entry : this.highestBossLevel.entrySet())
bossInfo.setShort(EntityList.getKey(entry.getKey()).toString(), entry.getValue());
tag.setTag("BossInfo", bossInfo);
tag.setInteger("NextBossTick", this.nextBossTicks);
tag.setFloat("DodgedDmg", this.dodgedDmg);
NBTTagList list=new NBTTagList();
tag.setTag("Contracts", list);
for(Contract contract:this.contracts) {
NBTTagCompound com=new NBTTagCompound();
com.setBoolean("Active", contract.active);
com.setShort("Progress", (short) contract.progress);
com.setByte("Rewards", (byte) contract.rewards);
byte[] objs=new byte[contract.objectives.length];
for(int i=0;i<contract.objectives.length;i++) {
objs[i]=(byte) contract.objectives[i].ordinal();
}
com.setByteArray("Objectives", objs);
com.setString("Name", contract.className);
list.appendTag(com);
}
tag.setInteger("NextContractDay", this.nextContractDay);
return tag;
}
示例12: writeToNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public NBTTagCompound writeToNBT(NBTTagCompound compound)
{
compound.setInteger("dimension", this.dimension);
compound.setInteger("xCenter", this.xCenter);
compound.setInteger("zCenter", this.zCenter);
compound.setByte("scale", this.scale);
compound.setShort("width", (short)128);
compound.setShort("height", (short)128);
compound.setByteArray("colors", this.colors);
compound.setBoolean("trackingPosition", this.trackingPosition);
return compound;
}