Skip to content

Commit

Permalink
i hate multiversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Superkat32 committed Dec 19, 2024
1 parent e337db6 commit 92fd419
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 23 deletions.
7 changes: 7 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ processResources {
filesMatching("fabric.mod.json") {
expand "version": project.version, 'mcdep': project.property('supported_mc_versions')
}

// val refmap = "refmap" to "${mod.name}-$mcVersion-$loader-refmap.json"
// inputs.properties(refmap)

filesMatching("explosiveenhancement.mixins.json5") {
expand "refmap": "explosive-enhancement-refmap.json"
}
}

tasks.withType(JavaCompile).configureEach {
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ plugins {

stonecutter {
create(rootProject) {
versions("1.19.2", "1.19.3", "1.19.4", "1.20", "1.21.1", "1.21.3")
versions("1.19.2", "1.19.3", "1.19.4", "1.20", "1.21.1", "1.21.3", "1.21.4")
vcsVersion = "1.21.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,13 @@ public static void spawnExplosionParticles(World world, double x, double y, doub
float smokePower = power * 0.4f;

if(CONFIG.showBlastWave) {
world.addParticle(ExplosiveEnhancement.BLASTWAVE, isImportant, x, y, z, blastwavePower, 0, 0);
addParticle(world, ExplosiveEnhancement.BLASTWAVE, isImportant, x, y, z, blastwavePower, 0, 0);
}

if(CONFIG.showFireball) {
world.addParticle(ExplosiveEnhancement.FIREBALL, isImportant, x, y + 0.5, z, fireballPower, isImportant ? 1 : 0, 0);
addParticle(world, ExplosiveEnhancement.FIREBALL, isImportant, x, y + 0.5, z, fireballPower, isImportant ? 1 : 0, 0);
} else if (CONFIG.showSparks) {
world.addParticle(ExplosiveEnhancement.BLANK_FIREBALL, isImportant, x, y + 0.5, z, fireballPower, isImportant ? 1 : 0, 0);
addParticle(world, ExplosiveEnhancement.BLANK_FIREBALL, isImportant, x, y + 0.5, z, fireballPower, isImportant ? 1 : 0, 0);
}

if(CONFIG.showMushroomCloud) {
Expand All @@ -235,13 +235,13 @@ public static void spawnUnderwaterExplosionParticles(World world, double x, doub
float fireballPower = power * 1.25f;

if(CONFIG.showUnderwaterBlastWave) {
world.addParticle(ExplosiveEnhancement.UNDERWATERBLASTWAVE, isImportant, x, y + 0.5, z, blastwavePower, 0, 0);
addParticle(world, ExplosiveEnhancement.UNDERWATERBLASTWAVE, isImportant, x, y + 0.5, z, blastwavePower, 0, 0);
}

if(CONFIG.showShockwave) {
world.addParticle(ExplosiveEnhancement.SHOCKWAVE, isImportant, x, y + 0.5, z, fireballPower, isImportant ? 1 : 0, 0);
addParticle(world, ExplosiveEnhancement.SHOCKWAVE, isImportant, x, y + 0.5, z, fireballPower, isImportant ? 1 : 0, 0);
} else if (CONFIG.showUnderwaterSparks) {
world.addParticle(ExplosiveEnhancement.BLANK_SHOCKWAVE, isImportant, x, y + 0.5, z, fireballPower, isImportant ? 1 : 0, 0);
addParticle(world, ExplosiveEnhancement.BLANK_SHOCKWAVE, isImportant, x, y + 0.5, z, fireballPower, isImportant ? 1 : 0, 0);
}

spawnBubble(world, x, y, z, isImportant);
Expand All @@ -252,20 +252,20 @@ private static void spawnMushroomCloud(World world, double x, double y, double z
//x, y, z, [size(power)/velX], velY, [size(power)/velZ]
//This is to allow for dynamic smoke depending on the explosion's power
//The smoke particle factory (should be) able to determine if the velX/velZ is the size or actual velocity
world.addParticle(ExplosiveEnhancement.SMOKE, isImportant, x, y, z, power, power * 0.25, 0);
world.addParticle(ExplosiveEnhancement.SMOKE, isImportant, x, y, z, power, smokePower, 0);
world.addParticle(ExplosiveEnhancement.SMOKE, isImportant, x, y, z, 0.15, smokePower, power);
world.addParticle(ExplosiveEnhancement.SMOKE, isImportant, x, y, z, -0.15, smokePower, power);
world.addParticle(ExplosiveEnhancement.SMOKE, isImportant, x, y, z, power, smokePower, 0.15);
world.addParticle(ExplosiveEnhancement.SMOKE, isImportant, x, y, z, power, smokePower, -0.15);
addParticle(world, ExplosiveEnhancement.SMOKE, isImportant, x, y, z, power, power * 0.25, 0);
addParticle(world, ExplosiveEnhancement.SMOKE, isImportant, x, y, z, power, smokePower, 0);
addParticle(world, ExplosiveEnhancement.SMOKE, isImportant, x, y, z, 0.15, smokePower, power);
addParticle(world, ExplosiveEnhancement.SMOKE, isImportant, x, y, z, -0.15, smokePower, power);
addParticle(world, ExplosiveEnhancement.SMOKE, isImportant, x, y, z, power, smokePower, 0.15);
addParticle(world, ExplosiveEnhancement.SMOKE, isImportant, x, y, z, power, smokePower, -0.15);
}

private static void spawnBubble(World world, double x, double y, double z, boolean isImportant) {
for (int i = 0; i < CONFIG.bubbleAmount; i++) {
double velX = world.random.nextBetween(1, 7) * 0.3 * world.random.nextBetween(-1, 1);
double velY = world.random.nextBetween(1, 10) * 0.1;
double velZ = world.random.nextBetween(1, 7) * 0.3 * world.random.nextBetween(-1, 1);
world.addParticle(ExplosiveEnhancement.BUBBLE, isImportant, x, y, z, velX, velY, velZ);
addParticle(world, ExplosiveEnhancement.BUBBLE, isImportant, x, y, z, velX, velY, velZ);
}
}

Expand All @@ -282,6 +282,14 @@ private static void spawnVanillaParticles(World world, double x, double y, doubl
/*ParticleEffect particle = ParticleTypes.EXPLOSION;
ParticleEffect emitter = ParticleTypes.EXPLOSION_EMITTER;
*///?}
world.addParticle(power >= 2.0f && didDestroyBlocks ? emitter : particle, isImportant, x, y, z, 1.0, 0.0, 0.0);
addParticle(world, power >= 2.0f && didDestroyBlocks ? emitter : particle, isImportant, x, y, z, 1.0, 0.0, 0.0);
}

private static void addParticle(World world, ParticleEffect particle, boolean isImportant, double x, double y, double z, double velX, double velY, double velZ) {
//? if(<=1.21.3) {
// world.addParticle(particle, isImportant, x, y, z, velX, velY, velZ);
//?} else {
world.addParticle(particle, isImportant, isImportant, x, y, z, velX, velY, velZ);
//?}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ public static Screen makeScreen(Screen parent) {
dynamicExplosionGroup.option(dynamicUnderwater);
//taking the easy way out for now
//may figure out how to add this to older versions later
//? if(>=1.21.2) {
//? if (>=1.21.2) {
dynamicExplosionGroup.option(extraPower);
dynamicExplosionGroup.option(bigExtraPower);
dynamicExplosionGroup.option(smallExtraPower);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.ModifyVariable;

import java.util.List;

import net.minecraft.server.world.ServerWorld;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(ServerWorld.class)
//?}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ public BlastWaveParticle(ClientWorld world, double x, double y, double z, double
this.setSpriteForAge(sprites);
}


@Override
public void buildGeometry(VertexConsumer buffer, Camera camera, float ticks) {
//? if(<=1.21.3) {
// public void buildGeometry(VertexConsumer buffer, Camera camera, float ticks) {
//?} else {
public void render(VertexConsumer buffer, Camera camera, float ticks) {
//?}
Vec3d vec3 = camera.getPos();
float x = (float) (MathHelper.lerp(ticks, this.prevPosX, this.x) - vec3.getX());
float y = (float) (MathHelper.lerp(ticks, this.prevPosY, this.y) - vec3.getY());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ public void tick() {
this.velocityY -= (double)this.gravityStrength;
this.move(this.velocityX, this.velocityY, this.velocityZ);
if(this.age >= this.maxAge * 0.65 && CONFIG.showSparks) {
this.world.addParticle(ExplosiveEnhancement.SPARKS, important, this.x, this.y, this.z, this.scale, this.velocityY, this.velocityZ);
//?if (<=1.21.3) {
// this.world.addParticle(ExplosiveEnhancement.SPARKS, important, this.x, this.y, this.z, this.scale, this.velocityY, this.velocityZ);
//?} else {
this.world.addParticle(ExplosiveEnhancement.SPARKS, important, important, this.x, this.y, this.z, this.scale, this.velocityY, this.velocityZ);
//?}
}
this.setSpriteForAge(this.spriteProvider);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ public void tick() {
this.velocityY -= (double)this.gravityStrength;
this.move(this.velocityX, this.velocityY, this.velocityZ);
if(this.age >= this.maxAge * 0.65 && CONFIG.showUnderwaterSparks) {
this.world.addParticle(ExplosiveEnhancement.UNDERWATERSPARKS, important, this.x, this.y, this.z, scale, this.velocityY, this.velocityZ);
//? if(<=1.21.3) {
// this.world.addParticle(ExplosiveEnhancement.UNDERWATERSPARKS, important, this.x, this.y, this.z, scale, this.velocityY, this.velocityZ);
//?} else {
this.world.addParticle(ExplosiveEnhancement.UNDERWATERSPARKS, important, important, this.x, this.y, this.z, scale, this.velocityY, this.velocityZ);
//?}
}
this.setSpriteForAge(this.spriteProvider);
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/explosiveenhancement.mixins.json5
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,10 @@
"injectors": {
"defaultRequire": 1
}
//i hate this i hate gradle
//you do not understand how frustrating the mixins have been here - hours wasted on nothing
//? if (>=1.21.2) {
,
"refmap": "explosive-enhancement-refmap.json",
//?}
}
2 changes: 1 addition & 1 deletion stonecutter.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id "dev.kikugie.stonecutter"
}
stonecutter.active "1.21.3" /* [SC] DO NOT EDIT */
stonecutter.active "1.21.4" /* [SC] DO NOT EDIT */

stonecutter.registerChiseled tasks.register("chiseledBuild", stonecutter.chiseled) {
setGroup "project"
Expand Down
2 changes: 1 addition & 1 deletion versions/1.21.3/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
minecraft_version=1.21.3
supported_mc_versions=>=1.21.2
supported_mc_versions=>=1.21.2 <=1.21.3
jarname_target=1.21.2-3
yarn_mappings=1.21.3+build.2

Expand Down
8 changes: 8 additions & 0 deletions versions/1.21.4/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
minecraft_version=1.21.4
supported_mc_versions=>=1.21.4
jarname_target=1.21.4
yarn_mappings=1.21.4+build.2

fabric_version=0.112.1+1.21.4
modmenu_version=13.0.0-beta.1
yacl_version=3.6.2+1.21.4-fabric

0 comments on commit 92fd419

Please sign in to comment.