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

View file

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