mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 02:15:11 +00:00
Add all Client Packets
This commit is contained in:
1 parent
ec133ce74c
commit
8a2a3e1ac3
63 files changed
+2678
-1
No files matched your search
@@ -1,4 +1,63 @@
|
||||
package kamkeel.network.enums;
|
||||
|
||||
// Packets to the Client
|
||||
public enum EnumClientPacket {
|
||||
CHAT,
|
||||
MESSAGE,
|
||||
PARTY_MESSAGE,
|
||||
SYNCRECIPES_ADD,
|
||||
SYNCRECIPES_WORKBENCH,
|
||||
DIALOG,
|
||||
QUEST_COMPLETION,
|
||||
EDIT_NPC,
|
||||
PLAY_SOUND,
|
||||
PLAY_MUSIC,
|
||||
UPDATE_NPC,
|
||||
ROLE,
|
||||
GUI,
|
||||
SCRIPTED_PARTICLE,
|
||||
PARTICLE,
|
||||
DELETE_NPC,
|
||||
SCROLL_LIST,
|
||||
SCROLL_DATA,
|
||||
SCROLL_DATA_PART,
|
||||
SCROLL_GROUP,
|
||||
SCROLL_GROUP_PART,
|
||||
SCROLL_SELECTED,
|
||||
GUI_REDSTONE,
|
||||
GUI_WAYPOINT,
|
||||
GUI_DATA,
|
||||
GUI_ERROR,
|
||||
GUI_CLOSE,
|
||||
VILLAGER_LIST,
|
||||
CHATBUBBLE,
|
||||
SYNCRECIPES_CARPENTRYBENCH,
|
||||
CLONE,
|
||||
CLONER,
|
||||
TELEPORTER,
|
||||
OPEN_BOOK,
|
||||
DIALOG_DUMMY,
|
||||
CONFIG,
|
||||
ISGUIOPEN,
|
||||
SCRIPT_OVERLAY_DATA,
|
||||
SCRIPT_OVERLAY_CLOSE,
|
||||
SWING_PLAYER_ARM,
|
||||
UPDATE_ITEM,
|
||||
PLAYER_UPDATE_SKIN_OVERLAYS,
|
||||
UPDATE_ANIMATIONS,
|
||||
OVERLAY_QUEST_TRACKING,
|
||||
DISABLE_MOUSE_INPUT,
|
||||
PLAY_SOUND_TO,
|
||||
PLAY_SOUND_TO_NO_ID,
|
||||
STOP_SOUND_FOR,
|
||||
PAUSE_SOUNDS,
|
||||
CONTINUE_SOUNDS,
|
||||
STOP_SOUNDS,
|
||||
SYNC_WEAPON,
|
||||
MARK_DATA,
|
||||
SYNC_ADD, SYNC_END, SYNC_UPDATE, SYNC_REMOVE, SYNC_PLAYER,
|
||||
SYNC_CONFIG,
|
||||
DBC_FORM,
|
||||
LARGE_NBT_PART, LARGE_NBT_END,
|
||||
PARTY_DATA
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.RenderChatMessages;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class ChatBubblePacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|ChatBubble";
|
||||
|
||||
public ChatBubblePacket() {}
|
||||
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.CHATBUBBLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if(CustomNpcs.side() != Side.CLIENT)
|
||||
return;
|
||||
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(in.readInt());
|
||||
if(entity == null || !(entity instanceof EntityNPCInterface))
|
||||
return;
|
||||
EntityNPCInterface npc = (EntityNPCInterface) entity;
|
||||
if(npc.messages == null)
|
||||
npc.messages = new RenderChatMessages();
|
||||
String text = NoppesStringUtils.formatText(Server.readString(in), player, npc);
|
||||
npc.messages.addMessage(text, npc);
|
||||
|
||||
if(in.readBoolean())
|
||||
player.addChatMessage(new ChatComponentTranslation(npc.getCommandSenderName() + ": " + text));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.Server;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class ChatPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|Chat";
|
||||
|
||||
public ChatPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.CHAT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if(CustomNpcs.side() != Side.CLIENT)
|
||||
return;
|
||||
|
||||
StringBuilder message = new StringBuilder();
|
||||
String str;
|
||||
while ((str = Server.readString(in)) != null && !str.isEmpty()) {
|
||||
message.append(str);
|
||||
}
|
||||
player.addChatMessage(new ChatComponentTranslation(message.toString()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.gui.player.GuiNpcMobSpawnerAdd;
|
||||
import noppes.npcs.NoppesUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class ClonePacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|Clone";
|
||||
|
||||
public ClonePacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.CLONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
NBTTagCompound nbt = Server.readNBT(in);
|
||||
NoppesUtil.openGUI(player, new GuiNpcMobSpawnerAdd(nbt));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class ClonerPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|Cloner";
|
||||
|
||||
public ClonerPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.CLONER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
int x = in.readInt();
|
||||
int y = in.readInt();
|
||||
int z = in.readInt();
|
||||
CustomNpcs.proxy.openGui(x, y, z, EnumGuiType.MobSpawner, player);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.ClientProxy;
|
||||
import noppes.npcs.config.ConfigClient;
|
||||
import noppes.npcs.client.ClientProxy.FontContainer;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class ConfigPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|Config";
|
||||
|
||||
public ConfigPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.CONFIG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
int configType = in.readInt();
|
||||
if (configType == 0) { // Font Configuration
|
||||
String font = Server.readString(in);
|
||||
int size = in.readInt();
|
||||
if (!font.isEmpty()) {
|
||||
ConfigClient.FontType = font;
|
||||
ConfigClient.FontSize = size;
|
||||
ClientProxy.Font = new FontContainer(ConfigClient.FontType, ConfigClient.FontSize);
|
||||
|
||||
ConfigClient.FontTypeProperty.set(ConfigClient.FontType);
|
||||
ConfigClient.FontSizeProperty.set(ConfigClient.FontSize);
|
||||
|
||||
if (ConfigClient.config.hasChanged()) {
|
||||
ConfigClient.config.save();
|
||||
}
|
||||
|
||||
player.addChatMessage(new ChatComponentTranslation("Font set to %s", ClientProxy.Font.getName()));
|
||||
} else {
|
||||
player.addChatMessage(new ChatComponentTranslation("Current font is %s", ClientProxy.Font.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.client.controllers.ScriptSoundController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class ContinueSoundsPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|ContinueSounds";
|
||||
|
||||
public ContinueSoundsPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.CONTINUE_SOUNDS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
ScriptSoundController.Instance.continueAllSounds();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.NoppesUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class DBCFormPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|DBCForm";
|
||||
|
||||
public DBCFormPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.DBC_FORM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
NoppesUtil.handleFormEnd();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class DeleteNpcPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|DeleteNpc";
|
||||
|
||||
public DeleteNpcPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.DELETE_NPC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(in.readInt());
|
||||
if (entity instanceof EntityNPCInterface) {
|
||||
((EntityNPCInterface) entity).delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.entity.EntityDialogNpc;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class DialogDummyPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|DialogDummy";
|
||||
|
||||
public DialogDummyPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.DIALOG_DUMMY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
EntityDialogNpc npc = new EntityDialogNpc(player.worldObj);
|
||||
npc.display.name = Server.readString(in);
|
||||
NoppesUtil.openDialog(Server.readNBT(in), npc, player);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class DialogPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|Dialog";
|
||||
|
||||
public DialogPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.DIALOG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(in.readInt());
|
||||
if (!(entity instanceof EntityNPCInterface)) {
|
||||
return;
|
||||
}
|
||||
NoppesUtil.openDialog(Server.readNBT(in), (EntityNPCInterface) entity, player);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.client.ClientEventHandler;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class DisableMouseInputPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|DisableMouseInput";
|
||||
|
||||
public DisableMouseInputPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.DISABLE_MOUSE_INPUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
long duration = in.readLong();
|
||||
String parsedButtons = Server.readString(in);
|
||||
|
||||
if (parsedButtons == null || parsedButtons.isEmpty()) {
|
||||
ClientEventHandler.disabledButtonTimes.put(-1, duration);
|
||||
return;
|
||||
}
|
||||
|
||||
String[] buttonIds = parsedButtons.split(";");
|
||||
for (String button : buttonIds) {
|
||||
ClientEventHandler.disabledButtonTimes.put(Integer.parseInt(button), duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class EditNpcPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|EditNpc";
|
||||
|
||||
public EditNpcPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.EDIT_NPC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(in.readInt());
|
||||
if (!(entity instanceof EntityNPCInterface)) {
|
||||
return;
|
||||
}
|
||||
NoppesUtil.setLastNpc((EntityNPCInterface) entity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.gui.util.IGuiClose;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class GuiClosePacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|GuiClose";
|
||||
|
||||
public GuiClosePacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.GUI_CLOSE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if (gui instanceof IGuiClose) {
|
||||
int closeCode = in.readInt();
|
||||
NBTTagCompound nbt = Server.readNBT(in);
|
||||
((IGuiClose) gui).setClose(closeCode, nbt);
|
||||
}
|
||||
Minecraft.getMinecraft().displayGuiScreen(null);
|
||||
Minecraft.getMinecraft().setIngameFocus();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.gui.util.GuiContainerNPCInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.gui.util.IGuiData;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class GuiDataPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|GuiData";
|
||||
|
||||
public GuiDataPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.GUI_DATA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if (gui instanceof GuiNPCInterface && ((GuiNPCInterface) gui).hasSubGui()) {
|
||||
gui = (GuiScreen) ((GuiNPCInterface) gui).getSubGui();
|
||||
} else if (gui instanceof GuiContainerNPCInterface && ((GuiContainerNPCInterface) gui).hasSubGui()) {
|
||||
gui = (GuiScreen) ((GuiContainerNPCInterface) gui).getSubGui();
|
||||
}
|
||||
if (gui instanceof IGuiData) {
|
||||
NBTTagCompound nbt = Server.readNBT(in);
|
||||
((IGuiData) gui).setGuiData(nbt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.gui.util.IGuiError;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class GuiErrorPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|GuiError";
|
||||
|
||||
public GuiErrorPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.GUI_ERROR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if (gui instanceof IGuiError) {
|
||||
int errorCode = in.readInt();
|
||||
NBTTagCompound nbt = Server.readNBT(in);
|
||||
((IGuiError) gui).setError(errorCode, nbt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class GuiPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|Gui";
|
||||
|
||||
public GuiPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.GUI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
EnumGuiType gui = EnumGuiType.values()[in.readInt()];
|
||||
int x = in.readInt();
|
||||
int y = in.readInt();
|
||||
int z = in.readInt();
|
||||
CustomNpcs.proxy.openGui(null, gui, x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.NoppesUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class GuiRedstonePacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|GuiRedstone";
|
||||
|
||||
public GuiRedstonePacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.GUI_REDSTONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
NBTTagCompound nbt = Server.readNBT(in);
|
||||
NoppesUtil.saveRedstoneBlock(player, nbt);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.NoppesUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class GuiWaypointPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|GuiWaypoint";
|
||||
|
||||
public GuiWaypointPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.GUI_WAYPOINT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
NBTTagCompound nbt = Server.readNBT(in);
|
||||
NoppesUtil.saveWayPointBlock(player, nbt);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.NoppesUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class IsGuiOpenPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|IsGuiOpen";
|
||||
|
||||
public IsGuiOpenPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.ISGUIOPEN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
boolean isGuiOpen = Minecraft.getMinecraft().currentScreen != null;
|
||||
NoppesUtil.isGUIOpen(isGuiOpen);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.NoppesUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class LargeNBTEndPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|LargeNBTEnd";
|
||||
|
||||
public LargeNBTEndPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.LARGE_NBT_END;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
// Finalize handling of large NBT data (if needed).
|
||||
NoppesUtil.handleLargeData(null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.NoppesUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class LargeNBTPartPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|LargeNBTPart";
|
||||
|
||||
public LargeNBTPartPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.LARGE_NBT_PART;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
byte[] chunk = new byte[in.readShort()];
|
||||
in.readBytes(chunk);
|
||||
NoppesUtil.handleLargeData(chunk);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.controllers.data.MarkData;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class MarkDataPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|MarkData";
|
||||
|
||||
public MarkDataPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.MARK_DATA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
Entity entity = player.worldObj.getEntityByID(in.readInt());
|
||||
if (!(entity instanceof EntityNPCInterface)) return;
|
||||
|
||||
EntityNPCInterface npc = (EntityNPCInterface) entity;
|
||||
NBTTagCompound nbt = Server.readNBT(in);
|
||||
MarkData data = MarkData.get(npc);
|
||||
data.setNBT(nbt);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.achievement.GuiAchievement;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.Server;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class MessagePacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|Message";
|
||||
|
||||
public MessagePacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.MESSAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if(CustomNpcs.side() != Side.CLIENT)
|
||||
return;
|
||||
|
||||
String description = StatCollector.translateToLocal(Server.readString(in));
|
||||
String message = Server.readString(in);
|
||||
Achievement achievement = new Achievement(message, description);
|
||||
GuiAchievement guiAchievement = Minecraft.getMinecraft().guiAchievement;
|
||||
guiAchievement.func_146256_a(achievement);
|
||||
ObfuscationReflectionHelper.setPrivateValue(GuiAchievement.class, guiAchievement, achievement.getDescription(), 4);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.gui.player.GuiBook;
|
||||
import noppes.npcs.NoppesUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class OpenBookPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|OpenBook";
|
||||
|
||||
public OpenBookPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.OPEN_BOOK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
int x = in.readInt();
|
||||
int y = in.readInt();
|
||||
int z = in.readInt();
|
||||
NBTTagCompound nbt = Server.readNBT(in);
|
||||
ItemStack book = ItemStack.loadItemStackFromNBT(nbt);
|
||||
NoppesUtil.openGUI(player, new GuiBook(player, book, x, y, z));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.gui.OverlayQuestTracking;
|
||||
import noppes.npcs.client.ClientCacheHandler;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class OverlayQuestTrackingPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|OverlayQuestTracking";
|
||||
|
||||
public OverlayQuestTrackingPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.OVERLAY_QUEST_TRACKING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
try {
|
||||
NBTTagCompound nbt = Server.readNBT(in);
|
||||
ClientCacheHandler.questTrackingOverlay = new OverlayQuestTracking(Minecraft.getMinecraft());
|
||||
ClientCacheHandler.questTrackingOverlay.setOverlayData(nbt);
|
||||
} catch (IOException e) {
|
||||
ClientCacheHandler.questTrackingOverlay = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class ParticlePacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|Particle";
|
||||
|
||||
public ParticlePacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.PARTICLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
NoppesUtil.spawnParticle(in);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.gui.util.GuiContainerNPCInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.gui.util.IPartyData;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class PartyDataPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|PartyData";
|
||||
|
||||
public PartyDataPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.PARTY_DATA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if (gui instanceof GuiNPCInterface && ((GuiNPCInterface) gui).hasSubGui()) {
|
||||
gui = (GuiScreen) ((GuiNPCInterface) gui).getSubGui();
|
||||
} else if (gui instanceof GuiContainerNPCInterface && ((GuiContainerNPCInterface) gui).hasSubGui()) {
|
||||
gui = (GuiScreen) ((GuiContainerNPCInterface) gui).getSubGui();
|
||||
}
|
||||
if (gui instanceof IPartyData) {
|
||||
NBTTagCompound nbt = Server.readNBT(in);
|
||||
((IPartyData) gui).setPartyData(nbt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.client.controllers.ScriptSoundController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class PauseSoundsPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|PauseSounds";
|
||||
|
||||
public PauseSoundsPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.PAUSE_SOUNDS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
ScriptSoundController.Instance.pauseAllSounds();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.controllers.MusicController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class PlayMusicPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|PlayMusic";
|
||||
|
||||
public PlayMusicPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.PLAY_MUSIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
String musicName = Server.readString(in);
|
||||
MusicController.Instance.playMusicBackground(musicName, player, Integer.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.controllers.MusicController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class PlaySoundPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|PlaySound";
|
||||
|
||||
public PlaySoundPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.PLAY_SOUND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
String soundName = Server.readString(in);
|
||||
float x = in.readFloat();
|
||||
float y = in.readFloat();
|
||||
float z = in.readFloat();
|
||||
MusicController.Instance.playSound(soundName, x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.controllers.ScriptClientSound;
|
||||
import noppes.npcs.client.controllers.ScriptSoundController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class PlaySoundToNoIdPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|PlaySoundToNoId";
|
||||
|
||||
public PlaySoundToNoIdPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.PLAY_SOUND_TO_NO_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
NBTTagCompound nbt = Server.readNBT(in);
|
||||
ScriptClientSound sound = ScriptClientSound.fromScriptSound(nbt, player.worldObj);
|
||||
ScriptSoundController.Instance.playSound(sound);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.controllers.ScriptClientSound;
|
||||
import noppes.npcs.client.controllers.ScriptSoundController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class PlaySoundToPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|PlaySoundTo";
|
||||
|
||||
public PlaySoundToPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.PLAY_SOUND_TO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
int soundId = in.readInt();
|
||||
NBTTagCompound nbt = Server.readNBT(in);
|
||||
ScriptClientSound sound = ScriptClientSound.fromScriptSound(nbt, player.worldObj);
|
||||
ScriptSoundController.Instance.playSound(soundId, sound);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.NoppesUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class PlayerUpdateSkinOverlaysPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|PlayerUpdateSkinOverlays";
|
||||
|
||||
public PlayerUpdateSkinOverlaysPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.PLAYER_UPDATE_SKIN_OVERLAYS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
String playerName = Server.readString(in);
|
||||
NBTTagCompound nbt = Server.readNBT(in);
|
||||
EntityPlayer sendingPlayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(playerName);
|
||||
if (sendingPlayer != null) {
|
||||
NoppesUtil.updateSkinOverlayData(sendingPlayer, nbt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class QuestCompletionPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|QuestCompletion";
|
||||
|
||||
public QuestCompletionPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.QUEST_COMPLETION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
NoppesUtil.guiQuestCompletion(player, Server.readNBT(in));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.NoppesUtil;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class RolePacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|Role";
|
||||
|
||||
public RolePacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.ROLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
NBTTagCompound compound = Server.readNBT(in);
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(compound.getInteger("EntityId"));
|
||||
if (entity instanceof EntityNPCInterface) {
|
||||
EntityNPCInterface npc = (EntityNPCInterface) entity;
|
||||
npc.advanced.setRole(compound.getInteger("Role"));
|
||||
npc.roleInterface.readFromNBT(compound);
|
||||
NoppesUtil.setLastNpc(npc);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.client.ClientCacheHandler;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class ScriptOverlayClosePacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|ScriptOverlayClose";
|
||||
|
||||
public ScriptOverlayClosePacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.SCRIPT_OVERLAY_CLOSE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
int overlayId = in.readInt();
|
||||
ClientCacheHandler.customOverlays.remove(overlayId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
|
||||
import noppes.npcs.client.ClientCacheHandler;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class ScriptOverlayDataPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|ScriptOverlayData";
|
||||
|
||||
public ScriptOverlayDataPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.SCRIPT_OVERLAY_DATA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
OverlayCustom overlayCustom = new OverlayCustom(Minecraft.getMinecraft());
|
||||
overlayCustom.setOverlayData(Server.readNBT(in));
|
||||
ClientCacheHandler.customOverlays.put(overlayCustom.overlay.getID(), overlayCustom);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class ScriptedParticlePacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|ScriptedParticle";
|
||||
|
||||
public ScriptedParticlePacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.SCRIPTED_PARTICLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
NoppesUtil.spawnScriptedParticle(player, in);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.NoppesUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class ScrollDataPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|ScrollData";
|
||||
|
||||
public ScrollDataPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.SCROLL_DATA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
NoppesUtil.setScrollData(in);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.NoppesUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class ScrollDataPartPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|ScrollDataPart";
|
||||
|
||||
public ScrollDataPartPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.SCROLL_DATA_PART;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
NoppesUtil.addScrollData(in);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.NoppesUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class ScrollGroupPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|ScrollGroup";
|
||||
|
||||
public ScrollGroupPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.SCROLL_GROUP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
NoppesUtil.setScrollGroup(in);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.NoppesUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class ScrollGroupPartPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|ScrollGroupPart";
|
||||
|
||||
public ScrollGroupPartPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.SCROLL_GROUP_PART;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
NoppesUtil.addScrollGroup(in);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class ScrollListPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|ScrollList";
|
||||
|
||||
public ScrollListPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.SCROLL_LIST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
NoppesUtil.setScrollList(in);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.gui.util.IScrollData;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class ScrollSelectedPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|ScrollSelected";
|
||||
|
||||
public ScrollSelectedPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.SCROLL_SELECTED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if (gui instanceof IScrollData) {
|
||||
String selected = Server.readString(in);
|
||||
((IScrollData) gui).setSelected(selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.client.controllers.ScriptSoundController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class StopSoundForPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|StopSoundFor";
|
||||
|
||||
public StopSoundForPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.STOP_SOUND_FOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
int soundId = in.readInt();
|
||||
ScriptSoundController.Instance.stopSound(soundId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.client.controllers.ScriptSoundController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class StopSoundsPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|StopSounds";
|
||||
|
||||
public StopSoundsPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.STOP_SOUNDS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
ScriptSoundController.Instance.stopAllSounds();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class SwingPlayerArmPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|SwingPlayerArm";
|
||||
|
||||
public SwingPlayerArmPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.SWING_PLAYER_ARM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
Minecraft.getMinecraft().thePlayer.swingItem();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.controllers.SyncController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class SyncAddPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|SyncAdd";
|
||||
|
||||
public SyncAddPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.SYNC_ADD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
int synctype = in.readInt();
|
||||
NBTTagCompound compound = Server.readNBT(in);
|
||||
SyncController.clientSync(synctype, compound, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.controllers.SyncController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class SyncConfigPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|SyncConfig";
|
||||
|
||||
public SyncConfigPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.SYNC_CONFIG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
NBTTagCompound configNBT = Server.readNBT(in);
|
||||
SyncController.receiveConfigs(configNBT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.controllers.SyncController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class SyncEndPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|SyncEnd";
|
||||
|
||||
public SyncEndPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.SYNC_END;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
int synctype = in.readInt();
|
||||
NBTTagCompound compound = Server.readNBT(in);
|
||||
SyncController.clientSync(synctype, compound, true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class SyncPlayerPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|SyncPlayer";
|
||||
|
||||
public SyncPlayerPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.SYNC_PLAYER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
boolean sync = in.readBoolean();
|
||||
NoppesUtil.handlePlayerDataEnd(sync);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.controllers.RecipeController;
|
||||
import noppes.npcs.controllers.data.RecipeCarpentry;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class SyncRecipesAddPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|SyncRecipesAdd";
|
||||
|
||||
public SyncRecipesAddPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.SYNCRECIPES_ADD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if(CustomNpcs.side() != Side.CLIENT)
|
||||
return;
|
||||
|
||||
NBTTagList list = Server.readNBT(in).getTagList("recipes", 10);
|
||||
if (list != null) {
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
RecipeCarpentry recipe = RecipeCarpentry.read(list.getCompoundTagAt(i));
|
||||
RecipeController.syncRecipes.put(recipe.id, recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.controllers.RecipeController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class SyncRecipesCarpentryBenchPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|SyncRecipesCarpentryBench";
|
||||
|
||||
public SyncRecipesCarpentryBenchPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.SYNCRECIPES_CARPENTRYBENCH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
RecipeController.Instance.anvilRecipes = RecipeController.syncRecipes;
|
||||
RecipeController.syncRecipes.clear();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.controllers.RecipeController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class SyncRecipesWorkbenchPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|SyncRecipesWorkbench";
|
||||
|
||||
public SyncRecipesWorkbenchPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.SYNCRECIPES_WORKBENCH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
RecipeController.reloadGlobalRecipes(RecipeController.syncRecipes);
|
||||
RecipeController.syncRecipes.clear();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.controllers.SyncController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class SyncRemovePacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|SyncRemove";
|
||||
|
||||
public SyncRemovePacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.SYNC_REMOVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
int synctype = in.readInt();
|
||||
int id = in.readInt();
|
||||
SyncController.clientSyncRemove(synctype, id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.controllers.SyncController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class SyncUpdatePacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|SyncUpdate";
|
||||
|
||||
public SyncUpdatePacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.SYNC_UPDATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
int synctype = in.readInt();
|
||||
NBTTagCompound compound = Server.readNBT(in);
|
||||
SyncController.clientSyncUpdate(synctype, compound, in);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class SyncWeaponPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|SyncWeapon";
|
||||
|
||||
public SyncWeaponPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.SYNC_WEAPON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
Entity entity = player.worldObj.getEntityByID(in.readInt());
|
||||
if (!(entity instanceof EntityNPCInterface)) return;
|
||||
|
||||
EntityNPCInterface npc = (EntityNPCInterface) entity;
|
||||
int weaponSlotIndex = in.readInt();
|
||||
NBTTagCompound nbt = Server.readNBT(in);
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(nbt);
|
||||
npc.inventory.weapons.put(weaponSlotIndex, stack);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class TeleporterPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|Teleporter";
|
||||
|
||||
public TeleporterPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.TELEPORTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
CustomNpcs.proxy.openGui(null, EnumGuiType.NpcDimensions);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.ClientCacheHandler;
|
||||
import noppes.npcs.controllers.data.Animation;
|
||||
import noppes.npcs.controllers.data.AnimationData;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class UpdateAnimationsPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|UpdateAnimations";
|
||||
|
||||
public UpdateAnimationsPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.UPDATE_ANIMATIONS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
NBTTagCompound nbt = Server.readNBT(in);
|
||||
AnimationData animationData = null;
|
||||
|
||||
if (nbt.hasKey("EntityId")) {
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(nbt.getInteger("EntityId"));
|
||||
if (entity instanceof EntityNPCInterface) {
|
||||
animationData = ((EntityNPCInterface) entity).display.animationData;
|
||||
}
|
||||
} else {
|
||||
String playerName = Server.readString(in);
|
||||
EntityPlayer sendingPlayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(playerName);
|
||||
if (sendingPlayer != null) {
|
||||
if (!ClientCacheHandler.playerAnimations.containsKey(sendingPlayer.getUniqueID())) {
|
||||
ClientCacheHandler.playerAnimations.put(sendingPlayer.getUniqueID(), new AnimationData(sendingPlayer));
|
||||
}
|
||||
animationData = ClientCacheHandler.playerAnimations.get(sendingPlayer.getUniqueID());
|
||||
animationData.parent = sendingPlayer;
|
||||
}
|
||||
}
|
||||
|
||||
if (animationData != null) {
|
||||
int animationId;
|
||||
if (nbt.hasKey("AnimationID")) {
|
||||
animationId = nbt.getInteger("AnimationID");
|
||||
} else {
|
||||
Animation animation = new Animation();
|
||||
animation.readFromNBT(nbt.getCompoundTag("Animation"));
|
||||
ClientCacheHandler.animationCache.put(animation.getID(), animation);
|
||||
animationId = animation.getID();
|
||||
}
|
||||
|
||||
animationData.setAnimation(ClientCacheHandler.animationCache.get(animationId));
|
||||
animationData.readFromNBT(nbt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class UpdateNpcPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|UpdateNpc";
|
||||
|
||||
public UpdateNpcPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.UPDATE_NPC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
NBTTagCompound compound = Server.readNBT(in);
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(compound.getInteger("EntityId"));
|
||||
if (entity instanceof EntityNPCInterface) {
|
||||
((EntityNPCInterface) entity).readSpawnData(compound);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package kamkeel.network.packets.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.network.AbstractPacket;
|
||||
import kamkeel.network.PacketChannel;
|
||||
import kamkeel.network.PacketHandler;
|
||||
import kamkeel.network.enums.EnumClientPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.ServerEventsHandler;
|
||||
import net.minecraft.village.MerchantRecipeList;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class VillagerListPacket extends AbstractPacket {
|
||||
public static final String packetName = "Client|VillagerList";
|
||||
|
||||
public VillagerListPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumClientPacket.VILLAGER_LIST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.CLIENT_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
// TODO: Send Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
MerchantRecipeList recipes = MerchantRecipeList.func_151390_b(new PacketBuffer(in));
|
||||
ServerEventsHandler.Merchant.setRecipes(recipes);
|
||||
}
|
||||
}
|
||||
@@ -143,5 +143,4 @@ public class Server {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user