Package com.mojang.nbt

Examples of com.mojang.nbt.CompoundTag


        return new TileEntityImpl(root);
    }
   
    public CommandBlock createCommandBlock(int x, int y, int z, String command)
    {
        CompoundTag root = createTileRoot(x, y, z, "Control");
        root.put("Command", new StringTag("Command", command));
        return new CommandBlock(root);
    }
View Full Code Here


        return new CommandBlock(root);
    }
   
    protected CompoundTag createTileRoot(int x, int y, int z, String id)
    {
        CompoundTag root = new CompoundTag();
        root.put("x", new IntTag("x", x));
        root.put("y", new IntTag("y", y));
        root.put("z", new IntTag("z", z));
        root.put("id", new StringTag("id", id));
        return root;
    }
View Full Code Here

        return root;
    }

    protected CompoundTag createEntityRoot(int x, int y, int z, String id)
    {
        CompoundTag root = new CompoundTag();
       
        root.put("id", new StringTag("id", id));
       
        ListTag<DoubleTag> pos = new ListTag<DoubleTag>("Pos");
        pos.add(new DoubleTag("x", x));
        pos.add(new DoubleTag("y", y));
        pos.add(new DoubleTag("z", z));
        root.put("Pos", pos)

        ListTag<DoubleTag> motion = new ListTag<DoubleTag>("Motion");
        motion.add(new DoubleTag("dX", 0));
        motion.add(new DoubleTag("dY", 0));
        motion.add(new DoubleTag("dZ", 0));
        root.put("Motion", motion);

        ListTag<FloatTag> rotation = new ListTag<FloatTag>("Rotation");
        rotation.add(new FloatTag("yaw", 0));
        rotation.add(new FloatTag("pitch", 0));
        root.put("Rotation", rotation);

        root.put("FallDistance", new FloatTag("FallDistance", 0));
        root.put("Fire", new ShortTag("Fire", (short)0));
        root.put("Air", new ShortTag("Air", (short)0));
        root.put("OnGround", new ByteTag("OnGround", (byte)0));
        root.put("Dimension", new IntTag("Dimension", 0));
        root.put("Invulnerable", new ByteTag("Invulnerable", (byte)1));
        root.put("PortalCooldown", new IntTag("PortalCooldown", 0));
       
        return root;
    }
View Full Code Here

    }
   
    @SuppressWarnings("unchecked")
    public static Chunk loadChunk(CompoundTag tag, EntityFactory factory)
    {
        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");

        Chunk chunk = new Chunk(xPos.data, zPos.data, heightmap.data, biome.data);
        chunk.loadSections(sections);

        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

   
    protected void loadSections(ListTag<CompoundTag> sections)
    {
        for(int i = 0; i < sections.size(); i++)
        {
            CompoundTag section = sections.get(i);
            Section sec = Section.loadSection(section);
            int y = sec.getY();
            this.sections[y] = sec;
        }
    }
View Full Code Here

        ((IntTag)tag.get("y")).data += y;
        ((IntTag)tag.get("z")).data += z;
       
        if(getID().equals("MobSpawner"))
        {
            CompoundTag data = ((CompoundTag)tag.get("SpawnData"));
            if(data != null)
            {
                Tag temp = data.get("Pos");               
                if(temp != null && (temp instanceof ListTag<?>))
                {
                    ListTag<DoubleTag> pos = (ListTag<DoubleTag>)temp;
                    pos.get(0).data += x;
                    pos.get(1).data += y;
View Full Code Here

        return true;
    }

    public CompoundTag createTag()
    {
        CompoundTag tag = new CompoundTag();

        ByteTag tagY = new ByteTag("Y", (byte) y);
        ByteArrayTag tagBlockid = new ByteArrayTag("Blocks", blockid);
        ByteArrayTag tagMetadata = new ByteArrayTag("Data", metadata.array);
        ByteArrayTag tagSkylight = new ByteArrayTag("SkyLight", skylight.array);
        ByteArrayTag tagBlocklight = new ByteArrayTag("BlockLight", blocklight.array);

        tag.put("Y", tagY);
        tag.put("Blocks", tagBlockid);
        tag.put("Data", tagMetadata);
        tag.put("SkyLight", tagSkylight);
        tag.put("BlockLight", tagBlocklight);

        return tag;
    }
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.