mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-18 07:53:07 +01:00
Fix StationUnloadedCondition not working in other dimensions
This commit is contained in:
parent
cf87508276
commit
c5e178de80
1 changed files with 14 additions and 4 deletions
|
@ -13,6 +13,9 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
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 {
|
||||
@Override
|
||||
|
@ -25,9 +28,16 @@ public class StationUnloadedCondition extends ScheduleWaitCondition {
|
|||
GlobalStation currentStation = train.getCurrentStation();
|
||||
if (currentStation == null)
|
||||
return false;
|
||||
if (level instanceof ServerLevel serverLevel)
|
||||
return !serverLevel.isPositionEntityTicking(currentStation.getTilePos());
|
||||
BlockPos stationPos = currentStation.getTilePos();
|
||||
ResourceKey<Level> stationDim = currentStation.getTileDimension();
|
||||
MinecraftServer server = level.getServer();
|
||||
if (server == null)
|
||||
return false;
|
||||
ServerLevel stationLevel = server.getLevel(stationDim);
|
||||
if (stationLevel == null) {
|
||||
return false;
|
||||
}
|
||||
return !stationLevel.isPositionEntityTicking(currentStation.getTilePos());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue