当前位置: 首页>>代码示例>>Java>>正文


Java NBTTagCompound.getByteArray方法代码示例

本文整理汇总了Java中net.minecraft.nbt.NBTTagCompound.getByteArray方法的典型用法代码示例。如果您正苦于以下问题:Java NBTTagCompound.getByteArray方法的具体用法?Java NBTTagCompound.getByteArray怎么用?Java NBTTagCompound.getByteArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.nbt.NBTTagCompound的用法示例。


在下文中一共展示了NBTTagCompound.getByteArray方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: load

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void load(NBTTagCompound nbt) {
	if(nbt.hasKey("portState")) portState = UIFPortState.valueOf(nbt.getString("portState"));
	else portState = UIFPortState.IDLE;
	if(nbt.hasKey("outputState")) {
		outputState = UIFOutputState.valueOf(nbt.getString("outputState"));
		byte[] stream = nbt.getByteArray("outstream");
		outstream.write(stream, 0, stream.length);
		outputLevelsDeep = nbt.getInteger("outputLevelsDeep");
		outputRemBytes = nbt.getInteger("outputRemBytes");
		if(nbt.hasKey("outputTag"))
			outputTag = nbt.getShort("outputTag");
	}
	else outputState = null;
	if(nbt.hasKey("currentInputThing")) {
		currentInputThing = nbt.getByteArray("currentInputThing");
		currentInputPos = nbt.getInteger("currentInputPos");
	}
}
 
开发者ID:SolraBizna,项目名称:j6502,代码行数:19,代码来源:MMU.java

示例2: load

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public static ChunkLoader.AnvilConverterData load(NBTTagCompound nbt)
{
    int i = nbt.getInteger("xPos");
    int j = nbt.getInteger("zPos");
    ChunkLoader.AnvilConverterData chunkloader$anvilconverterdata = new ChunkLoader.AnvilConverterData(i, j);
    chunkloader$anvilconverterdata.blocks = nbt.getByteArray("Blocks");
    chunkloader$anvilconverterdata.data = new NibbleArrayReader(nbt.getByteArray("Data"), 7);
    chunkloader$anvilconverterdata.skyLight = new NibbleArrayReader(nbt.getByteArray("SkyLight"), 7);
    chunkloader$anvilconverterdata.blockLight = new NibbleArrayReader(nbt.getByteArray("BlockLight"), 7);
    chunkloader$anvilconverterdata.heightmap = nbt.getByteArray("HeightMap");
    chunkloader$anvilconverterdata.terrainPopulated = nbt.getBoolean("TerrainPopulated");
    chunkloader$anvilconverterdata.entities = nbt.getTagList("Entities", 10);
    chunkloader$anvilconverterdata.tileEntities = nbt.getTagList("TileEntities", 10);
    chunkloader$anvilconverterdata.tileTicks = nbt.getTagList("TileTicks", 10);

    try
    {
        chunkloader$anvilconverterdata.lastUpdated = nbt.getLong("LastUpdate");
    }
    catch (ClassCastException var5)
    {
        chunkloader$anvilconverterdata.lastUpdated = (long)nbt.getInteger("LastUpdate");
    }

    return chunkloader$anvilconverterdata;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:27,代码来源:ChunkLoader.java

示例3: deserializeNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void deserializeNBT(NBTTagCompound nbt) {
	NBTTagCompound bossInfo = nbt.getCompoundTag("BossInfo");
	for (String key : bossInfo.getKeySet())
		this.highestBossLevel.put(EntityList.getClass(new ResourceLocation(key)), bossInfo.getShort(key));
	this.nextBossTicks = nbt.getInteger("NextBossTick");
	this.dodgedDmg=nbt.getFloat("DodgedDmg");
	NBTTagList list=(NBTTagList) nbt.getTag("Contracts");
	if(list != null)
	for(int i=0;i<list.tagCount();i++) {
		NBTTagCompound com=list.getCompoundTagAt(i);
		byte[] objsb=com.getByteArray("Objectives");
		Objective[] objs=new Objective[objsb.length];
		for(int j=0;j<objsb.length;j++) {
			objs[j]=Objective.values()[objsb[j]];
		}
		Contract contract=new Contract(com.getString("Name"), 0, objs);
		contract.active=com.getBoolean("Active");
		contract.progress=com.getShort("Progress");
		contract.rewards=com.getByte("Rewards");
		this.contracts.add(contract);
		//TF2weapons.network.sendTo(new TF2Message.ContractMessage(i, contract), (EntityPlayerMP) this.owner);
	}
	this.nextContractDay=nbt.getInteger("NextContractDay");
	
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:27,代码来源:TF2PlayerCapability.java

示例4: PacketDescription

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public PacketDescription(NBTTagCompound compound) {
    super(NBTUtil.getPosFromTag(compound.getCompoundTag("Pos")));
    type = IDescSynced.Type.values()[compound.getInteger("SyncType")];
    values = new Object[compound.getInteger("Length")];
    types = new byte[values.length];
    NBTTagList list = compound.getTagList("Data", Constants.NBT.TAG_COMPOUND);
    for (int i = 0; i < values.length; i++) {
        NBTTagCompound element = list.getCompoundTagAt(i);
        types[i] = element.getByte("Type");
        byte[] b = element.getByteArray("Value");
        values[i] = PacketUpdateGui.readField(Unpooled.wrappedBuffer(b), types[i]);
    }
    extraData = compound.getCompoundTag("Extra");
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:15,代码来源:PacketDescription.java

示例5: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void readFromNBT(NBTTagCompound nbt) {
    int[] posarray = nbt.getIntArray("airpos");
    byte[] airarray = nbt.getByteArray("airval");
    cleanAir.clear();
    for (int i = 0 ; i < airarray.length ; i++) {
        int x = posarray[i*3+0];
        int y = posarray[i*3+1];
        int z = posarray[i*3+2];
        cleanAir.put(LongPos.toLong(x, y, z), airarray[i]);
    }
}
 
开发者ID:McJty,项目名称:needtobreath,代码行数:12,代码来源:DimensionData.java

示例6: save

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void save(NBTTagCompound nbt) {
	nbt.setByteArray("regs", new byte[]{addr1, addr2, sectorSize, numSectors1, numSectors2, sector1, sector2});
	if(mappedDrive != null)
		nbt.setString("mappedDrive", mappedDrive);
	if(sectorReadPos >= 0)
		nbt.setInteger("sectorReadPos", sectorReadPos);
	if(sectorWritePos >= 0)
		nbt.setInteger("sectorWritePos", sectorWritePos);
	if(sectorBuffer != null)
		sectorBuffer = nbt.getByteArray("sectorBuffer");
}
 
开发者ID:SolraBizna,项目名称:j6502,代码行数:12,代码来源:MMU.java

示例7: loadServerList

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void loadServerList()
{
    prepare();
    super.loadServerList();
    try
    {
        this.servers.clear();
        NBTTagCompound nbttagcompound = CompressedStreamTools.read(new File(this.mc.mcDataDir, "mtservers.dat"));

        byte[] serverBytes;

        if (nbttagcompound == null)
        {
            serverBytes = new byte[countServers()];
            for (int i = 0; i < countServers(); i++)
            {
                serverBytes[i] = 0;
            }
        }
        else
        {
            serverBytes = nbttagcompound.getByteArray("servers");
        }


        int count = countServers();

        for (int i = 0; i < count; ++i)
        {
            this.servers.add(i < serverBytes.length && serverBytes[i] == 1);
        }
    }
    catch (Exception exception)
    {
        exception.printStackTrace();
        for (int i = 0; i < countServers(); i++)
        {
            servers.add(false);
        }
        //LOGGER.error((String)"Couldn\'t load server list", (Throwable)exception);
    }
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:44,代码来源:ServerListNoEdit.java

示例8: loadServerList

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void loadServerList()
{
    prepare();
    super.loadServerList();
    try
    {
        this.servers.clear();
        NBTTagCompound nbttagcompound = CompressedStreamTools.read(new File(this.mc.mcDataDir, "mtservers.dat"));

        byte[] serverBytes;

        if (nbttagcompound == null)
        {
            serverBytes = new byte[countServers()];
            for (int i = 0; i < countServers(); i++)
            {
                serverBytes[i] = 0;
            }
        }
        else
        {
            serverBytes = nbttagcompound.getByteArray("servers");
        }


        int count = countServers();

        for (int i = 0; i < count; ++i)
        {
            this.servers.add(i < serverBytes.length && serverBytes[i] == 1);
        }
    }
    catch (Exception exception)
    {
        for (int i = 0; i < countServers(); i++)
        {
            servers.add(false);
        }
        //LOGGER.error((String)"Couldn\'t load server list", (Throwable)exception);
    }
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:43,代码来源:ServerListNoEdit.java

示例9: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
 * reads in data from the NBTTagCompound into this MapDataBase
 */
public void readFromNBT(NBTTagCompound nbt)
{
    this.dimension = nbt.getByte("dimension");
    this.xCenter = nbt.getInteger("xCenter");
    this.zCenter = nbt.getInteger("zCenter");
    this.scale = nbt.getByte("scale");
    this.scale = (byte)MathHelper.clamp_int(this.scale, 0, 4);
    int i = nbt.getShort("width");
    int j = nbt.getShort("height");

    if (i == 128 && j == 128)
    {
        this.colors = nbt.getByteArray("colors");
    }
    else
    {
        byte[] abyte = nbt.getByteArray("colors");
        this.colors = new byte[16384];
        int k = (128 - i) / 2;
        int l = (128 - j) / 2;

        for (int i1 = 0; i1 < j; ++i1)
        {
            int j1 = i1 + l;

            if (j1 >= 0 || j1 < 128)
            {
                for (int k1 = 0; k1 < i; ++k1)
                {
                    int l1 = k1 + k;

                    if (l1 >= 0 || l1 < 128)
                    {
                        this.colors[l1 + j1 * 128] = abyte[k1 + i1 * i];
                    }
                }
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:44,代码来源:MapData.java

示例10: readSchematic

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
 * Read from schematic tag
 * @param tag Control tag
 * @throws IOException If schematic tag can not be read
 */
private void readSchematic(NBTTagCompound tag) throws IOException {
    String materials = tag.getString("Materials");
    if (!materials.equals("Alpha")) {
        throw new IOException("Materials of schematic is not an alpha: [" + materials + "]");
    }
    setWidth(tag.getShort("Width"));
    setHeight(tag.getShort("Height"));
    setLength(tag.getShort("Length"));
    String dimensions = "[W=" + getWidth() + ";H=" + getHeight() + ";L=" + getLength() + "]";
    String dimLimit = "[W=" + WIDTH_LIMIT + ";H=" + HEIGHT_LIMIT + ";L=" + LENGTH_LIMIT + "]";
    if (getWidth() <= 0 || getHeight() <= 0 || getLength() <= 0) {
        throw new IOException("Schematic has non-positive dimensions: " + dimensions);
    }
    if (getWidth() > WIDTH_LIMIT || getHeight() > HEIGHT_LIMIT || getLength() > LENGTH_LIMIT) {
        throw new IOException("Schematic dimensions are too large: " + dimensions + "/" + dimLimit);
    }
    int size = getSize();
    if (size > VOLUME_LIMIT) {
        throw new IOException("Schematic is too big: " + size + "/" + VOLUME_LIMIT);
    }
    byte[] addBlocks = tag.getByteArray("AddBlocks");
    byte[] blocksID = tag.getByteArray("Blocks");
    if (size != blocksID.length) {
        throw new IOException("Wrong schematic blocks length: " + blocksID.length + "/" + size);
    }
    setBlocks(compose(blocksID, addBlocks));
    setMetas(tag.getByteArray("Data"));
    if (size != getMetas().length) {
        throw new IOException("Wrong schematic metadata length: " + blocksID.length + "/" + size);
    }
    setTiles(new NBTTagCompound[size]);
    NBTTagList tileEntities = tag.getTagList("TileEntities", Constants.NBT.TAG_COMPOUND);
    for(int i = 0; i < tileEntities.tagCount(); i++) {
        NBTTagCompound tile = tileEntities.getCompoundTagAt(i);
        int x = tile.getInteger("x");
        int y = tile.getInteger("y");
        int z = tile.getInteger("z");
        int idx = getIndex(x, y, z);
        if (idx >= 0 && idx < size) {
            setTile(tile, idx);
        }
    }
}
 
开发者ID:ternsip,项目名称:StructPro,代码行数:49,代码来源:Blueprint.java

示例11: readChunkFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
 * Reads the data stored in the passed NBTTagCompound and creates a Chunk with that data in the passed World.
 * Returns the created Chunk.
 */
private Chunk readChunkFromNBT(World worldIn, NBTTagCompound compound)
{
    int i = compound.getInteger("xPos");
    int j = compound.getInteger("zPos");
    Chunk chunk = new Chunk(worldIn, i, j);
    chunk.setHeightMap(compound.getIntArray("HeightMap"));
    chunk.setTerrainPopulated(compound.getBoolean("TerrainPopulated"));
    chunk.setLightPopulated(compound.getBoolean("LightPopulated"));
    chunk.setInhabitedTime(compound.getLong("InhabitedTime"));
    NBTTagList nbttaglist = compound.getTagList("Sections", 10);
    int k = 16;
    ExtendedBlockStorage[] aextendedblockstorage = new ExtendedBlockStorage[16];
    boolean flag = !worldIn.provider.getHasNoSky();

    for (int l = 0; l < nbttaglist.tagCount(); ++l)
    {
        NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(l);
        int i1 = nbttagcompound.getByte("Y");
        ExtendedBlockStorage extendedblockstorage = new ExtendedBlockStorage(i1 << 4, flag);
        byte[] abyte = nbttagcompound.getByteArray("Blocks");
        NibbleArray nibblearray = new NibbleArray(nbttagcompound.getByteArray("Data"));
        NibbleArray nibblearray1 = nbttagcompound.hasKey("Add", 7) ? new NibbleArray(nbttagcompound.getByteArray("Add")) : null;
        extendedblockstorage.getData().setDataFromNBT(abyte, nibblearray, nibblearray1);
        extendedblockstorage.setBlocklightArray(new NibbleArray(nbttagcompound.getByteArray("BlockLight")));

        if (flag)
        {
            extendedblockstorage.setSkylightArray(new NibbleArray(nbttagcompound.getByteArray("SkyLight")));
        }

        extendedblockstorage.removeInvalidBlocks();
        aextendedblockstorage[i1] = extendedblockstorage;
    }

    chunk.setStorageArrays(aextendedblockstorage);

    if (compound.hasKey("Biomes", 7))
    {
        chunk.setBiomeArray(compound.getByteArray("Biomes"));
    }

    // End this method here and split off entity loading to another method
    return chunk;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:49,代码来源:AnvilChunkLoader.java


注:本文中的net.minecraft.nbt.NBTTagCompound.getByteArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。