Package com.mojang.nbt

Examples of com.mojang.nbt.CompoundTag


        if(dis == null)
            return null;

        // decompress chunk
        CompoundTag tag = NbtIo.read(dis);
        Chunk chunk = Chunk.loadChunk(tag);
        dis.close();
       
        return chunk;
    }
View Full Code Here


        if(dis == null)
            return null;

        // decompress chunk
        CompoundTag tag = NbtIo.read(dis);
        ManagedChunk chunk = ManagedChunk.loadChunk(tag, manager);
        dis.close();
       
        if(x != chunk.getX() || z != chunk.getZ())
            chunk.fixPosition(x, z);
View Full Code Here

    }
   
    @SuppressWarnings("unchecked")
    public static ManagedChunk loadChunk(CompoundTag tag, ChunkManager manager)
    {
        CompoundTag level = (CompoundTag) tag.get("Level");

        ListTag<CompoundTag> sections = (ListTag<CompoundTag>) level.get("Sections");
        IntArrayTag heightmap = (IntArrayTag) level.get("HeightMap");
        ByteArrayTag biome = (ByteArrayTag) level.get("Biomes");
        IntTag xPos = (IntTag) level.get("xPos");
        IntTag zPos = (IntTag) level.get("zPos");
       
        ManagedChunk chunk;
        chunk = new ManagedChunk(xPos.data, zPos.data, heightmap.data, biome.data, manager);
        // TODO: create ManagedSection to catch Section changes?
        // TODO: alternatively, hide sections from interface
        chunk.loadSections(sections);

        EntityFactory factory = manager.getEntityFactory();
       
        Tag tagEntities = level.get("Entities");  
        if(tagEntities != null)
        {
            ListTag<CompoundTag> list = (ListTag<CompoundTag>)tagEntities;           
            for(int i=0; i<list.size(); i++)
                chunk.entities.add(factory.createEntity(list.get(i)));
        }
       
        Tag tagTileEntities = level.get("TileEntities");
        if(tagEntities != null)
        {
            ListTag<CompoundTag> list = (ListTag<CompoundTag>)tagTileEntities;           
            for(int i=0; i<list.size(); i++)
                chunk.tileEntities.add(factory.createTileEntity(list.get(i)));
View Full Code Here

        this.x = x;
        this.z = z;
       
        if(this.tag != null)
        {
            CompoundTag level = this.tag.getCompound("Level");
           
            if(level != null)
            {
                level.put("xPos", new IntTag("xPos", x));
                level.put("zPos", new IntTag("zPos", z));
            }
        }
    }
View Full Code Here

        for(Section sec : sections)
            if(sec != null)
                list.add(sec.createTag());
       
        CompoundTag level = (CompoundTag)tag.get("Level");
        level.put("Sections", list);
       
        ListTag<CompoundTag> tagEntities = new ListTag<CompoundTag>("Entities");
        for(Entity e : entities)
            tagEntities.add(e.getTag());

        ListTag<CompoundTag> tagTileEntities = new ListTag<CompoundTag>("TileEntities");
        for(TileEntity e : tileEntities)
            tagTileEntities.add(e.getTag());
       
        level.put("Entities", tagEntities);
        level.put("TileEntities", tagTileEntities);

        return tag;
    }
View Full Code Here

        return tag;
    }
   
    private CompoundTag createChunkTag()
    {
        CompoundTag level = new CompoundTag("Level");
        level.put("Biomes", new ByteArrayTag("Biomes", biomes));
        level.put("HeightMap", new IntArrayTag("HeightMap", heightmap));
        level.put("LastUpdate", new LongTag("LastUpdate", 0));
        level.put("xPos", new IntTag("xPos", x));
        level.put("zPos", new IntTag("zPos", z));
        level.put("TerrainPopulated", new ByteTag("TerrainPopulated", (byte)1));

        CompoundTag root = new CompoundTag("");
        root.put("Level", level);
        return root;
    }
View Full Code Here

    }
   
    public CompoundTag getTag()
    {
        if(tag == null)
            tag = new CompoundTag("Schematic");

        ShortTag tagW = new ShortTag("Width", (short)width);
        ShortTag tagH = new ShortTag("Height", (short)height);
        ShortTag tagL = new ShortTag("Length", (short)length);
        StringTag tagMat = new StringTag("Materials", "Alpha");
View Full Code Here

            return new TileEntityImpl(tag);
    }
   
    public EntityImpl createXPOrb(int x, int y, int z, int value)
    {
        CompoundTag root = createEntityRoot(x, y, z, "XPOrb");
        root.put("Health", new ShortTag("Health", (short)5));
        root.put("Age", new ShortTag("Age", (short)0));
        root.put("Value", new ShortTag("Value", (short)value));
        return new EntityImpl(root);
    }
View Full Code Here

        return new EntityImpl(root);
    }
   
    public Entity createFallingBlock(int x, int y, int z, int id, int data)
    {
        CompoundTag root = createEntityRoot(x, y, z, "FallingSand");
        root.put("Tile", new ByteTag("Tile", (byte)id));
        root.put("Data", new ByteTag("Data", (byte)data));
        root.put("Time", new ByteTag("Time", (byte)0));
        root.put("DropItem", new ByteTag("DropItem", (byte)0));
        root.put("HurtEntities", new ByteTag("HurtEntities", (byte)0));
        root.put("FallHurtMax", new IntTag("FallHurtMax", 0));
        root.put("FallHurtAmount", new FloatTag("FallHurtAmount", 0));
        return new EntityImpl(root);
    }
View Full Code Here

        return new EntityImpl(root);
    }

    public TileEntity createHiddenBlock(int x, int y, int z, int id, int data, float delay)
    {
        CompoundTag root = createTileRoot(x, y, z, "Piston");
        root.put("blockId", new IntTag("blockId", id));
        root.put("blockData", new IntTag("blockData", data));
        root.put("facing", new IntTag("facing", 0));
        root.put("progress", new FloatTag("progress", -delay));
        root.put("extending", new ByteTag("extending", (byte)0));
        return new TileEntityImpl(root);
    }
View Full Code Here

TOP

Related Classes of com.mojang.nbt.CompoundTag

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.