Skip to content

Commit

Permalink
Fix dedicated server crash trying to spawn snowstorms
Browse files Browse the repository at this point in the history
  • Loading branch information
Corosauce committed Dec 3, 2023
1 parent 81d3fed commit 7b15ce9
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 27 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ dependencies {
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"

implementation fg.deobf('com.corosus.coroutil:coroutil:1.20.1-1.3.0')
implementation fg.deobf('com.corosus.coroutil:coroutil:1.20.1-1.3.1')
//implementation fg.deobf('com.corosus.enderio:EnderIO:1.20.1-6.0.21-alpha')
//implementation fg.deobf('com.corosus.pipez:pipez:1.20.1-1.1.5')
//implementation fg.deobf('oculus:oculus:mc1.20.1-1.6.9')
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ mod_name=Weather2
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
# The mod version. See https://semver.org/
mod_version=1.20.1-2.7.17
mod_version=1.20.1-2.8.0
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
Expand Down
Binary file not shown.
7 changes: 7 additions & 0 deletions src/main/java/weather2/ServerTickHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ public static void tickServer(TickEvent.ServerTickEvent event) {
@SubscribeEvent
public static void tickServer(TickEvent.LevelTickEvent event) {

//System.out.println("tick ConfigMisc.Aesthetic_Only_Mode: " + ConfigMisc.Aesthetic_Only_Mode);
//System.out.println("tick ConfigMisc.overcastMode: " + ConfigMisc.overcastMode);

//TODO: TEMPPPPPPPPPPPP
//ConfigMisc.Aesthetic_Only_Mode = true;
//ConfigMisc.overcastMode = true;

if (event.level.dimension() == Level.OVERWORLD && event.phase == TickEvent.Phase.END && !event.level.isClientSide()) {
if (ConfigMisc.Aesthetic_Only_Mode) {
if (!ConfigMisc.overcastMode) {
Expand Down
11 changes: 2 additions & 9 deletions src/main/java/weather2/command/CommandWeather2Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@ public static void register(final CommandDispatcher<CommandSourceStack> dispatch
float value = FloatArgumentType.getFloat(c, "value");
ConfigParticle.Particle_effect_rate = value;
c.getSource().sendSuccess(() -> Component.literal("Set weather2 particle effect rate to " + value), true);
//why 2? sometimes it doesnt take, wtf lol
ConfigMod.forceSaveAllFilesFromRuntimeSettings();
ConfigMod.forceSaveAllFilesFromRuntimeSettings();
return Command.SINGLE_SUCCESS;
}))
)
.then(literal("particle_reset_frequency")
/*.then(literal("particle_reset_frequency")
.then(argument("seconds", IntegerArgumentType.integer(0, 20*60*24)).executes(c -> {
int value = IntegerArgumentType.getInteger(c, "seconds");
ConfigDebug.Particle_Reset_Frequency = value * 20;
Expand All @@ -52,14 +50,13 @@ public static void register(final CommandDispatcher<CommandSourceStack> dispatch
ConfigMod.forceSaveAllFilesFromRuntimeSettings();
return Command.SINGLE_SUCCESS;
}))
)
)*/
.then(literal("particle_vanilla_precipitation")
.then(argument("value", BoolArgumentType.bool()).executes(c -> {
boolean value = BoolArgumentType.getBool(c, "value");
ConfigParticle.Particle_vanilla_precipitation = value;
c.getSource().sendSuccess(() -> Component.literal("Set weather2 to use vanilla particles?: " + value), true);
ConfigMod.forceSaveAllFilesFromRuntimeSettings();
ConfigMod.forceSaveAllFilesFromRuntimeSettings();
return Command.SINGLE_SUCCESS;
}))
)
Expand All @@ -68,15 +65,13 @@ public static void register(final CommandDispatcher<CommandSourceStack> dispatch
ConfigParticle.Particle_engine_weather2 = true;
c.getSource().sendSuccess(() -> Component.literal("Set particle engine to weather2"), true);
ConfigMod.forceSaveAllFilesFromRuntimeSettings();
ConfigMod.forceSaveAllFilesFromRuntimeSettings();
return Command.SINGLE_SUCCESS;
}))
.then(literal("vanilla").executes(c -> {
ConfigParticle.Particle_engine_weather2 = false;
ClientTickHandler.particleManagerExtended().clearParticles();
c.getSource().sendSuccess(() -> Component.literal("Set particle engine to vanilla"), true);
ConfigMod.forceSaveAllFilesFromRuntimeSettings();
ConfigMod.forceSaveAllFilesFromRuntimeSettings();
return Command.SINGLE_SUCCESS;
}))
)
Expand Down Expand Up @@ -139,7 +134,6 @@ public static void register(final CommandDispatcher<CommandSourceStack> dispatch
ConfigDebug.Particle_engine_render = value;
c.getSource().sendSuccess(() -> Component.literal("ConfigParticle.Particle_engine_render: " + value), true);
ConfigMod.forceSaveAllFilesFromRuntimeSettings();
ConfigMod.forceSaveAllFilesFromRuntimeSettings();
return Command.SINGLE_SUCCESS;
}))
)
Expand All @@ -149,7 +143,6 @@ public static void register(final CommandDispatcher<CommandSourceStack> dispatch
ConfigDebug.Particle_engine_tick = value;
c.getSource().sendSuccess(() -> Component.literal("ConfigParticle.Particle_engine_tick: " + value), true);
ConfigMod.forceSaveAllFilesFromRuntimeSettings();
ConfigMod.forceSaveAllFilesFromRuntimeSettings();
return Command.SINGLE_SUCCESS;
}))
)
Expand Down
10 changes: 0 additions & 10 deletions src/main/java/weather2/config/ConfigLTOverrides.java

This file was deleted.

5 changes: 4 additions & 1 deletion src/main/java/weather2/config/ConfigParticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,19 @@ public class ConfigParticle implements IConfigCategory {
public static boolean Particle_Rain_GroundSplash = true;
public static boolean Particle_Rain_DownfallSheet = false;
public static boolean Particle_VanillaAndWeatherOnly = false;*/

@ConfigComment("Adjust amount of precipitation based particles, works as a multiplier")
public static double Precipitation_Particle_effect_rate = 0.7D;
//public static double Sandstorm_Particle_Debris_effect_rate = 0.6D;
//public static double Sandstorm_Particle_Dust_effect_rate = 0.6D;

@ConfigComment("Adjust amount of all weather2 based particles, works as a multiplier")
public static double Particle_effect_rate = 1D;

@ConfigComment("If true, uses vanilla rain/snow non particle precipitation")
public static boolean Particle_vanilla_precipitation = false;

@ConfigComment("If set to false, particles are spawned in using the vanilla particle renderer, may cause issues")
@ConfigComment("If set to false, particles are spawned in using the vanilla particle renderer, may cause issues, performance seems worse")
public static boolean Particle_engine_weather2 = true;

@ConfigComment("Extra flying block particles to spawn when the tornado rips up a block")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package weather2.weathersystem.storm;

import com.corosus.coroutil.util.CoroUtilBlock;
import com.corosus.coroutil.util.CoroUtilCompatibility;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.Biomes;
Expand All @@ -12,12 +12,9 @@
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.registries.ForgeRegistries;
import weather2.WeatherBlocks;
import weather2.client.SceneEnhancer;
import weather2.config.ConfigSand;
import weather2.config.ConfigSnow;
import weather2.datatypes.PrecipitationType;
import weather2.util.CachedNBTTagCompound;
import weather2.util.WeatherUtilBlock;
import weather2.weathersystem.WeatherManager;
Expand Down Expand Up @@ -76,7 +73,7 @@ public static boolean isColdForStorm(Level world, Holder<Biome> biome, boolean f
//return biome.getPrecipitation() == Biome.Precipitation.SNOW;
//adjusted to this way to make it work with serene seasons
boolean canPrecip = biome.get().getPrecipitationAt(pos) == Biome.Precipitation.RAIN || biome.get().getPrecipitationAt(pos) == Biome.Precipitation.SNOW;
return canPrecip && SceneEnhancer.shouldSnowHere(world, biome.get(), pos);
return canPrecip && CoroUtilCompatibility.coldEnoughToSnow(biome.get(), pos, world);
}

public static boolean isDesert(Holder<Biome> biome, boolean forSpawn) {
Expand Down

0 comments on commit 7b15ce9

Please sign in to comment.