Skip to content

Commit

Permalink
fix guis
Browse files Browse the repository at this point in the history
  • Loading branch information
MeiNanziiii committed Dec 6, 2024
1 parent 4d63a78 commit 68d4340
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/main/java/ua/mei/mgui/api/font/GUITextureManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public class GUITextureManager {
public static MutableText requestGui(String path, FontResourceManager manager) {
BitmapGlyph glyph = manager.requestGlyph(path, 256, 0);
BitmapGlyph glyph = manager.requestGlyph(path, 256, 13);
return glyph.formatter().space(-8, -glyph.glyphWidth + 7).value;
}
}
1 change: 0 additions & 1 deletion src/main/java/ua/mei/mgui/impl/MGuiImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
@ApiStatus.Internal
public class MGuiImpl implements ModInitializer {
public static final String MOD_ID = "mgui";
public static final boolean GUI_ENABLED = false;

@Override
public void onInitialize() {
Expand Down
7 changes: 1 addition & 6 deletions src/main/java/ua/mei/mgui/mixin/ServerPlayerEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,13 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import ua.mei.mgui.impl.MGuiImpl;
import ua.mei.mgui.impl.VanillaTextures;

@Mixin(ServerPlayerEntity.class)
public abstract class ServerPlayerEntityMixin {
@ModifyArg(method = "openHandledScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V"))
private Packet<ClientPlayPacketListener> mgui$replaceName(Packet<ClientPlayPacketListener> par1) {
OpenScreenS2CPacket packet = (OpenScreenS2CPacket) par1;
if (MGuiImpl.GUI_ENABLED) {
return new OpenScreenS2CPacket(packet.getSyncId(), packet.getScreenHandlerType(), Text.empty().append(VanillaTextures.fromScreenHandler(packet.getScreenHandlerType()).formatted(Formatting.WHITE)).append(packet.getName()));
} else {
return par1;
}
return new OpenScreenS2CPacket(packet.getSyncId(), packet.getScreenHandlerType(), Text.empty().append(VanillaTextures.fromScreenHandler(packet.getScreenHandlerType()).formatted(Formatting.WHITE)).append(packet.getName()));
}
}
1 change: 1 addition & 0 deletions src/main/resources/mgui.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"package": "ua.mei.mgui.mixin",
"compatibilityLevel": "JAVA_21",
"mixins": [
"ServerPlayerEntityMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 68d4340

Please sign in to comment.