Skip to content

Commit 785b33d

Browse files
committed
fix: add splash particle for rain on Venus to prevent crash (resolves #431)
1 parent e12cab9 commit 785b33d

14 files changed

+128
-19
lines changed

src/main/java/dev/galacticraft/mod/Constant.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -533,19 +533,21 @@ interface Item {
533533
}
534534

535535
interface Particle {
536-
String DRIPPING_FUEL = "dripping_fuel";
537-
String FALLING_FUEL = "falling_fuel";
538536
String DRIPPING_CRUDE_OIL = "dripping_crude_oil";
539537
String FALLING_CRUDE_OIL = "falling_crude_oil";
538+
String DRIPPING_FUEL = "dripping_fuel";
539+
String FALLING_FUEL = "falling_fuel";
540+
String DRIPPING_SULFURIC_ACID = "dripping_sulfuric_acid";
541+
String FALLING_SULFURIC_ACID = "falling_sulfuric_acid";
542+
540543
String CRYOGENIC_PARTICLE = "cryogenic_particle";
541544
String LANDER_FLAME = "lander_flame_particle";
542545
String SPARK = "spark";
543-
String DRIPPING_SULFURIC_ACID = "dripping_sulfuric_acid";
544-
String FALLING_SULFURIC_ACID = "falling_sulfuric_acid";
545546
String LAUNCH_SMOKE = "launch_smoke";
546547
String LAUNCH_FLAME = "launch_flame";
547548
String LAUNCH_FLAME_LAUNCHED = "launch_flame_launched";
548549
String ACID_VAPOR_PARTICLE = "acid_vapor";
550+
String SPLASH_VENUS = "splash_venus";
549551
}
550552

551553
interface ScreenTexture {

src/main/java/dev/galacticraft/mod/GalacticraftClient.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
import net.fabricmc.fabric.api.client.rendering.v1.LivingEntityFeatureRendererRegistrationCallback;
7171
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
7272
import net.minecraft.client.gui.screens.MenuScreens;
73+
import net.minecraft.client.particle.SplashParticle;
7374
import net.minecraft.client.renderer.RenderType;
7475
import net.minecraft.client.renderer.entity.ThrownItemRenderer;
7576
import net.minecraft.server.packs.PackType;
@@ -156,17 +157,20 @@ public void onInitializeClient() {
156157
BlockRenderLayerMap.INSTANCE.putBlocks(RenderType.translucent(), GCBlocks.VACUUM_GLASS, GCBlocks.CLEAR_VACUUM_GLASS, GCBlocks.STRONG_VACUUM_GLASS);
157158
BlockRenderLayerMap.INSTANCE.putBlocks(RenderType.translucent(), GCBlocks.CRYOGENIC_CHAMBER, GCBlocks.CRYOGENIC_CHAMBER_PART, GCBlocks.PLAYER_TRANSPORT_TUBE);
158159

160+
ParticleFactoryRegistry.getInstance().register(GCParticleTypes.DRIPPING_CRUDE_OIL, DrippingCrudeOilProvider::new);
161+
ParticleFactoryRegistry.getInstance().register(GCParticleTypes.FALLING_CRUDE_OIL, FallingCrudeOilProvider::new);
159162
ParticleFactoryRegistry.getInstance().register(GCParticleTypes.DRIPPING_FUEL, DrippingFuelProvider::new);
160163
ParticleFactoryRegistry.getInstance().register(GCParticleTypes.FALLING_FUEL, FallingFuelProvider::new);
161-
ParticleFactoryRegistry.getInstance().register(GCParticleTypes.DRIPPING_CRUDE_OIL, DrippingOilProvider::new);
162-
ParticleFactoryRegistry.getInstance().register(GCParticleTypes.FALLING_CRUDE_OIL, FallingCrudeOilProvider::new);
164+
ParticleFactoryRegistry.getInstance().register(GCParticleTypes.DRIPPING_SULFURIC_ACID, DrippingSulfuricAcidProvider::new);
165+
ParticleFactoryRegistry.getInstance().register(GCParticleTypes.FALLING_SULFURIC_ACID, FallingSulfuricAcidProvider::new);
163166
ParticleFactoryRegistry.getInstance().register(GCParticleTypes.CRYOGENIC_PARTICLE, CryoFreezeParticle.Provider::new);
164167
ParticleFactoryRegistry.getInstance().register(GCParticleTypes.LANDER_FLAME_PARTICLE, LanderParticle.Provider::new);
165168
ParticleFactoryRegistry.getInstance().register(GCParticleTypes.SPARK_PARTICLE, SparksParticle.Provider::new);
166169
ParticleFactoryRegistry.getInstance().register(GCParticleTypes.LAUNCH_SMOKE_PARTICLE, LaunchSmokeParticle.Provider::new);
167170
ParticleFactoryRegistry.getInstance().register(GCParticleTypes.LAUNCH_FLAME, LaunchFlameParticle.Provider::new);
168171
ParticleFactoryRegistry.getInstance().register(GCParticleTypes.LAUNCH_FLAME_LAUNCHED, LaunchFlameParticle.LaunchedProvider::new);
169172
ParticleFactoryRegistry.getInstance().register(GCParticleTypes.ACID_VAPOR_PARTICLE, AcidVaporParticle.Provider::new);
173+
ParticleFactoryRegistry.getInstance().register(GCParticleTypes.SPLASH_VENUS, SplashParticle.Provider::new);
170174

171175
FluidRenderHandlerRegistry.INSTANCE.get(Fluids.WATER); // Workaround for classloading order bug
172176

src/main/java/dev/galacticraft/mod/client/particle/DrippingOilProvider.java src/main/java/dev/galacticraft/mod/client/particle/DrippingCrudeOilProvider.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import org.jetbrains.annotations.Nullable;
3636

3737
@Environment(EnvType.CLIENT)
38-
public record DrippingOilProvider(SpriteSet spriteProvider) implements ParticleProvider<SimpleParticleType> {
38+
public record DrippingCrudeOilProvider(SpriteSet spriteProvider) implements ParticleProvider<SimpleParticleType> {
3939
@Override
4040
@Nullable
4141
public Particle createParticle(SimpleParticleType particleOptions, ClientLevel clientLevel, double x, double y, double z, double velocityX, double velocityY, double velocityZ) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright (c) 2019-2025 Team Galacticraft
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in all
12+
* copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*/
22+
23+
package dev.galacticraft.mod.client.particle;
24+
25+
import dev.galacticraft.mod.content.GCFluids;
26+
import dev.galacticraft.mod.particle.GCParticleTypes;
27+
import net.fabricmc.api.EnvType;
28+
import net.fabricmc.api.Environment;
29+
import net.minecraft.client.multiplayer.ClientLevel;
30+
import net.minecraft.client.particle.DripParticle;
31+
import net.minecraft.client.particle.Particle;
32+
import net.minecraft.client.particle.ParticleProvider;
33+
import net.minecraft.client.particle.SpriteSet;
34+
import net.minecraft.core.particles.SimpleParticleType;
35+
import org.jetbrains.annotations.Nullable;
36+
37+
@Environment(EnvType.CLIENT)
38+
public record DrippingSulfuricAcidProvider(SpriteSet spriteProvider) implements ParticleProvider<SimpleParticleType> {
39+
@Override
40+
@Nullable
41+
public Particle createParticle(SimpleParticleType particleOptions, ClientLevel clientLevel, double x, double y, double z, double velocityX, double velocityY, double velocityZ) {
42+
var particle = new DripParticle.DripHangParticle(clientLevel, x, y, z, GCFluids.SULFURIC_ACID, GCParticleTypes.FALLING_SULFURIC_ACID);
43+
particle.setColor(151f / 255f, 245f / 255f, 70f / 255f);
44+
particle.pickSprite(this.spriteProvider);
45+
return particle;
46+
}
47+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (c) 2019-2025 Team Galacticraft
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in all
12+
* copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*/
22+
23+
package dev.galacticraft.mod.client.particle;
24+
25+
import dev.galacticraft.mod.content.GCFluids;
26+
import net.fabricmc.api.EnvType;
27+
import net.fabricmc.api.Environment;
28+
import net.minecraft.client.multiplayer.ClientLevel;
29+
import net.minecraft.client.particle.DripParticle;
30+
import net.minecraft.client.particle.Particle;
31+
import net.minecraft.client.particle.ParticleProvider;
32+
import net.minecraft.client.particle.SpriteSet;
33+
import net.minecraft.core.particles.SimpleParticleType;
34+
import org.jetbrains.annotations.Nullable;
35+
36+
@Environment(EnvType.CLIENT)
37+
public record FallingSulfuricAcidProvider(SpriteSet spriteProvider) implements ParticleProvider<SimpleParticleType> {
38+
@Override
39+
@Nullable
40+
public Particle createParticle(SimpleParticleType particleOptions, ClientLevel clientLevel, double x, double y, double z, double velocityX, double velocityY, double velocityZ) {
41+
var particle = new DripParticle.FallingParticle(clientLevel, x, y, z, GCFluids.SULFURIC_ACID);
42+
particle.setColor(151f / 255f, 245f / 255f, 70f / 255f);
43+
particle.pickSprite(this.spriteProvider);
44+
return particle;
45+
}
46+
}

src/main/java/dev/galacticraft/mod/client/render/dimension/VenusDimensionEffects.java

+6-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
package dev.galacticraft.mod.client.render.dimension;
2424

2525
import dev.galacticraft.mod.api.dimension.GalacticDimensionEffects;
26-
import dev.galacticraft.mod.particle.ScaleParticleType;
26+
import dev.galacticraft.mod.particle.GCParticleTypes;
2727
import net.minecraft.client.Camera;
2828
import net.minecraft.client.Minecraft;
2929
import net.minecraft.client.ParticleStatus;
@@ -33,6 +33,7 @@
3333
import net.minecraft.core.Direction;
3434
import net.minecraft.core.particles.ParticleOptions;
3535
import net.minecraft.core.particles.ParticleTypes;
36+
import net.minecraft.core.particles.SimpleParticleType;
3637
import net.minecraft.sounds.SoundEvents;
3738
import net.minecraft.sounds.SoundSource;
3839
import net.minecraft.tags.FluidTags;
@@ -119,12 +120,10 @@ public boolean tickRain(@NotNull ClientLevel level, Camera camera, int ticks) {
119120
double baseYOff = shape.max(Direction.Axis.Y, xOffset, zOffset);
120121
double fluidHeight = fluidState.getHeight(level, below);
121122
double yOffset = Math.max(baseYOff, fluidHeight);
122-
ParticleOptions particle = !fluidState.is(FluidTags.LAVA) && !blockState.is(Blocks.MAGMA_BLOCK) && !CampfireBlock.isLitCampfire(blockState)
123-
? new ScaleParticleType(ParticleTypes.SMOKE, 0.95F)
124-
: ParticleTypes.SMOKE;
125-
this.minecraft
126-
.level
127-
.addParticle(particle, (double) below.getX() + xOffset, (double) below.getY() + yOffset, (double) below.getZ() + zOffset, 0.0, 0.0, 0.0);
123+
SimpleParticleType simpleParticleType = fluidState.is(FluidTags.LAVA) || blockState.is(Blocks.MAGMA_BLOCK) || CampfireBlock.isLitCampfire(blockState)
124+
? ParticleTypes.SMOKE
125+
: GCParticleTypes.SPLASH_VENUS;
126+
this.minecraft.level.addParticle(simpleParticleType, (double) below.getX() + xOffset, (double) below.getY() + yOffset, (double) below.getZ() + zOffset, 0.0, 0.0, 0.0);
128127
}
129128
}
130129
}

src/main/java/dev/galacticraft/mod/client/render/dimension/VenusWeatherRenderer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class VenusWeatherRenderer implements DimensionRenderingRegistry.WeatherR
4242
public static final VenusWeatherRenderer INSTANCE = new VenusWeatherRenderer();
4343
private final float[] rainSizeX = new float[1024];
4444
private final float[] rainSizeZ = new float[1024];
45-
private static final ResourceLocation RAIN_TEXTURES = Constant.id("textures/misc/rain_venus.png");
45+
private static final ResourceLocation RAIN_TEXTURES = Constant.id("textures/environment/rain_venus.png");
4646

4747
public VenusWeatherRenderer() {
4848
for (int i = 0; i < 32; ++i) {

src/main/java/dev/galacticraft/mod/particle/GCParticleTypes.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,18 @@
3131

3232
public class GCParticleTypes {
3333
public static final GCRegistry<ParticleType<?>> PARTICLES = new GCRegistry<>(BuiltInRegistries.PARTICLE_TYPE);
34-
public static final SimpleParticleType DRIPPING_FUEL = PARTICLES.register(Particle.DRIPPING_FUEL, FabricParticleTypes.simple());
35-
public static final SimpleParticleType FALLING_FUEL = PARTICLES.register(Particle.FALLING_FUEL, FabricParticleTypes.simple());
34+
3635
public static final SimpleParticleType DRIPPING_CRUDE_OIL = PARTICLES.register(Particle.DRIPPING_CRUDE_OIL, FabricParticleTypes.simple());
3736
public static final SimpleParticleType FALLING_CRUDE_OIL = PARTICLES.register(Particle.FALLING_CRUDE_OIL, FabricParticleTypes.simple());
37+
public static final SimpleParticleType DRIPPING_FUEL = PARTICLES.register(Particle.DRIPPING_FUEL, FabricParticleTypes.simple());
38+
public static final SimpleParticleType FALLING_FUEL = PARTICLES.register(Particle.FALLING_FUEL, FabricParticleTypes.simple());
39+
public static final SimpleParticleType DRIPPING_SULFURIC_ACID = PARTICLES.register(Particle.DRIPPING_SULFURIC_ACID, FabricParticleTypes.simple());
40+
public static final SimpleParticleType FALLING_SULFURIC_ACID = PARTICLES.register(Particle.FALLING_SULFURIC_ACID, FabricParticleTypes.simple());
41+
3842
public static final SimpleParticleType CRYOGENIC_PARTICLE = PARTICLES.register(Particle.CRYOGENIC_PARTICLE, FabricParticleTypes.simple());
3943
public static final SimpleParticleType LANDER_FLAME_PARTICLE = PARTICLES.register(Particle.LANDER_FLAME, FabricParticleTypes.simple());
4044
public static final SimpleParticleType SPARK_PARTICLE = PARTICLES.register(Particle.SPARK, FabricParticleTypes.simple());
41-
public static final SimpleParticleType DRIPPING_SULFURIC_ACID = PARTICLES.register(Particle.DRIPPING_SULFURIC_ACID, FabricParticleTypes.simple());
42-
public static final SimpleParticleType FALLING_SULFURIC_ACID = PARTICLES.register(Particle.FALLING_SULFURIC_ACID, FabricParticleTypes.simple()); // Why does this exist?
45+
public static final SimpleParticleType SPLASH_VENUS = PARTICLES.register(Particle.SPLASH_VENUS, FabricParticleTypes.simple());
4346
public static final ParticleType<LaunchSmokeParticleOption> LAUNCH_SMOKE_PARTICLE = PARTICLES.register(Particle.LAUNCH_SMOKE, FabricParticleTypes.complex(false, LaunchSmokeParticleOption.CODEC, LaunchSmokeParticleOption.STREAM_CODEC));
4447
public static final ParticleType<EntityParticleOption> LAUNCH_FLAME = PARTICLES.register(Particle.LAUNCH_FLAME, FabricParticleTypes.complex(false, EntityParticleOption::codec, EntityParticleOption::streamCodec));
4548
public static final ParticleType<EntityParticleOption> LAUNCH_FLAME_LAUNCHED = PARTICLES.register(Particle.LAUNCH_FLAME_LAUNCHED, FabricParticleTypes.complex(false, EntityParticleOption::codec, EntityParticleOption::streamCodec));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"textures": [
3+
"galacticraft:splash_venus_3",
4+
"galacticraft:splash_venus_2",
5+
"galacticraft:splash_venus_1",
6+
"galacticraft:splash_venus_0"
7+
]
8+
}
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)