Skip to content
This repository has been archived by the owner on Jun 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #99 from TheMrEngMan/fabric_1_20
Browse files Browse the repository at this point in the history
Update to Minecraft 1.20.2
  • Loading branch information
gbl authored Sep 26, 2023
2 parents 2113e11 + 67e8c4f commit 7873c99
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 50 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
}
}
plugins {
id 'fabric-loom' version '1.2-SNAPSHOT'
id 'fabric-loom' version '1.3-SNAPSHOT'
id "com.modrinth.minotaur" version "2.+"
id "com.matthewprenger.cursegradle" version "1.4.0"
}
Expand All @@ -34,7 +34,7 @@ repositories {
}
maven {
name = "Ladysnake Libs"
url = "https://ladysnake.jfrog.io/artifactory/mods"
url = "https://maven.ladysnake.org/releases"
}
maven { url "https://maven.shedaniel.me/" }
}
Expand All @@ -43,10 +43,10 @@ sourceCompatibility = 17
targetCompatibility = 17

ext.Versions = new Properties()
Versions.load(file("Versionfiles/mcversion-1.20.properties").newReader())
Versions.load(file("Versionfiles/mcversion-1.20.2.properties").newReader())

archivesBaseName = "durabilityviewer"
ext.projectVersion = "1.10.4"
ext.projectVersion = "1.10.5"

version = "${Versions['minecraft_version']}-fabric${Versions['fabric_versiononly']}-${project.projectVersion}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ServerInfo;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_H;
Expand All @@ -29,6 +32,7 @@ public void onInitializeClient() {
ConfigurationProvider.register(MODNAME, confHandler);
confHandler.load(ConfigurationProvider.getSuggestedFile(MODID));
changedWindowTitle=null;
registerEvents();
}

public static void setWindowTitle(String s) {
Expand All @@ -49,5 +53,31 @@ public void setKeyBindings() {
final String category="key.categories.durabilityviewer";
KeyBindingHelper.registerKeyBinding(showHide = new KeyBinding("key.durabilityviewer.showhide", InputUtil.Type.KEYSYM, GLFW_KEY_H, category));
ClientTickEvents.END_CLIENT_TICK.register(e->processKeyBinds());
}
}

private void registerEvents() {

ClientPlayConnectionEvents.JOIN.register((handler, sender, client) -> {
if (!ConfigurationHandler.showPlayerServerName())
return;
MinecraftClient mc=MinecraftClient.getInstance();
ServerInfo serverData = mc.getCurrentServerEntry();
String serverName;
if (serverData==null)
serverName="local game";
else
serverName = serverData.name;
if (serverName==null)
serverName="unknown server";
DurabilityViewer.setWindowTitle(mc.getSession().getUsername() + " on "+serverName);
});

ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> {
if (!ConfigurationHandler.showPlayerServerName())
return;
MinecraftClient mc=MinecraftClient.getInstance();
DurabilityViewer.setWindowTitle(mc.getSession().getUsername() + " not connected");
});

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public void onRenderGameOverlayPost(DrawContext context, float partialTicks) {
// warning sound / do the visible
if (!visible
// || minecraft.player.abilities.creativeMode
|| minecraft.options.debugEnabled) {
|| minecraft.getDebugHud().shouldShowDebugHud()) {
return;
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ private void afterRenderStatusEffects(DrawContext context, CallbackInfo ci) {
}

@Inject(method="render", at=@At(
value="FIELD",
target="Lnet/minecraft/client/option/GameOptions;debugEnabled:Z",
value="INVOKE",
target="Lnet/minecraft/client/gui/hud/DebugHud;shouldShowDebugHud()Z",
opcode = Opcodes.GETFIELD, args = {"log=false"}))

private void beforeRenderDebugScreen(DrawContext context, float f, CallbackInfo ci) {
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/durabilityviewer/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"durabilityviewer.config.tt.mindurability": "Play sound when durability below X",
"durabilityviewer.config.tt.setwindowtitle": "Set window title to player and server name",
"durabilityviewer.config.tt.showdamagepercent": "Show damage instead of durability while the item is still better than this %",
"durabilityviewer.config.tt.hidedamagepercent": "Don't show item icon while the item is still better than this %",
"durabilityviewer.config.tt.showfreeslots": "Show chest icon with number of free inventory slots",
"durabilityviewer.config.tt.showalltrinkets": "If you have the trinkets mod, show all trinkets even when they don't have durability/damage",
"durabilityviewer.config.tt.percentvalues": "Show percentages instead of absolute values",
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/mixins.durabilityviewer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"minVersion": "0.6",
"client": [
"TooltipMixin",
"ConnectMixin",
"PotionEffectsMixin",
"WindowTitleMixin"
],
Expand Down

0 comments on commit 7873c99

Please sign in to comment.