Examples of StringTag


Examples of com.sk89q.jnbt.StringTag

    }

    @Override
    public CompoundTag getNbtData() {
        Map<String, Tag> values = new HashMap<String, Tag>();
        values.put("Text1", new StringTag(text[0]));
        values.put("Text2", new StringTag(text[1]));
        values.put("Text3", new StringTag(text[2]));
        values.put("Text4", new StringTag(text[3]));
        return new CompoundTag(values);
    }
View Full Code Here

Examples of com.sk89q.jnbt.StringTag

        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);
            }
        }

        schematic.put("Blocks", new ByteArrayTag(blocks));
        schematic.put("Data", new ByteArrayTag(blockData));
        schematic.put("TileEntities", new ListTag(CompoundTag.class, tileEntities));

        if (addBlocks != null) {
            schematic.put("AddBlocks", new ByteArrayTag(addBlocks));
        }

        // ====================================================================
        // Entities
        // ====================================================================

        List<Tag> entities = new ArrayList<Tag>();
        for (Entity entity : clipboard.getEntities()) {
            BaseEntity state = entity.getState();

            if (state != null) {
                Map<String, Tag> values = new HashMap<String, Tag>();

                // Put NBT provided data
                CompoundTag rawTag = state.getNbtData();
                if (rawTag != null) {
                    values.putAll(rawTag.getValue());
                }

                // Store our location data, overwriting any
                values.put("id", new StringTag(state.getTypeId()));
                values.put("Pos", writeVector(entity.getLocation().toVector(), "Pos"));
                values.put("Rotation", writeRotation(entity.getLocation(), "Rotation"));

                CompoundTag entityTag = new CompoundTag(values);
                entities.add(entityTag);
View Full Code Here

Examples of com.sk89q.jnbt.StringTag

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

Examples of er.chronic.tags.StringTag

  public void testToken() {
    Token token = new Token("foo");
    assertEquals(0, token.getTags().size());
    assertFalse(token.isTagged());
    token.tag(new StringTag("mytag"));
    assertEquals(1, token.getTags().size());
    assertTrue(token.isTagged());
    assertEquals(StringTag.class, token.getTag(StringTag.class).getClass());
    token.tag(new Scalar(Integer.valueOf(5)));
    assertEquals(2, token.getTags().size());
View Full Code Here

Examples of net.canarymod.api.nbt.StringTag

        boolean success = true;
        for (String page : pages) {
            if (page == null) {
                continue;
            }
            StringTag toAdd = PAGE_TITLE_AUTHOR.copy();
            toAdd.setName("page" + PAGES_TAG.size());
            toAdd.setValue(correctPage(page));
            success &= book.getDataTag().getListTag("pages").add(toAdd);
        }
        return success;
    }
View Full Code Here

Examples of net.canarymod.api.nbt.StringTag

        boolean success = true;
        for (String page : pages) {
            if (page == null) {
                continue;
            }
            StringTag toAdd = PAGE_TITLE_AUTHOR.copy();
            toAdd.setName("page" + PAGES_TAG.size());
            toAdd.setValue(correctPage(page));
            success &= pages_to_set.add(toAdd);
        }
        book.getDataTag().put("pages", pages_to_set);
        return success;
    }
View Full Code Here

Examples of org.jmule.core.edonkey.packet.tag.StringTag

    if (task.getRequestType() == RequestType.STORE) {
      kad_task.task_type = _._("mainwindow.kadtab.store");
      Publisher publisher = _jkad.getPublisher();
      if (publisher.getPublishKeywordTask(task.getTargetID())!=null) {
        PublishKeywordTask publish_keyword = publisher.getPublishKeywordTask(task.getTargetID());
        StringTag file_name = (StringTag)publish_keyword.getTagList().getTag(JKadConstants.TAG_FILENAME);
        kad_task.task_info = (String)file_name.getValue();
      } else
      if (publisher.getPublishSourceTask(task.getTargetID())!=null) {
        PublishSourceTask publish_keyword = publisher.getPublishSourceTask(task.getTargetID());
        StringTag file_name = (StringTag)publish_keyword.getTagList().getTag(JKadConstants.TAG_FILENAME);
        kad_task.task_info = (String)file_name.getValue();
      }
    }
   
    kad_task.task_id = task.getTargetID().toHexString();
    return kad_task;
View Full Code Here

Examples of org.jmule.core.edonkey.packet.tag.StringTag

  public TagList getTagList() {
    return tagList;
  }

  void setName(String newName) {
    Tag tag = new StringTag(SL_SERVERNAME, newName);
    tagList.removeTag(SL_SERVERNAME);
    tagList.addTag(tag);
  }
View Full Code Here

Examples of org.jmule.core.edonkey.packet.tag.StringTag

      return getAddress();
    }
  }

  void setDesc(String serverDesc) {
    Tag tag = new StringTag(SL_DESCRIPTION, serverDesc);
    tagList.removeTag(SL_DESCRIPTION);
    tagList.addTag(tag);

  }
View Full Code Here

Examples of org.jmule.core.edonkey.packet.tag.StringTag

  DownloadSession(ED2KFileLink fileLink) {
    this();
    try {
      TagList tagList = new TagList();
      Tag tag;
      tag = new StringTag(FT_FILENAME, fileLink.getFileName());
      tagList.addTag(tag);
      tag = new IntTag(FT_FILESIZE, Convert.longToInt((fileLink
          .getFileSize())));
      tagList.addTag(tag);
      createDownloadFiles(fileLink.getFileName(), fileLink.getFileSize(),
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.