mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-02-05 18:05:00 +01:00
cleanup
This commit is contained in:
parent
2565fa7605
commit
aff05bf84a
4 changed files with 12 additions and 13 deletions
|
@ -1,7 +1,6 @@
|
||||||
package com.simibubi.create.content.trains.entity;
|
package com.simibubi.create.content.trains.entity;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -55,8 +54,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.network.PacketDistributor;
|
import net.minecraftforge.network.PacketDistributor;
|
||||||
|
|
||||||
import org.openjdk.nashorn.internal.objects.Global;
|
|
||||||
|
|
||||||
public class CarriageContraptionEntity extends OrientedContraptionEntity {
|
public class CarriageContraptionEntity extends OrientedContraptionEntity {
|
||||||
|
|
||||||
private static final EntityDataAccessor<CarriageSyncData> CARRIAGE_DATA =
|
private static final EntityDataAccessor<CarriageSyncData> CARRIAGE_DATA =
|
||||||
|
|
|
@ -611,6 +611,7 @@ public class Navigation {
|
||||||
|
|
||||||
int signalWeight = Mth.clamp(ticksWaitingForSignal * 2, Train.Penalties.RED_SIGNAL, 200);
|
int signalWeight = Mth.clamp(ticksWaitingForSignal * 2, Train.Penalties.RED_SIGNAL, 200);
|
||||||
|
|
||||||
|
// Apply penalties to initial edge
|
||||||
int initialPenalty = 0;
|
int initialPenalty = 0;
|
||||||
if (costRelevant)
|
if (costRelevant)
|
||||||
initialPenalty += penalties.getOrDefault(initialEdge, 0);
|
initialPenalty += penalties.getOrDefault(initialEdge, 0);
|
||||||
|
@ -712,6 +713,7 @@ public class Navigation {
|
||||||
if (costRelevant)
|
if (costRelevant)
|
||||||
newPenalty += penalties.getOrDefault(newEdge, 0);
|
newPenalty += penalties.getOrDefault(newEdge, 0);
|
||||||
|
|
||||||
|
// Apply penalty to next connected edge
|
||||||
boolean hasDestination = false;
|
boolean hasDestination = false;
|
||||||
EdgeData signalData = newEdge.getEdgeData();
|
EdgeData signalData = newEdge.getEdgeData();
|
||||||
if (signalData.hasPoints()) {
|
if (signalData.hasPoints()) {
|
||||||
|
@ -758,7 +760,7 @@ public class Navigation {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
double remainingDist = 0;
|
double remainingDist = 0;
|
||||||
|
// Calculate remaining distance estimator for next connected edge
|
||||||
if (destinations != null && !destinations.isEmpty()) {
|
if (destinations != null && !destinations.isEmpty()) {
|
||||||
remainingDist = Double.MAX_VALUE;
|
remainingDist = Double.MAX_VALUE;
|
||||||
Vec3 newNodePosition = newNode.getLocation().getLocation();
|
Vec3 newNodePosition = newNode.getLocation().getLocation();
|
||||||
|
@ -884,9 +886,9 @@ public class Navigation {
|
||||||
c -> currentPath.add(Couple
|
c -> currentPath.add(Couple
|
||||||
.deserializeEach(c.getList("Nodes", Tag.TAG_COMPOUND), c2 -> TrackNodeLocation.read(c2, dimensions))
|
.deserializeEach(c.getList("Nodes", Tag.TAG_COMPOUND), c2 -> TrackNodeLocation.read(c2, dimensions))
|
||||||
.map(graph::locateNode)));
|
.map(graph::locateNode)));
|
||||||
|
|
||||||
removeBrokenPathEntries();
|
removeBrokenPathEntries();
|
||||||
|
|
||||||
waitingForSignal = tag.contains("BlockingSignal")
|
waitingForSignal = tag.contains("BlockingSignal")
|
||||||
? Pair.of(tag.getUUID("BlockingSignal"), tag.getBoolean("BlockingSignalSide"))
|
? Pair.of(tag.getUUID("BlockingSignal"), tag.getBoolean("BlockingSignalSide"))
|
||||||
: null;
|
: null;
|
||||||
|
@ -901,7 +903,7 @@ public class Navigation {
|
||||||
* Trains might load or save with null entries in their path, this method avoids
|
* Trains might load or save with null entries in their path, this method avoids
|
||||||
* that anomaly from causing NPEs. The underlying issue has not been found.
|
* that anomaly from causing NPEs. The underlying issue has not been found.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
boolean nullEntriesPresent = false;
|
boolean nullEntriesPresent = false;
|
||||||
|
|
||||||
for (Iterator<Couple<TrackNode>> iterator = currentPath.iterator(); iterator.hasNext();) {
|
for (Iterator<Couple<TrackNode>> iterator = currentPath.iterator(); iterator.hasNext();) {
|
||||||
|
|
|
@ -326,9 +326,9 @@ public class ScheduleRuntime {
|
||||||
return accumulatedTime;
|
return accumulatedTime;
|
||||||
if (predictionTicks.size() <= currentEntry)
|
if (predictionTicks.size() <= currentEntry)
|
||||||
return accumulatedTime;
|
return accumulatedTime;
|
||||||
|
|
||||||
int departureTime = estimateStayDuration(index);
|
int departureTime = estimateStayDuration(index);
|
||||||
|
|
||||||
if (accumulatedTime < 0) {
|
if (accumulatedTime < 0) {
|
||||||
predictions.add(createPrediction(index, filter.getFilter(), currentTitle, accumulatedTime));
|
predictions.add(createPrediction(index, filter.getFilter(), currentTitle, accumulatedTime));
|
||||||
return Math.min(accumulatedTime, departureTime);
|
return Math.min(accumulatedTime, departureTime);
|
||||||
|
@ -344,10 +344,10 @@ public class ScheduleRuntime {
|
||||||
|
|
||||||
if (accumulatedTime != TBD)
|
if (accumulatedTime != TBD)
|
||||||
accumulatedTime += departureTime;
|
accumulatedTime += departureTime;
|
||||||
|
|
||||||
if (departureTime == INVALID)
|
if (departureTime == INVALID)
|
||||||
accumulatedTime = INVALID;
|
accumulatedTime = INVALID;
|
||||||
|
|
||||||
return accumulatedTime;
|
return accumulatedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,7 +375,7 @@ public class ScheduleRuntime {
|
||||||
private TrainDeparturePrediction createPrediction(int index, String destination, String currentTitle, int time) {
|
private TrainDeparturePrediction createPrediction(int index, String destination, String currentTitle, int time) {
|
||||||
if (time == INVALID)
|
if (time == INVALID)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
int size = schedule.entries.size();
|
int size = schedule.entries.size();
|
||||||
if (index >= size) {
|
if (index >= size) {
|
||||||
if (!schedule.cyclic)
|
if (!schedule.cyclic)
|
||||||
|
|
|
@ -288,7 +288,7 @@ public class StationBlockEntity extends SmartBlockEntity implements ITransformab
|
||||||
BlockPos up = new BlockPos(track.getUpNormal(level, pos, state));
|
BlockPos up = new BlockPos(track.getUpNormal(level, pos, state));
|
||||||
BlockPos down = new BlockPos(track.getUpNormal(level, pos, state).scale(-1));
|
BlockPos down = new BlockPos(track.getUpNormal(level, pos, state).scale(-1));
|
||||||
int bogeyOffset = pos.distManhattan(edgePoint.getGlobalPosition()) - 1;
|
int bogeyOffset = pos.distManhattan(edgePoint.getGlobalPosition()) - 1;
|
||||||
|
|
||||||
if (!isValidBogeyOffset(bogeyOffset)) {
|
if (!isValidBogeyOffset(bogeyOffset)) {
|
||||||
for (boolean upsideDown : Iterate.falseAndTrue) {
|
for (boolean upsideDown : Iterate.falseAndTrue) {
|
||||||
for (int i = -1; i <= 1; i++) {
|
for (int i = -1; i <= 1; i++) {
|
||||||
|
|
Loading…
Reference in a new issue