diff --git a/common/CHANGELOG.md b/common/CHANGELOG.md index 57a5746b..113acb11 100644 --- a/common/CHANGELOG.md +++ b/common/CHANGELOG.md @@ -1,5 +1,14 @@ [**ETF Changelog:**] +[V4.3.1] + +- updated russian translation to 4.3 thanks to @Felix14-v2 +- fixed a button translation +- added compatibility warning message for Quark as it's [Variant Animal Textures] setting must be disabled for ETF's to work +- resolved an issue with additional textures like enderman_eyes.png or sheep_fur.png resetting after a short time if the + base texture had .properties but the additional texture didn't +- added shulker bullet texture support + [V4.3.0] *Update summary* diff --git a/common/src/main/java/traben/entity_texture_features/config/ETFConfig.java b/common/src/main/java/traben/entity_texture_features/config/ETFConfig.java index a41fea86..37d90844 100644 --- a/common/src/main/java/traben/entity_texture_features/config/ETFConfig.java +++ b/common/src/main/java/traben/entity_texture_features/config/ETFConfig.java @@ -2,7 +2,6 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import net.minecraft.client.gui.screen.ScreenTexts; import traben.entity_texture_features.ETFVersionDifferenceHandler; import traben.entity_texture_features.config.screens.ETFConfigScreenWarnings; import traben.entity_texture_features.texture_handlers.ETFManager; @@ -171,7 +170,7 @@ public DebugLogMode next() { @SuppressWarnings({"unused", "EnhancedSwitchMigration"}) public enum IllegalPathMode { - None(ScreenTexts.OFF.getString()), + None("options.off"), Entity("config." + MOD_ID + ".illegal_path_mode.entity"), All("config." + MOD_ID + ".illegal_path_mode.all"); @@ -183,7 +182,6 @@ public enum IllegalPathMode { @Override public String toString() { - return ETFVersionDifferenceHandler.getTextFromTranslation(key).getString(); } diff --git a/common/src/main/java/traben/entity_texture_features/config/screens/ETFConfigScreenEmissiveFixSettings.java b/common/src/main/java/traben/entity_texture_features/config/screens/ETFConfigScreenEmissiveFixSettings.java index d3d45448..681c86d1 100644 --- a/common/src/main/java/traben/entity_texture_features/config/screens/ETFConfigScreenEmissiveFixSettings.java +++ b/common/src/main/java/traben/entity_texture_features/config/screens/ETFConfigScreenEmissiveFixSettings.java @@ -1,8 +1,8 @@ package traben.entity_texture_features.config.screens; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.gui.screen.ScreenTexts; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import traben.entity_texture_features.ETFClientCommon; import traben.entity_texture_features.ETFVersionDifferenceHandler; @@ -34,6 +34,8 @@ protected void init() { ETFConfigScreenMain.temporaryETFConfig.removePixelsUnderEmissivePlayers = true; ETFConfigScreenMain.temporaryETFConfig.removePixelsUnderEmissiveMobs = true; ETFConfigScreenMain.temporaryETFConfig.removePixelsUnderEmissiveBlockEntity = true; + ETFConfigScreenMain.temporaryETFConfig.dontPatchPBRTextures = true; + ETFConfigScreenMain.temporaryETFConfig.dontPatchAnimatedTextures = true; Objects.requireNonNull(client).setScreen(new ETFConfigScreenEmissiveFixSettings(parent)); this.removed(); diff --git a/common/src/main/java/traben/entity_texture_features/config/screens/ETFConfigScreenWarnings.java b/common/src/main/java/traben/entity_texture_features/config/screens/ETFConfigScreenWarnings.java index 924dde95..52773281 100644 --- a/common/src/main/java/traben/entity_texture_features/config/screens/ETFConfigScreenWarnings.java +++ b/common/src/main/java/traben/entity_texture_features/config/screens/ETFConfigScreenWarnings.java @@ -105,7 +105,7 @@ public enum ConfigWarning { FIGURA(true, "figura", "config." + ETFClientCommon.MOD_ID + ".warn.figura.text.1", "config." + ETFClientCommon.MOD_ID + ".warn.figura.text.2"), //SKINLAYERS(false, "skinlayers", "config." + ETFClientCommon.MOD_ID + ".warn.skinlayers.text.1", "config." + ETFClientCommon.MOD_ID + ".warn.skinlayers.text.2"), ENHANCED_BLOCK_ENTITIES(false, "enhancedblockentities", "config." + ETFClientCommon.MOD_ID + ".warn.ebe.text.1", "config." + ETFClientCommon.MOD_ID + ".warn.ebe.text.2"), - //QUARK(true,"quark","config." + ETFClientCommon.MOD_ID + ".warn.quark.text.1", "config." + ETFClientCommon.MOD_ID + ".warn.quark.text.2"), + QUARK(false, "quark", "config." + ETFClientCommon.MOD_ID + ".warn.quark.text.3", "config." + ETFClientCommon.MOD_ID + ".warn.quark.text.4"), IRIS(false, "iris", "config." + ETFClientCommon.MOD_ID + ".warn.iris.text.1", "config." + ETFClientCommon.MOD_ID + ".warn.iris.text.2"); //IMPERSONATE(true, "impersonate", "config." + ETFClientCommon.MOD_ID + ".warn.impersonate.text.1", "config." + ETFClientCommon.MOD_ID + ".warn.impersonate.text.2"); diff --git a/common/src/main/java/traben/entity_texture_features/mixin/entity/renderer/MixinShulkerBulletEntityRenderer.java b/common/src/main/java/traben/entity_texture_features/mixin/entity/renderer/MixinShulkerBulletEntityRenderer.java new file mode 100644 index 00000000..4c1ae9f7 --- /dev/null +++ b/common/src/main/java/traben/entity_texture_features/mixin/entity/renderer/MixinShulkerBulletEntityRenderer.java @@ -0,0 +1,115 @@ +package traben.entity_texture_features.mixin.entity.renderer; + +import net.minecraft.client.render.RenderLayer; +import net.minecraft.client.render.VertexConsumer; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.entity.EntityRenderer; +import net.minecraft.client.render.entity.EntityRendererFactory; +import net.minecraft.client.render.entity.ShulkerBulletEntityRenderer; +import net.minecraft.client.render.entity.model.ShulkerBulletEntityModel; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.entity.projectile.ShulkerBulletEntity; +import net.minecraft.util.Identifier; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyArg; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; +import traben.entity_texture_features.texture_handlers.ETFManager; +import traben.entity_texture_features.utils.ETFUtils2; + +import static traben.entity_texture_features.ETFClientCommon.ETFConfigData; + +@Mixin(ShulkerBulletEntityRenderer.class) +public abstract class MixinShulkerBulletEntityRenderer extends EntityRenderer { + + @Final + @Shadow + private static Identifier TEXTURE; + + private ShulkerBulletEntity etf$entity = null; + + + protected MixinShulkerBulletEntityRenderer(EntityRendererFactory.Context ctx) { + super(ctx); + } + + @Shadow + @Final + private static RenderLayer LAYER; + + + @Shadow @Final private ShulkerBulletEntityModel model; + + @Inject( + method = "render(Lnet/minecraft/entity/projectile/ShulkerBulletEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", + at = @At(value = "HEAD")) + private void etf$getEntity(ShulkerBulletEntity shulkerBulletEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo ci) { + etf$entity = shulkerBulletEntity; + } + + @ModifyArg( + method = "render(Lnet/minecraft/entity/projectile/ShulkerBulletEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/VertexConsumerProvider;getBuffer(Lnet/minecraft/client/render/RenderLayer;)Lnet/minecraft/client/render/VertexConsumer;")) + private RenderLayer etf$returnAlteredTexture(RenderLayer renderLayer) { + + if (ETFConfigData.enableCustomTextures) { + try { + + Identifier alteredTexture = ETFManager.getInstance().getETFTexture(TEXTURE, etf$entity, ETFManager.TextureSource.ENTITY, ETFConfigData.removePixelsUnderEmissiveMobs).getTextureIdentifier(etf$entity); + RenderLayer layerToReturn; + + if (ETFManager.getInstance().ENTITY_TYPE_RENDER_LAYER.containsKey(etf$entity.getType())) { + //Identifier identifier = this.getTexture(entity); + int choice = ETFManager.getInstance().ENTITY_TYPE_RENDER_LAYER.getInt(etf$entity.getType()); + //noinspection EnhancedSwitchMigration + switch (choice) { + case 1: + layerToReturn = (RenderLayer.getEntityTranslucent(alteredTexture)); + break; + case 2: + layerToReturn = (RenderLayer.getEntityTranslucentCull(alteredTexture)); + break; + case 3: + layerToReturn = (RenderLayer.getEndGateway()); + break; + case 4: + layerToReturn = (RenderLayer.getOutline(alteredTexture)); + break; + default: + layerToReturn = (null); + break; + } + } else { + if (renderLayer.equals(LAYER)) { + layerToReturn = RenderLayer.getEntityTranslucent(alteredTexture); + } else { + layerToReturn = this.model.getLayer(alteredTexture); + } + } + + if (layerToReturn != null) return layerToReturn; + + } catch (Exception e) { + ETFUtils2.logError(e.toString(), false); + } + } + + return renderLayer; + } + + @Inject(method = "render(Lnet/minecraft/entity/projectile/ShulkerBulletEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/model/ShulkerBulletEntityModel;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;IIFFFF)V", + shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILSOFT) + private void etf$applyEmissive(ShulkerBulletEntity shulkerBulletEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo ci, float h, float j, float k, VertexConsumer vertexConsumer) { + //UUID id = livingEntity.getUuid(); + ETFManager.getInstance().getETFTexture(TEXTURE, shulkerBulletEntity, ETFManager.TextureSource.ENTITY, ETFConfigData.removePixelsUnderEmissiveMobs).renderEmissive(matrixStack, vertexConsumerProvider, model); + + } + +} + + diff --git a/common/src/main/java/traben/entity_texture_features/texture_handlers/ETFManager.java b/common/src/main/java/traben/entity_texture_features/texture_handlers/ETFManager.java index 650cbc9e..c7f1beef 100644 --- a/common/src/main/java/traben/entity_texture_features/texture_handlers/ETFManager.java +++ b/common/src/main/java/traben/entity_texture_features/texture_handlers/ETFManager.java @@ -258,14 +258,17 @@ public ETFTexture getETFTexture(@NotNull Identifier vanillaId Identifier newVariantIdentifier = returnNewAlreadyConfirmedOptifineTexture(entity, vanillaIdentifier, true); ENTITY_TEXTURE_MAP.put(cacheKey, Objects.requireNonNullElse(getOrCreateETFTexture(vanillaIdentifier, Objects.requireNonNullElse(newVariantIdentifier, vanillaIdentifier), canBePatched), getETFDefaultTexture(vanillaIdentifier, canBePatched))); - //iterate over list of all known features and update them - ObjectOpenHashSet featureSet = ENTITY_KNOWN_FEATURES_LIST.getOrDefault(id, new ObjectOpenHashSet<>()); - //possible concurrent editing of hashmap issues but simplest way to perform this - featureSet.forEach((forKey) -> { - Identifier forVariantIdentifier = returnNewAlreadyConfirmedOptifineTexture(entity, forKey.identifier(), true); - ENTITY_TEXTURE_MAP.put(forKey, Objects.requireNonNullElse(getOrCreateETFTexture(forKey.identifier(), Objects.requireNonNullElse(forVariantIdentifier, forKey.identifier()), canBePatched), getETFDefaultTexture(forKey.identifier(), canBePatched))); - - }); + //only if changed + if (!quickReturn.thisIdentifier.equals(newVariantIdentifier)) { + //iterate over list of all known features and update them + ObjectOpenHashSet featureSet = ENTITY_KNOWN_FEATURES_LIST.getOrDefault(id, new ObjectOpenHashSet<>()); + //possible concurrent editing of hashmap issues but simplest way to perform this + featureSet.forEach((forKey) -> { + Identifier forVariantIdentifier = getPossibleVariantIdentifierRedirectForFeatures(entity, forKey.identifier(), TextureSource.ENTITY_FEATURE); // returnNewAlreadyConfirmedOptifineTexture(entity, forKey.identifier(), true); + ENTITY_TEXTURE_MAP.put(forKey, Objects.requireNonNullElse(getOrCreateETFTexture(forKey.identifier(), Objects.requireNonNullElse(forVariantIdentifier, forKey.identifier()), canBePatched), getETFDefaultTexture(forKey.identifier(), canBePatched))); + + }); + } ENTITY_UPDATE_QUEUE.remove(id); } else { diff --git a/common/src/main/java/traben/entity_texture_features/utils/ETFUtils2.java b/common/src/main/java/traben/entity_texture_features/utils/ETFUtils2.java index 54eb6828..1e0699c8 100644 --- a/common/src/main/java/traben/entity_texture_features/utils/ETFUtils2.java +++ b/common/src/main/java/traben/entity_texture_features/utils/ETFUtils2.java @@ -306,11 +306,7 @@ public static boolean registerNativeImageToIdentifier(NativeImage img, Identifie public static void checkModCompatibility() { -// if (ETFVersionDifferenceHandler.isThisModLoaded("quark") && !ETFConfigData.ignoredConfigs.contains(ETFConfigScreenWarnings.ConfigWarning.QUARK)) { -// ETFConfigData.enableCustomBlockEntities = false; -// ETFConfigData.enableEmissiveBlockEntities = false; -// ETFUtils2.saveConfig(); -// } + if (ETFVersionDifferenceHandler.isThisModLoaded("figura") && !ETFConfigData.ignoredConfigs.contains(ETFConfigScreenWarnings.ConfigWarning.FIGURA)) { ETFConfigData.skinFeaturesEnabled = false; ETFUtils2.saveConfig(); diff --git a/common/src/main/resources/assets/entity_texture_features/lang/en_us.json b/common/src/main/resources/assets/entity_texture_features/lang/en_us.json index 8c955658..f869e802 100644 --- a/common/src/main/resources/assets/entity_texture_features/lang/en_us.json +++ b/common/src/main/resources/assets/entity_texture_features/lang/en_us.json @@ -161,6 +161,8 @@ "config.entity_texture_features.warn.ebe.text.2": "Block entity features don't apply to EBE block entities.", "config.entity_texture_features.warn.figura.text.1": "Figura", "config.entity_texture_features.warn.figura.text.2": "ETF skin features are disabled for compatibility.", + "config.entity_texture_features.warn.quark.text.3": "Quark", + "config.entity_texture_features.warn.quark.text.4": "Quark's [Variant Animal Textures] must be disabled for ETF random textures to work.", "config.entity_texture_features.warn.ignore": "Ignored: ", "config.entity_texture_features.warn.iris.text.1": "Iris PBR", "config.entity_texture_features.warn.iris.text.2": "See 'emissive fix options' if iris PBR does not work on mobs.", diff --git a/common/src/main/resources/entity_texture_features-common.mixins.json b/common/src/main/resources/entity_texture_features-common.mixins.json index ef425a7f..b9320796 100644 --- a/common/src/main/resources/entity_texture_features-common.mixins.json +++ b/common/src/main/resources/entity_texture_features-common.mixins.json @@ -33,6 +33,7 @@ "entity.renderer.MixinMinecartEntityRenderer", "entity.renderer.MixinPiglinEntityRenderer", "entity.renderer.MixinPlayerEntityRenderer", + "entity.renderer.MixinShulkerBulletEntityRenderer", "entity.renderer.MixinTridentEntityRenderer", "entity.renderer.feature.MixinCapeFeatureRenderer", "entity.renderer.feature.MixinDrownedOverlayFeatureRenderer", diff --git a/gradle.properties b/gradle.properties index a835b34f..0bfed1fb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx4096M minecraft_version=1.17.1 enabled_platforms=fabric,forge archives_base_name=entity_texture_features -mod_version=4.3.0 +mod_version=4.3.1 maven_group=traben.entity_texture_features architectury_version=5.6.22 fabric_loader_version=0.14.7