Dimension Get Packet

This commit is contained in:
Kam committed 2025-02-02 03:04:03 -05:00
1 parent 364bf2414f
commit bd783a2e98
5 files changed
+14 -13

No files matched your search

@@ -13,6 +13,7 @@ import kamkeel.npcs.network.packets.data.gui.*;
import kamkeel.npcs.network.packets.data.large.*;
import kamkeel.npcs.network.packets.data.npc.*;
import kamkeel.npcs.network.packets.data.script.*;
import kamkeel.npcs.network.packets.request.DimensionsGetPacket;
import kamkeel.npcs.network.packets.request.GuiRequestPacket;
import kamkeel.npcs.network.packets.request.bank.BankGetPacket;
import kamkeel.npcs.network.packets.request.bank.BankRemovePacket;
@@ -197,6 +198,7 @@ public class PacketHandler {
// Other
REQUEST_PACKET.registerPacket(new GuiRequestPacket());
REQUEST_PACKET.registerPacket(new DimensionsGetPacket());
}
public void registerDataPackets(){
@@ -43,6 +43,4 @@ public final class AnimationCachePacket extends AbstractPacket {
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
PlayerDataController.Instance.getPlayerData(player).animationData.cacheAnimation(in.readInt());
}
}
@@ -1,6 +1,7 @@
package noppes.npcs.client.gui;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.DimensionsGetPacket;
import kamkeel.npcs.network.packets.request.npc.RemoteDeletePacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.StatCollector;
@@ -20,7 +21,7 @@ public class GuiNpcDimension extends GuiNPCInterface implements IScrollData{
super();
xSize = 256;
setBackground("menubg.png");
Client.sendData(EnumPacketServer.DimensionsGet);
PacketClient.sendClient(new DimensionsGetPacket());
}
public void initGui()
{
@@ -1,5 +1,7 @@
package noppes.npcs.client.gui;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.DimensionsGetPacket;
import net.minecraft.client.gui.GuiButton;
import noppes.npcs.client.Client;
import noppes.npcs.client.gui.util.*;
@@ -14,14 +16,14 @@ public class SubGuiNpcDimensions extends SubGuiInterface implements IScrollData
private GuiCustomScroll allDimensions;
private HashMap<String, Integer> dimensionMap = new HashMap<>();
private GuiCustomScroll dataDimensions;
public SubGuiNpcDimensions(SpawnData data){
this.data = data;
setBackground("menubg.png");
xSize = 346;
ySize = 216;
closeOnEsc = true;
Client.sendData(EnumPacketServer.DimensionsGet);
PacketClient.sendClient(new DimensionsGetPacket());
}
public void initGui(){
@@ -34,7 +36,7 @@ public class SubGuiNpcDimensions extends SubGuiInterface implements IScrollData
allDimensions.guiTop = guiTop + 14;
this.addScroll(allDimensions);
addLabel(new GuiNpcLabel(1, "spawning.availableDimensions", guiLeft + 4, guiTop + 4));
if(dataDimensions == null){
dataDimensions = new GuiCustomScroll(this,1);
dataDimensions.setSize(140, 180);
@@ -58,8 +60,8 @@ public class SubGuiNpcDimensions extends SubGuiInterface implements IScrollData
addButton(new GuiNpcButton(3, guiLeft + 145, guiTop + 90, 55, 20, ">>"));
addButton(new GuiNpcButton(4, guiLeft + 145, guiTop + 112, 55, 20, "<<"));
addButton(new GuiNpcButton(66, guiLeft + 260, guiTop + 194, 60, 20, "gui.done"));
}
@@ -70,14 +72,14 @@ public class SubGuiNpcDimensions extends SubGuiInterface implements IScrollData
data.dimensions.add(dimensionMap.get(allDimensions.getSelected()));
allDimensions.selected = -1;
initGui();
}
}
}
if(button.id == 2){
if(dataDimensions.hasSelected()){
data.dimensions.remove(dimensionMap.get(dataDimensions.getSelected()));
dataDimensions.selected = -1;
initGui();
}
}
}
if(button.id == 3){
data.dimensions.clear();
@@ -1,8 +1,6 @@
package noppes.npcs.constants;
import net.minecraft.client.gui.Gui;
import noppes.npcs.CustomNpcsPermissions;
import noppes.npcs.client.gui.custom.components.CustomGuiButton;
public enum EnumPacketServer {
NPCDelete(CustomNpcsPermissions.NPC_DELETE, true),
@@ -69,7 +67,7 @@ public enum EnumPacketServer {
QuestGet, QuestCategoryGet,
SaveTileEntity, MailOpenSetup,
DimensionsGet, DimensionTeleport, GetTileEntity, Gui, IsGuiOpen, CacheAnimation,
DimensionTeleport, GetTileEntity, IsGuiOpen, CacheAnimation,
SavePartyData, CreateParty, GetPartyData, DisbandParty, KickPlayer, LeavePlayer, PartyInvite, GetPartyInviteList, AcceptInvite,
IgnoreInvite, SetPartyLeader, SetPartyQuest,