Skip to content

Commit

Permalink
Remove MinecraftVersion.create() call + update readme (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
A5b84 committed Aug 18, 2020
1 parent 539d188 commit 7bb68dc
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{
"label": "Build + copie",
"type": "shell",
"command": "./gradlew.bat build; scp ./build/libs/dark-loading-screen-1.4.3.jar $HOME/AppData/Roaming/.minecraft/mods/",
"command": "./gradlew.bat build; scp ./build/libs/dark-loading-screen-1.4.4.jar $HOME/AppData/Roaming/.minecraft/mods/",
"group": {
"kind": "build",
"isDefault": true
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

<!-- ### Unreleased -->

### [1.4.4]
- Fixed some potential incompatibilities with other mods
- `zh_cn` localization updated by [@Hambaka](https://github.com/Hambaka) ([#7](https://github.com/A5b84/dark-loading-screen/pull/7))

### [1.4.3]
- Fixed crashing when opening the config screen in 1.16.2
- The config screen is now only available in 1.16.2 and later (was 1.16 and later)
Expand Down Expand Up @@ -91,3 +95,4 @@ Compatible with Fabric 1.14-20w16a
[1.4.1]: https://github.com/A5b84/dark-loading-screen/releases/tag/v1.4.1
[1.4.2]: https://github.com/A5b84/dark-loading-screen/releases/tag/v1.4.2
[1.4.3]: https://github.com/A5b84/dark-loading-screen/releases/tag/v1.4.3
[1.4.4]: https://github.com/A5b84/dark-loading-screen/releases/tag/v1.4.4
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Manual changes are only visible after restarting the game.

## Credits

- Logo coloring suggested by [Minenash](https://github.com/Minenash)
- `es_xx` localizations by [Haseck](https://github.com/Haseck)
- `pl_pl` localization by [DarkKnightComes](https://github.com/DarkKnightComes)
- `zh_cn` localization by [w5860363](https://github.com/w5860363)
- Logo coloring suggested by [@Minenash](https://github.com/Minenash)
- `es_xx` localizations by [@Haseck](https://github.com/Haseck)
- `pl_pl` localization by [@DarkKnightComes](https://github.com/DarkKnightComes)
- `zh_cn` localization by [@w5860363](https://github.com/w5860363) and [@Hambaka](https://github.com/Hambaka)
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ yarn_mappings=1.16.2+build.6
loader_version=0.9.1+build.205

# Mod
mod_version=1.4.3
mod_version=1.4.4
archives_base_name=dark-loading-screen

# Dépendances
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
package io.github.a5b84.darkloadingscreen.mixin;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;

import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.MinecraftVersion;

/**
* Plugin qui désactive des mixins selon la version du jeu.
Expand Down Expand Up @@ -54,9 +60,26 @@ public class MixinConfigPlugin implements IMixinConfigPlugin {
+ ")?"
);

private static final int GAME_VERSION = MinecraftVersion.create().getWorldVersion();
private static final int GAME_VERSION = getGameVersion();
private static final boolean HAS_OPTIFINE = FabricLoader.getInstance().isModLoaded("optifabric");



/** Lit la version du jeu depuis le version.json dans le jar */
private static int getGameVersion() {
try (
final InputStream stream = MixinConfigPlugin.class.getResourceAsStream("/version.json");
final Reader reader = new InputStreamReader(stream);
) {
final JsonObject versions = new JsonParser().parse(reader).getAsJsonObject();
return versions.get("world_version").getAsInt();
} catch (IOException | NullPointerException e) {
throw new RuntimeException("[Dark Loading Screen] Couldn't get the game version", e);
}
}



@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
final Matcher matcher = CONSTRAINT_PATTERN.matcher(mixinClassName);
Expand Down

0 comments on commit 7bb68dc

Please sign in to comment.