aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-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"));