mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 09:39:05 +00:00
MAKE A trillion + 1 packets now 🐶
This commit is contained in:
1 parent
1e5cc66f2f
commit
35da0f92f6
157 files changed
+6290
-367
No files matched your search
@@ -5,6 +5,7 @@ import cpw.mods.fml.common.network.FMLEventChannel;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.enums.EnumChannelType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
@@ -130,15 +131,15 @@ public final class PacketHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onServerPacket(FMLNetworkEvent.ServerCustomPacketEvent event) {
|
||||
handlePacket(event.packet, ((NetHandlerPlayServer) event.handler).playerEntity);
|
||||
handlePacket(event.packet, ((NetHandlerPlayServer) event.handler).playerEntity, Side.SERVER);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onClientPacket(FMLNetworkEvent.ClientCustomPacketEvent event) {
|
||||
handlePacket(event.packet, CustomNpcs.proxy.getPlayer());
|
||||
handlePacket(event.packet, CustomNpcs.proxy.getPlayer(), Side.CLIENT);
|
||||
}
|
||||
|
||||
private void handlePacket(FMLProxyPacket packet, EntityPlayer player) {
|
||||
private void handlePacket(FMLProxyPacket packet, EntityPlayer player, Side side) {
|
||||
ByteBuf buf = packet.payload();
|
||||
try {
|
||||
int packetTypeOrdinal = buf.readInt();
|
||||
@@ -157,16 +158,17 @@ public final class PacketHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if permission is allowed
|
||||
if(abstractPacket.getPermission() != null && !CustomNpcsPermissions.hasPermission(player, abstractPacket.getPermission())){
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for required NPC
|
||||
if(abstractPacket.needsNPC()){
|
||||
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
|
||||
if(npc == null)
|
||||
if(side == Side.SERVER){
|
||||
// Check if permission is allowed
|
||||
if(abstractPacket.getPermission() != null && !CustomNpcsPermissions.hasPermission(player, abstractPacket.getPermission())){
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for required NPC
|
||||
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
|
||||
if(abstractPacket.needsNPC() && npc == null){
|
||||
return;
|
||||
}
|
||||
|
||||
abstractPacket.setNPC(npc);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,69 @@
|
||||
package kamkeel.npcs.network;
|
||||
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.LogWriter;
|
||||
|
||||
public class PacketUtil {
|
||||
|
||||
public static boolean verifyItemPacket(EnumItemPacketType type, EntityPlayer player){
|
||||
if(player == null)
|
||||
return false;
|
||||
|
||||
ItemStack item = player.inventory.getCurrentItem();
|
||||
if(item == null){
|
||||
LogWriter.error(String.format("%s attempted to utilize a %s Packet without an item, they could be a hacker", player.getCommandSenderName(), type.toString()));
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (type){
|
||||
case WAND:
|
||||
if(item.getItem() != CustomItems.wand){
|
||||
LogWriter.error(String.format("%s attempted to utilize a %s Packet without a Wand, they could be a hacker", player.getCommandSenderName(), type.toString()));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case MOUNTER:
|
||||
if(item.getItem() != CustomItems.mount){
|
||||
LogWriter.error(String.format("%s attempted to utilize a %s Packet without a Mounter, they could be a hacker", player.getCommandSenderName(), type.toString()));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case CLONER:
|
||||
if(item.getItem() != CustomItems.cloner){
|
||||
LogWriter.error(String.format("%s attempted to utilize a %s Packet without a Cloner, they could be a hacker", player.getCommandSenderName(), type.toString()));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case TELEPORTER:
|
||||
if(item.getItem() != CustomItems.teleporter){
|
||||
LogWriter.error(String.format("%s attempted to utilize a %s Packet without a Teleporter, they could be a hacker", player.getCommandSenderName(), type.toString()));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case SCRIPTER:
|
||||
if(item.getItem() != CustomItems.scripter){
|
||||
LogWriter.error(String.format("%s attempted to utilize a %s Packet without a Scripter, they could be a hacker", player.getCommandSenderName(), type.toString()));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case PATHER:
|
||||
if(item.getItem() != CustomItems.moving){
|
||||
LogWriter.error(String.format("%s attempted to utilize a %s Packet without a Pather, they could be a hacker", player.getCommandSenderName(), type.toString()));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case BLOCK:
|
||||
if(item.getItem() == Item.getItemFromBlock(CustomItems.waypoint) || item.getItem() == Item.getItemFromBlock(CustomItems.border) || item.getItem() == Item.getItemFromBlock(CustomItems.redstoneBlock)){
|
||||
LogWriter.error(String.format("%s attempted to utilize a %s Packet without a valid Block, they could be a hacker", player.getCommandSenderName(), type.toString()));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package kamkeel.npcs.network.enums;
|
||||
|
||||
public enum EnumItemPacketType {
|
||||
WAND,
|
||||
MOUNTER,
|
||||
CLONER,
|
||||
TELEPORTER,
|
||||
SCRIPTER,
|
||||
PATHER,
|
||||
BLOCK
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package kamkeel.npcs.network.enums;
|
||||
public enum EnumRequestPacket {
|
||||
Delete,
|
||||
NPCDelete,
|
||||
RemoteMainMenu,
|
||||
RemoteGlobalMenu,
|
||||
NpcMenuClose,
|
||||
NpcClose,
|
||||
RemoteDelete,
|
||||
RemoteFreeze,
|
||||
RemoteFreezeGet,
|
||||
@@ -109,18 +109,17 @@ public enum EnumRequestPacket {
|
||||
CustomGuiUnfocused,
|
||||
|
||||
PartyLogToServer,
|
||||
SavePartyData,
|
||||
CreateParty,
|
||||
GetPartyData,
|
||||
DisbandParty,
|
||||
KickPlayer,
|
||||
LeavePlayer,
|
||||
PartySave,
|
||||
PartyInfo,
|
||||
PartyDisband,
|
||||
PartyKick,
|
||||
PartyLeave,
|
||||
PartyInvite,
|
||||
GetPartyInviteList,
|
||||
AcceptInvite,
|
||||
IgnoreInvite,
|
||||
SetPartyLeader,
|
||||
SetPartyQuest,
|
||||
PartyInviteList,
|
||||
PartyAcceptInvite,
|
||||
PartyIgnoreInvite,
|
||||
PartySetLeader,
|
||||
PartySetQuest,
|
||||
|
||||
ServerUpdateSkinOverlays
|
||||
LinkedRemove, LinkedAdd, LinkedGetAll, LinkedSet, BankGet, BanksGet, BankSave, BankRemove, QuestCategoryGet, PlayerDataGet, PlayerDataRemove, PlayerDataMapRegen, JobSave, JobGet, JobSpawnerAdd, RoleCompanionUpdate, JobSpawnerRemove, RoleSave, RoleGet, MailOpenSetup, TransformSave, TransformGet, TransformLoad, TraderMarketSave, ServerUpdateSkinOverlays
|
||||
}
|
||||
@@ -29,7 +29,8 @@ public final class AchievementPacket extends AbstractPacket {
|
||||
private String description;
|
||||
private String message;
|
||||
|
||||
public AchievementPacket() {}
|
||||
public AchievementPacket() {
|
||||
}
|
||||
|
||||
public AchievementPacket(boolean isParty, String description, String message) {
|
||||
this.isParty = isParty;
|
||||
@@ -37,7 +38,7 @@ public final class AchievementPacket extends AbstractPacket {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public static void sendAchievement(EntityPlayerMP playerMP, boolean isParty, String description, String message){
|
||||
public static void sendAchievement(EntityPlayerMP playerMP, boolean isParty, String description, String message) {
|
||||
AchievementPacket packet = new AchievementPacket(isParty, description, message);
|
||||
PacketHandler.Instance.sendToPlayer(packet, playerMP);
|
||||
}
|
||||
@@ -62,7 +63,7 @@ public final class AchievementPacket extends AbstractPacket {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if(!ConfigClient.BannerAlerts)
|
||||
if (!ConfigClient.BannerAlerts)
|
||||
return;
|
||||
|
||||
boolean isNotParty = !in.readBoolean();
|
||||
|
||||
@@ -20,13 +20,14 @@ public final class ChatAlertPacket extends AbstractPacket {
|
||||
|
||||
private Object[] objects;
|
||||
|
||||
public ChatAlertPacket() {}
|
||||
public ChatAlertPacket() {
|
||||
}
|
||||
|
||||
public ChatAlertPacket(final Object... obs) {
|
||||
this.objects = obs;
|
||||
}
|
||||
|
||||
public static void sendChatAlert(EntityPlayerMP playerMP, final Object... obs){
|
||||
public static void sendChatAlert(EntityPlayerMP playerMP, final Object... obs) {
|
||||
ChatAlertPacket packet = new ChatAlertPacket(obs);
|
||||
PacketHandler.Instance.sendToPlayer(packet, playerMP);
|
||||
}
|
||||
@@ -49,7 +50,7 @@ public final class ChatAlertPacket extends AbstractPacket {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if(!ConfigClient.ChatAlerts)
|
||||
if (!ConfigClient.ChatAlerts)
|
||||
return;
|
||||
|
||||
StringBuilder message = new StringBuilder();
|
||||
|
||||
@@ -25,7 +25,8 @@ public final class ChatBubblePacket extends AbstractPacket {
|
||||
private String text;
|
||||
private boolean hideText;
|
||||
|
||||
public ChatBubblePacket() {}
|
||||
public ChatBubblePacket() {
|
||||
}
|
||||
|
||||
public ChatBubblePacket(int entityId, String text, boolean hideText) {
|
||||
this.entityId = entityId;
|
||||
@@ -54,16 +55,16 @@ public final class ChatBubblePacket extends AbstractPacket {
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(in.readInt());
|
||||
if(!(entity instanceof EntityNPCInterface))
|
||||
if (!(entity instanceof EntityNPCInterface))
|
||||
return;
|
||||
|
||||
EntityNPCInterface npc = (EntityNPCInterface) entity;
|
||||
if(npc.messages == null)
|
||||
if (npc.messages == null)
|
||||
npc.messages = new RenderChatMessages();
|
||||
String text = NoppesStringUtils.formatText(ByteBufUtils.readString(in), player, npc);
|
||||
npc.messages.addMessage(text, npc);
|
||||
|
||||
if(in.readBoolean())
|
||||
if (in.readBoolean())
|
||||
player.addChatMessage(new ChatComponentTranslation(npc.getCommandSenderName() + ": " + text));
|
||||
}
|
||||
}
|
||||
@@ -21,9 +21,10 @@ public final class ClonerPacket extends LargeAbstractPacket {
|
||||
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public ClonerPacket() {}
|
||||
public ClonerPacket() {
|
||||
}
|
||||
|
||||
public ClonerPacket(NBTTagCompound comp){
|
||||
public ClonerPacket(NBTTagCompound comp) {
|
||||
this.compound = comp;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,14 +6,14 @@ import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.enums.EnumDataPacket;
|
||||
import kamkeel.npcs.network.enums.EnumConfigOperation;
|
||||
import kamkeel.npcs.network.enums.EnumDataPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.client.ClientProxy;
|
||||
import noppes.npcs.config.ConfigClient;
|
||||
import noppes.npcs.client.ClientProxy.FontContainer;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import noppes.npcs.client.ClientProxy;
|
||||
import noppes.npcs.client.ClientProxy.FontContainer;
|
||||
import noppes.npcs.config.ConfigClient;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -23,7 +23,8 @@ public final class ConfigCommandPacket extends AbstractPacket {
|
||||
private EnumConfigOperation configOperation;
|
||||
private Object[] objects;
|
||||
|
||||
public ConfigCommandPacket() {}
|
||||
public ConfigCommandPacket() {
|
||||
}
|
||||
|
||||
public ConfigCommandPacket(EnumConfigOperation operation, Object... obs) {
|
||||
this.configOperation = operation;
|
||||
|
||||
@@ -19,7 +19,8 @@ public final class DisableMouseInputPacket extends AbstractPacket {
|
||||
private long duration;
|
||||
private String keys;
|
||||
|
||||
public DisableMouseInputPacket() {}
|
||||
public DisableMouseInputPacket() {
|
||||
}
|
||||
|
||||
public DisableMouseInputPacket(long duration, String keys) {
|
||||
this.duration = duration;
|
||||
|
||||
@@ -13,7 +13,8 @@ import java.io.IOException;
|
||||
public final class LoginPacket extends AbstractPacket {
|
||||
public static final String packetName = "CNPC+|Login";
|
||||
|
||||
public LoginPacket() {}
|
||||
public LoginPacket() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,7 +22,8 @@ public final class MarkDataPacket extends AbstractPacket {
|
||||
private int entityID;
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public MarkDataPacket() {}
|
||||
public MarkDataPacket() {
|
||||
}
|
||||
|
||||
public MarkDataPacket(int entityID, NBTTagCompound compound) {
|
||||
this.entityID = entityID;
|
||||
|
||||
@@ -11,8 +11,8 @@ import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.gui.OverlayQuestTracking;
|
||||
import noppes.npcs.client.ClientCacheHandler;
|
||||
import noppes.npcs.client.gui.OverlayQuestTracking;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -21,7 +21,8 @@ public final class OverlayQuestTrackingPacket extends AbstractPacket {
|
||||
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public OverlayQuestTrackingPacket() {}
|
||||
public OverlayQuestTrackingPacket() {
|
||||
}
|
||||
|
||||
public OverlayQuestTrackingPacket(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
|
||||
@@ -28,7 +28,8 @@ public final class ParticlePacket extends AbstractPacket {
|
||||
|
||||
private String particle;
|
||||
|
||||
public ParticlePacket() {}
|
||||
public ParticlePacket() {
|
||||
}
|
||||
|
||||
public ParticlePacket(double x, double y, double z, float height, float width, float yOffset, String particle) {
|
||||
this.x = x;
|
||||
@@ -70,7 +71,7 @@ public final class ParticlePacket extends AbstractPacket {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void spawnParticle(ByteBuf buffer) throws IOException{
|
||||
public static void spawnParticle(ByteBuf buffer) throws IOException {
|
||||
double posX = buffer.readDouble();
|
||||
double posY = buffer.readDouble();
|
||||
double posZ = buffer.readDouble();
|
||||
@@ -82,11 +83,10 @@ public final class ParticlePacket extends AbstractPacket {
|
||||
World worldObj = Minecraft.getMinecraft().theWorld;
|
||||
|
||||
Random rand = worldObj.rand;
|
||||
if(particle.equals("heal")){
|
||||
for (int k = 0; k < 6; k++)
|
||||
{
|
||||
worldObj.spawnParticle("instantSpell", posX + (rand.nextDouble() - 0.5D) * (double)width, (posY + rand.nextDouble() * (double)height) - (double)yOffset, posZ + (rand.nextDouble() - 0.5D) * (double)width, 0, 0, 0);
|
||||
worldObj.spawnParticle("spell", posX + (rand.nextDouble() - 0.5D) * (double)width, (posY + rand.nextDouble() * (double)height) - (double)yOffset, posZ + (rand.nextDouble() - 0.5D) * (double)width, 0, 0, 0);
|
||||
if (particle.equals("heal")) {
|
||||
for (int k = 0; k < 6; k++) {
|
||||
worldObj.spawnParticle("instantSpell", posX + (rand.nextDouble() - 0.5D) * (double) width, (posY + rand.nextDouble() * (double) height) - (double) yOffset, posZ + (rand.nextDouble() - 0.5D) * (double) width, 0, 0, 0);
|
||||
worldObj.spawnParticle("spell", posX + (rand.nextDouble() - 0.5D) * (double) width, (posY + rand.nextDouble() * (double) height) - (double) yOffset, posZ + (rand.nextDouble() - 0.5D) * (double) width, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@ public final class PlayerUpdateSkinOverlaysPacket extends AbstractPacket {
|
||||
private String playerName;
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public PlayerUpdateSkinOverlaysPacket() {}
|
||||
public PlayerUpdateSkinOverlaysPacket() {
|
||||
}
|
||||
|
||||
public PlayerUpdateSkinOverlaysPacket(String playerName, NBTTagCompound compound) {
|
||||
this.playerName = playerName;
|
||||
|
||||
@@ -20,13 +20,14 @@ public final class QuestCompletionPacket extends AbstractPacket {
|
||||
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public QuestCompletionPacket() {}
|
||||
public QuestCompletionPacket() {
|
||||
}
|
||||
|
||||
public QuestCompletionPacket(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
}
|
||||
|
||||
public static void sendQuestComplete(EntityPlayerMP playerMP, NBTTagCompound compound){
|
||||
public static void sendQuestComplete(EntityPlayerMP playerMP, NBTTagCompound compound) {
|
||||
QuestCompletionPacket packet = new QuestCompletionPacket(compound);
|
||||
PacketHandler.Instance.sendToPlayer(packet, playerMP);
|
||||
}
|
||||
|
||||
@@ -21,13 +21,14 @@ public final class ScrollSelectedPacket extends AbstractPacket {
|
||||
|
||||
private String selected;
|
||||
|
||||
public ScrollSelectedPacket() {}
|
||||
public ScrollSelectedPacket() {
|
||||
}
|
||||
|
||||
public ScrollSelectedPacket(String selected) {
|
||||
this.selected = selected;
|
||||
}
|
||||
|
||||
public static void setSelectedList(EntityPlayerMP playerMP, String item){
|
||||
public static void setSelectedList(EntityPlayerMP playerMP, String item) {
|
||||
ScrollSelectedPacket packet = new ScrollSelectedPacket(item);
|
||||
PacketHandler.Instance.sendToPlayer(packet, playerMP);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,8 @@ public final class SoundManagementPacket extends AbstractPacket {
|
||||
private NBTTagCompound nbt;
|
||||
private int soundId;
|
||||
|
||||
public SoundManagementPacket() {}
|
||||
public SoundManagementPacket() {
|
||||
}
|
||||
|
||||
public SoundManagementPacket(EnumSoundOperation operation) {
|
||||
this.operation = operation;
|
||||
|
||||
@@ -15,7 +15,8 @@ import java.io.IOException;
|
||||
public final class SwingPlayerArmPacket extends AbstractPacket {
|
||||
public static final String packetName = "Data|SwingPlayerArm";
|
||||
|
||||
public SwingPlayerArmPacket() {}
|
||||
public SwingPlayerArmPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
@@ -28,7 +29,8 @@ public final class SwingPlayerArmPacket extends AbstractPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {}
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,8 @@ public final class UpdateAnimationsPacket extends AbstractPacket {
|
||||
private NBTTagCompound animationCompound;
|
||||
private String playername;
|
||||
|
||||
public UpdateAnimationsPacket() {}
|
||||
public UpdateAnimationsPacket() {
|
||||
}
|
||||
|
||||
public UpdateAnimationsPacket(NBTTagCompound animationCompound, String playername) {
|
||||
this.animationCompound = animationCompound;
|
||||
|
||||
@@ -10,8 +10,8 @@ import kamkeel.npcs.network.enums.EnumDataPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import noppes.npcs.ServerEventsHandler;
|
||||
import net.minecraft.village.MerchantRecipeList;
|
||||
import noppes.npcs.ServerEventsHandler;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -20,7 +20,8 @@ public final class VillagerListPacket extends AbstractPacket {
|
||||
|
||||
private MerchantRecipeList merchantrecipelist;
|
||||
|
||||
public VillagerListPacket() {}
|
||||
public VillagerListPacket() {
|
||||
}
|
||||
|
||||
public VillagerListPacket(MerchantRecipeList merchantrecipelist) {
|
||||
this.merchantrecipelist = merchantrecipelist;
|
||||
|
||||
@@ -23,14 +23,15 @@ public final class GuiClosePacket extends AbstractPacket {
|
||||
private int code;
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public GuiClosePacket() {}
|
||||
public GuiClosePacket() {
|
||||
}
|
||||
|
||||
public GuiClosePacket(int code, NBTTagCompound compound) {
|
||||
this.code = code;
|
||||
this.compound = compound;
|
||||
}
|
||||
|
||||
public static void closeGUI(EntityPlayerMP playerMP, int closeCode, NBTTagCompound compound){
|
||||
public static void closeGUI(EntityPlayerMP playerMP, int closeCode, NBTTagCompound compound) {
|
||||
GuiClosePacket packet = new GuiClosePacket(closeCode, compound);
|
||||
PacketHandler.Instance.sendToPlayer(packet, playerMP);
|
||||
}
|
||||
|
||||
@@ -23,14 +23,15 @@ public final class GuiErrorPacket extends AbstractPacket {
|
||||
private int code;
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public GuiErrorPacket() {}
|
||||
public GuiErrorPacket() {
|
||||
}
|
||||
|
||||
public GuiErrorPacket(int code, NBTTagCompound compound) {
|
||||
this.code = code;
|
||||
this.compound = compound;
|
||||
}
|
||||
|
||||
public static void errorGUI(EntityPlayerMP playerMP, int closeCode, NBTTagCompound compound){
|
||||
public static void errorGUI(EntityPlayerMP playerMP, int closeCode, NBTTagCompound compound) {
|
||||
GuiErrorPacket packet = new GuiErrorPacket(closeCode, compound);
|
||||
PacketHandler.Instance.sendToPlayer(packet, playerMP);
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.gui.player.GuiBook;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.player.GuiBook;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -24,7 +24,8 @@ public final class GuiOpenBookPacket extends AbstractPacket {
|
||||
private int k;
|
||||
private NBTTagCompound nbtTagCompound;
|
||||
|
||||
public GuiOpenBookPacket() {}
|
||||
public GuiOpenBookPacket() {
|
||||
}
|
||||
|
||||
public GuiOpenBookPacket(int i, int j, int k, NBTTagCompound nbtTagCompound) {
|
||||
this.i = i;
|
||||
|
||||
@@ -23,7 +23,8 @@ public final class GuiOpenPacket extends AbstractPacket {
|
||||
private int y;
|
||||
private int z;
|
||||
|
||||
public GuiOpenPacket() {}
|
||||
public GuiOpenPacket() {
|
||||
}
|
||||
|
||||
public GuiOpenPacket(EnumGuiType type, int x, int y, int z) {
|
||||
this.type = type;
|
||||
@@ -32,7 +33,7 @@ public final class GuiOpenPacket extends AbstractPacket {
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public static void openGUI(EntityPlayerMP playerMP, EnumGuiType type, int x, int y, int z){
|
||||
public static void openGUI(EntityPlayerMP playerMP, EnumGuiType type, int x, int y, int z) {
|
||||
GuiOpenPacket packet = new GuiOpenPacket(type, x, y, z);
|
||||
PacketHandler.Instance.sendToPlayer(packet, playerMP);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,8 @@ public final class GuiRedstonePacket extends AbstractPacket {
|
||||
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public GuiRedstonePacket() {}
|
||||
public GuiRedstonePacket() {
|
||||
}
|
||||
|
||||
public GuiRedstonePacket(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
|
||||
@@ -17,7 +17,8 @@ import java.io.IOException;
|
||||
public final class GuiTeleporterPacket extends AbstractPacket {
|
||||
public static final String packetName = "Data|Teleporter";
|
||||
|
||||
public GuiTeleporterPacket(){}
|
||||
public GuiTeleporterPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
@@ -30,11 +31,12 @@ public final class GuiTeleporterPacket extends AbstractPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {}
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
CustomNpcs.proxy.openGui((EntityNPCInterface)null, EnumGuiType.NpcDimensions);
|
||||
CustomNpcs.proxy.openGui((EntityNPCInterface) null, EnumGuiType.NpcDimensions);
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,8 @@ public final class GuiWaypointPacket extends AbstractPacket {
|
||||
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public GuiWaypointPacket() {}
|
||||
public GuiWaypointPacket() {
|
||||
}
|
||||
|
||||
public GuiWaypointPacket(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
|
||||
@@ -16,7 +16,8 @@ import java.io.IOException;
|
||||
public final class IsGuiOpenPacket extends AbstractPacket {
|
||||
public static final String packetName = "Data|IsGuiOpen";
|
||||
|
||||
public IsGuiOpenPacket() {}
|
||||
public IsGuiOpenPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
@@ -29,7 +30,8 @@ public final class IsGuiOpenPacket extends AbstractPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {}
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
|
||||
@@ -25,13 +25,14 @@ public final class GuiDataPacket extends LargeAbstractPacket {
|
||||
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public GuiDataPacket(){}
|
||||
public GuiDataPacket() {
|
||||
}
|
||||
|
||||
public GuiDataPacket(NBTTagCompound comp){
|
||||
public GuiDataPacket(NBTTagCompound comp) {
|
||||
this.compound = comp;
|
||||
}
|
||||
|
||||
public static void sendGuiData(EntityPlayerMP playerMP, NBTTagCompound compound){
|
||||
public static void sendGuiData(EntityPlayerMP playerMP, NBTTagCompound compound) {
|
||||
GuiDataPacket packet = new GuiDataPacket(compound);
|
||||
PacketHandler.Instance.sendToPlayer(packet, playerMP);
|
||||
}
|
||||
@@ -60,9 +61,9 @@ public final class GuiDataPacket extends LargeAbstractPacket {
|
||||
protected void handleCompleteData(ByteBuf data, EntityPlayer player) throws IOException {
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if (gui instanceof GuiNPCInterface && ((GuiNPCInterface) gui).hasSubGui()) {
|
||||
gui = (GuiScreen) ((GuiNPCInterface) gui).getSubGui();
|
||||
gui = ((GuiNPCInterface) gui).getSubGui();
|
||||
} else if (gui instanceof GuiContainerNPCInterface && ((GuiContainerNPCInterface) gui).hasSubGui()) {
|
||||
gui = (GuiScreen) ((GuiContainerNPCInterface) gui).getSubGui();
|
||||
gui = ((GuiContainerNPCInterface) gui).getSubGui();
|
||||
}
|
||||
if (gui instanceof IGuiData) {
|
||||
NBTTagCompound nbt = ByteBufUtils.readBigNBT(data);
|
||||
|
||||
@@ -25,13 +25,14 @@ public final class PartyDataPacket extends LargeAbstractPacket {
|
||||
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public PartyDataPacket(){}
|
||||
public PartyDataPacket() {
|
||||
}
|
||||
|
||||
public PartyDataPacket(NBTTagCompound comp){
|
||||
public PartyDataPacket(NBTTagCompound comp) {
|
||||
this.compound = comp;
|
||||
}
|
||||
|
||||
public static void sendPartyData(EntityPlayerMP playerMP, NBTTagCompound compound){
|
||||
public static void sendPartyData(EntityPlayerMP playerMP, NBTTagCompound compound) {
|
||||
PartyDataPacket packet = new PartyDataPacket(compound);
|
||||
PacketHandler.Instance.sendToPlayer(packet, playerMP);
|
||||
}
|
||||
@@ -60,9 +61,9 @@ public final class PartyDataPacket extends LargeAbstractPacket {
|
||||
protected void handleCompleteData(ByteBuf data, EntityPlayer player) throws IOException {
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if (gui instanceof GuiNPCInterface && ((GuiNPCInterface) gui).hasSubGui()) {
|
||||
gui = (GuiScreen) ((GuiNPCInterface) gui).getSubGui();
|
||||
gui = ((GuiNPCInterface) gui).getSubGui();
|
||||
} else if (gui instanceof GuiContainerNPCInterface && ((GuiContainerNPCInterface) gui).hasSubGui()) {
|
||||
gui = (GuiScreen) ((GuiContainerNPCInterface) gui).getSubGui();
|
||||
gui = ((GuiContainerNPCInterface) gui).getSubGui();
|
||||
}
|
||||
if (gui instanceof IPartyData) {
|
||||
NBTTagCompound nbt = ByteBufUtils.readBigNBT(data);
|
||||
|
||||
@@ -19,7 +19,8 @@ public final class ScrollDataPacket extends LargeAbstractPacket {
|
||||
|
||||
private Map<String, Integer> data;
|
||||
|
||||
public ScrollDataPacket() {}
|
||||
public ScrollDataPacket() {
|
||||
}
|
||||
|
||||
public ScrollDataPacket(Map<String, Integer> data) {
|
||||
this.data = data;
|
||||
|
||||
@@ -19,13 +19,14 @@ public final class ScrollGroupPacket extends LargeAbstractPacket {
|
||||
|
||||
private Map<String, Integer> data;
|
||||
|
||||
public ScrollGroupPacket() {}
|
||||
public ScrollGroupPacket() {
|
||||
}
|
||||
|
||||
public ScrollGroupPacket(Map<String, Integer> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static void sendScrollGroup(EntityPlayerMP player, Map<String,Integer> map){
|
||||
public static void sendScrollGroup(EntityPlayerMP player, Map<String, Integer> map) {
|
||||
ScrollGroupPacket packet = new ScrollGroupPacket(map);
|
||||
PacketHandler.Instance.sendToPlayer(packet, player);
|
||||
}
|
||||
|
||||
@@ -19,13 +19,14 @@ public final class ScrollListPacket extends LargeAbstractPacket {
|
||||
|
||||
private List<String> data;
|
||||
|
||||
public ScrollListPacket() {}
|
||||
public ScrollListPacket() {
|
||||
}
|
||||
|
||||
public ScrollListPacket(List<String> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static void sendList(EntityPlayerMP player, List<String> list){
|
||||
public static void sendList(EntityPlayerMP player, List<String> list) {
|
||||
ScrollListPacket packet = new ScrollListPacket(list);
|
||||
PacketHandler.Instance.sendToPlayer(packet, player);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ public final class SyncPacket extends LargeAbstractPacket {
|
||||
private NBTTagCompound syncData;
|
||||
private int operationID;
|
||||
|
||||
public SyncPacket() {}
|
||||
public SyncPacket() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new LargeSyncPacket.
|
||||
@@ -70,7 +71,7 @@ public final class SyncPacket extends LargeAbstractPacket {
|
||||
|
||||
@Override
|
||||
protected void handleCompleteData(ByteBuf data, EntityPlayer player) throws IOException {
|
||||
if(CustomNpcs.side() != Side.CLIENT)
|
||||
if (CustomNpcs.side() != Side.CLIENT)
|
||||
return;
|
||||
|
||||
// Reconstruct everything from the ByteBuf
|
||||
|
||||
@@ -19,9 +19,10 @@ public final class DeleteNpcPacket extends AbstractPacket {
|
||||
|
||||
private int entityId;
|
||||
|
||||
public DeleteNpcPacket() {}
|
||||
public DeleteNpcPacket() {
|
||||
}
|
||||
|
||||
public DeleteNpcPacket(int id){
|
||||
public DeleteNpcPacket(int id) {
|
||||
this.entityId = id;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ public final class DialogPacket extends AbstractPacket {
|
||||
private int entityID;
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public DialogPacket() {}
|
||||
public DialogPacket() {
|
||||
}
|
||||
|
||||
public DialogPacket(String dummyName, int entityID, NBTTagCompound compound) {
|
||||
this.dummyName = dummyName;
|
||||
@@ -58,12 +59,11 @@ public final class DialogPacket extends AbstractPacket {
|
||||
NBTTagCompound tagCompound = ByteBufUtils.readNBT(in);
|
||||
|
||||
// Dummy NPC
|
||||
if(entityID == -1){
|
||||
if (entityID == -1) {
|
||||
EntityDialogNpc npc = new EntityDialogNpc(player.worldObj);
|
||||
npc.display.name = name;
|
||||
NoppesUtil.openDialog(tagCompound, npc, player);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(entityID);
|
||||
if (!(entity instanceof EntityNPCInterface)) {
|
||||
return;
|
||||
|
||||
@@ -19,7 +19,9 @@ public final class EditNpcPacket extends AbstractPacket {
|
||||
public static final String packetName = "Data|EditNpc";
|
||||
|
||||
int entityId;
|
||||
public EditNpcPacket() {}
|
||||
|
||||
public EditNpcPacket() {
|
||||
}
|
||||
|
||||
public EditNpcPacket(int entityId) {
|
||||
this.entityId = entityId;
|
||||
|
||||
@@ -22,7 +22,8 @@ public final class RolePacket extends AbstractPacket {
|
||||
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public RolePacket() {}
|
||||
public RolePacket() {
|
||||
}
|
||||
|
||||
public RolePacket(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
|
||||
@@ -21,7 +21,8 @@ public final class UpdateNpcPacket extends AbstractPacket {
|
||||
|
||||
private NBTTagCompound npcCompound;
|
||||
|
||||
public UpdateNpcPacket() {}
|
||||
public UpdateNpcPacket() {
|
||||
}
|
||||
|
||||
public UpdateNpcPacket(NBTTagCompound npcCompound) {
|
||||
this.npcCompound = npcCompound;
|
||||
|
||||
@@ -24,7 +24,8 @@ public final class WeaponNpcPacket extends AbstractPacket {
|
||||
private int weaponIndex;
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public WeaponNpcPacket() {}
|
||||
public WeaponNpcPacket() {
|
||||
}
|
||||
|
||||
public WeaponNpcPacket(int entityId, int weaponIndex, NBTTagCompound compound) {
|
||||
this.entityId = entityId;
|
||||
@@ -54,11 +55,11 @@ public final class WeaponNpcPacket extends AbstractPacket {
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(in.readInt());
|
||||
if(!(entity instanceof EntityNPCInterface))
|
||||
if (!(entity instanceof EntityNPCInterface))
|
||||
return;
|
||||
EntityNPCInterface npc = (EntityNPCInterface) entity;
|
||||
int weaponSlotIndex = in.readInt();
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(ByteBufUtils.readNBT(in));
|
||||
npc.inventory.weapons.put(weaponSlotIndex,stack);
|
||||
npc.inventory.weapons.put(weaponSlotIndex, stack);
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -17,7 +17,8 @@ public final class ScriptOverlayClosePacket extends AbstractPacket {
|
||||
|
||||
private int particleId;
|
||||
|
||||
public ScriptOverlayClosePacket() {}
|
||||
public ScriptOverlayClosePacket() {
|
||||
}
|
||||
|
||||
public ScriptOverlayClosePacket(int particleId) {
|
||||
this.particleId = particleId;
|
||||
|
||||
@@ -11,8 +11,8 @@ import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
|
||||
import noppes.npcs.client.ClientCacheHandler;
|
||||
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -21,7 +21,8 @@ public final class ScriptOverlayDataPacket extends AbstractPacket {
|
||||
|
||||
private NBTTagCompound overlayCompound;
|
||||
|
||||
public ScriptOverlayDataPacket() {}
|
||||
public ScriptOverlayDataPacket() {
|
||||
}
|
||||
|
||||
public ScriptOverlayDataPacket(NBTTagCompound overlayCompound) {
|
||||
this.overlayCompound = overlayCompound;
|
||||
|
||||
@@ -24,7 +24,8 @@ public final class ScriptedParticlePacket extends AbstractPacket {
|
||||
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public ScriptedParticlePacket() {}
|
||||
public ScriptedParticlePacket() {
|
||||
}
|
||||
|
||||
public ScriptedParticlePacket(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
@@ -48,15 +49,15 @@ public final class ScriptedParticlePacket extends AbstractPacket {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if(CustomNpcs.side() != Side.CLIENT)
|
||||
if (CustomNpcs.side() != Side.CLIENT)
|
||||
return;
|
||||
|
||||
spawnScriptedParticle(player, in);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void spawnScriptedParticle(EntityPlayer player, ByteBuf buffer){
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
public static void spawnScriptedParticle(EntityPlayer player, ByteBuf buffer) {
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
|
||||
NBTTagCompound compound;
|
||||
ScriptParticle particle;
|
||||
@@ -82,7 +83,7 @@ public final class ScriptedParticlePacket extends AbstractPacket {
|
||||
|
||||
CustomFX fx = CustomFX.fromScriptedParticle(particle, worldObj, entity);
|
||||
|
||||
for(int i = 0; i < particle.amount; i++){
|
||||
for (int i = 0; i < particle.amount; i++) {
|
||||
minecraft.effectRenderer.addEffect(fx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,15 +8,20 @@ import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class AnimationCachePacket extends AbstractPacket {
|
||||
public static final String packetName = "Request|AnimationCache";
|
||||
private int id;
|
||||
|
||||
public AnimationCachePacket() {}
|
||||
public AnimationCachePacket() {
|
||||
}
|
||||
|
||||
public AnimationCachePacket(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
@@ -30,11 +35,13 @@ public final class AnimationCachePacket extends AbstractPacket {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {}
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
out.writeInt(this.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
NoppesUtilServer.sendTagDataAll((EntityPlayerMP) player);
|
||||
PlayerDataController.Instance.getPlayerData(player).animationData.cacheAnimation(in.readInt());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.world.WorldProvider;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
@@ -20,7 +19,8 @@ import java.util.HashMap;
|
||||
public final class DimensionsGetPacket extends AbstractPacket {
|
||||
public static final String packetName = "Request|DimensionsGet";
|
||||
|
||||
public DimensionsGetPacket() {}
|
||||
public DimensionsGetPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
@@ -34,12 +34,13 @@ public final class DimensionsGetPacket extends AbstractPacket {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {}
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
HashMap<String,Integer> map = new HashMap<String,Integer>();
|
||||
for(int id : DimensionManager.getStaticDimensionIDs()){
|
||||
HashMap<String, Integer> map = new HashMap<String, Integer>();
|
||||
for (int id : DimensionManager.getStaticDimensionIDs()) {
|
||||
WorldProvider provider = DimensionManager.createProviderFor(id);
|
||||
map.put(provider.getDimensionName(), id);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package kamkeel.npcs.network.packets.request;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class GuiPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|Gui";
|
||||
|
||||
private int guiIndex, posX, posY, posZ;
|
||||
|
||||
public GuiPacket(int guiIndex, int posX, int posY, int posZ) {
|
||||
this.guiIndex = guiIndex;
|
||||
this.posX = posX;
|
||||
this.posY = posY;
|
||||
this.posZ = posZ;
|
||||
}
|
||||
|
||||
public GuiPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.Gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// No permission override
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
out.writeInt(guiIndex);
|
||||
out.writeInt(posX);
|
||||
out.writeInt(posY);
|
||||
out.writeInt(posZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
int index = in.readInt();
|
||||
int x = in.readInt();
|
||||
int y = in.readInt();
|
||||
int z = in.readInt();
|
||||
EnumGuiType gui = EnumGuiType.values()[index];
|
||||
NoppesUtilServer.sendOpenGui(player, gui, npc, x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,6 @@ import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
|
||||
@@ -20,9 +18,10 @@ public final class IsGuiOpenPacket extends AbstractPacket {
|
||||
|
||||
private boolean isOpen;
|
||||
|
||||
public IsGuiOpenPacket() {}
|
||||
public IsGuiOpenPacket() {
|
||||
}
|
||||
|
||||
public IsGuiOpenPacket(boolean isOpen){
|
||||
public IsGuiOpenPacket(boolean isOpen) {
|
||||
this.isOpen = isOpen;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package kamkeel.npcs.network.packets.request;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.containers.ContainerMail;
|
||||
import noppes.npcs.controllers.data.PlayerMail;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class MailOpenSetupPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|MailOpenSetup";
|
||||
|
||||
public MailOpenSetupPacket() { }
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.MailOpenSetup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException { }
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
PlayerMail mail = new PlayerMail();
|
||||
mail.readNBT(ByteBufUtils.readNBT(in));
|
||||
ContainerMail.staticmail = mail;
|
||||
player.openGui(CustomNpcs.instance, EnumGuiType.PlayerMailman.ordinal(), player.worldObj, 1, 0, 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package kamkeel.npcs.network.packets.request;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.village.MerchantRecipeList;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class MerchantUpdatePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|MerchantUpdate";
|
||||
|
||||
public MerchantUpdatePacket() { }
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.MerchantUpdate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.EDIT_VILLAGER;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException { }
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
|
||||
int entityId = in.readInt();
|
||||
Entity entity = player.worldObj.getEntityByID(entityId);
|
||||
if (!(entity instanceof EntityVillager))
|
||||
return;
|
||||
|
||||
MerchantRecipeList list = MerchantRecipeList.func_151390_b(new PacketBuffer(in));
|
||||
((EntityVillager)entity).setRecipes(list);
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,6 @@ import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -22,7 +21,8 @@ public final class QuestLogToServerPacket extends AbstractPacket {
|
||||
private NBTTagCompound compound;
|
||||
private String key;
|
||||
|
||||
public QuestLogToServerPacket() {}
|
||||
public QuestLogToServerPacket() {
|
||||
}
|
||||
|
||||
public QuestLogToServerPacket(NBTTagCompound compound, String key) {
|
||||
this.compound = compound;
|
||||
|
||||
@@ -7,10 +7,8 @@ import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -18,7 +16,8 @@ import java.io.IOException;
|
||||
public final class QuestUntrackPacket extends AbstractPacket {
|
||||
public static final String packetName = "Request|QuestUntrack";
|
||||
|
||||
public QuestUntrackPacket() {}
|
||||
public QuestUntrackPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
@@ -32,7 +31,8 @@ public final class QuestUntrackPacket extends AbstractPacket {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {}
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
|
||||
@@ -6,27 +6,22 @@ import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.enums.EnumDataPacket;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.controllers.data.MarkData;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class REQUESTPacket extends AbstractPacket {
|
||||
public static final String packetName = "Request|Name";
|
||||
|
||||
public REQUESTPacket() {}
|
||||
public REQUESTPacket() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.Delete;
|
||||
return EnumRequestPacket.NPCDelete;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -35,12 +30,12 @@ public final class REQUESTPacket extends AbstractPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission(){
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC(){
|
||||
public boolean needsNPC() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,20 +7,17 @@ import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.ScrollDataPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.world.WorldProvider;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
public final class TagsGetPacket extends AbstractPacket {
|
||||
public static final String packetName = "Request|TagsGet";
|
||||
|
||||
public TagsGetPacket() {}
|
||||
public TagsGetPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
@@ -34,7 +31,8 @@ public final class TagsGetPacket extends AbstractPacket {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {}
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
|
||||
@@ -13,7 +13,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.controllers.TagController;
|
||||
import noppes.npcs.controllers.data.Tag;
|
||||
|
||||
@@ -23,7 +22,8 @@ import java.util.UUID;
|
||||
public final class TagsNpcGetPacket extends AbstractPacket {
|
||||
public static final String packetName = "Request|NpcTagsGet";
|
||||
|
||||
public TagsNpcGetPacket() {}
|
||||
public TagsNpcGetPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
@@ -36,13 +36,14 @@ public final class TagsNpcGetPacket extends AbstractPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC(){
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {}
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
@@ -54,7 +55,7 @@ public final class TagsNpcGetPacket extends AbstractPacket {
|
||||
tagList.appendTag(new NBTTagString(tag.name));
|
||||
}
|
||||
}
|
||||
compound.setTag("TagNames",tagList);
|
||||
compound.setTag("TagNames", tagList);
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, compound);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package kamkeel.npcs.network.packets.request;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import foxz.utils.Market;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.roles.RoleTrader;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class TraderMarketSavePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|TraderMarketSave";
|
||||
|
||||
public TraderMarketSavePacket() { }
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.TraderMarketSave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.NPC_ADVANCED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException { }
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
String market = ByteBufUtils.readString(in);
|
||||
if (market == null) return;
|
||||
boolean bo = in.readBoolean();
|
||||
if(npc.roleInterface instanceof RoleTrader){
|
||||
if(bo)
|
||||
Market.setMarket(npc, market);
|
||||
else
|
||||
Market.save((RoleTrader)npc.roleInterface, market);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package kamkeel.npcs.network.packets.request.animation;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.controllers.AnimationController;
|
||||
import noppes.npcs.controllers.data.Animation;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class AnimationGetPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|AnimationGet";
|
||||
|
||||
public AnimationGetPacket() { }
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.AnimationGet;
|
||||
}
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
out.writeInt(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
int id = in.readInt();
|
||||
Animation animation = (Animation) AnimationController.getInstance().get(id);
|
||||
NBTTagCompound compound = animation.writeToNBT();
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, compound);
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package kamkeel.npcs.network.packets.request.animation;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.controllers.AnimationController;
|
||||
import noppes.npcs.controllers.data.Animation;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class AnimationRemovePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|AnimationRemove";
|
||||
|
||||
public AnimationRemovePacket() { }
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.AnimationRemove;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.GLOBAL_ANIMATION;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
out.writeInt(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
int id = in.readInt();
|
||||
AnimationController.getInstance().delete(id);
|
||||
NoppesUtilServer.sendAnimationDataAll((EntityPlayerMP) player);
|
||||
NBTTagCompound compound = new Animation().writeToNBT();
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, compound);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package kamkeel.npcs.network.packets.request.animation;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.controllers.AnimationController;
|
||||
import noppes.npcs.controllers.data.Animation;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class AnimationSavePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|AnimationSave";
|
||||
|
||||
private NBTTagCompound animationNBT;
|
||||
|
||||
public AnimationSavePacket(NBTTagCompound animationNBT) {
|
||||
this.animationNBT = animationNBT;
|
||||
}
|
||||
public AnimationSavePacket() { }
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.AnimationSave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.GLOBAL_ANIMATION;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
ByteBufUtils.writeNBT(out, animationNBT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
NBTTagCompound compound = ByteBufUtils.readNBT(in);
|
||||
Animation animation = new Animation();
|
||||
animation.readFromNBT(compound);
|
||||
AnimationController.getInstance().saveAnimation(animation);
|
||||
NoppesUtilServer.sendAnimationDataAll((EntityPlayerMP) player);
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, animation.writeToNBT());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package kamkeel.npcs.network.packets.request.animation;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class AnimationsGetPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|AnimationsGet";
|
||||
|
||||
public AnimationsGetPacket() { }
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.AnimationsGet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException { }
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
NoppesUtilServer.sendAnimationDataAll((EntityPlayerMP) player);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package kamkeel.npcs.network.packets.request.bank;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.controllers.BankController;
|
||||
import noppes.npcs.controllers.data.Bank;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class BankGetPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|BankGet";
|
||||
|
||||
private int bankId;
|
||||
|
||||
public BankGetPacket(int bankId) {
|
||||
this.bankId = bankId;
|
||||
}
|
||||
|
||||
public BankGetPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.BankGet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
out.writeInt(bankId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
int id = in.readInt();
|
||||
|
||||
Bank bank = BankController.getInstance().getBank(id);
|
||||
NoppesUtilServer.sendBank((EntityPlayerMP) player, bank);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package kamkeel.npcs.network.packets.request.bank;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.controllers.BankController;
|
||||
import noppes.npcs.controllers.data.Bank;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class BankRemovePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|BankRemove";
|
||||
|
||||
private int bankId;
|
||||
|
||||
public BankRemovePacket(int bankId) {
|
||||
this.bankId = bankId;
|
||||
}
|
||||
|
||||
public BankRemovePacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.BankRemove;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.GLOBAL_BANK;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
out.writeInt(bankId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
|
||||
int id = in.readInt();
|
||||
BankController.getInstance().removeBank(id);
|
||||
NoppesUtilServer.sendBankDataAll((EntityPlayerMP) player);
|
||||
NoppesUtilServer.sendBank((EntityPlayerMP) player, new Bank());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package kamkeel.npcs.network.packets.request.bank;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.controllers.BankController;
|
||||
import noppes.npcs.controllers.data.Bank;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class BankSavePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|BankSave";
|
||||
|
||||
private NBTTagCompound bankNBT;
|
||||
|
||||
public BankSavePacket(NBTTagCompound bankNBT) {
|
||||
this.bankNBT = bankNBT;
|
||||
}
|
||||
|
||||
public BankSavePacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.BankSave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.GLOBAL_BANK;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
ByteBufUtils.writeNBT(out, bankNBT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
|
||||
NBTTagCompound compound = ByteBufUtils.readNBT(in);
|
||||
Bank bank = new Bank();
|
||||
bank.readEntityFromNBT(compound);
|
||||
BankController.getInstance().saveBank(bank);
|
||||
NoppesUtilServer.sendBankDataAll((EntityPlayerMP) player);
|
||||
NoppesUtilServer.sendBank((EntityPlayerMP) player, bank);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package kamkeel.npcs.network.packets.request.bank;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class BanksGetPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|BanksGet";
|
||||
|
||||
public BanksGetPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.BanksGet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
// No permission override since BanksGet is null in the enum
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
NoppesUtilServer.sendBankDataAll((EntityPlayerMP) player);
|
||||
}
|
||||
}
|
||||
+5
-4
@@ -1,4 +1,4 @@
|
||||
package kamkeel.npcs.network.packets.request;
|
||||
package kamkeel.npcs.network.packets.request.customgui;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -23,9 +23,10 @@ public final class CustomGuiButtonPacket extends AbstractPacket {
|
||||
private NBTTagCompound compound;
|
||||
private int id;
|
||||
|
||||
public CustomGuiButtonPacket() {}
|
||||
public CustomGuiButtonPacket() {
|
||||
}
|
||||
|
||||
public CustomGuiButtonPacket(int id, NBTTagCompound comp){
|
||||
public CustomGuiButtonPacket(int id, NBTTagCompound comp) {
|
||||
this.compound = comp;
|
||||
this.id = id;
|
||||
}
|
||||
@@ -50,7 +51,7 @@ public final class CustomGuiButtonPacket extends AbstractPacket {
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if(!(player.openContainer instanceof ContainerCustomGui))
|
||||
if (!(player.openContainer instanceof ContainerCustomGui))
|
||||
return;
|
||||
|
||||
int id = in.readInt();
|
||||
+5
-4
@@ -1,4 +1,4 @@
|
||||
package kamkeel.npcs.network.packets.request;
|
||||
package kamkeel.npcs.network.packets.request.customgui;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -23,9 +23,10 @@ public final class CustomGuiClosePacket extends AbstractPacket {
|
||||
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public CustomGuiClosePacket() {}
|
||||
public CustomGuiClosePacket() {
|
||||
}
|
||||
|
||||
public CustomGuiClosePacket(int id, NBTTagCompound comp){
|
||||
public CustomGuiClosePacket(int id, NBTTagCompound comp) {
|
||||
this.compound = comp;
|
||||
}
|
||||
|
||||
@@ -48,7 +49,7 @@ public final class CustomGuiClosePacket extends AbstractPacket {
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if(!(player.openContainer instanceof ContainerCustomGui))
|
||||
if (!(player.openContainer instanceof ContainerCustomGui))
|
||||
return;
|
||||
|
||||
NBTTagCompound comp = ByteBufUtils.readNBT(in);
|
||||
+5
-4
@@ -1,4 +1,4 @@
|
||||
package kamkeel.npcs.network.packets.request;
|
||||
package kamkeel.npcs.network.packets.request.customgui;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -23,9 +23,10 @@ public final class CustomGuiUnfocusedPacket extends AbstractPacket {
|
||||
private NBTTagCompound compound;
|
||||
private int id;
|
||||
|
||||
public CustomGuiUnfocusedPacket() {}
|
||||
public CustomGuiUnfocusedPacket() {
|
||||
}
|
||||
|
||||
public CustomGuiUnfocusedPacket(int id, NBTTagCompound comp){
|
||||
public CustomGuiUnfocusedPacket(int id, NBTTagCompound comp) {
|
||||
this.compound = comp;
|
||||
this.id = id;
|
||||
}
|
||||
@@ -50,7 +51,7 @@ public final class CustomGuiUnfocusedPacket extends AbstractPacket {
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if(!(player.openContainer instanceof ContainerCustomGui))
|
||||
if (!(player.openContainer instanceof ContainerCustomGui))
|
||||
return;
|
||||
|
||||
int id = in.readInt();
|
||||
+4
-3
@@ -1,4 +1,4 @@
|
||||
package kamkeel.npcs.network.packets.request;
|
||||
package kamkeel.npcs.network.packets.request.customgui;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -27,7 +27,8 @@ public final class CustomScrollClickPacket extends AbstractPacket {
|
||||
private boolean doubleClick;
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public CustomScrollClickPacket() {}
|
||||
public CustomScrollClickPacket() {
|
||||
}
|
||||
|
||||
public CustomScrollClickPacket(NBTTagCompound compound, int scrollId, int scrollIndex, NBTTagCompound selection, boolean doubleClick) {
|
||||
this.compound = compound;
|
||||
@@ -60,7 +61,7 @@ public final class CustomScrollClickPacket extends AbstractPacket {
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if(!(player.openContainer instanceof ContainerCustomGui))
|
||||
if (!(player.openContainer instanceof ContainerCustomGui))
|
||||
return;
|
||||
|
||||
NBTTagCompound comp = ByteBufUtils.readNBT(in);
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package kamkeel.npcs.network.packets.request.dialog;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.controllers.DialogController;
|
||||
import noppes.npcs.controllers.data.DialogCategory;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class DialogCategoryGetPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|DialogCategoryGet";
|
||||
|
||||
public DialogCategoryGetPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.DialogCategoryGet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
// No permission override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
int id = in.readInt();
|
||||
DialogCategory category = DialogController.Instance.categories.get(id);
|
||||
if (category != null) {
|
||||
NBTTagCompound comp = category.writeNBT(new NBTTagCompound());
|
||||
comp.removeTag("Dialogs");
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, comp);
|
||||
}
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package kamkeel.npcs.network.packets.request.dialog;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.ScrollDataPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.controllers.DialogController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class DialogCategoryRemovePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|DialogCategoryRemove";
|
||||
|
||||
private int categoryId;
|
||||
|
||||
public DialogCategoryRemovePacket(int categoryId) {
|
||||
this.categoryId = categoryId;
|
||||
}
|
||||
|
||||
public DialogCategoryRemovePacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.DialogCategoryRemove;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.GLOBAL_DIALOG;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
out.writeInt(categoryId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
int id = in.readInt();
|
||||
DialogController.Instance.removeCategory(id);
|
||||
ScrollDataPacket.sendScrollData((EntityPlayerMP) player, DialogController.Instance.getScroll());
|
||||
}
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package kamkeel.npcs.network.packets.request.dialog;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.ScrollDataPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.controllers.DialogController;
|
||||
import noppes.npcs.controllers.data.DialogCategory;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class DialogCategorySavePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|DialogCategorySave";
|
||||
|
||||
private NBTTagCompound categoryNBT;
|
||||
|
||||
public DialogCategorySavePacket(NBTTagCompound categoryNBT) {
|
||||
this.categoryNBT = categoryNBT;
|
||||
}
|
||||
|
||||
public DialogCategorySavePacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.DialogCategorySave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.GLOBAL_DIALOG;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
ByteBufUtils.writeNBT(out, categoryNBT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
NBTTagCompound compound = ByteBufUtils.readNBT(in);
|
||||
DialogCategory category = new DialogCategory();
|
||||
category.readNBT(compound);
|
||||
DialogController.Instance.saveCategory(category);
|
||||
ScrollDataPacket.sendScrollData((EntityPlayerMP) player, DialogController.Instance.getScroll());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package kamkeel.npcs.network.packets.request.dialog;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class DialogNpcGetPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|DialogNpcGet";
|
||||
|
||||
public DialogNpcGetPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.DialogNpcGet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
// No permission override
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
NoppesUtilServer.sendNpcDialogs(player);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package kamkeel.npcs.network.packets.request.dialog;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class DialogNpcRemovePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|DialogNpcRemove";
|
||||
|
||||
private int index;
|
||||
|
||||
public DialogNpcRemovePacket(int index) {
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
public DialogNpcRemovePacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.DialogNpcRemove;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.NPC_ADVANCED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
out.writeInt(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
int idx = in.readInt();
|
||||
npc.dialogs.remove(idx);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package kamkeel.npcs.network.packets.request.dialog;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.controllers.data.DialogOption;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class DialogNpcSetPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|DialogNpcSet";
|
||||
|
||||
private int slot;
|
||||
private int dialog;
|
||||
|
||||
public DialogNpcSetPacket(int slot, int dialog) {
|
||||
this.slot = slot;
|
||||
this.dialog = dialog;
|
||||
}
|
||||
|
||||
public DialogNpcSetPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.DialogNpcSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.NPC_ADVANCED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
out.writeInt(slot);
|
||||
out.writeInt(dialog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
int s = in.readInt();
|
||||
int d = in.readInt();
|
||||
DialogOption option = NoppesUtilServer.setNpcDialog(s, d, player);
|
||||
if (option != null && option.hasDialog()) {
|
||||
NBTTagCompound compound = option.writeNBT();
|
||||
compound.setInteger("Position", s);
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, compound);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package kamkeel.npcs.network.packets.request.dialog;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.controllers.DialogController;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class DialogRemovePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|DialogRemove";
|
||||
|
||||
private int diagId;
|
||||
private boolean sendGroup;
|
||||
|
||||
public DialogRemovePacket(int diagId, boolean sendGroup) {
|
||||
this.diagId = diagId;
|
||||
this.sendGroup = sendGroup;
|
||||
}
|
||||
|
||||
public DialogRemovePacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.DialogRemove;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.GLOBAL_DIALOG;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
out.writeInt(diagId);
|
||||
out.writeBoolean(sendGroup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
int id = in.readInt();
|
||||
boolean sendGroup = in.readBoolean();
|
||||
Dialog dialog = DialogController.Instance.dialogs.get(id);
|
||||
if (dialog != null && dialog.category != null) {
|
||||
DialogController.Instance.removeDialog(dialog);
|
||||
if (sendGroup) {
|
||||
NoppesUtilServer.sendDialogGroup((EntityPlayerMP) player, dialog.category);
|
||||
} else {
|
||||
NoppesUtilServer.sendDialogData((EntityPlayerMP) player, dialog.category);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package kamkeel.npcs.network.packets.request.dialog;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.controllers.DialogController;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class DialogSavePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|DialogSave";
|
||||
|
||||
private int categoryId;
|
||||
private NBTTagCompound dialogNBT;
|
||||
private boolean sendGroup;
|
||||
|
||||
public DialogSavePacket(int categoryId, NBTTagCompound dialogNBT, boolean sendGroup) {
|
||||
this.categoryId = categoryId;
|
||||
this.dialogNBT = dialogNBT;
|
||||
this.sendGroup = sendGroup;
|
||||
}
|
||||
|
||||
public DialogSavePacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.DialogSave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.GLOBAL_DIALOG;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
out.writeInt(categoryId);
|
||||
ByteBufUtils.writeNBT(out, dialogNBT);
|
||||
out.writeBoolean(sendGroup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
|
||||
int cat = in.readInt();
|
||||
NBTTagCompound compound = ByteBufUtils.readNBT(in);
|
||||
boolean sendGroup = in.readBoolean();
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.readNBT(compound);
|
||||
DialogController.Instance.saveDialog(cat, dialog);
|
||||
|
||||
if (dialog.category != null) {
|
||||
if (sendGroup) {
|
||||
NoppesUtilServer.sendDialogGroup((EntityPlayerMP) player, dialog.category);
|
||||
} else {
|
||||
NoppesUtilServer.sendDialogData((EntityPlayerMP) player, dialog.category);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package kamkeel.npcs.network.packets.request.faction;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.controllers.FactionController;
|
||||
import noppes.npcs.controllers.data.Faction;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class FactionRemovePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|FactionRemove";
|
||||
|
||||
private int factionId;
|
||||
|
||||
public FactionRemovePacket(int factionId) {
|
||||
this.factionId = factionId;
|
||||
}
|
||||
|
||||
public FactionRemovePacket() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.FactionRemove;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.GLOBAL_FACTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
out.writeInt(factionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
int id = in.readInt();
|
||||
FactionController.getInstance().delete(id);
|
||||
NoppesUtilServer.sendFactionDataAll((EntityPlayerMP) player);
|
||||
NBTTagCompound comp = new NBTTagCompound();
|
||||
new Faction().writeNBT(comp);
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, comp);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package kamkeel.npcs.network.packets.request.faction;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.controllers.FactionController;
|
||||
import noppes.npcs.controllers.data.Faction;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class FactionSavePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|FactionSave";
|
||||
|
||||
private NBTTagCompound factionNBT;
|
||||
|
||||
public FactionSavePacket(NBTTagCompound factionNBT) {
|
||||
this.factionNBT = factionNBT;
|
||||
}
|
||||
|
||||
public FactionSavePacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.FactionSave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.GLOBAL_FACTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
ByteBufUtils.writeNBT(out, factionNBT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
NBTTagCompound compound = ByteBufUtils.readNBT(in);
|
||||
Faction faction = new Faction();
|
||||
faction.readNBT(compound);
|
||||
FactionController.getInstance().saveFaction(faction);
|
||||
NoppesUtilServer.sendFactionDataAll((EntityPlayerMP) player);
|
||||
NBTTagCompound comp = new NBTTagCompound();
|
||||
faction.writeNBT(comp);
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, comp);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package kamkeel.npcs.network.packets.request.faction;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class FactionSetPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|FactionSet";
|
||||
|
||||
private int facID;
|
||||
|
||||
public FactionSetPacket() {
|
||||
}
|
||||
|
||||
public FactionSetPacket(int id) {
|
||||
this.facID = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.FactionSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.NPC_ADVANCED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
out.writeInt(this.facID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
int factionId = in.readInt();
|
||||
npc.setFaction(factionId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package kamkeel.npcs.network.packets.request.jobs;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.constants.EnumJobType;
|
||||
import noppes.npcs.roles.JobSpawner;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class JobGetPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|JobGet";
|
||||
|
||||
public JobGetPacket() { }
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.JobGet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.NPC_ADVANCED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException { }
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
if(npc.jobInterface == null) return;
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setBoolean("JobData", true);
|
||||
npc.jobInterface.writeToNBT(compound);
|
||||
if(npc.advanced.job == EnumJobType.Spawner)
|
||||
((JobSpawner)npc.jobInterface).cleanCompound(compound);
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, compound);
|
||||
if(npc.advanced.job == EnumJobType.Spawner)
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, ((JobSpawner)npc.jobInterface).getTitles());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package kamkeel.npcs.network.packets.request.jobs;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
public final class JobSavePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|JobSave";
|
||||
|
||||
public JobSavePacket() { }
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.JobSave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.NPC_ADVANCED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException { }
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
NBTTagCompound original = npc.jobInterface.writeToNBT(new NBTTagCompound());
|
||||
NBTTagCompound compound = ByteBufUtils.readNBT(in);
|
||||
Set<String> names = compound.func_150296_c();
|
||||
for(String name : names)
|
||||
original.setTag(name, compound.getTag(name));
|
||||
|
||||
npc.jobInterface.readFromNBT(original);
|
||||
npc.updateClient = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package kamkeel.npcs.network.packets.request.jobs;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.constants.EnumJobType;
|
||||
import noppes.npcs.controllers.ServerCloneController;
|
||||
import noppes.npcs.roles.JobSpawner;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class JobSpawnerAddPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|JobSpawnerAdd";
|
||||
|
||||
public JobSpawnerAddPacket() { }
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.JobSpawnerAdd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.NPC_ADVANCED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException { }
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
if(npc.advanced.job != EnumJobType.Spawner) return;
|
||||
JobSpawner job = (JobSpawner) npc.jobInterface;
|
||||
boolean useServerClone = in.readBoolean();
|
||||
if(useServerClone){
|
||||
NBTTagCompound compound = ServerCloneController.Instance.getCloneData(null, ByteBufUtils.readString(in), in.readInt());
|
||||
job.setJobCompound(in.readInt(), compound);
|
||||
} else {
|
||||
job.setJobCompound(in.readInt(), ByteBufUtils.readNBT(in));
|
||||
}
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, job.getTitles());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package kamkeel.npcs.network.packets.request.jobs;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.constants.EnumJobType;
|
||||
import noppes.npcs.roles.JobSpawner;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class JobSpawnerRemovePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|JobSpawnerRemove";
|
||||
|
||||
public JobSpawnerRemovePacket() { }
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.JobSpawnerRemove;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.NPC_ADVANCED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException { }
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
if(npc.advanced.job != EnumJobType.Spawner) return;
|
||||
JobSpawner job = (JobSpawner) npc.jobInterface;
|
||||
job.setJobCompound(in.readInt(), null);
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, job.getTitles());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package kamkeel.npcs.network.packets.request.linked;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.ScrollListPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.controllers.LinkedNpcController;
|
||||
import noppes.npcs.controllers.LinkedNpcController.LinkedData;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class LinkedAddPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|LinkedAdd";
|
||||
|
||||
private String data;
|
||||
|
||||
public LinkedAddPacket(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public LinkedAddPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.LinkedAdd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.GLOBAL_LINKED;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
ByteBufUtils.writeString(out, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
|
||||
String received = ByteBufUtils.readString(in);
|
||||
LinkedNpcController.Instance.addData(received);
|
||||
List<String> list = new ArrayList<>();
|
||||
for (LinkedData d : LinkedNpcController.Instance.list) {
|
||||
list.add(d.name);
|
||||
}
|
||||
ScrollListPacket.sendList((EntityPlayerMP) player, list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package kamkeel.npcs.network.packets.request.linked;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.ScrollSelectedPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.ScrollListPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.controllers.LinkedNpcController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class LinkedGetAllPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|LinkedGetAll";
|
||||
|
||||
public LinkedGetAllPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.LinkedGetAll;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
List<String> list = new ArrayList<>();
|
||||
for (LinkedNpcController.LinkedData d : LinkedNpcController.Instance.list) {
|
||||
list.add(d.name);
|
||||
}
|
||||
ScrollListPacket.sendList((EntityPlayerMP) player, list);
|
||||
if (npc != null) {
|
||||
ScrollSelectedPacket.setSelectedList((EntityPlayerMP) player, npc.linkedName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package kamkeel.npcs.network.packets.request.linked;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.ScrollListPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.controllers.LinkedNpcController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class LinkedRemovePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|LinkedRemove";
|
||||
|
||||
private String data;
|
||||
|
||||
public LinkedRemovePacket(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public LinkedRemovePacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.LinkedRemove;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.GLOBAL_LINKED;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
ByteBufUtils.writeString(out, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
|
||||
String received = ByteBufUtils.readString(in);
|
||||
LinkedNpcController.Instance.removeData(received);
|
||||
List<String> list = new ArrayList<>();
|
||||
for (LinkedNpcController.LinkedData d : LinkedNpcController.Instance.list) {
|
||||
list.add(d.name);
|
||||
}
|
||||
ScrollListPacket.sendList((EntityPlayerMP) player, list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package kamkeel.npcs.network.packets.request.linked;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.controllers.LinkedNpcController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class LinkedSetPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|LinkedSet";
|
||||
|
||||
private String linkedName;
|
||||
|
||||
public LinkedSetPacket(String linkedName) {
|
||||
this.linkedName = linkedName;
|
||||
}
|
||||
|
||||
public LinkedSetPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.LinkedSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.NPC_ADVANCED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
ByteBufUtils.writeString(out, linkedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
npc.linkedName = ByteBufUtils.readString(in);
|
||||
LinkedNpcController.Instance.loadNpcData(npc);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package kamkeel.npcs.network.packets.request.mainmenu;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class MainmenuAIGetPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|MainmenuAIGet";
|
||||
|
||||
public MainmenuAIGetPacket() { }
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.MainmenuAIGet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException { }
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, npc.ai.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package kamkeel.npcs.network.packets.request.mainmenu;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class MainmenuAISavePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|MainmenuAISave";
|
||||
|
||||
public MainmenuAISavePacket() { }
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.MainmenuAISave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.NPC_AI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException { }
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
npc.ai.readToNBT(ByteBufUtils.readNBT(in));
|
||||
npc.setHealth(npc.getMaxHealth());
|
||||
npc.updateAI = true;
|
||||
npc.updateClient = true;
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package kamkeel.npcs.network.packets.request.mainmenu;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class MainmenuAdvancedGetPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|MainmenuAdvancedGet";
|
||||
|
||||
public MainmenuAdvancedGetPacket() { }
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.MainmenuAdvancedGet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.NPC_ADVANCED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException { }
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, npc.advanced.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package kamkeel.npcs.network.packets.request.mainmenu;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.controllers.data.MarkData;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class MainmenuAdvancedMarkDataPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|MainmenuAdvancedMarkData";
|
||||
|
||||
public MainmenuAdvancedMarkDataPacket() { }
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.MainmenuAdvancedMarkData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.NPC_ADVANCED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException { }
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
MarkData data = MarkData.get(npc);
|
||||
data.setNBT(ByteBufUtils.readNBT(in));
|
||||
data.syncClients();
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package kamkeel.npcs.network.packets.request.mainmenu;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class MainmenuAdvancedSavePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|MainmenuAdvancedSave";
|
||||
|
||||
public MainmenuAdvancedSavePacket() { }
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.MainmenuAdvancedSave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.NPC_ADVANCED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException { }
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
npc.advanced.readToNBT(ByteBufUtils.readNBT(in));
|
||||
npc.updateAI = true;
|
||||
npc.updateClient = true;
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package kamkeel.npcs.network.packets.request.mainmenu;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class MainmenuDisplayGetPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|MainmenuDisplayGet";
|
||||
|
||||
public MainmenuDisplayGetPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.MainmenuDisplayGet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.NPC_DISPLAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, npc.display.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package kamkeel.npcs.network.packets.request.mainmenu;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class MainmenuDisplaySavePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|MainmenuDisplaySave";
|
||||
|
||||
public MainmenuDisplaySavePacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.MainmenuDisplaySave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.NPC_DISPLAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
npc.display.readToNBT(ByteBufUtils.readNBT(in));
|
||||
npc.updateClient = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package kamkeel.npcs.network.packets.request.mainmenu;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class MainmenuInvGetPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|MainmenuInvGet";
|
||||
|
||||
public MainmenuInvGetPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.MainmenuInvGet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.NPC_INVENTORY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, npc.inventory.writeEntityToNBT(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package kamkeel.npcs.network.packets.request.mainmenu;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class MainmenuInvSavePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|MainmenuInvSave";
|
||||
|
||||
public MainmenuInvSavePacket() { }
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.MainmenuInvSave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.NPC_INVENTORY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException { }
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
npc.inventory.readEntityFromNBT(ByteBufUtils.readNBT(in));
|
||||
npc.updateAI = true;
|
||||
npc.updateClient = true;
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package kamkeel.npcs.network.packets.request.mainmenu;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class MainmenuStatsGetPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|MainmenuStatsGet";
|
||||
|
||||
public MainmenuStatsGetPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.MainmenuStatsGet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.NPC_STATS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, npc.stats.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package kamkeel.npcs.network.packets.request.mainmenu;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class MainmenuStatsSavePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|MainmenuStatsSave";
|
||||
|
||||
public MainmenuStatsSavePacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.MainmenuStatsSave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return CustomNpcsPermissions.NPC_STATS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
npc.stats.readToNBT(ByteBufUtils.readNBT(in));
|
||||
npc.updateClient = true;
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package kamkeel.npcs.network.packets.request.naturalspawns;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.ScrollDataPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.controllers.SpawnController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class NaturalSpawnGetAllPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|NaturalSpawnGetAll";
|
||||
|
||||
public NaturalSpawnGetAllPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.NaturalSpawnGetAll;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
ScrollDataPacket.sendScrollData((EntityPlayerMP) player, SpawnController.Instance.getScroll());
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package kamkeel.npcs.network.packets.request.naturalspawns;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.AbstractPacket;
|
||||
import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumItemPacketType;
|
||||
import kamkeel.npcs.network.enums.EnumRequestPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.controllers.SpawnController;
|
||||
import noppes.npcs.controllers.data.SpawnData;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class NaturalSpawnGetPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|NaturalSpawnGet";
|
||||
|
||||
private int spawnId;
|
||||
|
||||
public NaturalSpawnGetPacket(int spawnId) {
|
||||
this.spawnId = spawnId;
|
||||
}
|
||||
|
||||
public NaturalSpawnGetPacket() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.NaturalSpawnGet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
out.writeInt(spawnId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
int id = in.readInt();
|
||||
SpawnData spawn = SpawnController.Instance.getSpawnData(id);
|
||||
if (spawn != null) {
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, spawn.writeNBT(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loaded 100 of 157 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user