Skip to content

Commit

Permalink
fix cursor_on error
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Aug 27, 2019
1 parent 072c23b commit 6782f0c
Showing 1 changed file with 11 additions and 1 deletion.
Expand Up @@ -826,6 +826,16 @@ else if (!isGeneric()) {
return null;
}

public Location getTargetBlockSafe(Set<Material> mats, int range) {
try {
NMSHandler.getChunkHelper().changeChunkServerThread(getWorld());
return getLivingEntity().getTargetBlock(mats, range).getLocation();
}
finally {
NMSHandler.getChunkHelper().restoreServerThread(getWorld());
}
}

/**
* Gets the velocity of this entity
*
Expand Down Expand Up @@ -1759,7 +1769,7 @@ else if (mtr.angle == BlockFace.EAST) {
}
attribute = attribute.fulfill(1);
}
return new LocationTag(getLivingEntity().getTargetBlock(set, range).getLocation()).getAttribute(attribute);
return new LocationTag(getTargetBlockSafe(set, range)).getAttribute(attribute);
}

// <--[tag]
Expand Down

0 comments on commit 6782f0c

Please sign in to comment.