aboutsummaryrefslogtreecommitdiff
path: root/mod/src/main/java/kr/syeyoung
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2022-11-19 23:05:02 +0900
committersyeyoung <cyoung06@naver.com>2022-11-19 23:05:02 +0900
commit93517ec3723f93886f2869e50e95ffa51a65377e (patch)
tree322ad5aa0a063df467706e28d2a79dd632354db8 /mod/src/main/java/kr/syeyoung
parent10fec893e40816f7c09100dce3eff4d25028ef28 (diff)
downloadSkyblock-Dungeons-Guide-93517ec3723f93886f2869e50e95ffa51a65377e.tar.gz
Skyblock-Dungeons-Guide-93517ec3723f93886f2869e50e95ffa51a65377e.tar.bz2
Skyblock-Dungeons-Guide-93517ec3723f93886f2869e50e95ffa51a65377e.zip
- Why does worldclient have separate entity list
- do not exit hypixel when reloading dg - GC please Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'mod/src/main/java/kr/syeyoung')
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java21
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java16
2 files changed, 21 insertions, 16 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
index ea05603f..77758ac6 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
@@ -49,6 +49,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.*;
+import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.client.network.NetworkPlayerInfo;
import net.minecraft.client.renderer.ThreadDownloadImageData;
@@ -59,6 +60,7 @@ import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourcePack;
import net.minecraft.command.CommandHandler;
import net.minecraft.command.ICommand;
+import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.launchwrapper.LaunchClassLoader;
@@ -78,6 +80,7 @@ import org.apache.logging.log4j.Logger;
import java.io.File;
import java.io.IOException;
+import java.lang.reflect.Method;
import java.util.*;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
@@ -294,7 +297,15 @@ public class DungeonsGuide implements DGInterface {
List<ListenerList> all = ReflectionHelper.getPrivateValue(ListenerList.class, null, "allLists");
int busId = ReflectionHelper.getPrivateValue(EventBus.class, MinecraftForge.EVENT_BUS, "busID");
for (ListenerList listenerList : all) {
- listenerList.getListeners(busId); // refresh cache.
+ Object[] list = ReflectionHelper.getPrivateValue(ListenerList.class, listenerList, "lists");
+ Object inst = list[busId];
+ try {
+ Method m = inst.getClass().getDeclaredMethod("buildCache"); // refresh cache
+ m.setAccessible(true);
+ m.invoke(inst);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
@@ -363,6 +374,14 @@ public class DungeonsGuide implements DGInterface {
for (AbstractClientPlayer player : world.getPlayers(AbstractClientPlayer.class, input -> true)) {
transform(player);
}
+ if (world instanceof WorldClient) {
+ Set<Entity> list = ReflectionHelper.getPrivateValue(WorldClient.class, (WorldClient) world, "entityList", "field_73032_d", "c");
+ for (Entity e : list) {
+ if (e instanceof AbstractClientPlayer) {
+ transform((AbstractClientPlayer) e);
+ }
+ }
+ }
}
try {
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java
index fa516bfd..c414e75a 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java
@@ -145,21 +145,7 @@ public class CommandDungeonsGuide extends CommandBase {
}
}
} else if (args[0].equals("reload")) {
- Minecraft.getMinecraft().addScheduledTask(() -> {
- boolean flag = Minecraft.getMinecraft().isIntegratedServerRunning();
- boolean flag1 = Minecraft.getMinecraft().isConnectedToRealms();
- Minecraft.getMinecraft().theWorld.sendQuittingDisconnectingPacket();
- Minecraft.getMinecraft().loadWorld((WorldClient)null);
- if (flag) {
- Minecraft.getMinecraft().displayGuiScreen(new GuiMainMenu());
- } else if (flag1) {
- RealmsBridge realmsbridge = new RealmsBridge();
- realmsbridge.switchToRealms(new GuiMainMenu());
- } else {
- Minecraft.getMinecraft().displayGuiScreen(new GuiMultiplayer(new GuiMainMenu()));
- }
- Main.getMain().reloadWithoutStacktraceReference(Main.getMain().getCurrentLoader());
- });
+ Main.getMain().reloadWithoutStacktraceReference(Main.getMain().getCurrentLoader());
} else {
sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg §7-§fOpens configuration gui"));
sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg gui §7-§fOpens configuration gui"));