[DEV] New Cloth Config GUIs, new nojang apis, and bug fixes

This commit is contained in:
2025-01-14 17:14:57 +02:00
parent 864baeb6c5
commit 8a46899769
290 changed files with 6213 additions and 459 deletions

View File

@@ -1,10 +1,7 @@
package com.hypherionmc.craterlib.nojang.client.gui;
import lombok.RequiredArgsConstructor;
import net.minecraft.client.gui.screens.LevelLoadingScreen;
import net.minecraft.client.gui.screens.ReceivingLevelScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.TitleScreen;
import net.minecraft.client.gui.screens.*;
import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen;
import net.minecraft.realms.RealmsScreen;
@@ -29,6 +26,14 @@ public class BridgedScreen {
return internal instanceof LevelLoadingScreen || internal instanceof ReceivingLevelScreen;
}
public boolean isPauseScreen() {
return internal instanceof PauseScreen;
}
public boolean isDisconnetedScreen() {
return internal instanceof DisconnectedScreen;
}
public Screen toMojang() {
return internal;
}

View File

@@ -7,6 +7,7 @@ import lombok.RequiredArgsConstructor;
import net.kyori.adventure.text.Component;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.ServerGamePacketListenerImpl;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.player.Player;
import org.jetbrains.annotations.Nullable;
@@ -49,6 +50,34 @@ public class BridgedPlayer {
return BridgedBlockPos.of(internal.getOnPos());
}
public float getHealth() {
return internal.getHealth();
}
public float getMaxHealth() {
return internal.getMaxHealth();
}
public String getHeldItemMainHand() {
String value = "Nothing";
if (!internal.getItemInHand(InteractionHand.MAIN_HAND).isEmpty()) {
value = internal.getItemInHand(InteractionHand.MAIN_HAND).getDisplayName().getString();
}
return value;
}
public String getHeldItemOffHand() {
String value = "Nothing";
if (!internal.getItemInHand(InteractionHand.OFF_HAND).isEmpty()) {
value = internal.getItemInHand(InteractionHand.OFF_HAND).getDisplayName().getString();
}
return value;
}
@Nullable
public ServerGamePacketListenerImpl getConnection() {
if (isServerPlayer()) {