Skip to content

Commit

Permalink
fix entityitem property error for endermen
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed May 7, 2021
1 parent a5e78c4 commit 6895962
Showing 1 changed file with 5 additions and 3 deletions.
Expand Up @@ -10,6 +10,7 @@
import com.denizenscript.denizencore.tags.Attribute;
import net.citizensnpcs.api.npc.NPC;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Enderman;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Item;
Expand Down Expand Up @@ -65,10 +66,11 @@ else if (item.getBukkitEntityType() == EntityType.TRIDENT) {
return new ItemTag(NMSHandler.getEntityHelper().getItemFromTrident(item.getBukkitEntity()));
}
else if (item.getBukkitEntity() instanceof Enderman) {
Material mat = ((Enderman) item.getBukkitEntity()).getCarriedBlock().getMaterial();
if (mat == null) {
mat = Material.AIR;
BlockData data = ((Enderman) item.getBukkitEntity()).getCarriedBlock();
if (data == null) {
return new ItemTag(Material.AIR);
}
Material mat = data.getMaterial();
return new ItemTag(mat);
}
else if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_15) && item.getBukkitEntity() instanceof ThrowableProjectile) {
Expand Down

0 comments on commit 6895962

Please sign in to comment.