Skip to content

Commit 416b601

Browse files
committed
fix bloom particles become black when entity is killed by player
update architectury, forge, gradle, embeddium, sodium, fabric loader versions
1 parent 153f3a7 commit 416b601

File tree

14 files changed

+109
-63
lines changed

14 files changed

+109
-63
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.lowdragmc.shimmer.core.mixins;
2+
3+
import net.minecraft.client.renderer.LightTexture;
4+
import net.minecraft.client.renderer.texture.DynamicTexture;
5+
import org.spongepowered.asm.mixin.Mixin;
6+
import org.spongepowered.asm.mixin.gen.Accessor;
7+
8+
@Mixin(LightTexture.class)
9+
public interface LightTextureAccessor {
10+
@Accessor
11+
DynamicTexture getLightTexture();
12+
}
Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
{
2-
"required": true,
3-
"minVersion": "0.8",
4-
"package": "com.lowdragmc.shimmer.core.mixins",
5-
"compatibilityLevel": "JAVA_17",
6-
"plugin": "com.lowdragmc.shimmer.core.mixins.ShimmerMixinPlugin",
7-
"client": [
8-
"BlendModeMixin",
9-
"BlockLightEngineMixin",
10-
"GameRendererMixin",
11-
"GLStateManagerMixin",
12-
"HumanoidArmorLayerMixin",
13-
"LevelRendererMixin",
14-
"LiquidBlockRendererMixin",
15-
"MainTargetMixin",
16-
"ModelBlockRendererMixin",
17-
"ParticleDescriptionMixin",
18-
"PostChainMixin",
19-
"PostPassMixin",
20-
"ProgramMixin",
21-
"RebuildTaskMixin",
22-
"RenderChunkMixin",
23-
"RenderTargetMixin",
24-
"ShaderInstanceGlslProcessorMixin"
25-
],
26-
"mixins": [
27-
28-
],
29-
"injectors": {
30-
"defaultRequire": 1
2+
"required": true,
3+
"minVersion": "0.8",
4+
"package": "com.lowdragmc.shimmer.core.mixins",
5+
"compatibilityLevel": "JAVA_17",
6+
"plugin": "com.lowdragmc.shimmer.core.mixins.ShimmerMixinPlugin",
7+
"client": [
8+
"BlendModeMixin",
9+
"BlockLightEngineMixin",
10+
"GameRendererMixin",
11+
"GLStateManagerMixin",
12+
"HumanoidArmorLayerMixin",
13+
"LevelRendererMixin",
14+
"LightTextureAccessor",
15+
"LiquidBlockRendererMixin",
16+
"MainTargetMixin",
17+
"ModelBlockRendererMixin",
18+
"ParticleDescriptionMixin",
19+
"PostChainMixin",
20+
"PostPassMixin",
21+
"ProgramMixin",
22+
"RebuildTaskMixin",
23+
"RenderChunkMixin",
24+
"RenderTargetMixin",
25+
"ShaderInstanceGlslProcessorMixin"
26+
],
27+
"mixins": [
28+
],
29+
"injectors": {
30+
"defaultRequire": 1
3131
}
3232
}

Fabric/build.gradle.kts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ dependencies {
2828
common(project(path = ":Common", configuration = "namedElements")) { isTransitive = false }
2929
shadowCommon(project(path = ":Common", configuration = "transformProductionFabric")) { isTransitive = false }
3030

31-
include(mixinExtras)
32-
modApi("me.shedaniel.cloth:cloth-config-fabric:$cloth_config_version")
31+
modApi("me.shedaniel.cloth:cloth-config-fabric:$cloth_config_version") {
32+
exclude(group = "net.fabricmc", module = "fabric-loader")
33+
}
34+
3335
include("me.shedaniel.cloth:cloth-config-fabric:$cloth_config_version")
3436

3537
// Sodium
36-
modImplementation("maven.modrinth:sodium:mc1.18.2-0.4.1") {
38+
modImplementation("maven.modrinth:sodium:mc1.19.2-0.4.4") {
3739
exclude(group = "net.fabricmc.fabric-api")
3840
}
3941
// This is a dependency of Sodium....

Fabric/src/main/java/com/lowdragmc/shimmer/fabric/core/mixins/FabricParticleEngineMixin.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ private void renderPostParticles(PoseStack matrixStack, MultiBufferSource.Buffer
5151
BufferBuilder bufferBuilder = tesselator.getBuilder();
5252
particleRenderType.begin(bufferBuilder, this.textureManager);
5353

54+
lightTexture.turnOnLightLayer(); //see comments in ForgeParticleEngineMixin
55+
5456
PostProcessing postProcessing = particleRenderType.getPost();
5557
postProcessing.getPostTarget(false).bindWrite(false);
5658
postProcessing.hasParticle();

Fabric/src/main/java/com/lowdragmc/shimmer/fabric/core/mixins/ParticleEngineMixin.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.spongepowered.asm.mixin.Final;
3131
import org.spongepowered.asm.mixin.Mixin;
3232
import org.spongepowered.asm.mixin.Shadow;
33+
import org.spongepowered.asm.mixin.Unique;
3334
import org.spongepowered.asm.mixin.injection.At;
3435
import org.spongepowered.asm.mixin.injection.Inject;
3536
import org.spongepowered.asm.mixin.injection.Redirect;
@@ -55,10 +56,11 @@ public abstract class ParticleEngineMixin implements IParticleEngine {
5556

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

58-
@Shadow @Final private Queue<Particle> particlesToAdd;
59+
@Unique
5960
private final Map<ResourceLocation, String> PARTICLE_EFFECT = Maps.newHashMap();
6061

6162
@Nullable
63+
@Override
6264
public Particle createPostParticle(PostProcessing postProcessing, ParticleOptions pParticleData, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed) {
6365
Particle particle = makeParticle(pParticleData, pX, pY, pZ, pXSpeed, pYSpeed, pZSpeed);
6466
if (particle != null) {

Fabric/src/main/java/com/lowdragmc/shimmer/fabric/core/mixins/ShaderInstanceMixin.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
@Mixin(ShaderInstance.class)
2323
public abstract class ShaderInstanceMixin {
2424

25-
@Mutable
2625
@Shadow @Final private String name;
2726

2827
@Redirect(method = "<init>",

Fabric/src/main/resources/fabric.mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"shimmer.fabric.mixins.json"
3333
],
3434
"depends": {
35-
"fabricloader": ">=0.14.9",
35+
"fabricloader": ">=0.15.0",
3636
"fabric-api":">=0.62.0+1.19.2",
3737
"minecraft": "1.19.x",
3838
"java": ">=17"

Forge/build.gradle.kts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ dependencies {
4141
common(project(path = ":Common", configuration = "namedElements")) { isTransitive = false }
4242
shadowCommon(project(path = ":Common", configuration = "transformProductionForge")) { isTransitive = false }
4343

44-
include(mixinExtras)
45-
forgeRuntimeLibrary(mixinExtras)
44+
annotationProcessor(mixinExtraCommon)
45+
compileOnly(mixinExtraCommon)
46+
include(mixinExtraForge)
47+
implementation(mixinExtraForge)
4648

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

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

Forge/src/main/java/com/lowdragmc/shimmer/forge/core/mixins/ForgeParticleEngineMixin.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
import com.lowdragmc.shimmer.client.postprocessing.PostProcessing;
99
import com.lowdragmc.shimmer.core.IParticleDescription;
1010
import com.lowdragmc.shimmer.core.IParticleEngine;
11+
import com.lowdragmc.shimmer.core.mixins.LightTextureAccessor;
1112
import com.lowdragmc.shimmer.core.mixins.ShimmerMixinPlugin;
1213
import com.lowdragmc.shimmer.platform.Services;
1314
import com.mojang.blaze3d.pipeline.RenderTarget;
15+
import com.mojang.blaze3d.systems.RenderSystem;
1416
import com.mojang.blaze3d.vertex.BufferBuilder;
1517
import com.mojang.blaze3d.vertex.PoseStack;
1618
import net.minecraft.client.Camera;
@@ -31,6 +33,7 @@
3133
import org.spongepowered.asm.mixin.Final;
3234
import org.spongepowered.asm.mixin.Mixin;
3335
import org.spongepowered.asm.mixin.Shadow;
36+
import org.spongepowered.asm.mixin.Unique;
3437
import org.spongepowered.asm.mixin.injection.At;
3538
import org.spongepowered.asm.mixin.injection.Inject;
3639
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -63,6 +66,7 @@ public abstract class ForgeParticleEngineMixin implements IParticleEngine {
6366
private final Map<ResourceLocation, String> PARTICLE_EFFECT = Maps.newHashMap();
6467

6568
@Nullable
69+
@Override
6670
public Particle createPostParticle(PostProcessing postProcessing, ParticleOptions pParticleData, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed) {
6771
Particle particle = makeParticle(pParticleData, pX, pY, pZ, pXSpeed, pYSpeed, pZSpeed);
6872
if (particle != null) {
@@ -82,10 +86,27 @@ private ParticleRenderType injectRenderPre(ParticleRenderType particlerendertype
8286
PostProcessing postProcessing = ((IPostParticleType) particlerendertype).getPost();
8387
postProcessing.getPostTarget(false).bindWrite(false);
8488
postProcessing.hasParticle();
89+
shimmer$turnOnLightTextureIfNeeded();
8590
}
8691
return particlerendertype;
8792
}
8893

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

90111
@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",
91112
at = @At(value = "INVOKE",

Forge/src/main/resources/shimmer.forge.mixins.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55
"compatibilityLevel": "JAVA_17",
66
"plugin": "com.lowdragmc.shimmer.forge.core.mixins.ShimmerForgeMixinPlugin",
77
"client": [
8-
"BakedQuadMixin",
9-
"ForgeParticleEngineMixin",
10-
"ForgeShaderInstanceMixin",
11-
"QuadLighterMixin",
12-
"flywheel.LevelRenderMixin"
8+
"BakedQuadMixin",
9+
"ForgeParticleEngineMixin",
10+
"ForgeShaderInstanceMixin",
11+
"QuadLighterMixin",
12+
"flywheel.LevelRenderMixin"
1313
],
1414
"mixins": [
15-
"rubidium.BlockRendererMixin",
16-
"rubidium.ChunkRenderRebuildTaskMixin",
17-
"rubidium.FluidRendererMixin",
18-
"rubidium.RenderSectionManagerAccessor",
19-
"rubidium.RenderSectionMixin",
20-
"rubidium.ShaderChunkRendererMixin",
21-
"rubidium.ShaderLoaderMixin",
22-
"rubidium.SodiumWorldRendererMixin"
15+
"rubidium.BlockRendererMixin",
16+
"rubidium.ChunkRenderRebuildTaskMixin",
17+
"rubidium.FluidRendererMixin",
18+
"rubidium.RenderSectionManagerAccessor",
19+
"rubidium.RenderSectionMixin",
20+
"rubidium.ShaderChunkRendererMixin",
21+
"rubidium.ShaderLoaderMixin",
22+
"rubidium.SodiumWorldRendererMixin"
2323
],
2424
"injectors": {
2525
"defaultRequire": 1

0 commit comments

Comments
 (0)