See you later elevator

- Fixed elevator contraptions moving to y=0 when loading in #4830
This commit is contained in:
simibubi 2024-08-10 19:26:14 +02:00
parent 842e1bb3af
commit d8cd79852b
2 changed files with 9 additions and 1 deletions

View file

@ -33,6 +33,7 @@ public class ElevatorColumn {
protected List<Integer> contacts;
protected int targetedYLevel;
protected boolean isActive;
protected boolean targetAvailable;
@Nullable
public static ElevatorColumn get(LevelAccessor level, ColumnCoords coords) {
@ -49,6 +50,7 @@ public class ElevatorColumn {
this.level = level;
this.coords = coords;
contacts = new ArrayList<>();
targetAvailable = false;
}
public void markDirty() {
@ -115,6 +117,10 @@ public class ElevatorColumn {
targetedYLevel = yLevel;
}
public boolean isTargetAvailable() {
return targetAvailable;
}
public int getTargetedYLevel() {
return targetedYLevel;
}

View file

@ -87,7 +87,9 @@ public class ElevatorContraption extends PulleyContraption {
ElevatorColumn column = ElevatorColumn.get(level, coords);
if (column == null)
return null;
int targetedYLevel = column.targetedYLevel;
if (!column.isTargetAvailable())
return null;
int targetedYLevel = column.getTargetedYLevel();
if (isTargetUnreachable(targetedYLevel))
return null;
return targetedYLevel;