Skip to content

Commit

Permalink
Merge branch '1.19.2' into 1.19.3
Browse files Browse the repository at this point in the history
# Conflicts:
#	gradle.properties
  • Loading branch information
Superkat32 committed Oct 1, 2023
2 parents bd9ba36 + 213ecf5 commit bb0dcec
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 31 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.19.3+build.1
loader_version=0.14.11

# Mod Properties
mod_version = 1.2.1-1.19.3
mod_version = 1.2.2-1.19.3
maven_group = net.superkat
archives_base_name = explosive-enhancement

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void onInitializeClient() {
ParticleFactoryRegistry.getInstance().register(ExplosiveEnhancement.BUBBLE, BubbleParticle.Factory::new);
ParticleFactoryRegistry.getInstance().register(ExplosiveEnhancement.SHOCKWAVE, ShockwaveParticle.Factory::new);
ParticleFactoryRegistry.getInstance().register(ExplosiveEnhancement.BLANK_SHOCKWAVE, ShockwaveParticle.Factory::new);
ParticleFactoryRegistry.getInstance().register(ExplosiveEnhancement.UNDERWATERBLASTWAVE, BlastWaveParticle.Factory::new);
ParticleFactoryRegistry.getInstance().register(ExplosiveEnhancement.UNDERWATERBLASTWAVE, UnderwaterBlastWaveParticle.Factory::new);
ParticleFactoryRegistry.getInstance().register(ExplosiveEnhancement.UNDERWATERSPARKS, UnderwaterSparkParticle.Factory::new);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public class ExplosiveConfig {
public boolean attemptBetterSmallExplosions = true;
public double smallExplosionYOffset = -0.5;
public boolean modEnabled = true;
public boolean emissiveExplosion = true;
public boolean emissiveWaterExplosion = true;
public boolean alwaysShow = false;
public boolean debugLogs = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,26 @@ public static Screen makeScreen(Screen parent) {
)
.controller(booleanOption -> new BooleanController(booleanOption, true))
.build();
var emissiveExplosion = Option.createBuilder(boolean.class)
.name(Text.translatable("explosiveenhancement.extras.emissive"))
.tooltip(Text.translatable("explosiveenhancement.extras.emissive.tooltip"))
.binding(
defaults.emissiveExplosion,
() -> config.emissiveExplosion,
val -> config.emissiveExplosion = val
)
.controller(booleanOption -> new BooleanController(booleanOption, true))
.build();
var emissiveWaterExplosion = Option.createBuilder(boolean.class)
.name(Text.translatable("explosiveenhancement.extras.emissivewater"))
.tooltip(Text.translatable("explosiveenhancement.extras.emissivewater.tooltip"))
.binding(
defaults.emissiveWaterExplosion,
() -> config.emissiveWaterExplosion,
val -> config.emissiveWaterExplosion = val
)
.controller(booleanOption -> new BooleanController(booleanOption, true))
.build();
var alwaysShow = Option.createBuilder(boolean.class)
.name(Text.translatable("explosiveenhancement.extras.alwaysshow"))
.tooltip(Text.translatable("explosiveenhancement.extras.alwaysshow.tooltip"))
Expand All @@ -307,6 +327,8 @@ public static Screen makeScreen(Screen parent) {
.controller(booleanOption -> new BooleanController(booleanOption, true))
.build();
extrasGroup.option(modEnabled);
extrasGroup.option(emissiveExplosion);
extrasGroup.option(emissiveWaterExplosion);
extrasGroup.option(alwaysShow);
extrasGroup.option(debugLogs);
extrasCategoryBuilder.group(extrasGroup.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import org.joml.Quaternionf;
import org.joml.Vector3f;

import static net.superkat.explosiveenhancement.ExplosiveEnhancementClient.config;

@Environment(EnvType.CLIENT)
public class BlastWaveParticle extends SpriteBillboardParticle {
private final SpriteProvider sprites;
Expand Down Expand Up @@ -77,6 +79,12 @@ public ParticleTextureSheet getType() {
return ParticleTextureSheet.PARTICLE_SHEET_TRANSLUCENT;
}

//Makes the particle emissive
@Override
protected int getBrightness(float tint) {
return config.emissiveExplosion ? 15728880 : super.getBrightness(tint);
}

@Override
public void tick() {
super.tick();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ public ParticleTextureSheet getType() {
return ParticleTextureSheet.PARTICLE_SHEET_TRANSLUCENT;
}

//Makes the particle emissive
@Override
protected int getBrightness(float tint) {
return config.emissiveExplosion ? 15728880 : super.getBrightness(tint);
}

@Environment(EnvType.CLIENT)
public static class Factory implements ParticleFactory<DefaultParticleType> {
private final SpriteProvider spriteProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ public ParticleTextureSheet getType() {
return ParticleTextureSheet.PARTICLE_SHEET_TRANSLUCENT;
}

//Makes the particle emissive
@Override
protected int getBrightness(float tint) {
return config.emissiveWaterExplosion ? 15728880 : super.getBrightness(tint);
}

@Environment(EnvType.CLIENT)
public static class Factory implements ParticleFactory<DefaultParticleType> {
private final SpriteProvider spriteProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import net.minecraft.client.particle.*;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.particle.DefaultParticleType;
import net.minecraft.util.math.MathHelper;

import static net.superkat.explosiveenhancement.ExplosiveEnhancementClient.config;

@Environment(EnvType.CLIENT)
public class SmokeParticle extends SpriteBillboardParticle {
private final SpriteProvider spriteProvider;
// private final double startX;
// private final double startY;
// private final double startZ;

SmokeParticle(ClientWorld world, double x, double y, double z, double velX, double velY, double velZ, SpriteProvider spriteProvider) {
super(world, x, y, z);
Expand Down Expand Up @@ -39,43 +39,17 @@ public class SmokeParticle extends SpriteBillboardParticle {
}
this.velocityY = velY / 1.85;
this.gravityStrength = 3.0E-6F;
// this.scale = 1F;
// this.gravityStrength = 0.008F;
// this.velocityX = velX;
// this.velocityZ = velZ;
// this.setBoundingBoxSpacing(0.02F, 0.02F);
// this.velocityX = this.random.nextFloat() + 0.07;
// this.velocityY = 0;
// this.velocityZ = this.random.nextFloat() + 0.07;
// this.startX = x;
// this.startY = y;
// this.startZ = z;
this.collidesWithWorld = true;
this.setSpriteForAge(spriteProvider);
}

public void tick() {
// int direction = this.random.nextBetween(1, 4);
this.prevPosX = this.x;
this.prevPosY = this.y;
this.prevPosZ = this.z;
if (this.age++ >= this.maxAge) {
this.markDead();
} else {
// if (this.age == 1) {
// switch (direction) {
// case 2 -> {
// this.velocityX = this.velocityX * -1;
// }
// case 3 -> {
// this.velocityZ = this.velocityZ * -1;
// }
// case 4 -> {
// this.velocityX = this.velocityX * -1;
// this.velocityZ = this.velocityZ * -1;
// }
// }
// }
this.setSpriteForAge(this.spriteProvider);
if (this.age == 12) {
this.velocityX = 0;
Expand All @@ -90,6 +64,18 @@ public ParticleTextureSheet getType() {
return ParticleTextureSheet.PARTICLE_SHEET_TRANSLUCENT;
}

//Makes the particle emissive
@Override
protected int getBrightness(float tint) {
if(config.emissiveExplosion && this.age <= this.maxAge * 0.12) {
return 15728880;
} else if (config.emissiveExplosion && this.age <= this.maxAge * 0.17) {
return MathHelper.clamp(super.getBrightness(tint) + this.age + 30, super.getBrightness(tint), 15728880);
} else {
return super.getBrightness(tint);
}
}

@Environment(EnvType.CLIENT)
public static class Factory implements ParticleFactory<DefaultParticleType> {
private final SpriteProvider spriteProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ public ParticleTextureSheet getType() {
return ParticleTextureSheet.PARTICLE_SHEET_TRANSLUCENT;
}

//Makes the particle emissive
@Override
protected int getBrightness(float tint) {
return config.emissiveExplosion ? 15728880 : super.getBrightness(tint);
}

@Environment(EnvType.CLIENT)
public static class Factory implements ParticleFactory<DefaultParticleType> {
private final SpriteProvider spriteProvider;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package net.superkat.explosiveenhancement.particles;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.ParticleFactory;
import net.minecraft.client.particle.SpriteProvider;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.particle.DefaultParticleType;
import net.minecraft.util.math.BlockPos;

import static net.superkat.explosiveenhancement.ExplosiveEnhancementClient.config;

public class UnderwaterBlastWaveParticle extends BlastWaveParticle{
UnderwaterBlastWaveParticle(ClientWorld world, double x, double y, double z, double velX, double velY, double velZ, SpriteProvider sprites) {
super(world, x, y, z, velX, velY, velZ, sprites);
}

//Makes the particle emissive
//Doesn't use super.getBrightness because that would cause the particle to appear emissive if
//emissive underwater explosion is turned off and emissive explosion is turned on
@Override
protected int getBrightness(float tint) {
BlockPos blockPos = new BlockPos(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)
public record Factory(SpriteProvider sprites) implements ParticleFactory<DefaultParticleType> {
public Particle createParticle(DefaultParticleType type, ClientWorld world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
return new UnderwaterBlastWaveParticle(world, x, y, z, xSpeed, ySpeed, zSpeed, sprites);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ public ParticleTextureSheet getType() {
return ParticleTextureSheet.PARTICLE_SHEET_TRANSLUCENT;
}

//Makes the particle emissive
@Override
protected int getBrightness(float tint) {
return config.emissiveWaterExplosion ? 15728880 : super.getBrightness(tint);
}

@Environment(EnvType.CLIENT)
public static class Factory implements ParticleFactory<DefaultParticleType> {
private final SpriteProvider spriteProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
"explosiveenhancement.extras.group.tooltip": "Extra options",
"explosiveenhancement.extras.enabled": "Mod Enabled",
"explosiveenhancement.extras.enabled.tooltip": "Should the mod be enabled?",
"explosiveenhancement.extras.emissive": "Emissive Explosions",
"explosiveenhancement.extras.emissive.tooltip": "Should the normal explosions be emissive?",
"explosiveenhancement.extras.emissivewater": "Emissive Underwater Explosions",
"explosiveenhancement.extras.emissivewater.tooltip": "Should the underwater explosions be emissive?",
"explosiveenhancement.extras.alwaysshow": "Always Show Particles",
"explosiveenhancement.extras.alwaysshow.tooltip": "If enabled, the explosion particles will attempt to render from further away(roughly twice as far) AND on lower particle settings. Use wisely!",
"explosiveenhancement.extras.logs": "Debug Logs",
Expand Down

0 comments on commit bb0dcec

Please sign in to comment.