Skip to content

Commit

Permalink
Merge pull request #195 from Traben-0/1.20-dev
Browse files Browse the repository at this point in the history
1.20 dev
  • Loading branch information
Traben-0 authored Aug 6, 2023
2 parents c02cea0 + 5594e23 commit 1c89dd0
Show file tree
Hide file tree
Showing 60 changed files with 1,211 additions and 243 deletions.
23 changes: 23 additions & 0 deletions .github/README-assets/EMISSIVE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,33 @@
- Enhanced Block Entities (A mod which changes the block entity render to block render for performance optimizations)<br />breaks ETF's support for block entities
- Player skins support emissive textures, see the [`player skin features guide`](SKINS.md)


---
## Armor trims

Emmisive armor trim textures are defined just like in OptiFine, by adding one of the following material suffixes

to the trim base name: amethyst, copper, diamond, diamond_darker, emerald, gold, gold_darker,
iron, iron_darker, lapis, netherite, netherite_darker, quartz, redstone.

For example:

`textures/trims/models/armor/coast_amethyst_e.png`,
`textures/trims/models/armor/host_iron_darker_e.png`,
`textures/trims/models/armor/dune_leggings_netherite_e.png`

You can also add a copy of the non emissive texture present in the same path to override that trim.

For example:

`textures/trims/models/armor/coast_amethyst.png`,
`textures/trims/models/armor/host_iron_darker.png`,
`textures/trims/models/armor/dune_leggings_netherite.png`
---

Emissive textures can render in two different ways, set by the config. The two images below show the two rendering modes:


### Dull Emmisives [default]

<table>
Expand Down
15 changes: 14 additions & 1 deletion .github/README-assets/emissive.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,17 @@
# creeper.png - base texture
# creeper_e.png - emissive overlay
# The overlays can also be used for block entities.
suffix.emissive=_e
suffix.emissive=_e
#
#
###############################################################################
# Armor trims
# Emmisive armor trim textures are defined just like in OptiFine, by adding one of the following material suffixes
# to the trim base name: amethyst, copper, diamond, diamond_darker, emerald, gold, gold_darker,
# iron, iron_darker, lapis, netherite, netherite_darker, quartz, redstone.
# For example:
# textures/trims/models/armor/coast_amethyst_e.png, textures/trims/models/armor/host_iron_darker_e.png, textures/trims/models/armor/dune_leggings_netherite_e.png
#
# You can also add a copy of the non emissive texture present in the same path
# For example:
# textures/trims/models/armor/coast_amethyst.png, textures/trims/models/armor/host_iron_darker.png, textures/trims/models/armor/dune_leggings_netherite.png
Binary file modified .github/README-assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion .github/README-assets/random_entities.properties
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@
# or "assets/minecraft/etf/random/entity/chicken.properties"
# or "assets/minecraft/textures/entity/chicken.properties"
#
# painting support is planned but not yet implemented
#
###############################################################################
# For textures that already end with a number such as "warden_pulsating_spots_2.png"
# you must use the separator "." to denote variants:
# Alts:
# warden_pulsating_spots_2.2.png
# warden_pulsating_spots_2.3.png
# warden_pulsating_spots_2.4.png
#
###############################################################################
# This file consists of a sequence of rules, numbered from 1.
#
Expand Down
31 changes: 31 additions & 0 deletions common/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
[**ETF Changelog:**]


[4.4.99 - dev build]
- added more code to support EMF
- added a new logo
- added support for random & emissive painting textures
- added support for emissive armor trims the same format as OptiFine *(note this seems to break if iris and 3d skin layers are both installed, no idea why, it also fixes itself if a mob in the background is wearing the same trim, I'm tired of pulling my hair out about this so this is just how it will be for now)*
- added support for armor trim overrides *(e.g. the texture "textures\trims\models\armor\coast_redstone.png" will override the autogenerated trim if present)*
- added support for end crystal random and emissive textures
- added an option to enable extra warden textures like the heart to apply to the entire model
- textures ending with numbers now use the separator "." like OptiFine for variants *(e.g "mob4.png" now variates with "mob4.2.png")*
- Animatica textures are now detected and prevent certain ETF actions that could break these textures *(MoreMcmeta was already supported)*
- added new ETF skin feature to allow/prevent transparency for your skin specifically, plus general improvements to skin transparency handling.
- added new ETF skin feature variant of the villager nose setting that can use a custom texture set in the skin, instead of the default villager.

- updated the `minecraftcapes.net` api url when used in skin features
- improved the handling of "_eyes" textures
- tweaked the skin tool failure dialogue to be more informative and helpful
- tweaked warning messages and added some
- tweaked the resource-pack screen etf button

- fixed `biome` property breaking when using "CamelCase" instead of "snake_case"
- fixed `size` property being off by 1 when compared to OptiFine
- fixed `name` property not working for players usernames
- fixed custom ETF cape textures not working with `physics mod` capes
- fixed `3D skin layers mod` emissive body pixels with skin features
- tweaked some `en_us` translations
- fixed 2 forge crashes
- fixed `pattern` & `ipattern` to correctly match the OptiFine behaviour



[4.4.4]
- forge crash fix

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import net.minecraft.client.render.LightmapTextureManager;
import org.slf4j.Logger;
import traben.entity_texture_features.config.ETFConfig;
import traben.entity_texture_features.utils.ETFUtils2;
Expand All @@ -18,14 +19,22 @@ public class ETFClientCommon {
public static final String MOD_ID = "entity_texture_features";
//logging object
public final static Logger LOGGER = ETFVersionDifferenceHandler.getLogger();
public static boolean IRIS_DETECTED = false;
//config object
public static ETFConfig ETFConfigData = new ETFConfig();

//sets whether to display config load warning in gui
public static boolean configHadLoadError = false;

public static final int EYES_FEATURE_LIGHT_VALUE = LightmapTextureManager.MAX_LIGHT_COORDINATE+1;
public static final int EMISSIVE_FEATURE_LIGHT_VALUE = LightmapTextureManager.MAX_LIGHT_COORDINATE+2;
public static boolean SKIN_LAYERS_DETECTED = false;

public static void start() {
//check only once
SKIN_LAYERS_DETECTED = (ETFVersionDifferenceHandler.isThisModLoaded("skinlayers") || ETFVersionDifferenceHandler.isThisModLoaded("skinlayers3d"));
IRIS_DETECTED = ETFVersionDifferenceHandler.isThisModLoaded("iris") || ETFVersionDifferenceHandler.isThisModLoaded("oculus");

LOGGER.info("Loading Entity Texture Features, "+ randomQuip());
etf$loadConfig();
ETFUtils2.checkModCompatibility();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ public class ETFConfig {

public boolean use3DSkinLayerPatch = true;

public boolean enableFullBodyWardenTextures = true;

//string name stuff more in-depth than other enum for backwards compatibility

public static ETFConfig copyFrom(ETFConfig source) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.client.gui.tooltip.Tooltip;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.render.*;
import net.minecraft.screen.ScreenTexts;
import net.minecraft.text.OrderedText;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
Expand All @@ -21,7 +22,7 @@

//inspired by puzzles custom gui code
public abstract class ETFConfigScreen extends Screen {
static final RotatingCubeMapRenderer backgroundCube = new RotatingCubeMapRenderer(new CubeMapRenderer(new Identifier(MOD_ID + ":textures/gui/background/panorama")));
static final RotatingCubeMapRenderer backgroundCube = new RotatingCubeMapRenderer(new CubeMapRenderer(new Identifier(MOD_ID , "textures/gui/background/panorama")));
public final Screen parent;


Expand All @@ -30,6 +31,10 @@ public ETFConfigScreen(Text text, Screen parent) {
this.parent = parent;
}

public static String booleanAsOnOff(boolean bool){
return ScreenTexts.onOrOff(bool).getString();
}

public static void renderGUITexture(Identifier texture, double x1, double y1, double x2, double y2) {

Tessellator tessellator = Tessellator.getInstance();
Expand Down Expand Up @@ -80,13 +85,13 @@ public void close() {
public void render(DrawContext context, int mouseX, int mouseY, float delta) {


// ETFUtils2.renderBackgroundTexture(0,new Identifier("textures/block/deepslate_tiles.png"),this.height,this.width);
backgroundCube.render((float) 0.5, 1);

renderBackgroundTexture(0, new Identifier("textures/gui/options_background.png"), (int) (height * 0.15), width);
renderBackgroundTexture(0, new Identifier("textures/gui/options_background.png"), height, width, (int) (height * 0.85));
context.fillGradient( 0, (int) (height * 0.15), width, (int) (height * 0.85), -1072689136, -804253680);

//context.fill(RenderLayer.getEndGateway(),0, (int) (height * 0.15), width, (int) (height * 0.85), ColorHelper.Argb.getArgb(255,255,255,255));
context.drawCenteredTextWithShadow(textRenderer, title, width / 2, 15, 0xFFFFFF);

super.render(context, mouseX, mouseY, delta);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,18 @@ protected void init() {
},
ETFVersionDifferenceHandler.getTextFromTranslation("config." + ETFClientCommon.MOD_ID + ".hide_button.tooltip")
));
// this.addDrawableChild(getETFButton((int) (this.width * 0.2), (int) (this.height * 0.6), (int) (this.width * 0.6), 20,
// Text.of(ETFVersionDifferenceHandler.getTextFromTranslation(
// "config." + ETFClientCommon.MOD_ID + ".piglin_ear.button"
// ).getString() + ": " + (ETFConfigScreenMain.temporaryETFConfig.hideConfigButton ? ScreenTexts.ON : ScreenTexts.OFF).getString()),
// (button) -> {
// ETFConfigScreenMain.temporaryETFConfig.zombiePiglinRightEarEnabled = !ETFConfigScreenMain.temporaryETFConfig.zombiePiglinRightEarEnabled;
// button.setMessage(Text.of(ETFVersionDifferenceHandler.getTextFromTranslation(
// "config." + ETFClientCommon.MOD_ID + ".piglin_ear.button"
// ).getString() + ": " + (ETFConfigScreenMain.temporaryETFConfig.zombiePiglinRightEarEnabled ? ScreenTexts.ON : ScreenTexts.OFF).getString()));
// },
// ETFVersionDifferenceHandler.getTextFromTranslation("config." + ETFClientCommon.MOD_ID + ".piglin_ear.tooltip")
// ));
this.addDrawableChild(getETFButton((int) (this.width * 0.2), (int) (this.height * 0.6), (int) (this.width * 0.6), 20,
Text.of(ETFVersionDifferenceHandler.getTextFromTranslation(
"config." + ETFClientCommon.MOD_ID + ".warden.title"
).getString() + ": " + (ETFConfigScreenMain.temporaryETFConfig.enableFullBodyWardenTextures ? ScreenTexts.ON : ScreenTexts.OFF).getString()),
(button) -> {
ETFConfigScreenMain.temporaryETFConfig.enableFullBodyWardenTextures = !ETFConfigScreenMain.temporaryETFConfig.enableFullBodyWardenTextures;
button.setMessage(Text.of(ETFVersionDifferenceHandler.getTextFromTranslation(
"config." + ETFClientCommon.MOD_ID + ".warden.title"
).getString() + ": " + (ETFConfigScreenMain.temporaryETFConfig.enableFullBodyWardenTextures ? ScreenTexts.ON : ScreenTexts.OFF).getString()));
},
ETFVersionDifferenceHandler.getTextFromTranslation("config." + ETFClientCommon.MOD_ID + ".warden.tooltip")
));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public ETFConfigScreenMain(Screen parent) {

for (ETFConfigScreenWarnings.ConfigWarning warning :
ETFConfigScreenWarnings.ConfigWarning.values()) {
if (ETFVersionDifferenceHandler.isThisModLoaded(warning.getMod_id())) {
if (warning.isConditionMet()) {
shownWarning = true;
warningCount++;
warningsFound.add(warning);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import net.minecraft.text.Text;
import traben.entity_texture_features.ETFClientCommon;
import traben.entity_texture_features.ETFVersionDifferenceHandler;
import traben.entity_texture_features.texture_handlers.ETFManager;
import traben.entity_texture_features.texture_handlers.ETFPlayerTexture;
import traben.entity_texture_features.utils.ETFUtils2;

import java.util.Objects;

Expand Down Expand Up @@ -101,7 +101,7 @@ protected void init() {
},
ETFVersionDifferenceHandler.getTextFromTranslation("config." + ETFClientCommon.MOD_ID + ".skin_features_try_transparency_for_all.tooltip")
));
if(ETFManager.getInstance().skinLayersModPresent) {
if(ETFClientCommon.SKIN_LAYERS_DETECTED) {
this.addDrawableChild(getETFButton((int) (this.width * 0.025), (int) (this.height * 0.7), (int) (this.width * 0.45), 20,
Text.of(ETFVersionDifferenceHandler.getTextFromTranslation(
"config." + ETFClientCommon.MOD_ID + ".skin_layers_patch.title"
Expand All @@ -116,22 +116,48 @@ protected void init() {
));
}

//capture conditions separately to generate specific instructions for users to fix tool
boolean condition1 = ETFClientCommon.ETFConfigData.skinFeaturesEnabled;
boolean condition2 = !ETFVersionDifferenceHandler.isFabric() || ETFVersionDifferenceHandler.isThisModLoaded("fabric");
boolean condition3 = MinecraftClient.getInstance().player != null;
boolean condition4 = ETFPlayerTexture.clientPlayerOriginalSkinImageForTool != null;

canLaunchTool = condition1 && condition2 && condition3 && condition4;

StringBuilder reasonText = new StringBuilder();
if(!canLaunchTool){
//log reason
reasonText.append(ETFVersionDifferenceHandler.getTextFromTranslation("config.entity_texture_features.player_skin_editor.reason_0").getString());
if(!condition1){
reasonText.append(ETFVersionDifferenceHandler.getTextFromTranslation("config.entity_texture_features.player_skin_editor.reason_1").getString());
}
if(!condition2 ){
reasonText.append(ETFVersionDifferenceHandler.getTextFromTranslation("config.entity_texture_features.player_skin_editor.reason_2").getString());
}
if(!condition3){
reasonText.append(ETFVersionDifferenceHandler.getTextFromTranslation("config.entity_texture_features.player_skin_editor.reason_3").getString());
}
if(!condition4){
reasonText.append(ETFVersionDifferenceHandler.getTextFromTranslation("config.entity_texture_features.player_skin_editor.reason_4").getString());
}
ETFUtils2.logWarn(reasonText.toString());
}

canLaunchTool = (ETFClientCommon.ETFConfigData.skinFeaturesEnabled && ETFVersionDifferenceHandler.isFabric() == ETFVersionDifferenceHandler.isThisModLoaded("fabric"))
&& MinecraftClient.getInstance().player != null && ETFPlayerTexture.clientPlayerOriginalSkinImageForTool != null;

ButtonWidget skinTool = getETFButton((int) (this.width * 0.525), (int) (this.height * 0.5), (int) (this.width * 0.45), 20,
ETFVersionDifferenceHandler.getTextFromTranslation("config." + ETFClientCommon.MOD_ID + ".player_skin_editor.button." + (
canLaunchTool ? "enabled" : "disabled"
)),
(button) -> Objects.requireNonNull(client).setScreen(playerSkinEditorScreen),
canLaunchTool ? Text.of("") : ETFVersionDifferenceHandler.getTextFromTranslation("config." + ETFClientCommon.MOD_ID + ".player_skin_editor.fail_tooltip")
Text.of(reasonText.toString())
);
skinTool.active = canLaunchTool;

this.addDrawableChild(skinTool);




}

private boolean canLaunchTool=false;
Expand All @@ -144,7 +170,8 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) {
context.drawCenteredTextWithShadow( textRenderer, ETFVersionDifferenceHandler.getTextFromTranslation("config." + ETFClientCommon.MOD_ID + ".player_skin_editor.button_desc.1"), (int) (width * 0.75), (int) (height * 0.4), 0xCCCCCC);
context.drawCenteredTextWithShadow( textRenderer, ETFVersionDifferenceHandler.getTextFromTranslation("config." + ETFClientCommon.MOD_ID + ".player_skin_editor.button_desc.2"), (int) (width * 0.75), (int) (height * 0.45), 0xCCCCCC);
if(!canLaunchTool)
context.drawCenteredTextWithShadow( textRenderer, ETFVersionDifferenceHandler.getTextFromTranslation("config." + ETFClientCommon.MOD_ID + ".player_skin_editor.button_desc.fail"), (int) (width * 0.75), (int) (height * 0.6), 0xCC5555);
context.drawCenteredTextWithShadow( textRenderer, ETFVersionDifferenceHandler.getTextFromTranslation("config." + ETFClientCommon.MOD_ID + ".player_skin_editor.button_desc.fail2"), (int) (width * 0.75), (int) (height * 0.6), 0xCC5555);
context.drawCenteredTextWithShadow( textRenderer, ETFVersionDifferenceHandler.getTextFromTranslation("config." + ETFClientCommon.MOD_ID + ".player_skin_editor.info"), (int) (width * 0.5), (int) (height * 0.8), 0xCCCCCC);
}

}
Loading

0 comments on commit 1c89dd0

Please sign in to comment.