From 3ada3a9774ac47e0cd830e14c765f7b65fdd78b1 Mon Sep 17 00:00:00 2001 From: sk89q Date: Fri, 29 Apr 2011 23:15:09 -0700 Subject: [PATCH] Added light level to the query tool. --- src/com/sk89q/worldedit/LocalWorld.java | 8 ++++++++ src/com/sk89q/worldedit/bukkit/BukkitWorld.java | 11 +++++++++++ src/com/sk89q/worldedit/tools/QueryTool.java | 4 ++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/com/sk89q/worldedit/LocalWorld.java b/src/com/sk89q/worldedit/LocalWorld.java index fbec2d47c..9a6bdf0ac 100644 --- a/src/com/sk89q/worldedit/LocalWorld.java +++ b/src/com/sk89q/worldedit/LocalWorld.java @@ -79,6 +79,14 @@ public abstract class LocalWorld { * @return */ public abstract int getBlockData(Vector pt); + + /** + * Get block light level. + * + * @param pt + * @return + */ + public abstract int getBlockLightLevel(Vector pt); /** * Regenerate an area. diff --git a/src/com/sk89q/worldedit/bukkit/BukkitWorld.java b/src/com/sk89q/worldedit/bukkit/BukkitWorld.java index 2a729dca9..9b32f4d0c 100644 --- a/src/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/src/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -113,6 +113,17 @@ public class BukkitWorld extends LocalWorld { return world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).getData(); } + /** + * Get block light level. + * + * @param pt + * @return + */ + @Override + public int getBlockLightLevel(Vector pt) { + return world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).getLightLevel(); + } + /** * Regenerate an area. * diff --git a/src/com/sk89q/worldedit/tools/QueryTool.java b/src/com/sk89q/worldedit/tools/QueryTool.java index fcd3e4dd8..da30b3dd5 100644 --- a/src/com/sk89q/worldedit/tools/QueryTool.java +++ b/src/com/sk89q/worldedit/tools/QueryTool.java @@ -37,10 +37,10 @@ public class QueryTool implements BlockTool { BaseBlock block = (new EditSession(world, 0)).rawGetBlock(clicked); player.print("\u00A79@" + clicked + ": " + "\u00A7e" - + "Type: " + block.getType() + "\u00A77" + " (" + + "#" + block.getType() + "\u00A77" + " (" + BlockType.fromID(block.getType()).getName() + ") " + "\u00A7f" - + "[" + block.getData() + "]"); + + "[" + block.getData() + "]" + " (" + world.getBlockLightLevel(clicked) + "/" + world.getBlockLightLevel(clicked.add(0, 1, 0)) + ")"); if (block instanceof MobSpawnerBlock) { player.printRaw("\u00A7e" + "Mob Type: "