mirror of
https://github.com/TeamMidnightDust/PictureSign.git
synced 2025-12-13 04:45:10 +01:00
PictureSign 1.1.0 - Iris Compat & Sign render distance
- Better Compatibility with Iris Shaders - Added sign render distance option (configurable in PictureSign config)
This commit is contained in:
@@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
loader_version=0.11.7
|
loader_version=0.11.7
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.0.0
|
mod_version = 1.1.0
|
||||||
maven_group = eu.midnightdust
|
maven_group = eu.midnightdust
|
||||||
archives_base_name = picturesign
|
archives_base_name = picturesign
|
||||||
|
|
||||||
|
|||||||
@@ -6,4 +6,5 @@ public class PictureSignConfig extends MidnightConfig {
|
|||||||
@Entry public static boolean enabled = true;
|
@Entry public static boolean enabled = true;
|
||||||
@Entry public static boolean debug = false;
|
@Entry public static boolean debug = false;
|
||||||
@Entry(min = 1, max = 10) public static int maxThreads = 4;
|
@Entry(min = 1, max = 10) public static int maxThreads = 4;
|
||||||
|
@Entry(min = 0, max = 1024) public static int signRenderDistance = 64;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
|||||||
import net.minecraft.client.render.block.entity.SignBlockEntityRenderer;
|
import net.minecraft.client.render.block.entity.SignBlockEntityRenderer;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
@@ -27,4 +28,9 @@ public abstract class MixinSignBlockEntityRenderer implements BlockEntityRendere
|
|||||||
private static void shouldRender(SignBlockEntity sign, int signColor, CallbackInfoReturnable<Boolean> cir) {
|
private static void shouldRender(SignBlockEntity sign, int signColor, CallbackInfoReturnable<Boolean> cir) {
|
||||||
if (PictureSignConfig.enabled && sign.getTextOnRow(0,false).getString().matches("(!PS:.*)")) cir.setReturnValue(true);
|
if (PictureSignConfig.enabled && sign.getTextOnRow(0,false).getString().matches("(!PS:.*)")) cir.setReturnValue(true);
|
||||||
}
|
}
|
||||||
|
@Unique
|
||||||
|
@Override
|
||||||
|
public int getRenderDistance() {
|
||||||
|
return PictureSignConfig.signRenderDistance;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package eu.midnightdust.picturesign.render;
|
|||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import eu.midnightdust.picturesign.PictureDownloader;
|
import eu.midnightdust.picturesign.PictureDownloader;
|
||||||
|
import net.coderbot.iris.Iris;
|
||||||
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.minecraft.block.entity.SignBlockEntity;
|
import net.minecraft.block.entity.SignBlockEntity;
|
||||||
import net.minecraft.client.render.*;
|
import net.minecraft.client.render.*;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
@@ -87,7 +89,15 @@ public class PictureSignRenderer {
|
|||||||
|
|
||||||
matrixStack.push();
|
matrixStack.push();
|
||||||
|
|
||||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
int l;
|
||||||
|
if (FabricLoader.getInstance().isModLoaded("iris") && Iris.getIrisConfig().areShadersEnabled() && Iris.getCurrentPack().isPresent()) {
|
||||||
|
RenderSystem.setShader(GameRenderer::getRenderTypeCutoutShader);
|
||||||
|
l = 230;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
RenderSystem.setShader(GameRenderer::getPositionColorTexLightmapShader);
|
||||||
|
l = light;
|
||||||
|
}
|
||||||
RenderSystem.setShaderTexture(0, data.identifier);
|
RenderSystem.setShaderTexture(0, data.identifier);
|
||||||
|
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
@@ -98,19 +108,19 @@ public class PictureSignRenderer {
|
|||||||
matrixStack.multiply(yRotation);
|
matrixStack.multiply(yRotation);
|
||||||
|
|
||||||
Matrix4f matrix4f = matrixStack.peek().getModel();
|
Matrix4f matrix4f = matrixStack.peek().getModel();
|
||||||
buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
|
buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR_TEXTURE_LIGHT);
|
||||||
|
|
||||||
buffer.vertex(matrix4f, width, 0.0F, 1.0F).texture(1.0F, 1.0F).color(255, 255, 255, 255)
|
buffer.vertex(matrix4f, width, 0.0F, 1.0F).color(255, 255, 255, 255).texture(1.0F, 1.0F).light(l).overlay(overlay)
|
||||||
.light(light).overlay(overlay).next();
|
.next();
|
||||||
|
|
||||||
buffer.vertex(matrix4f, width, height, 1.0F).texture(1.0F, 0.0F).color(255, 255, 255, 255)
|
buffer.vertex(matrix4f, width, height, 1.0F).color(255, 255, 255, 255).texture(1.0F, 0.0F).light(l).overlay(overlay)
|
||||||
.light(light).overlay(overlay).next();
|
.next();
|
||||||
|
|
||||||
buffer.vertex(matrix4f, 0.0F, height, 1.0F).texture(0.0F, 0.0F).color(255, 255, 255, 255)
|
buffer.vertex(matrix4f, 0.0F, height, 1.0F).color(255, 255, 255, 255).texture(0.0F, 0.0F).light(l).overlay(overlay)
|
||||||
.light(light).overlay(overlay).next();
|
.next();
|
||||||
|
|
||||||
buffer.vertex(matrix4f, 0.0F, 0.0F, 1.0F).texture(0.0F, 1.0F).color(255, 255, 255, 255)
|
buffer.vertex(matrix4f, 0.0F, 0.0F, 1.0F).color(255, 255, 255, 255).texture(0.0F, 1.0F).light(l).overlay(overlay)
|
||||||
.light(light).overlay(overlay).next();
|
.next();
|
||||||
|
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
matrixStack.pop();
|
matrixStack.pop();
|
||||||
|
|||||||
@@ -3,5 +3,6 @@
|
|||||||
|
|
||||||
"picturesign.midnightconfig.enabled":"Enabled",
|
"picturesign.midnightconfig.enabled":"Enabled",
|
||||||
"picturesign.midnightconfig.debug":"Send debug info",
|
"picturesign.midnightconfig.debug":"Send debug info",
|
||||||
"picturesign.midnightconfig.maxThreads":"Max download threads"
|
"picturesign.midnightconfig.maxThreads":"Max download threads",
|
||||||
|
"picturesign.midnightconfig.signRenderDistance":"Sign render distance"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user