Search in sources :

Example 1 with MinecraftWorld

use of org.pepsoft.worldpainter.exporting.MinecraftWorld in project WorldPainter by Captain-Chaos.

the class DumpWater method main.

public static final void main(String[] args) throws IOException {
    File levelDatFile = new File(args[0]);
    int x = Integer.parseInt(args[1]);
    int y = Integer.parseInt(args[2]);
    int z = Integer.parseInt(args[3]);
    Level level = Level.load(levelDatFile);
    MinecraftWorld world = new JavaMinecraftWorld(levelDatFile.getParentFile(), 0, level.getMaxHeight(), level.getVersion() == SUPPORTED_VERSION_1 ? DefaultPlugin.JAVA_MCREGION : DefaultPlugin.JAVA_ANVIL, true, CACHE_SIZE);
    for (int dy = 16; dy >= -16; dy--) {
        for (int dx = -16; dx <= 16; dx++) {
            int blockX = x + dx, blockZ = z;
            int blockType = world.getBlockTypeAt(blockX, blockZ, y + dy);
            System.out.print('[');
            System.out.print(blockType != BLK_AIR ? BLOCK_TYPE_NAMES[blockType].substring(0, 3).toUpperCase() : "   ");
            System.out.print(';');
            int data = world.getDataAt(blockX, blockZ, y + dy);
            if (data > 0) {
                if (data < 10) {
                    System.out.print('0');
                }
                System.out.print(data);
            } else {
                System.out.print("  ");
            }
            System.out.print(']');
        }
        System.out.println();
    }
}
Also used : MinecraftWorld(org.pepsoft.worldpainter.exporting.MinecraftWorld) JavaMinecraftWorld(org.pepsoft.worldpainter.exporting.JavaMinecraftWorld) Level(org.pepsoft.minecraft.Level) File(java.io.File) JavaMinecraftWorld(org.pepsoft.worldpainter.exporting.JavaMinecraftWorld)

Example 2 with MinecraftWorld

use of org.pepsoft.worldpainter.exporting.MinecraftWorld in project WorldPainter by Captain-Chaos.

the class DumpLighting method main.

public static void main(String[] args) throws IOException {
    File levelDatFile = new File(args[0]);
    int x = Integer.parseInt(args[1]);
    int y = Integer.parseInt(args[2]);
    int z = Integer.parseInt(args[3]);
    Level level = Level.load(levelDatFile);
    MinecraftWorld world = new JavaMinecraftWorld(levelDatFile.getParentFile(), 0, level.getMaxHeight(), level.getVersion() == SUPPORTED_VERSION_1 ? DefaultPlugin.JAVA_MCREGION : DefaultPlugin.JAVA_ANVIL, true, CACHE_SIZE);
    for (int dy = 16; dy >= -62; dy--) {
        for (int dx = -16; dx <= 16; dx++) {
            int blockX = x + dx, blockZ = z;
            int blockType = world.getBlockTypeAt(blockX, blockZ, y + dy);
            System.out.print('[');
            System.out.print(blockType != BLK_AIR ? BLOCK_TYPE_NAMES[blockType].substring(0, 3).toUpperCase() : "   ");
            System.out.print(';');
            int skyLightLevel = world.getSkyLightLevel(blockX, blockZ, y + dy);
            if (skyLightLevel < 15) {
                if (skyLightLevel < 10) {
                    System.out.print('0');
                }
                System.out.print(skyLightLevel);
            } else {
                System.out.print("  ");
            }
            // int blockLightLevel = world.getBlockLightLevel(blockX, blockZ, y + dy);
            // if (blockLightLevel > 0) {
            // if (blockLightLevel < 10) {
            // System.out.print('0');
            // }
            // System.out.print(blockLightLevel);
            // } else {
            // System.out.print("  ");
            // }
            System.out.print(']');
        }
        System.out.println();
    }
}
Also used : MinecraftWorld(org.pepsoft.worldpainter.exporting.MinecraftWorld) JavaMinecraftWorld(org.pepsoft.worldpainter.exporting.JavaMinecraftWorld) Level(org.pepsoft.minecraft.Level) File(java.io.File) JavaMinecraftWorld(org.pepsoft.worldpainter.exporting.JavaMinecraftWorld)

Aggregations

File (java.io.File)2 Level (org.pepsoft.minecraft.Level)2 JavaMinecraftWorld (org.pepsoft.worldpainter.exporting.JavaMinecraftWorld)2 MinecraftWorld (org.pepsoft.worldpainter.exporting.MinecraftWorld)2