當前位置: 首頁>>代碼示例>>Java>>正文


Java NBTTagCompound.setByteArray方法代碼示例

本文整理匯總了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;
}
 
開發者ID:ToroCraft,項目名稱:Minecoprocessors,代碼行數:24,代碼來源:Processor.java

示例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;
}
 
開發者ID:ternsip,項目名稱:StructPro,代碼行數:28,代碼來源:Blueprint.java

示例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;
}
 
開發者ID:McJty,項目名稱:needtobreath,代碼行數:19,代碼來源:DimensionData.java

示例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());
    }

}
 
開發者ID:Drazuam,項目名稱:RunicArcana,代碼行數:22,代碼來源:TileEntityChalkBase.java

示例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);
    }
}
 
開發者ID:CreeperHost,項目名稱:CreeperHostGui,代碼行數:26,代碼來源:ServerListNoEdit.java

示例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);
}
 
開發者ID:ternsip,項目名稱:StructPro,代碼行數:11,代碼來源:Structure.java

示例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);
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:9,代碼來源:EntityThrown.java

示例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);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:14,代碼來源:MapData.java

示例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;
}
 
開發者ID:PearXTeam,項目名稱:PurificatiMagicae,代碼行數:11,代碼來源:TileCodeStorage.java

示例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;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:14,代碼來源:MapData.java

示例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;
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:29,代碼來源:TF2PlayerCapability.java

示例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;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:13,代碼來源:MapData.java


注:本文中的net.minecraft.nbt.NBTTagCompound.setByteArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。