port: 1.21.4

- Also features some cleanup work
This commit is contained in:
Martin Prokoph
2025-05-03 13:13:25 +02:00
parent cd9bae83ca
commit 2d5b713fb0
13 changed files with 107 additions and 109 deletions

View File

@@ -1,6 +1,6 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
}
@@ -27,7 +27,7 @@ subprojects {
dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
implementation "com.github.SrRapero720.watermedia:build:${rootProject.watermedia_version}"
implementation "maven.modrinth:watermedia:${rootProject.watermedia_version}"
// The following line declares the mojmap mappings, you may use other mappings as well
//mappings loom.officialMojangMappings()
// The following line declares the yarn mappings you may select this one as well.

View File

@@ -19,8 +19,8 @@ public class PictureSignClient {
public static final String MOD_ID = "picturesign";
public static String[] clipboard = new String[4];
public static final MinecraftClient client = MinecraftClient.getInstance();
public static final KeyBinding BINDING_COPY_SIGN = new KeyBinding("key."+MOD_ID+".copy_sign",
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_U, "key.categories."+MOD_ID);
public static final KeyBinding BINDING_COPY_SIGN = new KeyBinding("key.%s.copy_sign".formatted(MOD_ID),
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_U, "key.categories.%s".formatted(MOD_ID));
public static void init() {
PictureSignConfig.init(MOD_ID, PictureSignConfig.class);

View File

@@ -2,47 +2,58 @@ package eu.midnightdust.picturesign.config;
import com.google.common.collect.Lists;
import eu.midnightdust.lib.config.MidnightConfig;
import net.minecraft.client.gl.ShaderProgram;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.gl.ShaderProgramKey;
import net.minecraft.client.gl.ShaderProgramKeys;
import net.minecraft.client.texture.TextureManager;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.function.Supplier;
import static eu.midnightdust.picturesign.PictureSignClient.id;
public class PictureSignConfig extends MidnightConfig {
private static final String general = "1general";
private static final String advanced = "advanced";
private static final String GENERAL = "general";
private static final String ADVANCED = "advanced";
@Entry(category = general) public static boolean enabled = true;
@Entry(category = general) public static boolean enableMultimediaSigns = true;
@Entry(min = 0, max = 1000, isSlider = true, category = general) public static int audioDistanceMultiplier = 30;
@Entry(category = general) public static boolean translucency = false;
@Entry(category = general) public static boolean fullBrightPicture = false;
@Entry(category = general) public static boolean helperUi = true;
@Entry(category = general) public static boolean exceedVanillaLineLength = true;
@Entry(category = advanced) public static boolean debug = false;
@Entry(min = 1, max = 10, isSlider = true, category = advanced) public static int maxThreads = 4;
@Entry(min = 0, max = 2048, isSlider = true, category = general) public static int signRenderDistance = 64;
@Entry(category = advanced) public static boolean safeMode = true;
@Entry(category = advanced) public static List<String> safeProviders = Lists.newArrayList("https://i.imgur.com/", "https://i.ibb.co/", "https://pictshare.net/", "https://iili.io/");
@Entry(category = advanced) public static List<String> safeGifProviders = Lists.newArrayList("https://i.imgur.com/", "https://media1.tenor.com/");
@Entry(category = advanced) public static List<String> safeMultimediaProviders = Lists.newArrayList("https://youtube.com/", "https://www.youtube.com/", "https://youtu.be/","https://vimeo.com/");
@Entry(category = advanced) public static List<String> safeJsonProviders = Lists.newArrayList("https://github.com/", "https://gist.github.com/", "https://www.jsonkeeper.com/", "https://api.npoint.io/", "https://api.jsonsilo.com/");
@Comment(category = general) public static Comment ebeWarning;
@Entry(category = advanced) public static MissingImageMode missingImageMode = MissingImageMode.BLACK;
@Entry(category = advanced) public static PictureShader pictureShader = PictureShader.PosColTexLight;
@Entry(category = GENERAL) public static boolean enabled = true;
@Entry(category = GENERAL) public static boolean enableMultimediaSigns = true;
@Entry(min = 0, max = 1000, isSlider = true, category = GENERAL) public static int audioDistanceMultiplier = 30;
@Entry(category = GENERAL) public static boolean translucency = false;
@Entry(category = GENERAL) public static boolean fullBrightPicture = false;
@Entry(category = GENERAL) public static boolean helperUi = true;
@Entry(category = GENERAL) public static boolean exceedVanillaLineLength = true;
@Entry(category = ADVANCED) public static boolean debug = false;
@Entry(min = 1, max = 10, isSlider = true, category = ADVANCED) public static int maxThreads = 4;
@Entry(min = 0, max = 2048, isSlider = true, category = GENERAL) public static int signRenderDistance = 64;
@Entry(category = ADVANCED) public static boolean safeMode = true;
@Entry(category = ADVANCED) public static List<String> safeProviders = Lists.newArrayList("https://i.imgur.com/", "https://i.ibb.co/", "https://pictshare.net/", "https://iili.io/");
@Entry(category = ADVANCED) public static List<String> safeGifProviders = Lists.newArrayList("https://i.imgur.com/", "https://media1.tenor.com/");
@Entry(category = ADVANCED) public static List<String> safeMultimediaProviders = Lists.newArrayList("https://youtube.com/", "https://www.youtube.com/", "https://youtu.be/","https://vimeo.com/");
@Entry(category = ADVANCED) public static List<String> safeJsonProviders = Lists.newArrayList("https://github.com/", "https://gist.github.com/", "https://www.jsonkeeper.com/", "https://api.npoint.io/", "https://api.jsonsilo.com/");
@Comment(category = GENERAL) @Condition(requiredModId = "enhancedblockentities") public static Comment ebeWarning;
@Entry(category = ADVANCED) public static MissingImageMode missingImageMode = MissingImageMode.BLACK;
@Entry(category = ADVANCED) public static PictureShader pictureShader = PictureShader.PosColTexLight;
public enum MissingImageMode {
BLACK, MISSING_TEXTURE, TRANSPARENT
BLACK(id("textures/black.png")),
MISSING_TEXTURE(TextureManager.MISSING_IDENTIFIER),
TRANSPARENT(null);
MissingImageMode(@Nullable Identifier missingTextureId) {
this.missingTextureId = missingTextureId;
}
@Nullable public final Identifier missingTextureId;
}
public enum PictureShader {
PosColTexLight(GameRenderer::getPositionColorTexLightmapProgram),
RenderTypeCutout(GameRenderer::getRenderTypeCutoutProgram),
PosTex(GameRenderer::getPositionTexProgram),
PosTexCol(GameRenderer::getPositionTexColorProgram);
PosColTexLight(ShaderProgramKeys.POSITION_COLOR_TEX_LIGHTMAP),
RenderTypeCutout(ShaderProgramKeys.RENDERTYPE_CUTOUT),
PosTex(ShaderProgramKeys.POSITION_TEX),
PosTexCol(ShaderProgramKeys.POSITION_TEX_COLOR);
PictureShader(Supplier<ShaderProgram> program) {
PictureShader(ShaderProgramKey program) {
this.program = program;
}
public final Supplier<ShaderProgram> program;
public final ShaderProgramKey program;
}
}

View File

@@ -5,8 +5,8 @@ import eu.midnightdust.picturesign.render.PictureSignRenderer;
import eu.midnightdust.picturesign.util.PictureSignType;
import net.minecraft.block.entity.SignBlockEntity;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.block.entity.AbstractSignBlockEntityRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.HangingSignBlockEntityRenderer;
import net.minecraft.client.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
@@ -17,15 +17,15 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import static eu.midnightdust.picturesign.util.PictureSignType.isCandidate;
import static eu.midnightdust.picturesign.util.PictureSignType.isNotOfType;
@Mixin(HangingSignBlockEntityRenderer.class)
public abstract class MixinHangingSignBlockEntityRenderer implements BlockEntityRenderer<SignBlockEntity> {
@Unique PictureSignRenderer psRenderer = new PictureSignRenderer();
@Mixin(AbstractSignBlockEntityRenderer.class)
public abstract class MixinAbstractSignBlockEntityRenderer implements BlockEntityRenderer<SignBlockEntity> {
@Unique PictureSignRenderer picturesign$psRenderer = new PictureSignRenderer();
@Inject(at = @At("HEAD"), method = "render")
@Inject(at = @At("HEAD"), method = "render(Lnet/minecraft/block/entity/SignBlockEntity;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;II)V")
public void ps$onRender(SignBlockEntity sign, float f, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light, int overlay, CallbackInfo ci) {
if (PictureSignConfig.enabled) {
if (isCandidate(sign, true) && isNotOfType(sign, PictureSignType.NONE, true)) psRenderer.render(sign, matrixStack, vertexConsumerProvider, light, overlay, true);
if (isCandidate(sign, false) && isNotOfType(sign, PictureSignType.NONE, false)) psRenderer.render(sign, matrixStack, vertexConsumerProvider, light, overlay, false);
if (isCandidate(sign, true) && isNotOfType(sign, PictureSignType.NONE, true)) picturesign$psRenderer.render(sign, matrixStack, vertexConsumerProvider, light, overlay, true);
if (isCandidate(sign, false) && isNotOfType(sign, PictureSignType.NONE, false)) picturesign$psRenderer.render(sign, matrixStack, vertexConsumerProvider, light, overlay, false);
}
}
@Unique

View File

@@ -31,17 +31,17 @@ public abstract class MixinSignBlockEntityRenderer implements BlockEntityRendere
psRenderer = new PictureSignRenderer();
}
@Inject(at = @At("HEAD"), method = "render")
public void ps$onRender(SignBlockEntity sign, float f, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light, int overlay, CallbackInfo ci) {
if (PictureSignConfig.enabled && psRenderer != null) {
if (isCandidate(sign, true) && isNotOfType(sign, PictureSignType.NONE, true)) psRenderer.render(sign, matrixStack, vertexConsumerProvider, light, overlay, true);
if (isCandidate(sign, false) && isNotOfType(sign, PictureSignType.NONE, false)) psRenderer.render(sign, matrixStack, vertexConsumerProvider, light, overlay, false);
}
}
@Inject(at = @At("HEAD"), method = "shouldRender", cancellable = true)
private static void shouldRender(BlockPos pos, int signColor, CallbackInfoReturnable<Boolean> cir) {
if (PictureSignConfig.enabled && client.world != null && hasPicture((SignBlockEntity) client.world.getBlockEntity(pos))) cir.setReturnValue(true);
}
// @Inject(at = @At("HEAD"), method = "render")
// public void ps$onRender(SignBlockEntity sign, float f, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light, int overlay, CallbackInfo ci) {
// if (PictureSignConfig.enabled && psRenderer != null) {
// if (isCandidate(sign, true) && isNotOfType(sign, PictureSignType.NONE, true)) psRenderer.render(sign, matrixStack, vertexConsumerProvider, light, overlay, true);
// if (isCandidate(sign, false) && isNotOfType(sign, PictureSignType.NONE, false)) psRenderer.render(sign, matrixStack, vertexConsumerProvider, light, overlay, false);
// }
// }
// @Inject(at = @At("HEAD"), method = "shouldRender", cancellable = true)
// private static void shouldRender(BlockPos pos, int signColor, CallbackInfoReturnable<Boolean> cir) {
// if (PictureSignConfig.enabled && client.world != null && hasPicture((SignBlockEntity) client.world.getBlockEntity(pos))) cir.setReturnValue(true);
// }
@Unique
@Override
public int getRenderDistance() {

View File

@@ -23,14 +23,14 @@ import static eu.midnightdust.picturesign.PictureSignClient.id;
@Mixin(AbstractSignEditScreen.class)
public abstract class MixinSignEditScreen extends Screen {
@Shadow @Final private SignBlockEntity blockEntity;
@Shadow @Final protected SignBlockEntity blockEntity;
@Shadow @Final private String[] messages;
@Shadow @Final private boolean front;
@Unique private static final Identifier PICTURESIGN_ICON_TEXTURE = id("icon/picturesign");
@Unique private static final Identifier CLIPBOARD_ICON_TEXTURE = id("icon/clipboard");
@Unique private static final Identifier TRASHBIN_ICON_TEXTURE = id("icon/trashbin");
@Unique private static boolean switchScreen = false;
@Unique private static boolean picturesign$switchScreen = false;
protected MixinSignEditScreen(Text title) {
super(title);
@@ -61,7 +61,7 @@ public abstract class MixinSignEditScreen extends Screen {
this.addDrawableChild(trashbinBuilder);
TextIconButtonWidget picturesignBuilder = TextIconButtonWidget.builder(Text.empty(), (buttonWidget) -> {
switchScreen = true;
picturesign$switchScreen = true;
Objects.requireNonNull(client).setScreen(new PictureSignHelperScreen(this.blockEntity, front, false));
}, true).texture(PICTURESIGN_ICON_TEXTURE, 16, 16).dimension(20, 20).build();
picturesignBuilder.setPosition(this.width - 40, this.height - 40);
@@ -70,8 +70,8 @@ public abstract class MixinSignEditScreen extends Screen {
}
@Inject(at = @At("HEAD"), method = "removed", cancellable = true)
private void picturesign$removed(CallbackInfo ci) {
if (switchScreen) {
switchScreen = false;
if (picturesign$switchScreen) {
picturesign$switchScreen = false;
ci.cancel();
}
}

View File

@@ -15,9 +15,9 @@ import eu.midnightdust.picturesign.util.records.PictureOffset;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gl.ShaderProgramKeys;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.BufferRenderer;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.render.Tessellator;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.VertexFormat;
@@ -32,7 +32,6 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RotationAxis;
import net.minecraft.world.World;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.joml.Matrix4f;
import java.util.Iterator;
@@ -41,7 +40,6 @@ import static eu.midnightdust.picturesign.PictureSignClient.client;
import static eu.midnightdust.picturesign.PictureSignClient.id;
import static eu.midnightdust.picturesign.util.PictureSignType.GIF;
import static eu.midnightdust.picturesign.util.PictureSignType.PICTURE;
import static net.minecraft.client.texture.TextureManager.MISSING_IDENTIFIER;
public class PictureRenderer {
private boolean isSafeUrl;
@@ -150,9 +148,9 @@ public class PictureRenderer {
int l = PictureSignConfig.fullBrightPicture ? 15728880 : light;
if (PlatformFunctions.isModLoaded("iris") && IrisCompat.isShaderPackInUse())
RenderSystem.setShader(PictureSignConfig.pictureShader.program);
else RenderSystem.setShader(GameRenderer::getPositionColorTexLightmapProgram);
else RenderSystem.setShader(ShaderProgramKeys.POSITION_COLOR_TEX_LIGHTMAP);
Identifier texture = getMissingTexture();
Identifier texture = PictureSignConfig.missingImageMode.missingTextureId;
if (errorMessage == null) {
if (type == PICTURE) {
assert data != null;
@@ -223,14 +221,6 @@ public class PictureRenderer {
textRenderer.draw(text, 1, wrappedY + 1, 0x555555, false, matrix, vertices, TextRenderer.TextLayerType.POLYGON_OFFSET, 0, 15728880);
matrix.translate(0, 0, -0.025f);
}
private static final Identifier BLACK_TEXTURE = id("textures/black.png");
public @Nullable Identifier getMissingTexture() {
return switch (PictureSignConfig.missingImageMode) {
case BLACK -> BLACK_TEXTURE;
case MISSING_TEXTURE -> MISSING_IDENTIFIER;
default -> null;
};
}
public void checkJsonUrlSafety(String jsonUrl) {
isSafeJsonUrl = false;
PictureSignConfig.safeJsonProviders.forEach(safe -> {

View File

@@ -22,11 +22,9 @@ import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.client.gui.widget.SliderWidget;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.gui.widget.TextIconButtonWidget;
import net.minecraft.client.render.DiffuseLighting;
import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.TexturedRenderLayers;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.model.Model;
import net.minecraft.client.render.*;
import net.minecraft.client.render.block.entity.AbstractSignBlockEntityRenderer;
import net.minecraft.client.render.block.entity.SignBlockEntityRenderer;
import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.client.util.math.MatrixStack;
@@ -51,7 +49,7 @@ public class PictureSignHelperScreen extends Screen {
private static final Identifier CLIPBOARD_ICON_TEXTURE = id("icon/clipboard");
private static final Identifier TRASHBIN_ICON_TEXTURE = id("icon/trashbin");
private final SignBlockEntity sign;
private SignBlockEntityRenderer.SignModel model;
private Model model;
protected String[] text;
private final boolean front;
private final boolean isHanging;
@@ -166,7 +164,7 @@ public class PictureSignHelperScreen extends Screen {
pictureWidgets.add(posYWidget);
pictureWidgets.add(posZWidget);
if (text[2].matches("(.*\\d:.*\\d:.*\\d)")) addRotationWidgets();
this.model = SignBlockEntityRenderer.createSignModel(this.client.getEntityModelLoader(), AbstractSignBlock.getWoodType(sign.getCachedState().getBlock()));
this.model = SignBlockEntityRenderer.createSignModel(this.client.getLoadedEntityModels(), this.signType, !isHanging);
}
public void applyPosition(String position, int index) {
String[] dimensions = new String[5];
@@ -338,7 +336,7 @@ public class PictureSignHelperScreen extends Screen {
}
float n = (float)(-this.client.textRenderer.getWidth(string) / 2);
this.client.textRenderer.draw(string, n, (float)(m * 10 - this.text.length * 5), i, false, matrix4f, immediate, TextRenderer.TextLayerType.NORMAL, 0, 15728880, false);
this.client.textRenderer.draw(Text.of(string), n, (float)(m * 10 - this.text.length * 5), i, false, matrix4f, immediate, TextRenderer.TextLayerType.NORMAL, 0, 15728880, false);
}
}
@@ -373,11 +371,9 @@ public class PictureSignHelperScreen extends Screen {
matrices.scale(0.6666667F, -0.6666667F, -0.6666667F);
SpriteIdentifier spriteIdentifier = TexturedRenderLayers.getSignTextureId(AbstractSignBlock.getWoodType(state.getBlock()));
SignBlockEntityRenderer.SignModel var10002 = this.model;
Objects.requireNonNull(var10002);
VertexConsumer vertexConsumer = spriteIdentifier.getVertexConsumer(immediate, var10002::getLayer);
this.model.stick.visible = bl;
this.model.root.render(matrices, vertexConsumer, 15728880, OverlayTexture.DEFAULT_UV);
Objects.requireNonNull(model);
VertexConsumer vertexConsumer = spriteIdentifier.getVertexConsumer(immediate, model::getLayer);
this.model.render(matrices, vertexConsumer, 15728880, OverlayTexture.DEFAULT_UV);
matrices.pop();
matrices.translate(0.0, 0.3333333432674408, 0.046666666865348816);
matrices.scale(0.010416667F, -0.010416667F, 0.010416667F);
@@ -385,7 +381,7 @@ public class PictureSignHelperScreen extends Screen {
else {
MatrixStack matrices = context.getMatrices();
matrices.scale(4.5F, 4.5F, 1.0F);
context.drawTexture(Identifier.ofVanilla("textures/gui/hanging_signs/" + this.signType.name() + ".png"), -8, -8, 0.0F, 0.0F, 16, 16, 16, 16);
context.drawTexture(RenderLayer::getGuiTextured, Identifier.ofVanilla("textures/gui/hanging_signs/" + this.signType.name() + ".png"), -8, -8, 0.0F, 0.0F, 16, 16, 16, 16);
}
}

View File

@@ -2,7 +2,6 @@ package eu.midnightdust.picturesign.util;
import eu.midnightdust.picturesign.PictureSignClient;
import eu.midnightdust.picturesign.config.PictureSignConfig;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.texture.NativeImageBackedTexture;
import net.minecraft.util.Identifier;
@@ -10,11 +9,12 @@ import net.minecraft.util.Identifier;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.URL;
import java.net.URI;
import java.util.Hashtable;
import java.util.concurrent.ExecutorService;
import static eu.midnightdust.picturesign.PictureSignClient.MOD_ID;
import static eu.midnightdust.picturesign.PictureSignClient.client;
import static java.util.concurrent.Executors.newFixedThreadPool;
public class PictureDownloader {
@@ -71,8 +71,8 @@ public class PictureDownloader {
service.submit(() -> {
try {
BufferedInputStream in = new BufferedInputStream(new URL(url).openStream());
File file = File.createTempFile("."+MOD_ID, "temp");
BufferedInputStream in = new BufferedInputStream(URI.create(url).toURL().openStream());
File file = File.createTempFile(".%s".formatted(MOD_ID), "temp");
file.deleteOnExit();
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file));
@@ -93,7 +93,7 @@ public class PictureDownloader {
data.identifier = texture;
}
if (PictureSignConfig.debug) PictureSignClient.LOGGER.info("Finished downloading picture: " + url);
if (PictureSignConfig.debug) PictureSignClient.LOGGER.info("Finished downloading picture: {}", url);
} catch (IOException error) {
PictureSignClient.LOGGER.error("Error downloading picture: " + error);
@@ -102,7 +102,7 @@ public class PictureDownloader {
}
private void loadLocalPicture(String url) {
String realPath = url.replace("file:", "");
if (PictureSignConfig.debug) PictureSignClient.LOGGER.info("Started loading local picture: " + url);
if (PictureSignConfig.debug) PictureSignClient.LOGGER.info("Started loading local picture: {}", url);
this.cache.put(url, new PictureData(url));
service.submit(() -> {
@@ -115,11 +115,11 @@ public class PictureDownloader {
}
} catch (IOException error) {
PictureSignClient.LOGGER.error("Error loading local picture: " + error);
PictureSignClient.LOGGER.error("Error loading local picture: {}", String.valueOf(error));
}
});
if (PictureSignConfig.debug) PictureSignClient.LOGGER.info("Finished loading local picture: " + url);
if (PictureSignConfig.debug) PictureSignClient.LOGGER.info("Finished loading local picture: {}", url);
}
private void loadResourcePackTexture(String url) {
String realIdentifierPath = url.replace("rp:", "");
@@ -128,7 +128,7 @@ public class PictureDownloader {
if (PictureSignConfig.debug) PictureSignClient.LOGGER.info("Started loading resource pack picture: " + url);
Identifier id = Identifier.tryParse(realIdentifierPath);
if (id == null) {
PictureSignClient.LOGGER.error("Unable to locate resource texture: " + url);
PictureSignClient.LOGGER.error("Unable to locate resource texture: {}", url);
return;
}
@@ -140,7 +140,7 @@ public class PictureDownloader {
}
});
if (PictureSignConfig.debug) PictureSignClient.LOGGER.info("Finished loading resource pack picture: " + url);
if (PictureSignConfig.debug) PictureSignClient.LOGGER.info("Finished loading resource pack picture: {}", url);
}
private static Identifier convert2png(File file) throws IOException {
@@ -154,8 +154,9 @@ public class PictureDownloader {
NativeImage nativeImage = NativeImage.read(inputStream);
NativeImageBackedTexture nativeImageBackedTexture = new NativeImageBackedTexture(nativeImage);
return MinecraftClient.getInstance().getTextureManager().registerDynamicTexture("picturesign/image",
nativeImageBackedTexture);
Identifier textureId = PictureSignClient.id("picturesign/image_%s".formatted(file.hashCode()));
client.getTextureManager().registerTexture(textureId, nativeImageBackedTexture);
return textureId;
}
}

View File

@@ -13,7 +13,7 @@
"picturesign.midnightconfig.signRenderDistance":"Schildsichtweite",
"picturesign.midnightconfig.safeMode":"Sicherer Modus",
"picturesign.midnightconfig.safeMode.tooltip":"Lädt nur Bilder von vertrauten Seiten",
"picturesign.midnightconfig.ebeWarning":"§cWenn du die Mod 'Enhanced Block Entities' benutzt, stelle sicher, dass du alles in Relation zu Schildern in der EBE Config deaktiviert hast!",
"picturesign.midnightconfig.ebeWarning":"§cDu benutzt die Mod 'Enhanced Block Entities' stelle sicher, dass du alles in Relation zu Schildern in der EBE Config deaktiviert hast!",
"picturesign.midnightconfig.safeProviders":"Sichere Bildanbieter",
"picturesign.midnightconfig.safeGifProviders":"Sichere GIF-Anbieter",
"picturesign.midnightconfig.safeMultimediaProviders":"Sichere Multimedia-Anbieter",
@@ -26,7 +26,7 @@
"key.picturesign.copy_sign": "Text eines Schildes kopieren",
"key.picturesign.edit_sign":"Schild bearbeiten",
"picturesign.midnightconfig.category.1general": "Generell",
"picturesign.midnightconfig.category.general": "Generell",
"picturesign.midnightconfig.category.advanced": "Fortgeschritten",
"picturesign.midnightconfig.fullBrightPicture": "Höchste Helligkeit",
"picturesign.midnightconfig.fullBrightPicture.tooltip": "Sorgt dafür, dass Bilder immer vollkommen beleuchtet dargestellt werden",

View File

@@ -1,6 +1,6 @@
{
"picturesign.midnightconfig.title":"PictureSign Config",
"picturesign.midnightconfig.category.1general":"General",
"picturesign.midnightconfig.category.general":"General",
"picturesign.midnightconfig.category.advanced":"Advanced",
"picturesign.midnightconfig.enabled":"Enable Pictures",
@@ -17,7 +17,7 @@
"picturesign.midnightconfig.signRenderDistance":"Sign render distance",
"picturesign.midnightconfig.safeMode":"Safe mode",
"picturesign.midnightconfig.safeMode.tooltip":"Only load images from trusted providers",
"picturesign.midnightconfig.ebeWarning":"§cIf you are using the mod 'Enhanced Block Entities' make sure to disable anything sign-related in it's config!",
"picturesign.midnightconfig.ebeWarning":"§cYou are using the mod 'Enhanced Block Entities' make sure to disable anything sign-related in it's config!",
"picturesign.midnightconfig.safeProviders":"Safe Image Providers",
"picturesign.midnightconfig.safeGifProviders":"Safe GIF Providers",
"picturesign.midnightconfig.safeMultimediaProviders":"Safe Multimedia Providers",

View File

@@ -4,7 +4,7 @@
"compatibilityLevel": "JAVA_17",
"client": [
"MixinSignBlockEntityRenderer",
"MixinHangingSignBlockEntityRenderer",
"MixinAbstractSignBlockEntityRenderer",
"MixinSignEditScreen",
"MixinSignBlockEntity"
],

View File

@@ -1,26 +1,26 @@
org.gradle.jvmargs=-Xmx2048M
minecraft_version=1.21
yarn_mappings=1.21+build.2
minecraft_version=1.21.4
yarn_mappings=1.21.4+build.1
enabled_platforms=fabric,neoforge
archives_base_name=picturesign
mod_version=2.0.1
mod_version=2.1.0
maven_group=eu.midnightdust
release_type=release
curseforge_id=533897
modrinth_id=9WP2dmkk
midnightlib_version=1.6.3
watermedia_version=2.1.2
midnightlib_version=1.7.2+1.21.4
watermedia_version=2.1.24
iris_version=1.6.17+1.20.4
# The latest Iris version causes the build to fail, but we don't need that anyway
fabric_loader_version=0.15.11
fabric_api_version=0.100.1+1.21
fabric_loader_version=0.16.9
fabric_api_version=0.111.0+1.21.4
neoforge_version=21.0.14-beta
neoforge_version=21.4.10-beta
yarn_mappings_patch_neoforge_version = 1.21+build.4
quilt_loader_version=0.19.0-beta.18