diff options
author | md_5 <git@md-5.net> | 2018-07-28 08:28:56 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-07-28 08:28:56 +1000 |
commit | 4d3ef4821f61be8dc692b58bf0673029dc16e9f1 (patch) | |
tree | c108e35b5257c4bd5df547535548057b85a017a8 /src/main/java/org | |
parent | 4b00823222b633f1776cdc12da55b2e0f88371e2 (diff) | |
download | craftbukkit-4d3ef4821f61be8dc692b58bf0673029dc16e9f1.tar craftbukkit-4d3ef4821f61be8dc692b58bf0673029dc16e9f1.tar.gz craftbukkit-4d3ef4821f61be8dc692b58bf0673029dc16e9f1.tar.lz craftbukkit-4d3ef4821f61be8dc692b58bf0673029dc16e9f1.tar.xz craftbukkit-4d3ef4821f61be8dc692b58bf0673029dc16e9f1.zip |
SPIGOT-4164: Treat new _AIR blocks as air
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java | 2 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java | 14 |
2 files changed, 7 insertions, 9 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index d6e4adf1..f5dc63f2 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -489,7 +489,7 @@ public class CraftBlock implements Block { } public boolean isEmpty() { - return getType() == Material.AIR; + return getNMS().isAir(); } public boolean isLiquid() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 3bf5b2a6..ae402a2b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -1,5 +1,6 @@ package org.bukkit.craftbukkit.entity; +import com.google.common.collect.Sets; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; @@ -134,6 +135,9 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } private List<Block> getLineOfSight(Set<Material> transparent, int maxDistance, int maxLength) { + if (transparent == null) { + transparent = Sets.newHashSet(Material.AIR, Material.CAVE_AIR, Material.VOID_AIR); + } if (maxDistance > 120) { maxDistance = 120; } @@ -146,14 +150,8 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { blocks.remove(0); } Material material = block.getType(); - if (transparent == null) { - if (!material.equals(Material.AIR)) { - break; - } - } else { - if (!transparent.contains(material)) { - break; - } + if (!transparent.contains(material)) { + break; } } return blocks; |