mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-28 07:56:44 +01:00
Merge pull request #4005 from falxie/mc1.18/dev
Fix StationUnloadedCondition not working in other dimensions
This commit is contained in:
commit
d0c76494d7
1 changed files with 13 additions and 4 deletions
|
@ -13,6 +13,9 @@ import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.resources.ResourceKey;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
|
||||||
public class StationUnloadedCondition extends ScheduleWaitCondition {
|
public class StationUnloadedCondition extends ScheduleWaitCondition {
|
||||||
@Override
|
@Override
|
||||||
|
@ -25,9 +28,15 @@ public class StationUnloadedCondition extends ScheduleWaitCondition {
|
||||||
GlobalStation currentStation = train.getCurrentStation();
|
GlobalStation currentStation = train.getCurrentStation();
|
||||||
if (currentStation == null)
|
if (currentStation == null)
|
||||||
return false;
|
return false;
|
||||||
if (level instanceof ServerLevel serverLevel)
|
ResourceKey<Level> stationDim = currentStation.getTileDimension();
|
||||||
return !serverLevel.isPositionEntityTicking(currentStation.getTilePos());
|
MinecraftServer server = level.getServer();
|
||||||
return false;
|
if (server == null)
|
||||||
|
return false;
|
||||||
|
ServerLevel stationLevel = server.getLevel(stationDim);
|
||||||
|
if (stationLevel == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !stationLevel.isPositionEntityTicking(currentStation.getTilePos());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -45,4 +54,4 @@ public class StationUnloadedCondition extends ScheduleWaitCondition {
|
||||||
public MutableComponent getWaitingStatus(Level level, Train train, CompoundTag tag) {
|
public MutableComponent getWaitingStatus(Level level, Train train, CompoundTag tag) {
|
||||||
return Lang.translateDirect("schedule.condition.unloaded.status");
|
return Lang.translateDirect("schedule.condition.unloaded.status");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue