Skip to content

Commit

Permalink
fix space having clouds and rain
Browse files Browse the repository at this point in the history
  • Loading branch information
screret committed Aug 28, 2024
1 parent 1a75173 commit da9fbe0
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/generated/resources/data/gcyr/worldgen/biome/space.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"carvers": {},
"downfall": 0.5,
"downfall": 0.0,
"effects": {
"fog_color": 12638463,
"sky_color": 8103167,
"water_color": 4159204,
"water_fog_color": 329011
},
"features": [],
"has_precipitation": true,
"has_precipitation": false,
"spawn_costs": {},
"spawners": {
"ambient": [],
Expand Down
23 changes: 18 additions & 5 deletions src/main/java/argent_matter/gcyr/common/data/GCYRBiomes.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,28 @@ public static void bootstrap(BootstapContext<Biome> ctx) {

public static Biome space(HolderGetter<PlacedFeature> placedFeatures, HolderGetter<ConfiguredWorldCarver<?>> worldCarvers) {
BiomeGenerationSettings.Builder builder = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers);
return biome(0.0f, 0.5F, 0.5F, new MobSpawnSettings.Builder(), builder, null);
return biome(0.0f, 0.5F, false, new MobSpawnSettings.Builder(), builder, null);
}

private static Biome biome(float downfall, float temp, float rainfall, MobSpawnSettings.Builder spawn, BiomeGenerationSettings.Builder gen, @Nullable Music music) {
return biome(downfall, temp, rainfall, 4159204, 329011, spawn, gen, music);
private static Biome biome(float downfall, float temp, boolean hasRain, MobSpawnSettings.Builder spawn, BiomeGenerationSettings.Builder gen, @Nullable Music music) {
return biome(downfall, temp, hasRain, 4159204, 329011, spawn, gen, music);
}

private static Biome biome(float downfall, float temp, float rainfall, int waterColor, int waterFogColor, MobSpawnSettings.Builder mobSpawning, BiomeGenerationSettings.Builder generation, @Nullable Music music) {
return new Biome.BiomeBuilder().downfall(downfall).temperature(temp).downfall(rainfall).specialEffects((new BiomeSpecialEffects.Builder()).waterColor(waterColor).waterFogColor(waterFogColor).fogColor(12638463).skyColor(calculateSkyColor(temp)).backgroundMusic(music).build()).mobSpawnSettings(mobSpawning.build()).generationSettings(generation.build()).build();
private static Biome biome(float downfall, float temp, boolean hasRain, int waterColor, int waterFogColor, MobSpawnSettings.Builder mobSpawning, BiomeGenerationSettings.Builder generation, @Nullable Music music) {
return new Biome.BiomeBuilder()
.downfall(downfall)
.temperature(temp)
.hasPrecipitation(hasRain)
.specialEffects(new BiomeSpecialEffects.Builder()
.waterColor(waterColor)
.waterFogColor(waterFogColor)
.fogColor(12638463)
.skyColor(calculateSkyColor(temp))
.backgroundMusic(music)
.build())
.mobSpawnSettings(mobSpawning.build())
.generationSettings(generation.build())
.build();
}

protected static int calculateSkyColor(float temperature) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@ public List<PosWithState> read(FriendlyByteBuf buffer) {

@Override
public List<PosWithState> copy(List<PosWithState> value) {
ArrayList<PosWithState> newValue = new ArrayList<>();
for (PosWithState val : value) {
newValue.add(new PosWithState(val.pos(), val.state()));
}
return newValue;
return new ArrayList<>(value);
}
};

Expand Down
18 changes: 11 additions & 7 deletions src/main/java/argent_matter/gcyr/common/entity/RocketEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,6 @@ public class RocketEntity extends Entity implements HasCustomInventoryScreen, IU

private final Set<BlockPos> thrusterPositions = new HashSet<>();

@Getter
private ThreadLocal<Boolean> hasRequestedBlockSync = ThreadLocal.withInitial(() -> false);


public RocketEntity(EntityType<?> entityType, Level level) {
super(entityType, level);
Expand Down Expand Up @@ -458,7 +455,7 @@ public boolean countdown() {
// movement must happen both server + client side
public void flightMovement() {
var vec = getDeltaMovement();
if (speed < getRocketSpeed()-0.01) {
if (speed < getRocketSpeed() - 0.01) {
speed += 0.05;
}

Expand Down Expand Up @@ -871,13 +868,21 @@ public void addBlock(PosWithState state) {

// resolve average tier of used motors
this.motorTiersTotal += rocketMotorBlock.getTier();
this.motorTier = this.motorTiersTotal / this.partCounts.object2IntEntrySet().stream().filter(p -> p.getKey() instanceof RocketMotorBlock).map(Map.Entry::getValue).reduce(0, Integer::sum);
this.motorTier = this.motorTiersTotal / this.partCounts.object2IntEntrySet()
.stream()
.filter(p -> p.getKey() instanceof RocketMotorBlock)
.map(Map.Entry::getValue)
.reduce(0, Integer::sum);
} else if (block instanceof FuelTankBlock fuelTankBlock) {
this.setFuelCapacity(this.getFuelCapacity() + fuelTankBlock.getTankProperties().getFuelStorage());

// resolve average tier of used fuel tanks
this.fuelTankTiersTotal += fuelTankBlock.getTier();
this.fuelTankTier = this.fuelTankTiersTotal / this.partCounts.object2IntEntrySet().stream().filter(p -> p.getKey() instanceof FuelTankBlock).map(Map.Entry::getValue).reduce(0, Integer::sum);
this.fuelTankTier = this.fuelTankTiersTotal / this.partCounts.object2IntEntrySet()
.stream()
.filter(p -> p.getKey() instanceof FuelTankBlock)
.map(Map.Entry::getValue)
.reduce(0, Integer::sum);
} else if (state.state().is(GCYRBlocks.SEAT.get())) {
this.addSeatPos(pos);
}
Expand Down Expand Up @@ -1010,7 +1015,6 @@ protected void addAdditionalSaveData(CompoundTag compound) {
public void onSyncedDataUpdated(EntityDataAccessor<?> key) {
if (POSITIONED_STATES.equals(key) || SIZE.equals(key)) {
this.setBoundingBox(makeBoundingBox());
hasRequestedBlockSync.set(false);
}
super.onSyncedDataUpdated(key);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"world": "gcyr:overworld_orbit",
"stars": {
"fancy_count": 16000,
"fast_count": 8000,
"colored_stars": true,
"daylight_visible": true
},
"sunset_color": "none",
"dimension_effects": {
"type": "none"
},
"cloud_effects": "none",
"weather_effects": "none",
"horizon_angle": 0,
"sky_objects": [
{
"texture": "gcyr:textures/sky/earth.png",
"blending": true,
"render_type": "dynamic",
"scale": 90.0,
"rotation": [
0.0,
-90.0,
0.0
]
}
]
}

0 comments on commit da9fbe0

Please sign in to comment.