mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
Fix NullPointerException due to nullable source extent in ExtentEntityCopy (#2447)
Fix NullPointerException due to nullable source extent Co-authored-by: opl <4833621+opl@users.noreply.github.com>
This commit is contained in:
parent
90d52f39d9
commit
aae9249014
@ -257,7 +257,8 @@ public class ExtentEntityCopy implements EntityFunction {
|
|||||||
//FAWE start
|
//FAWE start
|
||||||
if (hasRotation) {
|
if (hasRotation) {
|
||||||
ListTag orgrot = state.getNbtData().getListTag("Rotation");
|
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();
|
Vector3 newDirection = transform.apply(orgDirection).subtract(transform.apply(Vector3.ZERO)).normalize();
|
||||||
builder.put(
|
builder.put(
|
||||||
"Rotation",
|
"Rotation",
|
||||||
@ -276,7 +277,8 @@ public class ExtentEntityCopy implements EntityFunction {
|
|||||||
CompoundTagBuilder builder = tag.createBuilder();
|
CompoundTagBuilder builder = tag.createBuilder();
|
||||||
|
|
||||||
ListTag orgrot = state.getNbtData().getListTag("Rotation");
|
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();
|
Vector3 newDirection = transform.apply(orgDirection).subtract(transform.apply(Vector3.ZERO)).normalize();
|
||||||
builder.put(
|
builder.put(
|
||||||
"Rotation",
|
"Rotation",
|
||||||
|
Loading…
Reference in New Issue
Block a user