mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 03:49:10 +00:00
Revert Some Multithreading for Synchronization
This commit is contained in:
1 parent
892d11b89b
commit
204e7a9c15
6 files changed
+20
-31
No files matched your search
@@ -39,7 +39,6 @@ import noppes.npcs.roles.RoleTransporter;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.ScriptSound;
|
||||
import noppes.npcs.scripted.event.DialogEvent;
|
||||
import noppes.npcs.util.CustomNPCsScheduler;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
@@ -256,20 +255,18 @@ public class NoppesUtilServer {
|
||||
setEditingNpc(player, npc);
|
||||
sendExtraData(player, npc,gui, i, j, k);
|
||||
|
||||
CustomNPCsScheduler.runTack(() -> {
|
||||
if(CustomNpcs.proxy.getServerGuiElement(gui.ordinal(), player, player.worldObj, i, j, k) != null){
|
||||
player.openGui(CustomNpcs.instance, gui.ordinal(), player.worldObj, i, j, k);
|
||||
return;
|
||||
}
|
||||
else{
|
||||
Server.sendDataChecked((EntityPlayerMP)player, EnumPacketClient.GUI, gui.ordinal(), i, j, k);
|
||||
}
|
||||
ArrayList<String> list = getScrollData(player, gui, npc);
|
||||
if(list == null || list.isEmpty())
|
||||
return;
|
||||
if(CustomNpcs.proxy.getServerGuiElement(gui.ordinal(), player, player.worldObj, i, j, k) != null){
|
||||
player.openGui(CustomNpcs.instance, gui.ordinal(), player.worldObj, i, j, k);
|
||||
return;
|
||||
}
|
||||
else{
|
||||
Server.sendDataChecked((EntityPlayerMP)player, EnumPacketClient.GUI, gui.ordinal(), i, j, k);
|
||||
}
|
||||
ArrayList<String> list = getScrollData(player, gui, npc);
|
||||
if(list == null || list.isEmpty())
|
||||
return;
|
||||
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.SCROLL_LIST, list);
|
||||
}, 100);
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.SCROLL_LIST, list);
|
||||
}
|
||||
|
||||
public static void sendOpenGuiNoDelay(final EntityPlayer player,
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.Map;
|
||||
public class Server {
|
||||
|
||||
public static void sendData(final EntityPlayerMP player, final EnumPacketClient enu, final Object... obs) {
|
||||
sendDataDelayed(player, enu, 0, obs);
|
||||
sendDataChecked(player, enu, obs);
|
||||
}
|
||||
|
||||
public static void sendDataDelayed(final EntityPlayerMP player, final EnumPacketClient type, int delay, final Object... obs) {
|
||||
|
||||
@@ -27,16 +27,14 @@ public class Client {
|
||||
private static HashMap<String, ImageData> imageDataCache = new HashMap<>();
|
||||
|
||||
public static void sendData(final EnumPacketServer enu, final Object... obs) {
|
||||
CustomNPCsScheduler.runTack(() -> {
|
||||
ByteBuf buffer = Unpooled.buffer();
|
||||
try {
|
||||
if(!Server.fillBuffer(buffer, enu, obs))
|
||||
return;
|
||||
CustomNpcs.Channel.sendToServer(new FMLProxyPacket(buffer, "CustomNPCs"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
ByteBuf buffer = Unpooled.buffer();
|
||||
try {
|
||||
if(!Server.fillBuffer(buffer, enu, obs))
|
||||
return;
|
||||
CustomNpcs.Channel.sendToServer(new FMLProxyPacket(buffer, "CustomNPCs"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static ImageData getImageData(String directory) {
|
||||
|
||||
@@ -18,7 +18,6 @@ import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.util.CustomNPCsScheduler;
|
||||
|
||||
public class ItemNpcWand extends Item{
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.client.gui.player.GuiFaction;
|
||||
import noppes.npcs.client.gui.player.GuiQuestLog;
|
||||
import noppes.npcs.util.CustomNPCsScheduler;
|
||||
|
||||
public class InventoryTabFactions extends AbstractTab {
|
||||
public InventoryTabFactions() {
|
||||
|
||||
@@ -3,11 +3,8 @@ package tconstruct.client.tabs;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.play.client.C0DPacketCloseWindow;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.client.gui.player.GuiFaction;
|
||||
import noppes.npcs.client.gui.player.GuiQuestLog;
|
||||
import noppes.npcs.util.CustomNPCsScheduler;
|
||||
|
||||
public class InventoryTabQuests extends AbstractTab {
|
||||
public InventoryTabQuests() {
|
||||
|
||||
Reference in new issue
Block a user