From 92fd41989921f19ea2752a8e0388a1634ec955c5 Mon Sep 17 00:00:00 2001 From: Superkat32 <89557012+Superkat32@users.noreply.github.com> Date: Thu, 19 Dec 2024 18:37:51 -0500 Subject: [PATCH] i hate multiversion --- build.gradle | 7 ++++ settings.gradle | 2 +- .../ExplosiveHandler.java | 36 +++++++++++-------- .../config/YaclIntegration.java | 2 +- .../mixin/ServerWorldMixin.java | 4 ++- .../particles/normal/BlastWaveParticle.java | 7 ++-- .../particles/normal/FireballParticle.java | 6 +++- .../underwater/ShockwaveParticle.java | 6 +++- .../explosiveenhancement.mixins.json5 | 6 ++++ stonecutter.gradle | 2 +- versions/1.21.3/gradle.properties | 2 +- versions/1.21.4/gradle.properties | 8 +++++ 12 files changed, 65 insertions(+), 23 deletions(-) create mode 100644 versions/1.21.4/gradle.properties diff --git a/build.gradle b/build.gradle index 07036ab..6ea6c0a 100644 --- a/build.gradle +++ b/build.gradle @@ -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 { diff --git a/settings.gradle b/settings.gradle index e4499cd..4d18f51 100644 --- a/settings.gradle +++ b/settings.gradle @@ -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" } } \ No newline at end of file diff --git a/src/main/java/net/superkat/explosiveenhancement/ExplosiveHandler.java b/src/main/java/net/superkat/explosiveenhancement/ExplosiveHandler.java index 943cbb2..788ee54 100644 --- a/src/main/java/net/superkat/explosiveenhancement/ExplosiveHandler.java +++ b/src/main/java/net/superkat/explosiveenhancement/ExplosiveHandler.java @@ -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) { @@ -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); @@ -252,12 +252,12 @@ 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) { @@ -265,7 +265,7 @@ private static void spawnBubble(World world, double x, double y, double z, boole 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); } } @@ -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); + //?} } } diff --git a/src/main/java/net/superkat/explosiveenhancement/config/YaclIntegration.java b/src/main/java/net/superkat/explosiveenhancement/config/YaclIntegration.java index f402de3..bb4003a 100644 --- a/src/main/java/net/superkat/explosiveenhancement/config/YaclIntegration.java +++ b/src/main/java/net/superkat/explosiveenhancement/config/YaclIntegration.java @@ -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); diff --git a/src/main/java/net/superkat/explosiveenhancement/mixin/ServerWorldMixin.java b/src/main/java/net/superkat/explosiveenhancement/mixin/ServerWorldMixin.java index 9135c6f..de33beb 100644 --- a/src/main/java/net/superkat/explosiveenhancement/mixin/ServerWorldMixin.java +++ b/src/main/java/net/superkat/explosiveenhancement/mixin/ServerWorldMixin.java @@ -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) //?} diff --git a/src/main/java/net/superkat/explosiveenhancement/particles/normal/BlastWaveParticle.java b/src/main/java/net/superkat/explosiveenhancement/particles/normal/BlastWaveParticle.java index 4fc47ae..500b52e 100644 --- a/src/main/java/net/superkat/explosiveenhancement/particles/normal/BlastWaveParticle.java +++ b/src/main/java/net/superkat/explosiveenhancement/particles/normal/BlastWaveParticle.java @@ -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()); diff --git a/src/main/java/net/superkat/explosiveenhancement/particles/normal/FireballParticle.java b/src/main/java/net/superkat/explosiveenhancement/particles/normal/FireballParticle.java index 1db0aff..0d61d4d 100644 --- a/src/main/java/net/superkat/explosiveenhancement/particles/normal/FireballParticle.java +++ b/src/main/java/net/superkat/explosiveenhancement/particles/normal/FireballParticle.java @@ -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); } diff --git a/src/main/java/net/superkat/explosiveenhancement/particles/underwater/ShockwaveParticle.java b/src/main/java/net/superkat/explosiveenhancement/particles/underwater/ShockwaveParticle.java index 0595c7d..b463eef 100644 --- a/src/main/java/net/superkat/explosiveenhancement/particles/underwater/ShockwaveParticle.java +++ b/src/main/java/net/superkat/explosiveenhancement/particles/underwater/ShockwaveParticle.java @@ -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); } diff --git a/src/main/resources/explosiveenhancement.mixins.json5 b/src/main/resources/explosiveenhancement.mixins.json5 index 08d7114..5fb4c86 100644 --- a/src/main/resources/explosiveenhancement.mixins.json5 +++ b/src/main/resources/explosiveenhancement.mixins.json5 @@ -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", + //?} } diff --git a/stonecutter.gradle b/stonecutter.gradle index 15aacf9..73cbd81 100644 --- a/stonecutter.gradle +++ b/stonecutter.gradle @@ -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" diff --git a/versions/1.21.3/gradle.properties b/versions/1.21.3/gradle.properties index 202324f..58a1390 100644 --- a/versions/1.21.3/gradle.properties +++ b/versions/1.21.3/gradle.properties @@ -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 diff --git a/versions/1.21.4/gradle.properties b/versions/1.21.4/gradle.properties new file mode 100644 index 0000000..b4415cc --- /dev/null +++ b/versions/1.21.4/gradle.properties @@ -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 \ No newline at end of file