aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/LocalLoader.java2
-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
3 files changed, 22 insertions, 17 deletions
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/LocalLoader.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/LocalLoader.java
index 1264c7ee..42d27b76 100644
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/LocalLoader.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/LocalLoader.java
@@ -90,7 +90,7 @@ public class LocalLoader implements IDGLoader {
classLoader.cleanup();
classLoader = null;
dgInterface = null;
- System.gc();// pls do
+ System.gc(); // pls do
Reference<? extends ClassLoader> t = refQueue.poll();
if (t == null) throw new DungeonsGuideUnloadingException("Reference Leaked"); // Why do you have to be that strict? Well, to tell them to actually listen on DungeonsGuideReloadListener. If it starts causing issues then I will remove check cus it's not really loaded (classes are loaded by child classloader)
t.clear();
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"));