Examples of IntTag


Examples of com.mojang.nbt.IntTag

        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
View Full Code Here

Examples of com.mojang.nbt.IntTag

        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.IntTag

    }

    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.IntTag

    }
   
    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.IntTag

        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.IntTag

        {
            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

Examples of com.mojang.nbt.IntTag

    {
        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

Examples of com.mojang.nbt.IntTag

        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");  
View Full Code Here

Examples of com.sk89q.jnbt.IntTag

        HashMap<String, Tag> schematic = new HashMap<String, Tag>();
        schematic.put("Width", new ShortTag((short) width));
        schematic.put("Length", new ShortTag((short) length));
        schematic.put("Height", new ShortTag((short) height));
        schematic.put("Materials", new StringTag("Alpha"));
        schematic.put("WEOriginX", new IntTag(min.getBlockX()));
        schematic.put("WEOriginY", new IntTag(min.getBlockY()));
        schematic.put("WEOriginZ", new IntTag(min.getBlockZ()));
        schematic.put("WEOffsetX", new IntTag(offset.getBlockX()));
        schematic.put("WEOffsetY", new IntTag(offset.getBlockY()));
        schematic.put("WEOffsetZ", new IntTag(offset.getBlockZ()));

        // ====================================================================
        // Block handling
        // ====================================================================

        byte[] blocks = new byte[width * height * length];
        byte[] addBlocks = null;
        byte[] blockData = new byte[width * height * length];
        List<Tag> tileEntities = new ArrayList<Tag>();

        for (Vector point : region) {
            Vector relative = point.subtract(min);
            int x = relative.getBlockX();
            int y = relative.getBlockY();
            int z = relative.getBlockZ();

            int index = y * width * length + z * width + x;
            BaseBlock block = clipboard.getBlock(point);

            // Save 4096 IDs in an AddBlocks section
            if (block.getType() > 255) {
                if (addBlocks == null) { // Lazily create section
                    addBlocks = new byte[(blocks.length >> 1) + 1];
                }

                addBlocks[index >> 1] = (byte) (((index & 1) == 0) ?
                        addBlocks[index >> 1] & 0xF0 | (block.getType() >> 8) & 0xF
                        : addBlocks[index >> 1] & 0xF | ((block.getType() >> 8) & 0xF) << 4);
            }

            blocks[index] = (byte) block.getType();
            blockData[index] = (byte) block.getData();

            // Store TileEntity data
            CompoundTag rawTag = block.getNbtData();
            if (rawTag != null) {
                Map<String, Tag> values = new HashMap<String, Tag>();
                for (Entry<String, Tag> entry : rawTag.getValue().entrySet()) {
                    values.put(entry.getKey(), entry.getValue());
                }

                values.put("id", new StringTag(block.getNbtId()));
                values.put("x", new IntTag(x));
                values.put("y", new IntTag(y));
                values.put("z", new IntTag(z));

                CompoundTag tileEntityTag = new CompoundTag(values);
                tileEntities.add(tileEntityTag);
            }
        }
View Full Code Here

Examples of com.sk89q.jnbt.IntTag

        HashMap<String, Tag> schematic = new HashMap<String, Tag>();
        schematic.put("Width", new ShortTag((short) width));
        schematic.put("Length", new ShortTag((short) length));
        schematic.put("Height", new ShortTag((short) height));
        schematic.put("Materials", new StringTag("Alpha"));
        schematic.put("WEOriginX", new IntTag(clipboard.getOrigin().getBlockX()));
        schematic.put("WEOriginY", new IntTag(clipboard.getOrigin().getBlockY()));
        schematic.put("WEOriginZ", new IntTag(clipboard.getOrigin().getBlockZ()));
        schematic.put("WEOffsetX", new IntTag(clipboard.getOffset().getBlockX()));
        schematic.put("WEOffsetY", new IntTag(clipboard.getOffset().getBlockY()));
        schematic.put("WEOffsetZ", new IntTag(clipboard.getOffset().getBlockZ()));

        // Copy
        byte[] blocks = new byte[width * height * length];
        byte[] addBlocks = null;
        byte[] blockData = new byte[width * height * length];
        ArrayList<Tag> tileEntities = new ArrayList<Tag>();

        for (int x = 0; x < width; ++x) {
            for (int y = 0; y < height; ++y) {
                for (int z = 0; z < length; ++z) {
                    int index = y * width * length + z * width + x;
                    BaseBlock block = clipboard.getPoint(new BlockVector(x, y, z));

                    // Save 4096 IDs in an AddBlocks section
                    if (block.getType() > 255) {
                        if (addBlocks == null) { // Lazily create section
                            addBlocks = new byte[(blocks.length >> 1) + 1];
                        }

                        addBlocks[index >> 1] = (byte) (((index & 1) == 0) ?
                                addBlocks[index >> 1] & 0xF0 | (block.getType() >> 8) & 0xF
                                : addBlocks[index >> 1] & 0xF | ((block.getType() >> 8) & 0xF) << 4);
                    }

                    blocks[index] = (byte) block.getType();
                    blockData[index] = (byte) block.getData();

                    // Get the list of key/values from the block
                    CompoundTag rawTag = block.getNbtData();
                    if (rawTag != null) {
                        Map<String, Tag> values = new HashMap<String, Tag>();
                        for (Entry<String, Tag> entry : rawTag.getValue().entrySet()) {
                            values.put(entry.getKey(), entry.getValue());
                        }

                        values.put("id", new StringTag(block.getNbtId()));
                        values.put("x", new IntTag(x));
                        values.put("y", new IntTag(y));
                        values.put("z", new IntTag(z));

                        CompoundTag tileEntityTag = new CompoundTag(values);
                        tileEntities.add(tileEntityTag);
                    }
                }
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.