From 9a2c27eec0efb27868283cf975605779c44f6e32 Mon Sep 17 00:00:00 2001 From: Hantonik Date: Sun, 15 Sep 2024 00:06:39 +0200 Subject: [PATCH] Fix particles becoming dark, fixes #21 --- .../java/hantonik/fbp/util/FBPConstants.java | 7 +++++- .../hantonik/fbp/util/FBPRenderHelper.java | 3 ++- Forge/build.gradle | 3 +-- .../fbp/mixin/MixinItemPickupParticle.java | 25 ------------------- .../src/main/resources/fbp.forge.mixins.json | 10 -------- update.json | 3 ++- 6 files changed, 11 insertions(+), 40 deletions(-) delete mode 100644 Forge/src/main/java/hantonik/fbp/mixin/MixinItemPickupParticle.java delete mode 100644 Forge/src/main/resources/fbp.forge.mixins.json diff --git a/Common/src/main/java/hantonik/fbp/util/FBPConstants.java b/Common/src/main/java/hantonik/fbp/util/FBPConstants.java index 3c04227..98ee1db 100644 --- a/Common/src/main/java/hantonik/fbp/util/FBPConstants.java +++ b/Common/src/main/java/hantonik/fbp/util/FBPConstants.java @@ -50,12 +50,14 @@ public final class FBPConstants { public static final ParticleRenderType FBP_PARTICLE_RENDER = new ParticleRenderType() { @Override public void begin(BufferBuilder buffer, @NotNull TextureManager manager) { + Minecraft.getInstance().gameRenderer.lightTexture().turnOnLightLayer(); + RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); RenderSystem.depthMask(true); + RenderSystem.enableDepthTest(); RenderSystem.setShaderTexture(0, InventoryMenu.BLOCK_ATLAS); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.setShader(GameRenderer::getParticleShader); RenderSystem.enableCull(); @@ -78,9 +80,12 @@ public void end(Tesselator tesselator) { public static final ParticleRenderType FBP_TERRAIN_RENDER = new ParticleRenderType() { @Override public void begin(BufferBuilder buffer, TextureManager manager) { + Minecraft.getInstance().gameRenderer.lightTexture().turnOnLightLayer(); + RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); RenderSystem.depthMask(true); + RenderSystem.enableDepthTest(); RenderSystem.setShaderTexture(0, InventoryMenu.BLOCK_ATLAS); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShader(GameRenderer::getRendertypeTranslucentShader); diff --git a/Common/src/main/java/hantonik/fbp/util/FBPRenderHelper.java b/Common/src/main/java/hantonik/fbp/util/FBPRenderHelper.java index a7df008..23cbe22 100644 --- a/Common/src/main/java/hantonik/fbp/util/FBPRenderHelper.java +++ b/Common/src/main/java/hantonik/fbp/util/FBPRenderHelper.java @@ -4,6 +4,7 @@ import hantonik.fbp.platform.Services; import lombok.AccessLevel; import lombok.NoArgsConstructor; +import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.util.Mth; import org.joml.Vector2f; import org.joml.Vector3d; @@ -69,7 +70,7 @@ public static void renderCubeShaded(VertexConsumer buffer, Vector2f[] uv, double } public static void addVertex(VertexConsumer buffer, Vector3d pos, float u, float v, int light, float red, float green, float blue, float alpha, Vector3d normal) { - buffer.vertex(pos.x, pos.y, pos.z).color(red, green, blue, alpha).uv(u, v).uv2(light).normal((float) normal.x, (float) normal.y, (float) normal.z).endVertex(); + buffer.vertex(pos.x, pos.y, pos.z).color(red, green, blue, alpha).uv(u, v).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal((float) normal.x, (float) normal.y, (float) normal.z).endVertex(); } public static Vector3d rotate(Vector3d vector, float angleX, float angleY, float angleZ) { diff --git a/Forge/build.gradle b/Forge/build.gradle index 0d3e584..aa854d5 100644 --- a/Forge/build.gradle +++ b/Forge/build.gradle @@ -15,7 +15,6 @@ mixin { add sourceSets.main, "${mod_id}.refmap.json" config "${mod_id}.mixins.json" - config "${mod_id}.forge.mixins.json" } println "Forge: $forge_version" @@ -98,7 +97,7 @@ jar { manifest { attributes([ - 'MixinConfigs': "${mod_id}.mixins.json,${mod_id}.forge.mixins.json" + 'MixinConfigs': "${mod_id}.mixins.json" ]) } diff --git a/Forge/src/main/java/hantonik/fbp/mixin/MixinItemPickupParticle.java b/Forge/src/main/java/hantonik/fbp/mixin/MixinItemPickupParticle.java deleted file mode 100644 index 00f02f3..0000000 --- a/Forge/src/main/java/hantonik/fbp/mixin/MixinItemPickupParticle.java +++ /dev/null @@ -1,25 +0,0 @@ -package hantonik.fbp.mixin; - -import com.mojang.blaze3d.vertex.VertexConsumer; -import net.minecraft.client.Camera; -import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.particle.ItemPickupParticle; -import net.minecraft.client.particle.Particle; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(ItemPickupParticle.class) -public abstract class MixinItemPickupParticle extends Particle { - protected MixinItemPickupParticle(ClientLevel pLevel, double pX, double pY, double pZ) { - super(pLevel, pX, pY, pZ); - } - - @Inject(at = @At("HEAD"), method = "render", cancellable = true) - public void render(VertexConsumer pBuffer, Camera pRenderInfo, float pPartialTicks, CallbackInfo callback) { - callback.cancel(); - - // temporary solution - } -} diff --git a/Forge/src/main/resources/fbp.forge.mixins.json b/Forge/src/main/resources/fbp.forge.mixins.json deleted file mode 100644 index 57ab510..0000000 --- a/Forge/src/main/resources/fbp.forge.mixins.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "required": true, - "package": "hantonik.fbp.mixin", - "compatibilityLevel": "JAVA_17", - "refmap": "fbp.refmap.json", - "client": [ - "MixinItemPickupParticle" - ], - "minVersion": "0.8" -} \ No newline at end of file diff --git a/update.json b/update.json index 93c0315..d8e9b6e 100644 --- a/update.json +++ b/update.json @@ -2,10 +2,11 @@ "homepage": "https://www.curseforge.com/minecraft/mc-mods/fbp-renewed", "promos": { - "1.19.4-latest": "19.4.0.3-beta" + "1.19.4-latest": "19.4.0.4-beta" }, "1.19.4": { + "19.4.0.4-beta": "Fix particles becoming dark", "19.4.0.3-beta": "Fix a crash on Freeze effect", "19.4.0.2-beta": "Fix publication on Modrinth", "19.4.0.1-beta": "Fix crash when config file is corrupt",