From db1bb6e7eb75f77f915290a7d93b71f884d9d3a4 Mon Sep 17 00:00:00 2001 From: Caffeine Date: Tue, 5 Nov 2024 04:43:29 +0100 Subject: [PATCH 1/4] iris compat --- build.gradle | 5 +++++ .../actuallyadditions/mod/blocks/render/RenderTypes.java | 3 ++- .../actuallyadditions/mod/particle/ParticleBeam.java | 1 + .../de/ellpeck/actuallyadditions/mod/util/AssetUtil.java | 8 ++++---- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 73d70c662..1eacb6da8 100644 --- a/build.gradle +++ b/build.gradle @@ -94,6 +94,9 @@ repositories { includeGroup "curse.maven" } } + maven { + url = "https://api.modrinth.com/maven" + } maven { url = 'https://maven.octo-studios.com/releases' } } @@ -110,6 +113,8 @@ dependencies { localRuntime "curse.maven:jade-324717:5803666" localRuntime "curse.maven:mekanism-268560:5680395" + localRuntime "maven.modrinth:sodium:mc1.21.1-0.6.0-beta.4-neoforge" + localRuntime "curse.maven:irisshaders-455508:5873114" // Immersive Engineering, mainly for compat datagen localRuntime "curse.maven:ie-231951:5828000" diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderTypes.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderTypes.java index 591fbbdd6..d30188560 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderTypes.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderTypes.java @@ -25,6 +25,7 @@ public class RenderTypes extends RenderType { .setOutputState(MAIN_TARGET) .setLightmapState(RenderStateShard.LIGHTMAP) .setCullState(RenderStateShard.NO_CULL) - .setShaderState(RenderStateShard.POSITION_COLOR_TEX_LIGHTMAP_SHADER) + .setShaderState(RenderStateShard.POSITION_COLOR_SHADER) .createCompositeState(true)); + } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleBeam.java b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleBeam.java index 664aeff31..7165fd692 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleBeam.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleBeam.java @@ -37,6 +37,7 @@ public class ParticleBeam extends Particle { public BufferBuilder begin(Tesselator tesselator, TextureManager textureManager) { RenderSystem.disableCull(); RenderSystem.enableBlend(); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 0.2F); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); return tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java index fcaa8b9d5..ce18c7b3d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java @@ -234,9 +234,9 @@ public final class AssetUtil { int g = (color >> 8) & 0xFF; int b = color & 0xFF; int a = (int) (alpha * 255);*/ - int r = (int)(((color >> 16) & 0xFF) * alpha); - int g = (int)(((color >> 8) & 0xFF) * alpha); - int b = (int)((color & 0xFF) * alpha); + int r = (int)(((color >> 16) & 0xFF) * alpha * 0.4F); + int g = (int)(((color >> 8) & 0xFF) * alpha * 0.4F); + int b = (int)((color & 0xFF) * alpha * 0.4F); int a = 255; int lightmap = LightTexture.pack(MAX_LIGHT_X, MAX_LIGHT_Y); @@ -334,7 +334,7 @@ public final class AssetUtil { Matrix4f matrix = matrixStack.last().pose(); - RenderSystem.setShader(GameRenderer::getPositionColorLightmapShader); + RenderSystem.setShader(GameRenderer::getPositionColorShader); TextureAtlasSprite sprite = Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(FORGE_WHITE); float minU = sprite.getU0(); From 7fb62cb85917beed48720caccdd948b71d851d30 Mon Sep 17 00:00:00 2001 From: Mrbysco Date: Tue, 5 Nov 2024 19:32:29 +0100 Subject: [PATCH 2/4] Fix particle vertex format (Fixes the color) Fix alpha not being fed to the color int provided to the ParticleBeam --- .../ellpeck/actuallyadditions/mod/particle/ParticleBeam.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleBeam.java b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleBeam.java index 7165fd692..d086a2fd7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleBeam.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleBeam.java @@ -37,9 +37,8 @@ public class ParticleBeam extends Particle { public BufferBuilder begin(Tesselator tesselator, TextureManager textureManager) { RenderSystem.disableCull(); RenderSystem.enableBlend(); - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 0.2F); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); - return tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE); + return tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); } @Override @@ -101,7 +100,7 @@ public class ParticleBeam extends Particle { public static ParticleOptions createData(double endX, double endY, double endZ, int color, float alpha, int maxAge, double rotationTime, float size) { - return new BeamParticleData(endX, endY, endZ, color, maxAge, rotationTime, size); + return new BeamParticleData(endX, endY, endZ, FastColor.ARGB32.color((int)(alpha * 255F), color), maxAge, rotationTime, size); } } } From 5fb22fa63c567250d2260f72c6ea181cf537a578 Mon Sep 17 00:00:00 2001 From: Mrbysco Date: Tue, 5 Nov 2024 19:34:09 +0100 Subject: [PATCH 3/4] Remove iris/sodium from runtime If needing testing can always throw the jars in the mods folder --- build.gradle | 5 ----- 1 file changed, 5 deletions(-) diff --git a/build.gradle b/build.gradle index 1eacb6da8..73d70c662 100644 --- a/build.gradle +++ b/build.gradle @@ -94,9 +94,6 @@ repositories { includeGroup "curse.maven" } } - maven { - url = "https://api.modrinth.com/maven" - } maven { url = 'https://maven.octo-studios.com/releases' } } @@ -113,8 +110,6 @@ dependencies { localRuntime "curse.maven:jade-324717:5803666" localRuntime "curse.maven:mekanism-268560:5680395" - localRuntime "maven.modrinth:sodium:mc1.21.1-0.6.0-beta.4-neoforge" - localRuntime "curse.maven:irisshaders-455508:5873114" // Immersive Engineering, mainly for compat datagen localRuntime "curse.maven:ie-231951:5828000" From de635bb709691bb768699e528047f9d7cf3b2ce6 Mon Sep 17 00:00:00 2001 From: Mrbysco Date: Tue, 5 Nov 2024 20:43:43 +0100 Subject: [PATCH 4/4] Remove unused vertex attributes from laser --- .../actuallyadditions/mod/util/AssetUtil.java | 77 ++++++++----------- 1 file changed, 32 insertions(+), 45 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java index ce18c7b3d..c770ee83a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java @@ -26,7 +26,6 @@ import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.texture.TextureAtlas; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.BlockPos; @@ -254,35 +253,29 @@ public final class AssetUtil { Matrix4f matrix = matrixStack.last().pose(); - TextureAtlasSprite sprite = Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(FORGE_WHITE); - float minU = sprite.getU0(); - float maxU = sprite.getU1(); - float minV = sprite.getV0(); - float maxV = sprite.getV1(); - //Draw laser tube faces for (int i = 1; i < 4; i++) { float width = beamWidth * (i / 4.0f); //top - builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a).setUv(minU, maxV).setLight(lightmap); - builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap); - builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a).setUv(maxU, minV).setLight(lightmap); - builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap); + builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a).setLight(lightmap); + builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a).setLight(lightmap); + builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a).setLight(lightmap); + builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a).setLight(lightmap); //bottom - builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a).setUv(minU, maxV).setLight(lightmap); - builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap); - builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a).setUv(maxU, minV).setLight(lightmap); - builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap); + builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a).setLight(lightmap); + builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a).setLight(lightmap); + builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a).setLight(lightmap); + builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a).setLight(lightmap); //left - builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap); - builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap); - builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap); - builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap); + builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a).setLight(lightmap); + builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a).setLight(lightmap); + builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a).setLight(lightmap); + builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a).setLight(lightmap); //right - builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap); - builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap); - builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap); - builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap); + builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a).setLight(lightmap); + builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a).setLight(lightmap); + builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a).setLight(lightmap); + builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a).setLight(lightmap); } @@ -336,35 +329,29 @@ public final class AssetUtil { RenderSystem.setShader(GameRenderer::getPositionColorShader); - TextureAtlasSprite sprite = Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(FORGE_WHITE); - float minU = sprite.getU0(); - float maxU = sprite.getU1(); - float minV = sprite.getV0(); - float maxV = sprite.getV1(); - //Draw laser tube faces for (int i = 1; i < 4; i++) { float width = beamWidth * (i / 4.0f); //top - builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a).setUv(minU, maxV).setLight(lightmap); - builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap); - builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a).setUv(maxU, minV).setLight(lightmap); - builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap); + builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a); + builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a); + builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a); + builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a); //bottom - builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a).setUv(minU, maxV).setLight(lightmap); - builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap); - builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a).setUv(maxU, minV).setLight(lightmap); - builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap); + builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a); + builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a); + builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a); + builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a); //left - builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap); - builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap); - builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap); - builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap); + builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a); + builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a); + builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a); + builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a); //right - builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap); - builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap); - builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap); - builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap); + builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a); + builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a); + builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a); + builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a); } matrixStack.popPose();