Fix nullpointer in RCursor
All checks were successful
SteamWarCI Build successful

This commit is contained in:
D4rkr34lm
2025-05-05 22:46:10 +02:00
parent 139a2c275c
commit 7b25bd31fc

View File

@ -44,7 +44,8 @@ public class RCursor {
RayTraceUtils.RRayTraceResult rayTraceResult = RayTraceUtils.traceREntity(owner, owner.getLocation(), targetServer.getEntities());
if (rayTraceResult == null) {
cursorEntity.die();
if(cursorEntity != null) cursorEntity.die();
cursorEntity = null;
return;
}
@ -58,12 +59,15 @@ public class RCursor {
if (cursorEntity == null) {
cursorEntity = new RFallingBlockEntity(targetServer, activeCursorLocation, activeCursorMaterial);
cursorEntity.setNoGravity(true);
} else if (cursorEntity.getMaterial() == activeCursorMaterial) {
} if (cursorEntity.getMaterial() == activeCursorMaterial) {
cursorEntity.move(activeCursorLocation);
} else {
cursorEntity.die();
cursorEntity = new RFallingBlockEntity(targetServer, activeCursorLocation, activeCursorMaterial);
cursorEntity.setNoGravity(true);
if(activeCursorMaterial == highlightMaterial) {
cursorEntity.setGlowing(true);
}
}
}
@ -71,6 +75,7 @@ public class RCursor {
visible = false;
if (cursorEntity != null) {
cursorEntity.die();
cursorEntity = null;
}
}