Skip to content

Commit

Permalink
4.3.1 - 1.17.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Traben-0 committed Jan 3, 2023
1 parent f4cfd16 commit 9fb55ca
Show file tree
Hide file tree
Showing 10 changed files with 145 additions and 19 deletions.
9 changes: 9 additions & 0 deletions common/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");

Expand All @@ -183,7 +182,6 @@ public enum IllegalPathMode {

@Override
public String toString() {

return ETFVersionDifferenceHandler.getTextFromTranslation(key).getString();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
Original file line number Diff line number Diff line change
@@ -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<ShulkerBulletEntity> {

@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<ShulkerBulletEntity> 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);

}

}


Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,17 @@ public <T extends Entity> 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<ETFCacheKey> 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<ETFCacheKey> 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9fb55ca

Please sign in to comment.