Skip to content

Commit

Permalink
update package
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBreakNFix committed Sep 14, 2024
1 parent 74fa6b3 commit aaac8e3
Show file tree
Hide file tree
Showing 28 changed files with 139 additions and 543 deletions.
447 changes: 17 additions & 430 deletions LICENSE

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jar {
}

loom {
accessWidenerPath = file("src/main/resources/uiutils.accesswidener")
accessWidenerPath = file("src/main/resources/ui_utils.accesswidener")
}

// configure the maven publication
Expand Down
17 changes: 8 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@ org.gradle.jvmargs=-Xmx4G

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21
yarn_mappings=1.21+build.2
loader_version=0.15.11
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.16.5

fabric_version=0.104.0+1.21.1

# Mod Properties
mod_version = 2.0.0
mod_version = 2.1.0

#x.y.z

#x -- major mc release
#y -- minor mc release
#z -- ui utils release (never gonna be anything but zero tbh)

maven_group = org.uiutils
archives_base_name = uiutils

#Fabric api
fabric_version=0.100.1+1.21
maven_group = com.ui_utils
archives_base_name = ui_utils
20 changes: 20 additions & 0 deletions src/main/java/com/ui_utils/GithubRelease.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ui_utils;

import com.google.gson.annotations.SerializedName;

public class GithubRelease {
@SerializedName("tag_name")
private String tagName;

public String getTagName() {
return tagName;
}

@SerializedName("name")
private String name;

public String getMcVersion() {
// in name, return the text within the ()
return name.substring(name.indexOf("(") + 1, name.indexOf(")"));
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.uiutils;
package com.ui_utils;

import com.google.common.collect.ImmutableList;
import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap;
Expand All @@ -25,11 +25,10 @@
import org.lwjgl.glfw.GLFW;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.uiutils.mixin.accessor.ClientConnectionAccessor;
import com.ui_utils.mixin.accessor.ClientConnectionAccessor;

import javax.swing.*;
import java.awt.*;
import java.awt.datatransfer.StringSelection;
import java.util.Objects;
import java.util.Timer;
import java.util.TimerTask;
Expand Down Expand Up @@ -531,8 +530,8 @@ public void run() {
}

public static String getModVersion(String modId) {
ModMetadata modMetadata = FabricLoader.getInstance().getModContainer(modId).get().getMetadata();
ModMetadata modMetadata = FabricLoader.getInstance().getModContainer(modId).isPresent() ? FabricLoader.getInstance().getModContainer(modId).get().getMetadata() : null;

return modMetadata.getVersion().getFriendlyString();
return modMetadata != null ? modMetadata.getVersion().getFriendlyString() : "null";
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.uiutils;
package com.ui_utils;

import net.minecraft.client.gui.screen.Screen;
import net.minecraft.network.packet.Packet;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package org.uiutils;
// UpdateUtils.java
package com.ui_utils;

import com.google.gson.Gson;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;
import org.uiutils.gui.UpdateScreen;
import com.ui_utils.gui.UpdateScreen;

import java.awt.*;
import java.io.IOException;
Expand All @@ -18,14 +19,15 @@
import java.util.concurrent.Future;
import java.util.logging.Level;

import static org.uiutils.MainClient.getModVersion;
import static com.ui_utils.MainClient.getModVersion;

public class UpdateUtils {

public static boolean isOutdated;
public static String version;
public static String mcVersion;
public static boolean messageShown;
public static final String currentVersion = getModVersion("uiutils");
public static final String currentVersion = getModVersion("ui_utils");

public static void checkForUpdates() {
ExecutorService executorService = Executors.newSingleThreadExecutor();
Expand All @@ -41,6 +43,7 @@ public static void checkForUpdates() {
if (response.statusCode() == 200) {
Gson gson = new Gson();
GithubRelease release = gson.fromJson(response.body(), GithubRelease.class);
mcVersion = release.getMcVersion();
return release.getTagName();
} else {
MainClient.LOGGER.error("Failed to fetch the latest version. Status code: " + response.statusCode());
Expand Down Expand Up @@ -82,5 +85,4 @@ public static void downloadUpdate() {
}
MinecraftClient.getInstance().setScreen(new UpdateScreen(Text.empty()));
}
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.uiutils.gui;
package com.ui_utils.gui;

import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.ButtonWidget;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.uiutils.mixin;
package com.ui_utils.mixin;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
Expand All @@ -11,8 +11,8 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.uiutils.MainClient;
import org.uiutils.SharedVariables;
import com.ui_utils.MainClient;
import com.ui_utils.SharedVariables;

import java.util.regex.Pattern;

Expand All @@ -24,14 +24,13 @@ protected BookEditScreenMixin(Text title) {
@Unique
private static final MinecraftClient mc = MinecraftClient.getInstance();

private TextFieldWidget addressField;
@Inject(at = @At("TAIL"), method = "init")
public void init(CallbackInfo ci) {
if (SharedVariables.enabled) {
MainClient.createWidgets(mc, this);

// create chat box
this.addressField = new TextFieldWidget(textRenderer, 5, 245, 160, 20, Text.of("Chat ...")) {
TextFieldWidget addressField = new TextFieldWidget(textRenderer, 5, 245, 160, 20, Text.of("Chat ...")) {
@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
if (keyCode == GLFW.GLFW_KEY_ENTER) {
Expand All @@ -58,10 +57,10 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
return super.keyPressed(keyCode, scanCode, modifiers);
}
};
this.addressField.setText("");
this.addressField.setMaxLength(255);
addressField.setText("");
addressField.setMaxLength(255);

this.addDrawableChild(this.addressField);
this.addDrawableChild(addressField);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.uiutils.mixin;
package com.ui_utils.mixin;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
Expand All @@ -11,8 +11,8 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.uiutils.MainClient;
import org.uiutils.SharedVariables;
import com.ui_utils.MainClient;
import com.ui_utils.SharedVariables;

import java.util.regex.Pattern;

Expand All @@ -24,14 +24,13 @@ protected BookScreenMixin(Text title) {
@Unique
private static final MinecraftClient mc = MinecraftClient.getInstance();

private TextFieldWidget addressField;
@Inject(at = @At("TAIL"), method = "init")
public void init(CallbackInfo ci) {
if (SharedVariables.enabled) {
MainClient.createWidgets(mc, this);

// create chat box
this.addressField = new TextFieldWidget(textRenderer, 5, 245, 160, 20, Text.of("Chat ...")) {
TextFieldWidget addressField = new TextFieldWidget(textRenderer, 5, 245, 160, 20, Text.of("Chat ...")) {
@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
if (keyCode == GLFW.GLFW_KEY_ENTER) {
Expand All @@ -58,10 +57,10 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
return super.keyPressed(keyCode, scanCode, modifiers);
}
};
this.addressField.setText("");
this.addressField.setMaxLength(255);
addressField.setText("");
addressField.setMaxLength(255);

this.addDrawableChild(this.addressField);
this.addDrawableChild(addressField);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.uiutils.mixin;
package com.ui_utils.mixin;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ChatScreen;
Expand All @@ -7,8 +7,8 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.uiutils.MainClient;
import org.uiutils.SharedVariables;
import com.ui_utils.MainClient;
import com.ui_utils.SharedVariables;

@Mixin(ChatScreen.class)
public class ChatScreenMixin {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.uiutils.mixin;
package com.ui_utils.mixin;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientCommonNetworkHandler;
Expand All @@ -11,8 +11,8 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.uiutils.MainClient;
import org.uiutils.SharedVariables;
import com.ui_utils.MainClient;
import com.ui_utils.SharedVariables;

@Mixin(ClientCommonNetworkHandler.class)
public abstract class ClientCommonNetworkHandlerMixin {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.uiutils.mixin;
package com.ui_utils.mixin;

import net.minecraft.network.ClientConnection;
import net.minecraft.network.PacketCallbacks;
Expand All @@ -10,7 +10,7 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.uiutils.SharedVariables;
import com.ui_utils.SharedVariables;

@Mixin(ClientConnection.class)
public class ClientConnectionMixin {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.uiutils.mixin;
package com.ui_utils.mixin;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
Expand All @@ -17,8 +17,8 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.uiutils.MainClient;
import org.uiutils.SharedVariables;
import com.ui_utils.MainClient;
import com.ui_utils.SharedVariables;

import java.util.regex.Pattern;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.uiutils.mixin;
package com.ui_utils.mixin;

import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
Expand All @@ -8,7 +8,7 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.uiutils.SharedVariables;
import com.ui_utils.SharedVariables;

@Mixin(MultiplayerScreen.class)
public class MultiplayerScreenMixin extends Screen {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.uiutils.mixin;
package com.ui_utils.mixin;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
Expand All @@ -16,9 +16,9 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.uiutils.MainClient;
import org.uiutils.SharedVariables;
import org.uiutils.mixin.accessor.ScreenAccessor;
import com.ui_utils.MainClient;
import com.ui_utils.SharedVariables;
import com.ui_utils.mixin.accessor.ScreenAccessor;

import java.util.regex.Pattern;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.uiutils.mixin;
package com.ui_utils.mixin;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
Expand All @@ -10,7 +10,7 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.uiutils.SharedVariables;
import com.ui_utils.SharedVariables;

@Mixin(SignEditScreen.class)
public class SignEditScreenMixin extends Screen {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.uiutils.mixin;
package com.ui_utils.mixin;

import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.SleepingChatScreen;
Expand All @@ -8,7 +8,7 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.uiutils.SharedVariables;
import com.ui_utils.SharedVariables;

@Mixin(SleepingChatScreen.class)
public class SleepingChatScreenMixin extends Screen {
Expand Down
Loading

0 comments on commit aaac8e3

Please sign in to comment.