From 0f49186bf57f4e4293af30c6852df06853526965 Mon Sep 17 00:00:00 2001 From: sk89q Date: Thu, 18 Oct 2012 23:12:53 -0700 Subject: [PATCH] Fixed reported bug that block #0 (air) is not considered valid. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed a reported bug that block #0 (air) is not considered valid. Also set skipNmsValidBlockCheck to true if the check fails (as I assume was originally intended). --- src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index 18a2fe431..ad1138023 100644 --- a/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -869,10 +869,11 @@ public class BukkitWorld extends LocalWorld { public boolean isValidBlockType(int type) { if (!skipNmsValidBlockCheck) { try { - return type >=0 && type < net.minecraft.server.Block.byId.length - && net.minecraft.server.Block.byId[type] != null; + return type == 0 || (type >= 1 && type < net.minecraft.server.Block.byId.length + && net.minecraft.server.Block.byId[type] != null); } catch (Exception e) { logger.log(Level.SEVERE, "Error checking NMS valid block type", e); + skipNmsValidBlockCheck = true; } } return Material.getMaterial(type) != null && Material.getMaterial(type).isBlock();