Basic StationRocketEngineBlock functionality. StationFlightComputerBlock simply sets traveling to true. Rocket crash fixes. TEST

This commit is contained in:
XevianLight
2026-03-28 19:56:15 -06:00
parent 0f4b98a912
commit 341ed8a17d
38 changed files with 705 additions and 103 deletions

View File

@@ -6,6 +6,7 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.Level;
import net.xevianlight.aphelion.Aphelion;
import net.xevianlight.aphelion.util.registries.ModRegistries;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
import java.util.Map;
@@ -17,6 +18,7 @@ public final class PlanetCache {
public static final Planet DEFAULT = new Planet(
ResourceKey.create(Registries.DIMENSION, ResourceLocation.withDefaultNamespace("overworld")),
ResourceKey.create(ModRegistries.ORBIT, Aphelion.id("orbit/overworld")),
1,
ResourceKey.create(ModRegistries.STAR_SYSTEM, Aphelion.id("sol")),
true,
@@ -48,6 +50,17 @@ public final class PlanetCache {
return PLANETS.getOrDefault(id, DEFAULT);
}
public static @Nullable Planet getOrNull(ResourceLocation id) {
return PLANETS.getOrDefault(id, null);
}
public static @Nullable Planet getByOrbitOrNull(ResourceLocation id) {
return PLANETS.values().stream()
.filter(planet -> planet.orbit().location().equals(id))
.findFirst()
.orElse(null);
}
public static Planet getByDimensionOrNull(ResourceKey<Level> dimension) {
ResourceLocation planetId = PLANET_BY_DIMENSION.get(dimension);
return planetId == null ? null : PLANETS.get(planetId);