Skip to content

Commit 17e8fb2

Browse files
authored
Merge pull request #146 from Traben-0/1.19.3-dev
1.19.3 dev
2 parents 6504d35 + c9550d5 commit 17e8fb2

51 files changed

Lines changed: 1044 additions & 398 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/README-assets/random_entities.properties

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,23 @@ weather.<n>=<clear|rain|thunder>
220220
# sizes.3=0-2 4-7
221221
sizes.<n>=<list>
222222
#
223+
# NBT (Optional)
224+
# Select whether a mob must have matching NBT data values
225+
# Note: this is an OptiFine feature that has not yet received documentation, this is subject to change in ETF once full
226+
# OptiFine documentation is released.
227+
# NBT requires an additional value in the key this is called <nbtPath>.
228+
# - nbtPath must match the exact name of the nbt element and is case-sensitive
229+
# - nbtPath supports matching nested nbt elements by defining the full nbt path with '.' marking a separation
230+
# - E.G. the Villager profession level nbtPath is "VillagerData.level" meaning the full property key would be "nbt.<n>.VillagerData.level"
231+
# NBT can be checked in several ways:
232+
# - "exists:true" will make the property match only if the nbt element exists
233+
# - "exists:false" is the opposite, only matching if the element does not exist
234+
# - "list" will match the nbt element as a string against a list of possible values separated by spaces e.g "0.0 1 34.5 56"
235+
# - "print" as nbt values can be unpredictable, and I do not yet know OptiFine's intended matching method,
236+
# ETF will simply match the String value of nbt elements for now. To aid with this,
237+
# if the nbt property is just "print" ETF will print the nbt value, if found, so that you can figure out what to use.
238+
nbt.<n>.<nbtPath>=<list|print|exists:true|exists:false>
239+
#
223240
# Speed Ranges (Optional)
224241
# ETF Only!
225242
# Select a range of top speeds a mob must match

common/CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
[**ETF Changelog:**]
22

3+
[V4.3.2]
4+
5+
- added the `NBT` OptiFine texture property, which can read any NBT value of an entity that is available to the client
6+
- added wolf collar support
7+
- API updated for other mods to utilise ETFs random texture .properties file loading *(will be used in EMF)*
8+
- added an option to enable transparent skins for all players, even ones not using ETF skin features.
9+
- added checks to catch some nullPointer crashes
10+
- fixed an issue requiring other clients to have ETF installed when joining an Essentials mod hosted game
11+
- reworked the handling of all entities internally by ETF, The ETFPlaceHolderEntity EntityType has been removed.
12+
- fixed a crash caused by modded entities with large numbers as texture file name making etf think it is a variant .png
13+
- added config setting to disabled using variants in the vanilla directories *(making only optifine and etf folders
14+
work)* this is specifically added for certain mods that have their mob textures named like "mob2.png" that are detected
15+
as random mobs by etf
16+
- `Illegal path override = All` config setting will no longer allow empty paths
17+
- added brazilian portuguese translations
18+
- updated chinese translations
19+
- fixed a crash when uploading skin changes on the forge version
20+
21+
[V4.3.1]
22+
23+
- updated russian translation to 4.3 thanks to @Felix14-v2
24+
- fixed a button translation
25+
- added compatibility warning message for Quark as it's [Variant Animal Textures] setting must be disabled for ETF's to work
26+
- resolved an issue with additional textures like enderman_eyes.png or sheep_fur.png resetting after a short time if the
27+
base texture had .properties but the additional texture didn't
28+
- added shulker bullet texture support
29+
330
[V4.3.0]
431

532
*Update summary*

common/src/main/java/traben/entity_texture_features/ETFApi.java

Lines changed: 91 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,31 @@
11
package traben.entity_texture_features;
22

3+
import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap;
4+
import net.minecraft.block.entity.BlockEntity;
5+
import net.minecraft.entity.Entity;
6+
import net.minecraft.util.Identifier;
7+
import org.jetbrains.annotations.Nullable;
38
import traben.entity_texture_features.config.ETFConfig;
49
import traben.entity_texture_features.texture_handlers.ETFManager;
10+
import traben.entity_texture_features.utils.ETFTexturePropertiesUtils;
511
import traben.entity_texture_features.utils.ETFUtils2;
612

13+
import java.util.List;
14+
import java.util.Properties;
15+
import java.util.UUID;
16+
717
//an api that will remain unchanged for external mod access (primarily puzzle at this time)
818
@SuppressWarnings("unused")
919
public class ETFApi {
1020

11-
final public static int ETFApiVersion = 2;
21+
final public static int ETFApiVersion = 3;
1222
//provides access to the ETF config object to read AND modify its values
1323
//please be sure to run the save config method below after any changes
24+
public static ETFConfig getETFConfigObject() {
25+
return ETFClientCommon.ETFConfigData;
26+
}
27+
//static getter that simply provided an object pointer, doesn't work with config resseting
28+
@Deprecated
1429
public static ETFConfig getETFConfigObject = ETFClientCommon.ETFConfigData;
1530

1631
//saves any config changes to file and resets ETF to function with the new settings
@@ -24,6 +39,79 @@ public static void resetETF() {
2439
ETFManager.resetInstance();
2540
}
2641

27-
//for now only puzzle support has been considered
28-
//please notify the dev if you would like something added here
42+
43+
44+
45+
// returns the object below that provides functionality to input an entity and output a suffix integer as defined in
46+
// a valid OptiFine random entity properties file given in this method.
47+
// this method will return null for any failure and should print some relevant information on the failure reason.
48+
// the return from this method only requires object.getSuffixForEntity() to be called to retrieve a suffix integer,
49+
// the suffix may or may not be valid, it is up to you to test if the file with that suffix actually exists.
50+
// see the comments below within the object itself for further info.
51+
//
52+
//suffixKeyName would be "skins" for regular OptiFine random textures and "models" for OptiFine random entity models
53+
public ETFRandomTexturePropertyInstance readRandomPropertiesFileAndReturnTestingObject(Identifier propertiesFileIdentifier, String suffixKeyName) {
54+
return ETFRandomTexturePropertyInstance.getInstance(propertiesFileIdentifier, suffixKeyName);
55+
}
56+
57+
58+
public static class ETFRandomTexturePropertyInstance {
59+
@Nullable
60+
private static ETFRandomTexturePropertyInstance getInstance(Identifier propertiesFileIdentifier, String suffixKeyName) {
61+
Properties props = ETFUtils2.readAndReturnPropertiesElseNull(propertiesFileIdentifier);
62+
if (props == null) return null;
63+
List<ETFTexturePropertiesUtils.ETFTexturePropertyCase> etfs = ETFTexturePropertiesUtils.getAllValidPropertyObjects(props, suffixKeyName, propertiesFileIdentifier);
64+
if (etfs.isEmpty()) return null;
65+
return new ETFRandomTexturePropertyInstance(etfs);
66+
}
67+
68+
private ETFRandomTexturePropertyInstance(List<ETFTexturePropertiesUtils.ETFTexturePropertyCase> etfs) {
69+
propertyCases = etfs;
70+
}
71+
72+
private final List<ETFTexturePropertiesUtils.ETFTexturePropertyCase> propertyCases;
73+
74+
// this is the primary method of the object,
75+
// it will accept an entity and some additional args and will output a variant suffix integer that matches
76+
// the OptiFine cases outlined in the properties file, it ONLY outputs an integer, testing whether that
77+
// variant number exists or not is up to you.
78+
//
79+
// the boolean second arg provides the algorithm context to allow faster iterations when an entity needs to be
80+
// repeatedly tested, as is the case with the health property, since it can change over time you must retest the
81+
// entity occasionally, the boolean should be true the first time an entity is sent to this method,
82+
// and false every time thereafter, if you don't care about this just hard code it to [true].
83+
//
84+
// the third arg is an optimized type of Map<UUID,boolean>. this map is for your own optimization usage as
85+
// the method will put a boolean into the map to mark whether an entity ever needs to be updated again.
86+
// if the entity has no update-able properties (like health) it will never need to be tested again, so you can
87+
// check this map to skip testing it if it's not needed.
88+
// if the map returns [true] then that entity can possibly update, and you should retest it periodically, if the
89+
// map returns [false] then the entity will never change its suffix, and you can skip testing it.
90+
// the map can simply be hard coded [null] if you do not care.
91+
//
92+
// note an output of 0 ALWAYS means you need to use the vanilla variant, usually due to finding no match
93+
// an output of 1, can be handled in 2 ways, usually it is used to refer to the vanilla suffix, but you might
94+
// also choose to check for a #1 suffix, I would recommend using 1 to mean the vanilla/default variant.
95+
int getSuffixForEntity(Entity entityToBeTested, boolean isThisTheFirstTestForEntity, Object2BooleanOpenHashMap<UUID> cacheToMarkEntitiesWhoseVariantCanChangeAgain) {
96+
boolean isAnUpdate = !isThisTheFirstTestForEntity;
97+
for (ETFTexturePropertiesUtils.ETFTexturePropertyCase testCase : propertyCases) {
98+
if (testCase.doesEntityMeetConditionsOfThisCase(entityToBeTested, isThisTheFirstTestForEntity, cacheToMarkEntitiesWhoseVariantCanChangeAgain)){
99+
return testCase.getAnEntityVariantSuffixFromThisCase(entityToBeTested.getUuid());
100+
}
101+
}
102+
return 0;
103+
}
104+
105+
// same as above but valid for Block Entities, you must supply a UUID,
106+
// you can always generate a UUID from a string with UUID.nameUUIDFromBytes("STRING".getBytes())
107+
int getSuffixForBlockEntity(BlockEntity entityToBeTested, UUID uuidForBlockEntity, boolean isThisTheFirstTestForEntity, Object2BooleanOpenHashMap<UUID> cacheToMarkEntitiesWhoseVariantCanChangeAgain) {
108+
boolean isAnUpdate = !isThisTheFirstTestForEntity;
109+
for (ETFTexturePropertiesUtils.ETFTexturePropertyCase testCase : propertyCases) {
110+
if (testCase.doesEntityMeetConditionsOfThisCase(entityToBeTested, uuidForBlockEntity, isThisTheFirstTestForEntity, cacheToMarkEntitiesWhoseVariantCanChangeAgain)){
111+
return testCase.getAnEntityVariantSuffixFromThisCase(uuidForBlockEntity);
112+
}
113+
}
114+
return 0;
115+
}
116+
}
29117
}

common/src/main/java/traben/entity_texture_features/ETFClientCommon.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class ETFClientCommon {
2525

2626

2727
public static void start() {
28-
LOGGER.info("Loading Entity Texture Features, Thank you for 3 Million downloads :)");
28+
LOGGER.info("Loading Entity Texture Features, Thank you for 4 Million downloads :)");
2929
etf$loadConfig();
3030
ETFUtils2.checkModCompatibility();
3131
}

common/src/main/java/traben/entity_texture_features/ETFVersionDifferenceHandler.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package traben.entity_texture_features;
22

33
import dev.architectury.injectables.annotations.ExpectPlatform;
4-
import net.minecraft.entity.EntityType;
54
import net.minecraft.text.Text;
65
import net.minecraft.util.math.BlockPos;
76
import net.minecraft.world.World;
87
import org.jetbrains.annotations.NotNull;
98
import org.slf4j.Logger;
109
import org.slf4j.LoggerFactory;
11-
import traben.entity_texture_features.utils.ETFPlaceholderEntity;
1210

1311
import java.io.File;
1412

@@ -40,11 +38,6 @@ public static boolean areShadersInUse() {
4038
return false;
4139
}
4240

43-
@NotNull
44-
@ExpectPlatform
45-
public static EntityType<ETFPlaceholderEntity> getPlaceHolderEntityType() {
46-
throw new NullPointerException("");
47-
}
4841

4942
//the below act as handlers for minecraft version differences that have come up during development
5043
//for instance biome code changed in 1.18.2

common/src/main/java/traben/entity_texture_features/config/ETFConfig.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.google.gson.Gson;
44
import com.google.gson.GsonBuilder;
5-
import net.minecraft.screen.ScreenTexts;
65
import traben.entity_texture_features.ETFVersionDifferenceHandler;
76
import traben.entity_texture_features.config.screens.ETFConfigScreenWarnings;
87
import traben.entity_texture_features.texture_handlers.ETFManager;
@@ -42,6 +41,8 @@ public class ETFConfig {
4241
public boolean skinFeaturesEnabled = true;
4342
public boolean skinFeaturesEnableTransparency = true;
4443
public boolean skinFeaturesEnableFullTransparency = false;
44+
45+
public boolean tryETFTransparencyForAllSkins = false;
4546
//public boolean skinFeaturesPrintETFReadySkin = false;
4647
public boolean enableEnemyTeamPlayersSkinFeatures = true;
4748
public boolean enableBlinking = true;
@@ -70,6 +71,8 @@ public class ETFConfig {
7071

7172
public boolean hideConfigButton = false;
7273

74+
public boolean disableVanillaDirectoryVariantTextures = false;
75+
7376
//string name stuff more in-depth than other enum for backwards compatibility
7477

7578
public static ETFConfig copyFrom(ETFConfig source) {
@@ -171,7 +174,7 @@ public DebugLogMode next() {
171174

172175
@SuppressWarnings({"unused", "EnhancedSwitchMigration"})
173176
public enum IllegalPathMode {
174-
None(ScreenTexts.OFF.getString()),
177+
None("options.off"),
175178
Entity("config." + MOD_ID + ".illegal_path_mode.entity"),
176179
All("config." + MOD_ID + ".illegal_path_mode.all");
177180

@@ -183,7 +186,6 @@ public enum IllegalPathMode {
183186

184187
@Override
185188
public String toString() {
186-
187189
return ETFVersionDifferenceHandler.getTextFromTranslation(key).getString();
188190
}
189191

common/src/main/java/traben/entity_texture_features/config/screens/ETFConfigScreenEmissiveFixSettings.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ protected void init() {
3434
ETFConfigScreenMain.temporaryETFConfig.removePixelsUnderEmissivePlayers = true;
3535
ETFConfigScreenMain.temporaryETFConfig.removePixelsUnderEmissiveMobs = true;
3636
ETFConfigScreenMain.temporaryETFConfig.removePixelsUnderEmissiveBlockEntity = true;
37+
ETFConfigScreenMain.temporaryETFConfig.dontPatchPBRTextures = true;
38+
ETFConfigScreenMain.temporaryETFConfig.dontPatchAnimatedTextures = true;
3739

3840
this.clearAndInit();
3941
//Objects.requireNonNull(client).setScreen(parent);

common/src/main/java/traben/entity_texture_features/config/screens/ETFConfigScreenRandomSettings.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ protected void init() {
3939
ETFConfigScreenMain.temporaryETFConfig.restrictBiome = true;
4040
ETFConfigScreenMain.temporaryETFConfig.restrictBlock = true;
4141
ETFConfigScreenMain.temporaryETFConfig.restrictHeight = true;
42+
ETFConfigScreenMain.temporaryETFConfig.disableVanillaDirectoryVariantTextures = false;
43+
4244
this.clearAndInit();
4345
//Objects.requireNonNull(client).setScreen(parent);
4446
}));
@@ -98,6 +100,19 @@ protected void init() {
98100
ETFVersionDifferenceHandler.getTextFromTranslation("config." + ETFClientCommon.MOD_ID + ".restrict_update_properties.tooltip")
99101
));
100102

103+
this.addDrawableChild(getETFButton((int) (this.width * 0.2), (int) (this.height * 0.7), (int) (this.width * 0.6), 20,
104+
Text.of(ETFVersionDifferenceHandler.getTextFromTranslation(
105+
"config." + ETFClientCommon.MOD_ID + ".disable_default_directory.title"
106+
).getString() + ": " + (ETFConfigScreenMain.temporaryETFConfig.disableVanillaDirectoryVariantTextures ? ScreenTexts.ON : ScreenTexts.OFF).getString()),
107+
(button) -> {
108+
ETFConfigScreenMain.temporaryETFConfig.disableVanillaDirectoryVariantTextures = !ETFConfigScreenMain.temporaryETFConfig.disableVanillaDirectoryVariantTextures;
109+
button.setMessage(Text.of(ETFVersionDifferenceHandler.getTextFromTranslation(
110+
"config." + ETFClientCommon.MOD_ID + ".disable_default_directory.title"
111+
).getString() + ": " + (ETFConfigScreenMain.temporaryETFConfig.disableVanillaDirectoryVariantTextures ? ScreenTexts.ON : ScreenTexts.OFF).getString()));
112+
},
113+
ETFVersionDifferenceHandler.getTextFromTranslation("config." + ETFClientCommon.MOD_ID + ".disable_default_directory.tooltip")
114+
));
115+
101116

102117
}
103118

common/src/main/java/traben/entity_texture_features/config/screens/ETFConfigScreenSkinSettings.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ protected void init() {
3535
ETFConfigScreenMain.temporaryETFConfig.skinFeaturesEnableFullTransparency = false;
3636
ETFConfigScreenMain.temporaryETFConfig.skinFeaturesEnableTransparency = true;
3737
ETFConfigScreenMain.temporaryETFConfig.enableEnemyTeamPlayersSkinFeatures = true;
38+
ETFConfigScreenMain.temporaryETFConfig.tryETFTransparencyForAllSkins = false;
3839
this.clearAndInit();
3940
//Objects.requireNonNull(client).setScreen(parent);
4041
}));
@@ -87,6 +88,18 @@ protected void init() {
8788
},
8889
ETFVersionDifferenceHandler.getTextFromTranslation("config." + ETFClientCommon.MOD_ID + ".skin_features_enable_full_transparency.tooltip")
8990
));
91+
this.addDrawableChild(getETFButton((int) (this.width * 0.025), (int) (this.height * 0.6), (int) (this.width * 0.45), 20,
92+
Text.of(ETFVersionDifferenceHandler.getTextFromTranslation(
93+
"config." + ETFClientCommon.MOD_ID + ".skin_features_try_transparency_for_all.title"
94+
).getString() + ": " + (ETFConfigScreenMain.temporaryETFConfig.tryETFTransparencyForAllSkins ? ScreenTexts.ON : ScreenTexts.OFF).getString()),
95+
(button) -> {
96+
ETFConfigScreenMain.temporaryETFConfig.tryETFTransparencyForAllSkins = !ETFConfigScreenMain.temporaryETFConfig.tryETFTransparencyForAllSkins;
97+
button.setMessage(Text.of(ETFVersionDifferenceHandler.getTextFromTranslation(
98+
"config." + ETFClientCommon.MOD_ID + ".skin_features_try_transparency_for_all.title"
99+
).getString() + ": " + (ETFConfigScreenMain.temporaryETFConfig.tryETFTransparencyForAllSkins ? ScreenTexts.ON : ScreenTexts.OFF).getString()));
100+
},
101+
ETFVersionDifferenceHandler.getTextFromTranslation("config." + ETFClientCommon.MOD_ID + ".skin_features_try_transparency_for_all.tooltip")
102+
));
90103

91104
boolean canLaunchTool = (
92105
ETFClientCommon.ETFConfigData.skinFeaturesEnabled && ETFVersionDifferenceHandler.isFabric() == ETFVersionDifferenceHandler.isThisModLoaded("fabric"))

common/src/main/java/traben/entity_texture_features/config/screens/ETFConfigScreenWarnings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public enum ConfigWarning {
104104
FIGURA(true, "figura", "config." + ETFClientCommon.MOD_ID + ".warn.figura.text.1", "config." + ETFClientCommon.MOD_ID + ".warn.figura.text.2"),
105105
//SKINLAYERS(false, "skinlayers", "config." + ETFClientCommon.MOD_ID + ".warn.skinlayers.text.1", "config." + ETFClientCommon.MOD_ID + ".warn.skinlayers.text.2"),
106106
ENHANCED_BLOCK_ENTITIES(false, "enhancedblockentities", "config." + ETFClientCommon.MOD_ID + ".warn.ebe.text.1", "config." + ETFClientCommon.MOD_ID + ".warn.ebe.text.2"),
107-
//QUARK(true,"quark","config." + ETFClientCommon.MOD_ID + ".warn.quark.text.1", "config." + ETFClientCommon.MOD_ID + ".warn.quark.text.2"),
107+
QUARK(false, "quark", "config." + ETFClientCommon.MOD_ID + ".warn.quark.text.3", "config." + ETFClientCommon.MOD_ID + ".warn.quark.text.4"),
108108
IRIS(false, "iris", "config." + ETFClientCommon.MOD_ID + ".warn.iris.text.1", "config." + ETFClientCommon.MOD_ID + ".warn.iris.text.2");
109109
//IMPERSONATE(true, "impersonate", "config." + ETFClientCommon.MOD_ID + ".warn.impersonate.text.1", "config." + ETFClientCommon.MOD_ID + ".warn.impersonate.text.2");
110110

0 commit comments

Comments
 (0)