mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-14 16:23:42 +01:00
fix nullability crash in Carriage.java
This commit is contained in:
parent
157077b0ef
commit
52593a2ae9
1 changed files with 10 additions and 5 deletions
|
@ -16,6 +16,8 @@ import java.util.function.Function;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
|
||||||
import org.apache.commons.lang3.mutable.MutableDouble;
|
import org.apache.commons.lang3.mutable.MutableDouble;
|
||||||
|
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
|
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
|
||||||
|
@ -129,7 +131,7 @@ public class Carriage {
|
||||||
boolean onTwoBogeys = isOnTwoBogeys();
|
boolean onTwoBogeys = isOnTwoBogeys();
|
||||||
double stress = train.derailed ? 0 : onTwoBogeys ? bogeySpacing - getAnchorDiff() : 0;
|
double stress = train.derailed ? 0 : onTwoBogeys ? bogeySpacing - getAnchorDiff() : 0;
|
||||||
blocked = false;
|
blocked = false;
|
||||||
|
|
||||||
MutableDouble distanceMoved = new MutableDouble(distance);
|
MutableDouble distanceMoved = new MutableDouble(distance);
|
||||||
boolean iterateFromBack = distance < 0;
|
boolean iterateFromBack = distance < 0;
|
||||||
|
|
||||||
|
@ -141,7 +143,7 @@ public class Carriage {
|
||||||
CarriageBogey bogey = bogeys.get(actuallyFirstBogey);
|
CarriageBogey bogey = bogeys.get(actuallyFirstBogey);
|
||||||
double bogeyCorrection = stress * (actuallyFirstBogey ? 0.5d : -0.5d);
|
double bogeyCorrection = stress * (actuallyFirstBogey ? 0.5d : -0.5d);
|
||||||
double bogeyStress = bogey.getStress();
|
double bogeyStress = bogey.getStress();
|
||||||
|
|
||||||
for (boolean firstWheel : Iterate.trueAndFalse) {
|
for (boolean firstWheel : Iterate.trueAndFalse) {
|
||||||
boolean actuallyFirstWheel = firstWheel ^ iterateFromBack;
|
boolean actuallyFirstWheel = firstWheel ^ iterateFromBack;
|
||||||
TravellingPoint point = bogey.points.get(actuallyFirstWheel);
|
TravellingPoint point = bogey.points.get(actuallyFirstWheel);
|
||||||
|
@ -249,8 +251,11 @@ public class Carriage {
|
||||||
|
|
||||||
boolean discard =
|
boolean discard =
|
||||||
!currentlyTraversedDimensions.isEmpty() && !currentlyTraversedDimensions.contains(entry.getKey());
|
!currentlyTraversedDimensions.isEmpty() && !currentlyTraversedDimensions.contains(entry.getKey());
|
||||||
ServerLevel currentLevel = level.getServer()
|
|
||||||
.getLevel(entry.getKey());
|
MinecraftServer server = level.getServer();
|
||||||
|
if (server == null)
|
||||||
|
continue;
|
||||||
|
ServerLevel currentLevel = server.getLevel(entry.getKey());
|
||||||
if (currentLevel == null)
|
if (currentLevel == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -848,7 +853,7 @@ public class Carriage {
|
||||||
train.carriageWaitingForChunks = id;
|
train.carriageWaitingForChunks = id;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.getPassengers()
|
if (entity.getPassengers()
|
||||||
.stream()
|
.stream()
|
||||||
.anyMatch(p -> p instanceof Player)
|
.anyMatch(p -> p instanceof Player)
|
||||||
|
|
Loading…
Reference in a new issue