Skip to content
This repository was archived by the owner on Dec 28, 2024. It is now read-only.

Commit b4d1b28

Browse files
authored
Merge pull request #44 from dxxxxy/hotfix-may-23
Essential Mod v1.3.2.4 - May 23, 2024
2 parents b9c2e10 + 115e835 commit b4d1b28

File tree

7 files changed

+35
-25
lines changed

7 files changed

+35
-25
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# EssentialCosmeticsUnlocker
2-
**Client-side only** patch that allows you to unlock ALL cosmetics (+ emotes) in the Essential mod. Works on every version of Essential MC (1.8.9 - 1.20.4).
2+
**Client-side only** patch that allows you to unlock ALL cosmetics (+ emotes) in the Essential mod. Works on every version of Essential MC (1.8.9 - 1.20.6).
33

44
![](https://img.shields.io/badge/COMPATIBILITY-∞-0?style=for-the-badge)
55
![](https://img.shields.io/github/downloads/DxxxxY/EssentialCosmeticsUnlocker/total?style=for-the-badge)
@@ -11,25 +11,25 @@ Grab the .jar you need from the [Releases](https://github.com/DxxxxY/EssentialCo
1111
- Efficient, single class and light-weight thanks to mixins.
1212
- Unlock ALL cosmetics and emotes (including developer).
1313
- Universally compatible with any version (view [Compatibility](#compatibility) table).
14-
- Saves equipped cosmetics to config file located in your `LocalAppData`.
14+
- Saves equipped cosmetics to config file located in `AppData/Roaming/ecu`.
1515
- Loads equipped cosmetics from config file when you toggle the `Hide/Show My Cosmetics` button.
16-
- Dumps cosmetic data in your `LocalAppData` (texture, geometry) when opening the game. Useful for those looking to replicate the cosmetics in their own projects.
16+
- Dumps cosmetic data in `AppData/Roaming/ecu` (texture, geometry) when opening the game. Useful for those looking to replicate the cosmetics in their own projects.
1717

1818
## Compatibility
1919
Feel free to contribute to this table with a PR and a convincing screenshot. Only the major versions are tested as it takes time to do it manually.
2020

2121
| MC Major Version | Forge | Fabric* | Last Checked (dd/mm/yyyy) |
2222
|------------------|--------------|--------------------|---------------------------|
23-
| 1.8 | `✔️ works`^ | `⬛ not applicable` | 27/04/2024 |
24-
| 1.12 | `✔️ works`^️ | `⬛ not applicable` | 27/04/2024 |
23+
| 1.8 | `✔️ works`^ | `⬛ not applicable` | 24/05/2024 |
24+
| 1.12 | `✔️ works`^️ | `⬛ not applicable` | |
2525
| | | | |
2626
| 1.16 | `✔️ works` | `✔️ works` | |
2727
| 1.17 | `✔️ works`| `✔️ works` | |
2828
| 1.18 | `✔️ works`| `✔️ works` | |
2929
| 1.19 | `✔️ works`| `✔️ works` | |
30-
| 1.20 | `✔️ works` | `✔️ works` | 27/04/2024 |
30+
| 1.20 | `✔️ works` | `✔️ works` | 24/05/2024 |
3131

32-
Last Essential version checked: **v1.3.1.3**
32+
Last Essential version checked: **v1.3.2.4**
3333

3434
Tested with downloads from [essential website](https://essential.gg/downloads).
3535

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ plugins {
1818
apply plugin: "net.minecraftforge.gradle.forge"
1919
apply plugin: "org.spongepowered.mixin"
2020

21-
version = "1.3.0"
21+
version = "1.4.0"
2222
group = "dreamys.studio.ecu" //http://maven.apache.org/guides/mini/guide-naming-conventions.html
2323
archivesBaseName = "ecu" //name of the output jar
2424

libs/essential.mock.jar

-583 KB
Binary file not shown.

src/main/java/studio/dreamys/ecu/mixin/other/essential/cosmetics/MixinCosmeticsManager.java

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
import gg.essential.network.connectionmanager.ConnectionManager;
99
import gg.essential.network.connectionmanager.cosmetics.CosmeticsData;
1010
import gg.essential.network.connectionmanager.cosmetics.CosmeticsManager;
11+
import gg.essential.network.connectionmanager.cosmetics.EquippedCosmeticsManager;
1112
import gg.essential.network.cosmetics.Cosmetic;
1213
import gg.essential.util.UUIDUtil;
1314
import org.jetbrains.annotations.NotNull;
15+
import org.spongepowered.asm.mixin.Final;
1416
import org.spongepowered.asm.mixin.Mixin;
1517
import org.spongepowered.asm.mixin.Overwrite;
1618
import org.spongepowered.asm.mixin.Shadow;
@@ -28,13 +30,14 @@ public abstract class MixinCosmeticsManager {
2830
public Map<CosmeticSlot, String> map = new HashMap<>();
2931

3032
@Shadow
31-
public abstract @NotNull CosmeticsData getCosmeticsData();
33+
@Final
34+
private @NotNull EquippedCosmeticsManager equippedCosmeticsManager;
3235

3336
@Shadow
34-
public abstract void setEquippedCosmetics(@NotNull UUID playerId, @NotNull Map<CosmeticSlot, String> equippedCosmetics);
37+
public abstract @NotNull CosmeticsData getCosmeticsData();
3538

3639
@Shadow
37-
private boolean ownCosmeticsVisible;
40+
public abstract boolean getOwnCosmeticsVisible();
3841

3942
@Overwrite
4043
public @NotNull State<Set<String>> getUnlockedCosmetics() {
@@ -46,7 +49,12 @@ public void CosmeticManager(ConnectionManager connectionManager, File baseDir, C
4649
//load config
4750
try {
4851
System.out.println("[EssentialCosmeticsUnlocker] Loading config");
49-
Scanner sc = new Scanner(new File(System.getenv("LOCALAPPDATA"), "ecu.txt"));
52+
53+
//create if doesnt exist
54+
File configFile = new File(new File(System.getenv("APPDATA"), "ecu"), "ecu.txt");
55+
configFile.getParentFile().mkdirs();
56+
57+
Scanner sc = new Scanner(configFile);
5058

5159
while (sc.hasNextLine()) {
5260
String[] line = sc.nextLine().split("=");
@@ -63,18 +71,18 @@ public void CosmeticManager(ConnectionManager connectionManager, File baseDir, C
6371

6472
@Inject(method = "resetState", at = @At("TAIL"))
6573
public void resetState(CallbackInfo ci) {
66-
setEquippedCosmetics(UUIDUtil.getClientUUID(), map);
74+
equippedCosmeticsManager.update(UUIDUtil.getClientUUID(), map, Collections.emptyMap());
6775
}
6876

6977
@Inject(method = "toggleOwnCosmeticVisibility", at = @At("HEAD"))
7078
public void toggleOwnCosmeticVisibility(boolean notification, CallbackInfo ci) {
71-
if (ownCosmeticsVisible) return;
79+
if (getOwnCosmeticsVisible()) return;
7280
Notifications.INSTANCE.push("EssentialCosmeticsUnlocker", "Loaded cosmetics from config.");
73-
setEquippedCosmetics(UUIDUtil.getClientUUID(), map);
81+
equippedCosmeticsManager.update(UUIDUtil.getClientUUID(), map, Collections.emptyMap());
7482
}
7583

7684
@Overwrite
77-
public @NotNull ImmutableMap<CosmeticSlot, String> getEquippedCosmetics() {
85+
public @NotNull Map<CosmeticSlot, String> getEquippedCosmetics() {
7886
ImmutableMap<CosmeticSlot, String> result = ImmutableMap.copyOf(map);
7987
return result != null ? result : ImmutableMap.of();
8088
}
@@ -87,7 +95,7 @@ public void updateEquippedCosmetic(CosmeticSlot slot, String cosmeticId, Callbac
8795
//save config
8896
try {
8997
System.out.println("[EssentialCosmeticsUnlocker] Saving config");
90-
PrintWriter pw = new PrintWriter(new File(System.getenv("LOCALAPPDATA"), "ecu.txt"));
98+
PrintWriter pw = new PrintWriter(new File(new File(System.getenv("APPDATA"), "ecu"), "ecu.txt"));
9199

92100
for (Map.Entry<CosmeticSlot, String> entry : map.entrySet()) {
93101
pw.println(entry.getKey().getId() + "=" + entry.getValue());

src/main/java/studio/dreamys/ecu/mixin/other/essential/cosmetics/MixinServerCosmeticsPopulatePacketHandler.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,21 @@ public void onHandle(ConnectionManager connectionManager, ServerCosmeticsPopulat
2525
try {
2626
Gson gson = new Gson();
2727
List<Cosmetic> cosmetics = new ArrayList<>();
28-
File file = new File(System.getenv("LOCALAPPDATA"), "ecu.dump.txt");
28+
File dumpFile = new File(new File(System.getenv("APPDATA"), "ecu"), "dump.txt");
29+
dumpFile.getParentFile().mkdirs();
2930

3031
//start with already existing or new list
31-
if (file.exists()) {
32-
cosmetics = gson.fromJson(Files.readAllLines(file.toPath()).toString(), new TypeToken<List<Cosmetic>>() {}.getType());
32+
if (dumpFile.exists()) {
33+
cosmetics = gson.fromJson(Files.readAllLines(dumpFile.toPath()).toString(), new TypeToken<List<Cosmetic>>() {
34+
}.getType());
3335
}
3436

3537
//add incoming cosmetics to the list
3638
cosmetics.addAll(packet.getCosmetics());
3739

3840
//dump the list to file
3941
System.out.println("[EssentialCosmeticsUnlocker] Dumping cosmetics to file...");
40-
PrintWriter pw = new PrintWriter(new FileOutputStream(file, true));
42+
PrintWriter pw = new PrintWriter(new FileOutputStream(dumpFile, true));
4143
pw.println(new Gson().toJson(cosmetics));
4244
pw.close();
4345
System.out.println("[EssentialCosmeticsUnlocker] Dumped cosmetics to file!");

src/main/resources/fabric.mod.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"schemaVersion": 1,
33
"id": "ecu",
4-
"version": "1.3.0",
4+
"version": "1.4.0",
55
"name": "EssentialCosmeticsUnlocker",
6-
"description": "Client-side only patch that allows you to unlock ALL cosmetics (+ emotes) in the Essential mod. Works on every version of Essential MC (1.8.9 - 1.20.4).",
6+
"description": "Client-side only patch that allows you to unlock ALL cosmetics (+ emotes) in the Essential mod. Works on every version of Essential MC (1.8.9 - 1.20.6).",
77
"authors": ["dxxxxy"],
88
"license": "GPL-3.0",
99
"environment": "*",

src/main/resources/modid.info

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[{
22
"modid": "ecu",
33
"name": "EssentialCosmeticsUnlocker",
4-
"description": "Client-side only patch that allows you to unlock ALL cosmetics (+ emotes) in the Essential mod. Works on every version of Essential MC (1.8.9 - 1.20.4).",
5-
"version": "1.3.0",
4+
"description": "Client-side only patch that allows you to unlock ALL cosmetics (+ emotes) in the Essential mod. Works on every version of Essential MC (1.8.9 - 1.20.6).",
5+
"version": "1.4.0",
66
"authorList": ["dxxxxy"],
77
}]

0 commit comments

Comments
 (0)