diff options
-rw-r--r-- | fabric/build.gradle | 3 | ||||
-rw-r--r-- | forge/src/main/java/de/hype/bbsentials/forge/BBUtils.java | 31 | ||||
-rw-r--r-- | forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandOpenConfig.java | 4 | ||||
-rw-r--r-- | forge/src/main/java/de/hype/bbsentials/forge/DebugThread.java | 3 | ||||
-rw-r--r-- | forge/src/main/java/de/hype/bbsentials/forge/ForgeMod.java (renamed from forge/src/main/java/de/hype/bbsentials/forge/ExampleMod.java) | 4 |
5 files changed, 25 insertions, 20 deletions
diff --git a/fabric/build.gradle b/fabric/build.gradle index df68863..ae6e01f 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -24,7 +24,8 @@ dependencies { modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation 'com.terraformersmc:modmenu:8.0.0' modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - modApi("me.shedaniel.cloth:cloth-config-fabric:12.0.109") { + + modApi("me.shedaniel.cloth:cloth-config-fabric:12.0.111") { exclude(group: "net.fabricmc.fabric-api") } } diff --git a/forge/src/main/java/de/hype/bbsentials/forge/BBUtils.java b/forge/src/main/java/de/hype/bbsentials/forge/BBUtils.java index c7d2e22..e50ef3b 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/BBUtils.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/BBUtils.java @@ -1,16 +1,20 @@ package de.hype.bbsentials.forge; import com.google.common.collect.Lists; +import com.mojang.realmsclient.dto.PlayerInfo; import de.hype.bbsentials.common.chat.Chat; import de.hype.bbsentials.common.constants.enviromentShared.Islands; import net.minecraft.client.Minecraft; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.server.gui.PlayerListComponent; +import java.util.Iterator; import java.util.List; public class BBUtils implements de.hype.bbsentials.common.mclibraries.BBUtils { public Islands getCurrentIsland() { try { - String string = Minecraft.getMinecraft().getNetHandler().getPlayerInfo("!C-b").getDisplayName().getUnformattedText(); + String string = getTabListPlayerName("!C-b"); if (!string.startsWith("Area: ")) { Chat.sendPrivateMessageToSelfError("Could not get Area data. Are you in Skyblock?"); } @@ -22,14 +26,15 @@ public class BBUtils implements de.hype.bbsentials.common.mclibraries.BBUtils { return null; } + public static String getTabListPlayerName(String id) { + return Minecraft.getMinecraft().getNetHandler().getPlayerInfo(id).getDisplayName().getUnformattedText(); + } public int getPlayerCount() { -// return Integer.parseInt(MinecraftClient.getInstance().player.networkHandler.getPlayerListEntry("!B-a").getDisplayName().getString().trim().replaceAll("[^0-9]", "")); - return 0; + return Integer.parseInt(getTabListPlayerName("!B-a").trim().replaceAll("[^0-9]", "")); } public String getServer() { -// return MinecraftClient.getInstance().player.networkHandler.getPlayerListEntry("!C-c").getDisplayName().getString().replace("Server:", "").trim(); - return "mini0b"; + return getTabListPlayerName("!C-c").replace("Server:", "").trim(); } public boolean isOnMegaServer() { @@ -53,14 +58,14 @@ public class BBUtils implements de.hype.bbsentials.common.mclibraries.BBUtils { public List<String> getPlayers() { List<String> list = Lists.newArrayList(); -// Iterator var2 = MinecraftClient.getInstance().getNetworkHandler().getPlayerList().iterator(); -// while (var2.hasNext()) { -// PlayerListEntry playerListEntry = (PlayerListEntry) var2.next(); -// String playerName = playerListEntry.getProfile().getName(); -// if (!playerName.startsWith("!")) { -// list.add(playerName); -// } -// } + Iterator var2 = Minecraft.getMinecraft().getNetHandler().getPlayerInfoMap().iterator(); + while (var2.hasNext()) { + NetworkPlayerInfo playerListEntry = (NetworkPlayerInfo) var2.next(); + String playerName = playerListEntry.getDisplayName().getUnformattedText(); + if (!playerName.startsWith("!")) { + list.add(playerName); + } + } return list; } } diff --git a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandOpenConfig.java b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandOpenConfig.java index acdc683..40fb418 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandOpenConfig.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandOpenConfig.java @@ -1,6 +1,6 @@ package de.hype.bbsentials.forge.CommandImplementations; -import de.hype.bbsentials.forge.ExampleMod; +import de.hype.bbsentials.forge.ForgeMod; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; @@ -19,7 +19,7 @@ public class CommandOpenConfig extends CommandBase { @Override public void processCommand(ICommandSender sender, String[] args) { - ExampleMod.config.openConfigGui(); + ForgeMod.config.openConfigGui(); } @Override diff --git a/forge/src/main/java/de/hype/bbsentials/forge/DebugThread.java b/forge/src/main/java/de/hype/bbsentials/forge/DebugThread.java index 6fb61fb..111eff5 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/DebugThread.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/DebugThread.java @@ -6,11 +6,12 @@ import java.util.List; public class DebugThread implements de.hype.bbsentials.common.client.DebugThread { @Override public void loop() { - + test(); } @Override public List<String> test() { + ForgeMod.config.openConfigGui(); return Collections.singletonList(""); } } diff --git a/forge/src/main/java/de/hype/bbsentials/forge/ExampleMod.java b/forge/src/main/java/de/hype/bbsentials/forge/ForgeMod.java index 1202036..f39dcfc 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/ExampleMod.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/ForgeMod.java @@ -3,8 +3,6 @@ package de.hype.bbsentials.forge; import de.hype.bbsentials.common.client.BBsentials; import de.hype.bbsentials.common.mclibraries.EnvironmentCore; import de.hype.bbsentials.forge.client.MoulConfig; -import io.github.moulberry.moulconfig.gui.MoulConfigEditor; -import io.github.moulberry.moulconfig.processor.MoulConfigProcessor; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.fml.common.Mod; @@ -12,7 +10,7 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @Mod(modid = "bbsentials", useMetadata = true) -public class ExampleMod { +public class ForgeMod { static boolean alreadyInialised = false; static BBsentials sentials = new BBsentials(); public static MoulConfig config = new MoulConfig(); |