forked from SteamWar/SteamWar
Fix nullpointer in RCursor
This commit is contained in:
@@ -44,7 +44,8 @@ public class RCursor {
|
|||||||
|
|
||||||
RayTraceUtils.RRayTraceResult rayTraceResult = RayTraceUtils.traceREntity(owner, owner.getLocation(), targetServer.getEntities());
|
RayTraceUtils.RRayTraceResult rayTraceResult = RayTraceUtils.traceREntity(owner, owner.getLocation(), targetServer.getEntities());
|
||||||
if (rayTraceResult == null) {
|
if (rayTraceResult == null) {
|
||||||
cursorEntity.die();
|
if(cursorEntity != null) cursorEntity.die();
|
||||||
|
cursorEntity = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,12 +59,15 @@ public class RCursor {
|
|||||||
if (cursorEntity == null) {
|
if (cursorEntity == null) {
|
||||||
cursorEntity = new RFallingBlockEntity(targetServer, activeCursorLocation, activeCursorMaterial);
|
cursorEntity = new RFallingBlockEntity(targetServer, activeCursorLocation, activeCursorMaterial);
|
||||||
cursorEntity.setNoGravity(true);
|
cursorEntity.setNoGravity(true);
|
||||||
} else if (cursorEntity.getMaterial() == activeCursorMaterial) {
|
} if (cursorEntity.getMaterial() == activeCursorMaterial) {
|
||||||
cursorEntity.move(activeCursorLocation);
|
cursorEntity.move(activeCursorLocation);
|
||||||
} else {
|
} else {
|
||||||
cursorEntity.die();
|
cursorEntity.die();
|
||||||
cursorEntity = new RFallingBlockEntity(targetServer, activeCursorLocation, activeCursorMaterial);
|
cursorEntity = new RFallingBlockEntity(targetServer, activeCursorLocation, activeCursorMaterial);
|
||||||
cursorEntity.setNoGravity(true);
|
cursorEntity.setNoGravity(true);
|
||||||
|
if(activeCursorMaterial == highlightMaterial) {
|
||||||
|
cursorEntity.setGlowing(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,6 +75,7 @@ public class RCursor {
|
|||||||
visible = false;
|
visible = false;
|
||||||
if (cursorEntity != null) {
|
if (cursorEntity != null) {
|
||||||
cursorEntity.die();
|
cursorEntity.die();
|
||||||
|
cursorEntity = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user