Skip to content

Commit

Permalink
Prep for 1.21
Browse files Browse the repository at this point in the history
BUILD: Changed version from 1.3.0 to 1.2.3 because the wind effect hasn't been added yet
REFACTOR: Removed deprecated annotations on older API methods
REFACTOR: Removed all wind related effects for now
Signed-off-by: Superkat32 <superkat1806@gmail.com>
  • Loading branch information
Superkat32 committed Jun 13, 2024
1 parent 18a8235 commit bbc6820
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 18 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.20.6+build.3
loader_version=0.15.11

# Mod Properties
mod_version = 1.3.0-SNAPSHOT1-1.20.x
mod_version = 1.2.3-1.20.x
maven_group = net.superkat
archives_base_name = explosive-enhancement

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.superkat.explosiveenhancement;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.ParticlesMode;
import net.minecraft.particle.ParticleEffect;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.registry.tag.FluidTags;
Expand All @@ -16,24 +17,34 @@ public static void spawnParticles(World world, double x, double y, double z, flo
if(config.modEnabled) {
if(config.debugLogs) {
LOGGER.info("ExplosiveHandler has been called!");
LOGGER.info("Minecraft particle settings: " + MinecraftClient.getInstance().options.getParticles().getValue());
LOGGER.info("Explosive Enhancement Enabled: " + config.modEnabled);
ParticlesMode particlesMode = MinecraftClient.getInstance().options.getParticles().getValue();
LOGGER.info("Minecraft particle settings: " + particlesMode);
if(particlesMode == ParticlesMode.MINIMAL) {
//This is the cause of most issues, so giving the user a hint may help reduce bug reports
LOGGER.warn("[Explosive Enhancement]: Minecraft's particle settings is set to Minimal! This means that no explosion particles will be shown.");
} else if (particlesMode == ParticlesMode.DECREASED) {
//This would have been helpful for me and saved me a good 5 minutes of my life
LOGGER.warn("[Explosive Enhancement]: Minecraft's particle settings is set to Decreased! This means that some explosions particles may not always be shown.");
}
}

switch(explosionParticleType) {
case NORMAL -> spawnExplosionParticles(world, x, y, z, power, didDestroyBlocks, isImportant);
case WATER -> spawnUnderwaterExplosionParticles(world, x, y, z, power, didDestroyBlocks, isImportant);
case WIND -> spawnWindExplosionParticles(world, x, y, z, power, didDestroyBlocks, isImportant);
case WIND -> spawnWindExplosionParticles(world, x, y, z, power, didDestroyBlocks, isImportant); //unused for now
}

if(config.debugLogs) { LOGGER.info("ExplosiveHandler finished!"); }
}
}

public static ExplosionParticleType determineParticleType(World world, double x, double y, double z, ParticleEffect particle, ParticleEffect emitterParticle) {
if(config.underwaterExplosions && blockIsInWater(world, x, y, z)) {
return ExplosionParticleType.WATER;
} else if (particlesAreWindGust(particle, emitterParticle)) {
//TODO - Wind takes priority over water for now, but water should take priority over wind in the future
if (particlesAreWindGust(particle, emitterParticle)) {
return ExplosionParticleType.WIND;
} else if(config.underwaterExplosions && blockIsInWater(world, x, y, z)) {
return ExplosionParticleType.WATER;
} else {
return ExplosionParticleType.NORMAL;
}
Expand Down Expand Up @@ -138,6 +149,7 @@ private static void spawnBubble(World world, double x, double y, double z, boole
}

public static void spawnWindExplosionParticles(World world, double x, double y, double z, float power, boolean didDestroyBlocks, boolean isImportant) {
//This should never be called until I add a special wind effect
spawnVanillaParticles(world, x, y, z, power, didDestroyBlocks, isImportant, true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public interface ExplosiveApi {
* @param power The explosion's power.
* @param explosionParticleType The explosion particle effect to show(water, wind, or normal).
*
* @since Explosive Enhancement 1.3
* @since Explosive Enhancement 1.2.3
*/
static void spawnParticles(World world, double x, double y, double z, float power, ExplosionParticleType explosionParticleType) {
spawnParticles(world, x, y, z, power, explosionParticleType, true, false);
Expand All @@ -33,7 +33,7 @@ static void spawnParticles(World world, double x, double y, double z, float powe
* @param explosionParticleType The explosion particle effect to show(water, wind, or normal).
* @param didDestroyBlocks Used to help determine the particle type for the vanilla particles.
*
* @since Explosive Enhancement 1.3
* @since Explosive Enhancement 1.2.3
*/
static void spawnParticles(World world, double x, double y, double z, float power, ExplosionParticleType explosionParticleType, boolean didDestroyBlocks) {
spawnParticles(world, x, y, z, power, explosionParticleType, didDestroyBlocks, false);
Expand All @@ -51,7 +51,7 @@ static void spawnParticles(World world, double x, double y, double z, float powe
* @param didDestroyBlocks Used to help determine the particle type for the vanilla particles.
* @param isImportant Renders the effect from further away AND on lower particle settings. If true, the user's config option is ignored, otherwise it refers to the user's config option.
*
* @since Explosive Enhancement 1.3
* @since Explosive Enhancement 1.2.3
*/
static void spawnParticles(World world, double x, double y, double z, float power, ExplosionParticleType explosionParticleType, boolean didDestroyBlocks, boolean isImportant) {
ExplosiveHandler.spawnParticles(world, x, y, z, power, explosionParticleType, didDestroyBlocks, isImportant);
Expand All @@ -72,14 +72,13 @@ static void spawnParticles(World world, double x, double y, double z, float powe
* @param emitterParticle The explosion's normal particle(normally an emitter particle) for a higher explosion power.
* @return The appropriate ExplosionParticleType depending on the particles or coordinates given.
*
* @since Explosive Enhancement 1.3
* @since Explosive Enhancement 1.2.3
*/
static ExplosionParticleType determineParticleType(World world, double x, double y, double z, ParticleEffect particle, ParticleEffect emitterParticle) {
return ExplosiveHandler.determineParticleType(world, x, y, z, particle, emitterParticle);
}

/**
* @deprecated
* Spawn Explosive Enhancement's particles while still keeping the user's config options
*
* @param world The world to spawn the effect in
Expand All @@ -95,7 +94,6 @@ static void spawnParticles(World world, double x, double y, double z, float powe
}

/**
* @deprecated
* Spawn Explosive Enhancement's particles while still keeping the user's config options
*
* @param world The world to spawn the effect in
Expand All @@ -113,7 +111,6 @@ static void spawnParticles(World world, double x, double y, double z, float powe
}

/**
* @deprecated
* Spawn Explosive Enhancement's particles while still keeping the user's config options
* @param world The world to spawn the effect in
* @param x The effect's x coordinate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ public abstract class ExplosionMixin {

@Inject(method = "affectWorld(Z)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;addParticle(Lnet/minecraft/particle/ParticleEffect;DDDDDD)V"), cancellable = true)
public void explosiveenhancement$spawnExplosiveParticles(boolean particles, CallbackInfo ci) {
if (config.modEnabled) {
if (config.debugLogs) { LOGGER.info("affectWorld has been called!"); }
if (config.modEnabled && particles) {
if (config.debugLogs) { LOGGER.info("[Explosive Enhancement]: affectWorld has been called!"); }

ExplosionParticleType explosionParticleType = ExplosiveApi.determineParticleType(world, x, y, z, particle, emitterParticle);
ExplosiveApi.spawnParticles(world, x, y, z, power, explosionParticleType, this.shouldDestroy());
ci.cancel();
if(explosionParticleType != ExplosionParticleType.WIND) { //allows normal wind particles to be shown until I add special effect
ExplosiveApi.spawnParticles(world, x, y, z, power, explosionParticleType, this.shouldDestroy());
ci.cancel();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class UnderwaterBlastWaveParticle extends BlastWaveParticle{
protected int getBrightness(float tint) {
BlockPos blockPos = BlockPos.ofFloored(this.x, this.y, this.z);
return config.emissiveWaterExplosion ? 15728880 : this.world.isChunkLoaded(blockPos) ? WorldRenderer.getLightmapCoordinates(this.world, blockPos) : 0;
// return config.emissiveWaterExplosion ? 15728880 : super.getBrightness(tint);
}

@Environment(EnvType.CLIENT)
Expand Down

0 comments on commit bbc6820

Please sign in to comment.