Skip to content

Commit

Permalink
fix bloom particles become black when entity is killed by player
Browse files Browse the repository at this point in the history
update architectury, forge, gradle, embeddium, sodium, fabric loader versions
  • Loading branch information
zomb-676 committed Jun 19, 2024
1 parent 153f3a7 commit 416b601
Show file tree
Hide file tree
Showing 14 changed files with 109 additions and 63 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.lowdragmc.shimmer.core.mixins;

import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.texture.DynamicTexture;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

@Mixin(LightTexture.class)
public interface LightTextureAccessor {
@Accessor
DynamicTexture getLightTexture();
}
58 changes: 29 additions & 29 deletions Common/src/main/resources/shimmer.mixins.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
{
"required": true,
"minVersion": "0.8",
"package": "com.lowdragmc.shimmer.core.mixins",
"compatibilityLevel": "JAVA_17",
"plugin": "com.lowdragmc.shimmer.core.mixins.ShimmerMixinPlugin",
"client": [
"BlendModeMixin",
"BlockLightEngineMixin",
"GameRendererMixin",
"GLStateManagerMixin",
"HumanoidArmorLayerMixin",
"LevelRendererMixin",
"LiquidBlockRendererMixin",
"MainTargetMixin",
"ModelBlockRendererMixin",
"ParticleDescriptionMixin",
"PostChainMixin",
"PostPassMixin",
"ProgramMixin",
"RebuildTaskMixin",
"RenderChunkMixin",
"RenderTargetMixin",
"ShaderInstanceGlslProcessorMixin"
],
"mixins": [

],
"injectors": {
"defaultRequire": 1
"required": true,
"minVersion": "0.8",
"package": "com.lowdragmc.shimmer.core.mixins",
"compatibilityLevel": "JAVA_17",
"plugin": "com.lowdragmc.shimmer.core.mixins.ShimmerMixinPlugin",
"client": [
"BlendModeMixin",
"BlockLightEngineMixin",
"GameRendererMixin",
"GLStateManagerMixin",
"HumanoidArmorLayerMixin",
"LevelRendererMixin",
"LightTextureAccessor",
"LiquidBlockRendererMixin",
"MainTargetMixin",
"ModelBlockRendererMixin",
"ParticleDescriptionMixin",
"PostChainMixin",
"PostPassMixin",
"ProgramMixin",
"RebuildTaskMixin",
"RenderChunkMixin",
"RenderTargetMixin",
"ShaderInstanceGlslProcessorMixin"
],
"mixins": [
],
"injectors": {
"defaultRequire": 1
}
}
8 changes: 5 additions & 3 deletions Fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ dependencies {
common(project(path = ":Common", configuration = "namedElements")) { isTransitive = false }
shadowCommon(project(path = ":Common", configuration = "transformProductionFabric")) { isTransitive = false }

include(mixinExtras)
modApi("me.shedaniel.cloth:cloth-config-fabric:$cloth_config_version")
modApi("me.shedaniel.cloth:cloth-config-fabric:$cloth_config_version") {
exclude(group = "net.fabricmc", module = "fabric-loader")
}

include("me.shedaniel.cloth:cloth-config-fabric:$cloth_config_version")

// Sodium
modImplementation("maven.modrinth:sodium:mc1.18.2-0.4.1") {
modImplementation("maven.modrinth:sodium:mc1.19.2-0.4.4") {
exclude(group = "net.fabricmc.fabric-api")
}
// This is a dependency of Sodium....
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ private void renderPostParticles(PoseStack matrixStack, MultiBufferSource.Buffer
BufferBuilder bufferBuilder = tesselator.getBuilder();
particleRenderType.begin(bufferBuilder, this.textureManager);

lightTexture.turnOnLightLayer(); //see comments in ForgeParticleEngineMixin

PostProcessing postProcessing = particleRenderType.getPost();
postProcessing.getPostTarget(false).bindWrite(false);
postProcessing.hasParticle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
Expand All @@ -55,10 +56,11 @@ public abstract class ParticleEngineMixin implements IParticleEngine {

@Shadow @Final private Map<ParticleRenderType, Queue<Particle>> particles;

@Shadow @Final private Queue<Particle> particlesToAdd;
@Unique
private final Map<ResourceLocation, String> PARTICLE_EFFECT = Maps.newHashMap();

@Nullable
@Override
public Particle createPostParticle(PostProcessing postProcessing, ParticleOptions pParticleData, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed) {
Particle particle = makeParticle(pParticleData, pX, pY, pZ, pXSpeed, pYSpeed, pZSpeed);
if (particle != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
@Mixin(ShaderInstance.class)
public abstract class ShaderInstanceMixin {

@Mutable
@Shadow @Final private String name;

@Redirect(method = "<init>",
Expand Down
2 changes: 1 addition & 1 deletion Fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"shimmer.fabric.mixins.json"
],
"depends": {
"fabricloader": ">=0.14.9",
"fabricloader": ">=0.15.0",
"fabric-api":">=0.62.0+1.19.2",
"minecraft": "1.19.x",
"java": ">=17"
Expand Down
8 changes: 5 additions & 3 deletions Forge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ dependencies {
common(project(path = ":Common", configuration = "namedElements")) { isTransitive = false }
shadowCommon(project(path = ":Common", configuration = "transformProductionForge")) { isTransitive = false }

include(mixinExtras)
forgeRuntimeLibrary(mixinExtras)
annotationProcessor(mixinExtraCommon)
compileOnly(mixinExtraCommon)
include(mixinExtraForge)
implementation(mixinExtraForge)

modCompileOnly("curse.maven:rubidium-574856:3973894")
modImplementation("maven.modrinth:embeddium:0.3.18+mc1.19.2")

modImplementation("com.jozufozu.flywheel:flywheel-forge-$minecraft_version:$flywheel_version")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
import com.lowdragmc.shimmer.client.postprocessing.PostProcessing;
import com.lowdragmc.shimmer.core.IParticleDescription;
import com.lowdragmc.shimmer.core.IParticleEngine;
import com.lowdragmc.shimmer.core.mixins.LightTextureAccessor;
import com.lowdragmc.shimmer.core.mixins.ShimmerMixinPlugin;
import com.lowdragmc.shimmer.platform.Services;
import com.mojang.blaze3d.pipeline.RenderTarget;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Camera;
Expand All @@ -31,6 +33,7 @@
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
Expand Down Expand Up @@ -63,6 +66,7 @@ public abstract class ForgeParticleEngineMixin implements IParticleEngine {
private final Map<ResourceLocation, String> PARTICLE_EFFECT = Maps.newHashMap();

@Nullable
@Override
public Particle createPostParticle(PostProcessing postProcessing, ParticleOptions pParticleData, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed) {
Particle particle = makeParticle(pParticleData, pX, pY, pZ, pXSpeed, pYSpeed, pZSpeed);
if (particle != null) {
Expand All @@ -82,10 +86,27 @@ private ParticleRenderType injectRenderPre(ParticleRenderType particlerendertype
PostProcessing postProcessing = ((IPostParticleType) particlerendertype).getPost();
postProcessing.getPostTarget(false).bindWrite(false);
postProcessing.hasParticle();
shimmer$turnOnLightTextureIfNeeded();
}
return particlerendertype;
}

/**
* {@link ParticleRenderType#CUSTOM} can implementation custom render logical not defined
* for example {@link net.minecraft.client.particle.ItemPickupParticle}
* where {@link net.minecraft.client.renderer.RenderType#entityShadow(ResourceLocation)} is used
* it will use {@link net.minecraft.client.renderer.RenderStateShard.LightmapStateShard}
* which will call {@link LightTexture#turnOffLightLayer()}, so we need turn on it if needed
*/
@Unique
private void shimmer$turnOnLightTextureIfNeeded() {
int currentLightTextureSlotID = RenderSystem.getShaderTexture(2);
LightTexture lightTexture = Minecraft.getInstance().gameRenderer.lightTexture();
int lightTextureID = ((LightTextureAccessor) lightTexture).getLightTexture().getId();
if (currentLightTextureSlotID != lightTextureID) {
lightTexture.turnOnLightLayer();
}
}

@Inject(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;Lnet/minecraft/client/renderer/LightTexture;Lnet/minecraft/client/Camera;FLnet/minecraft/client/renderer/culling/Frustum;)V",
at = @At(value = "INVOKE",
Expand Down
26 changes: 13 additions & 13 deletions Forge/src/main/resources/shimmer.forge.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
"compatibilityLevel": "JAVA_17",
"plugin": "com.lowdragmc.shimmer.forge.core.mixins.ShimmerForgeMixinPlugin",
"client": [
"BakedQuadMixin",
"ForgeParticleEngineMixin",
"ForgeShaderInstanceMixin",
"QuadLighterMixin",
"flywheel.LevelRenderMixin"
"BakedQuadMixin",
"ForgeParticleEngineMixin",
"ForgeShaderInstanceMixin",
"QuadLighterMixin",
"flywheel.LevelRenderMixin"
],
"mixins": [
"rubidium.BlockRendererMixin",
"rubidium.ChunkRenderRebuildTaskMixin",
"rubidium.FluidRendererMixin",
"rubidium.RenderSectionManagerAccessor",
"rubidium.RenderSectionMixin",
"rubidium.ShaderChunkRendererMixin",
"rubidium.ShaderLoaderMixin",
"rubidium.SodiumWorldRendererMixin"
"rubidium.BlockRendererMixin",
"rubidium.ChunkRenderRebuildTaskMixin",
"rubidium.FluidRendererMixin",
"rubidium.RenderSectionManagerAccessor",
"rubidium.RenderSectionMixin",
"rubidium.ShaderChunkRendererMixin",
"rubidium.ShaderLoaderMixin",
"rubidium.SodiumWorldRendererMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import net.fabricmc.loom.api.LoomGradleExtensionAPI
import java.util.*

plugins {
id("architectury-plugin")
Expand Down Expand Up @@ -59,16 +60,15 @@ subprojects {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-$parchment_version@zip")
})
"implementation"(mixinExtras)
"annotationProcessor"(mixinExtras)
"implementation"("com.github.spotbugs:spotbugs-annotations:4.8.5")
}

extensions.getByType<BasePluginExtension>().apply {
archivesName.set(archiveBaseName)
}

extensions.getByType<PublishingExtension>().apply {
val platformName = project.name.toLowerCase()
val platformName = project.name.lowercase(Locale.getDefault())
publications {
create<MavenPublication>(name = platformName) {
groupId = maven_group
Expand Down
19 changes: 12 additions & 7 deletions buildSrc/src/main/kotlin/Constant.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.gradle.api.Project
import java.util.*

//Mod options
val mod_name = "Shimmer"
Expand All @@ -14,23 +15,27 @@ val enabled_platforms = "fabric,forge"
val architectury_version = "4.8.79"

//Fabric
val fabric_loader_version = "0.14.9"
val fabric_api_version = "0.62.0+$minecraft_version"
val fabric_loader_version = "0.15.11"
val fabric_api_version = "0.77.0+$minecraft_version"
val cloth_config_version = "8.2.88"

//Forge
val forge_version = "$minecraft_version-43.1.34"
val forge_version = "$minecraft_version-43.3.7"
val modernui_version = "3.6.1.115"

//Project
val version_major = 0.1
val version_patch = 15
val version_major = 0.2
val version_patch = 5
val semantics_version = "$minecraft_version-$version_major.$version_patch"
val maven_path = "snapshots"
val maven_group = "com.lowdragmc.shimmer"

val mixinExtras = "com.github.LlamaLad7:MixinExtras:0.1.0"
private val mixinExtra = "io.github.llamalad7:mixinextras"
private val mixinExtraVersion = "0.3.6"
val mixinExtraCommon = "$mixinExtra-common:$mixinExtraVersion"
val mixinExtraForge = "$mixinExtra-forge:$mixinExtraVersion"
val mixinExtraFabric = "$mixinExtra-fabric:$mixinExtraVersion"

val flywheel_version = "0.6.7-8"

val Project.archiveBaseName get() = "$mod_name-${project.name.toLowerCase()}"
val Project.archiveBaseName get() = "$mod_name-${project.name.lowercase(Locale.getDefault())}"
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Tue Jun 18 17:31:20 GMT+08:00 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pluginManagement {
}
plugins{
id("architectury-plugin") version ("3.4-SNAPSHOT") apply false
id("dev.architectury.loom") version ("0.12.0-SNAPSHOT") apply false
id("dev.architectury.loom") version ("1.5-SNAPSHOT") apply false
id("com.github.johnrengelman.shadow").version("7.1.2").apply(false)
}
}
Expand Down

0 comments on commit 416b601

Please sign in to comment.