Skip to content

Commit

Permalink
Fix NullPointerException due to nullable source extent in ExtentEntit…
Browse files Browse the repository at this point in the history
…yCopy (#2447)

Fix NullPointerException due to nullable source extent

Co-authored-by: opl <4833621+opl@users.noreply.github.com>
  • Loading branch information
opl- and opl- authored Oct 7, 2023
1 parent 90d52f3 commit aae9249
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ private BaseEntity transformNbtData(BaseEntity state) {
//FAWE start
if (hasRotation) {
ListTag orgrot = state.getNbtData().getListTag("Rotation");
Vector3 orgDirection = new Location(source, 0, 0, 0, orgrot.getFloat(0), orgrot.getFloat(1)).getDirection();
// source extent may be null: use non-nullable destination instead since this is just a conversion into a vector.
Vector3 orgDirection = new Location(destination, 0, 0, 0, orgrot.getFloat(0), orgrot.getFloat(1)).getDirection();
Vector3 newDirection = transform.apply(orgDirection).subtract(transform.apply(Vector3.ZERO)).normalize();
builder.put(
"Rotation",
Expand All @@ -276,7 +277,8 @@ private BaseEntity transformNbtData(BaseEntity state) {
CompoundTagBuilder builder = tag.createBuilder();

ListTag orgrot = state.getNbtData().getListTag("Rotation");
Vector3 orgDirection = new Location(source, 0, 0, 0, orgrot.getFloat(0), orgrot.getFloat(1)).getDirection();
// source extent may be null: use non-nullable destination instead since this is just a conversion into a vector.
Vector3 orgDirection = new Location(destination, 0, 0, 0, orgrot.getFloat(0), orgrot.getFloat(1)).getDirection();
Vector3 newDirection = transform.apply(orgDirection).subtract(transform.apply(Vector3.ZERO)).normalize();
builder.put(
"Rotation",
Expand Down

0 comments on commit aae9249

Please sign in to comment.