Examples of CompoundTag


Examples of com.mojang.nbt.CompoundTag

        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

Examples of com.mojang.nbt.CompoundTag

        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

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

Examples of com.mojang.nbt.CompoundTag

        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

Examples of com.mojang.nbt.CompoundTag

        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

Examples of com.mojang.nbt.CompoundTag

    }
   
    @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

Examples of com.mojang.nbt.CompoundTag

   
    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

Examples of com.mojang.nbt.CompoundTag

        ((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

Examples of com.sk89q.jnbt.CompoundTag

            List<CompoundTag> enchantmentList = new ArrayList<CompoundTag>();
            for(Map.Entry<Integer, Integer> entry : item.getEnchantments().entrySet()) {
                Map<String, Tag> enchantment = new HashMap<String, Tag>();
                enchantment.put("id", new ShortTag(entry.getKey().shortValue()));
                enchantment.put("lvl", new ShortTag(entry.getValue().shortValue()));
                enchantmentList.add(new CompoundTag(enchantment));
            }

            Map<String, Tag> auxData = new HashMap<String, Tag>();
            auxData.put("ench", new ListTag(CompoundTag.class, enchantmentList));
            data.put("tag", new CompoundTag(auxData));
        }
        return data;
    }
View Full Code Here

Examples of com.sk89q.jnbt.CompoundTag

        List<CompoundTag> tags = new ArrayList<CompoundTag>();
        for (int i = 0; i < items.length; ++i) {
            if (items[i] != null) {
                Map<String, Tag> tagData = serializeItem(items[i]);
                tagData.put("Slot", new ByteTag((byte) i));
                tags.add(new CompoundTag(tagData));
            }
        }
        return tags;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.