summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-08-15 08:51:18 +1000
committermd_5 <git@md-5.net>2018-08-15 08:51:18 +1000
commit452a173807261fbf8c016223277bd26cb77c62d1 (patch)
tree7ff97989a783bc093f79b11731a1d36d3f71e197 /src
parent4a241086654d1331eaf51c749306a04ae224e7f1 (diff)
downloadcraftbukkit-452a173807261fbf8c016223277bd26cb77c62d1.tar
craftbukkit-452a173807261fbf8c016223277bd26cb77c62d1.tar.gz
craftbukkit-452a173807261fbf8c016223277bd26cb77c62d1.tar.lz
craftbukkit-452a173807261fbf8c016223277bd26cb77c62d1.tar.xz
craftbukkit-452a173807261fbf8c016223277bd26cb77c62d1.zip
SPIGOT-4271: Fix API error when enderman are not carrying a block
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
index 5998530a..b81693d9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
@@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityEnderman;
import net.minecraft.server.IBlockData;
+import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
@@ -18,13 +19,13 @@ public class CraftEnderman extends CraftMonster implements Enderman {
public MaterialData getCarriedMaterial() {
IBlockData blockData = getHandle().getCarried();
- return CraftMagicNumbers.getMaterial(blockData);
+ return (blockData == null) ? Material.AIR.getNewData((byte) 0) : CraftMagicNumbers.getMaterial(blockData);
}
@Override
public BlockData getCarriedBlock() {
IBlockData blockData = getHandle().getCarried();
- return CraftBlockData.fromData(blockData);
+ return (blockData == null) ? null : CraftBlockData.fromData(blockData);
}
public void setCarriedMaterial(MaterialData data) {
@@ -33,7 +34,7 @@ public class CraftEnderman extends CraftMonster implements Enderman {
@Override
public void setCarriedBlock(BlockData blockData) {
- getHandle().setCarried(((CraftBlockData) blockData).getState());
+ getHandle().setCarried(blockData == null ? null : ((CraftBlockData) blockData).getState());
}
@Override