Search in sources :

Example 1 with JavaMinecraftWorld

use of org.pepsoft.worldpainter.exporting.JavaMinecraftWorld 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 JavaMinecraftWorld

use of org.pepsoft.worldpainter.exporting.JavaMinecraftWorld 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)

Example 3 with JavaMinecraftWorld

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

the class WPDynmapWorld method forMinecraftMap.

public static WPDynmapWorld forMinecraftMap(File worldDir, int dim) throws IOException {
    File levelDatFile = new File(worldDir, "level.dat");
    Level level = Level.load(levelDatFile);
    return forMinecraftWorld(new JavaMinecraftWorld(worldDir, dim, level.getMaxHeight(), level.getVersion() == org.pepsoft.minecraft.Constants.SUPPORTED_VERSION_1 ? DefaultPlugin.JAVA_MCREGION : DefaultPlugin.JAVA_ANVIL, true, 256), level.getName(), dim, 62, new Point3i(level.getSpawnX(), level.getSpawnZ(), level.getSpawnY()));
}
Also used : Point3i(javax.vecmath.Point3i) File(java.io.File) JavaMinecraftWorld(org.pepsoft.worldpainter.exporting.JavaMinecraftWorld)

Aggregations

File (java.io.File)3 JavaMinecraftWorld (org.pepsoft.worldpainter.exporting.JavaMinecraftWorld)3 Level (org.pepsoft.minecraft.Level)2 MinecraftWorld (org.pepsoft.worldpainter.exporting.MinecraftWorld)2 Point3i (javax.vecmath.Point3i)1