Skip to content

Commit

Permalink
update, try to fix thing
Browse files Browse the repository at this point in the history
  • Loading branch information
screret committed Nov 3, 2023
1 parent 9a467b8 commit 8748332
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
- add satellite packaging machine (slightly nonfunctional)
- make space not have the starting platform, rocket places it from the package.
- make space not have the starting platform, rocket places it from the package.
- fix GT compat.

WARNING: space station doesn't build correctly just yet.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import argent_matter.gcyr.GCyR;
import argent_matter.gcyr.api.capability.ISpaceStationHolder;
import argent_matter.gcyr.api.space.planet.Planet;
import argent_matter.gcyr.common.worldgen.SpaceLevelSource;
import argent_matter.gcyr.data.loader.PlanetData;
import argent_matter.gcyr.util.Vec2i;
Expand All @@ -26,7 +27,13 @@
public class StationWorldSavedData extends SavedData implements ISpaceStationHolder {
@Nullable
public static StationWorldSavedData getOrCreate(@Nullable ServerLevel serverLevel) {
if (serverLevel == null || !PlanetData.isOrbitLevel(serverLevel.dimension())) return null;
if (serverLevel == null) return null;
if (!PlanetData.isOrbitLevel(serverLevel.dimension())) {
Planet planet = PlanetData.getPlanetFromLevel(serverLevel.dimension()).orElse(null);
if (planet == null) return null;
ServerLevel orbit = serverLevel.getServer().getLevel(planet.orbitWorld());
return getOrCreate(orbit);
}
return serverLevel.getDataStorage().computeIfAbsent(tag -> new StationWorldSavedData(serverLevel, tag), () -> new StationWorldSavedData(serverLevel), GCyR.MOD_ID + "_space_stations");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ public void unBuild() {
private void buildSpaceStation(ItemStack stack, BlockPos origin) {
if (!GCyRItems.SPACE_STATION_PACKAGE.isIn(stack)) return;
Set<PosWithState> blocks = StationContainerBehaviour.getSatelliteBlocks(stack);
if (blocks == null) return;
if (blocks == null || blocks.isEmpty()) return;

boolean start = true;
BlockPos original = origin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static Set<PosWithState> getSatelliteBlocks(ItemStack stack) {
if (!stack.hasTag() || !stack.getTag().contains(SATELLITE_BLOCKS_KEY, Tag.TAG_LIST)) return null;

Set<PosWithState> states = new HashSet<>();
ListTag blocks = stack.getOrCreateTag().getList("blocks", Tag.TAG_COMPOUND);
ListTag blocks = stack.getOrCreateTag().getList(SATELLITE_BLOCKS_KEY, Tag.TAG_COMPOUND);
for (int i = 0; i < blocks.size(); ++i) {
states.add(PosWithState.readFromTag(blocks.getCompound(i)));
}
Expand Down

0 comments on commit 8748332

Please sign in to comment.