Package net.glowstone.util.nbt

Examples of net.glowstone.util.nbt.NBTInputStream


        if (buf.readByte() == 0) {
            return null;
        }

        buf.readerIndex(idx);
        try (NBTInputStream str = new NBTInputStream(new ByteBufInputStream(buf), false)) {
            return str.readCompound();
        } catch (IOException e) {
            return null;
        }
    }
View Full Code Here


        }

        DataInputStream in = region.getChunkDataInputStream(regionX, regionZ);

        CompoundTag levelTag;
        try (NBTInputStream nbt = new NBTInputStream(in, false)) {
            CompoundTag root = nbt.readCompound();
            levelTag = root.getCompound("Level");
        }

        // read the vertical sections
        List<CompoundTag> sectionList = levelTag.getCompoundList("Sections");
View Full Code Here

        // read in world information
        CompoundTag level = new CompoundTag();
        File levelFile = new File(dir, "level.dat");
        if (levelFile.exists()) {
            try (NBTInputStream in = new NBTInputStream(new FileInputStream(levelFile))) {
                level = in.readCompound();
                if (level.isCompound("Data")) {
                    level = level.getCompound("Data");
                } else {
                    server.getLogger().warning("Loading world \"" + world.getName() + "\": reading from root, not Data");
                }
View Full Code Here

    @Override
    public void readData(GlowPlayer player) {
        File playerFile = getPlayerFile(player.getUniqueId());
        CompoundTag playerTag = new CompoundTag();
        if (playerFile.exists()) {
            try (NBTInputStream in = new NBTInputStream(new FileInputStream(playerFile))) {
                playerTag = in.readCompound();
            } catch (IOException e) {
                player.kickPlayer("Failed to read player data!");
                server.getLogger().log(Level.SEVERE, "Failed to read data for " + player.getName() + ": " + playerFile, e);
            }
        }
View Full Code Here

        private CompoundTag tag = new CompoundTag();
        private boolean hasPlayed = false;

        public NbtPlayerReader(File playerFile) {
            if (playerFile.exists()) {
                try (NBTInputStream in = new NBTInputStream(new FileInputStream(playerFile))) {
                    tag = in.readCompound();
                    hasPlayed = true;
                } catch (IOException e) {
                    server.getLogger().log(Level.SEVERE, "Failed to read data for player: " + playerFile, e);
                }
            }
View Full Code Here

TOP

Related Classes of net.glowstone.util.nbt.NBTInputStream

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.