mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 00:19:05 +00:00
Merge remote-tracking branch 'upstream/packet' into packet
This commit is contained in:
commit
5ce4beab34
29 files changed
+315
-228
No files matched your search
@@ -17,6 +17,7 @@ import kamkeel.npcs.network.packets.data.script.*;
|
||||
import kamkeel.npcs.network.packets.player.BankPacket;
|
||||
import kamkeel.npcs.network.packets.player.FollowerPacket;
|
||||
import kamkeel.npcs.network.packets.request.*;
|
||||
import kamkeel.npcs.network.packets.request.animation.*;
|
||||
import kamkeel.npcs.network.packets.request.bank.BankGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.bank.BankRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.bank.BankSavePacket;
|
||||
@@ -54,9 +55,7 @@ import kamkeel.npcs.network.packets.request.recipe.RecipesGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.role.RoleCompanionUpdatePacket;
|
||||
import kamkeel.npcs.network.packets.request.role.RoleGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.role.RoleSavePacket;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagSavePacket;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagSetPacket;
|
||||
import kamkeel.npcs.network.packets.request.tags.*;
|
||||
import kamkeel.npcs.network.packets.request.transform.TransformGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.transform.TransformLoadPacket;
|
||||
import kamkeel.npcs.network.packets.request.transform.TransformSavePacket;
|
||||
@@ -108,7 +107,6 @@ public class PacketHandler {
|
||||
REQUEST_PACKET.registerPacket(new NpcClosePacket());
|
||||
REQUEST_PACKET.registerPacket(new NpcDeletePacket());
|
||||
|
||||
|
||||
// Linked Packets
|
||||
REQUEST_PACKET.registerPacket(new LinkedGetAllPacket());
|
||||
REQUEST_PACKET.registerPacket(new LinkedRemovePacket());
|
||||
@@ -152,6 +150,7 @@ public class PacketHandler {
|
||||
REQUEST_PACKET.registerPacket(new QuestCategoryGetPacket());
|
||||
|
||||
// Quest Packets
|
||||
REQUEST_PACKET.registerPacket(new QuestOpenGuiPacket());
|
||||
REQUEST_PACKET.registerPacket(new QuestSavePacket());
|
||||
REQUEST_PACKET.registerPacket(new QuestRemovePacket());
|
||||
REQUEST_PACKET.registerPacket(new QuestDialogGetTitlePacket());
|
||||
@@ -162,6 +161,8 @@ public class PacketHandler {
|
||||
REQUEST_PACKET.registerPacket(new FactionSetPacket());
|
||||
|
||||
// Tag Packets
|
||||
REQUEST_PACKET.registerPacket(new TagsGetPacket());
|
||||
REQUEST_PACKET.registerPacket(new TagsNpcGetPacket());
|
||||
REQUEST_PACKET.registerPacket(new TagSetPacket());
|
||||
REQUEST_PACKET.registerPacket(new TagSavePacket());
|
||||
REQUEST_PACKET.registerPacket(new TagRemovePacket());
|
||||
@@ -230,6 +231,15 @@ public class PacketHandler {
|
||||
REQUEST_PACKET.registerPacket(new TransformGetPacket());
|
||||
REQUEST_PACKET.registerPacket(new TransformLoadPacket());
|
||||
|
||||
// Trader Packets
|
||||
REQUEST_PACKET.registerPacket(new TraderMarketSavePacket());
|
||||
|
||||
// Animation Packets
|
||||
REQUEST_PACKET.registerPacket(new AnimationsGetPacket());
|
||||
REQUEST_PACKET.registerPacket(new AnimationGetPacket());
|
||||
REQUEST_PACKET.registerPacket(new AnimationRemovePacket());
|
||||
REQUEST_PACKET.registerPacket(new AnimationSavePacket());
|
||||
|
||||
// Other Packets
|
||||
REQUEST_PACKET.registerPacket(new IsGuiOpenInform());
|
||||
REQUEST_PACKET.registerPacket(new GuiRequestPacket());
|
||||
@@ -238,6 +248,8 @@ public class PacketHandler {
|
||||
REQUEST_PACKET.registerPacket(new MerchantUpdatePacket());
|
||||
REQUEST_PACKET.registerPacket(new ModelDataSavePacket());
|
||||
REQUEST_PACKET.registerPacket(new MailOpenSetupPacket());
|
||||
REQUEST_PACKET.registerPacket(new TileEntityGetPacket());
|
||||
REQUEST_PACKET.registerPacket(new TileEntitySavePacket());
|
||||
}
|
||||
|
||||
public void registerDataPackets(){
|
||||
|
||||
@@ -97,8 +97,8 @@ public enum EnumRequestPacket {
|
||||
|
||||
RemoteNpcsGet,
|
||||
RemoteTpToNpc,
|
||||
SaveTileEntity,
|
||||
GetTileEntity,
|
||||
TileEntitySave,
|
||||
TileEntityGet,
|
||||
Gui,
|
||||
IsGuiOpen,
|
||||
CacheAnimation,
|
||||
|
||||
@@ -8,7 +8,7 @@ import kamkeel.npcs.network.PacketChannel;
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.enums.EnumDataPacket;
|
||||
import kamkeel.npcs.network.packets.request.AnimationCachePacket;
|
||||
import kamkeel.npcs.network.packets.request.animation.AnimationCachePacket;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
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.enums.EnumRequestPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class REQUESTPacket extends AbstractPacket {
|
||||
public static final String packetName = "Request|Name";
|
||||
|
||||
public REQUESTPacket() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.NPCDelete;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomNpcsPermissions.Permission getPermission() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
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.network.packets.data.large.GuiDataPacket;
|
||||
import kamkeel.npcs.network.packets.data.large.ScrollDataPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.WorldProvider;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
public final class TileEntityGetPacket extends AbstractPacket {
|
||||
public static final String packetName = "Request|TileEntityGet";
|
||||
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
|
||||
|
||||
public TileEntityGetPacket() {}
|
||||
|
||||
public TileEntityGetPacket(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.TileEntityGet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
out.writeInt(this.x);
|
||||
out.writeInt(this.y);
|
||||
out.writeInt(this.z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
if (!PacketUtil.verifyItemPacket(player, EnumItemPacketType.WAND, EnumItemPacketType.BLOCK))
|
||||
return;
|
||||
|
||||
TileEntity tile = player.worldObj.getTileEntity(in.readInt(), in.readInt(), in.readInt());
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
tile.writeToNBT(compound);
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, compound);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
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 net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class TileEntitySavePacket extends AbstractPacket {
|
||||
public static final String packetName = "Request|TileEntitySave";
|
||||
|
||||
private NBTTagCompound compound;
|
||||
|
||||
public TileEntitySavePacket() {}
|
||||
|
||||
public TileEntitySavePacket(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.TileEntitySave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.REQUEST_PACKET;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
ByteBufUtils.writeNBT(out, this.compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
if (!PacketUtil.verifyItemPacket(player, EnumItemPacketType.WAND, EnumItemPacketType.BLOCK))
|
||||
return;
|
||||
|
||||
NoppesUtilServer.saveTileEntity((EntityPlayerMP) player, ByteBufUtils.readNBT(in));
|
||||
}
|
||||
}
|
||||
@@ -21,8 +21,16 @@ import java.io.IOException;
|
||||
public final class TraderMarketSavePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|TraderMarketSave";
|
||||
|
||||
private String marketName;
|
||||
private boolean setMarket;
|
||||
|
||||
public TraderMarketSavePacket() { }
|
||||
|
||||
public TraderMarketSavePacket(String marketName, boolean setMarket) {
|
||||
this.marketName = marketName;
|
||||
this.setMarket = setMarket;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.TraderMarketSave;
|
||||
@@ -45,14 +53,23 @@ public final class TraderMarketSavePacket extends AbstractPacket {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException { }
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
ByteBufUtils.writeString(out, this.marketName);
|
||||
out.writeBoolean(this.setMarket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
|
||||
String market = ByteBufUtils.readString(in);
|
||||
if (market == null) return;
|
||||
if (market == null)
|
||||
return;
|
||||
|
||||
boolean bo = in.readBoolean();
|
||||
if(npc.roleInterface instanceof RoleTrader){
|
||||
if(bo)
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package kamkeel.npcs.network.packets.request;
|
||||
package kamkeel.npcs.network.packets.request.animation;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
+13
-3
@@ -21,8 +21,14 @@ import java.io.IOException;
|
||||
public final class AnimationGetPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|AnimationGet";
|
||||
|
||||
private int animationID;
|
||||
|
||||
public AnimationGetPacket() { }
|
||||
|
||||
public AnimationGetPacket(int animationID) {
|
||||
this.animationID = animationID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.AnimationGet;
|
||||
@@ -35,13 +41,17 @@ public final class AnimationGetPacket extends AbstractPacket {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
out.writeInt(0);
|
||||
out.writeInt(animationID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
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();
|
||||
|
||||
+13
-3
@@ -23,8 +23,14 @@ import java.io.IOException;
|
||||
public final class AnimationRemovePacket extends AbstractPacket {
|
||||
public static String packetName = "Request|AnimationRemove";
|
||||
|
||||
private int animationID;
|
||||
|
||||
public AnimationRemovePacket() { }
|
||||
|
||||
public AnimationRemovePacket(int animationID) {
|
||||
this.animationID = animationID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumRequestPacket.AnimationRemove;
|
||||
@@ -43,13 +49,17 @@ public final class AnimationRemovePacket extends AbstractPacket {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
out.writeInt(0);
|
||||
out.writeInt(this.animationID );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
|
||||
int id = in.readInt();
|
||||
AnimationController.getInstance().delete(id);
|
||||
NoppesUtilServer.sendAnimationDataAll((EntityPlayerMP) player);
|
||||
|
||||
+7
-3
@@ -29,7 +29,7 @@ public final class AnimationSavePacket extends AbstractPacket {
|
||||
public AnimationSavePacket(NBTTagCompound animationNBT) {
|
||||
this.animationNBT = animationNBT;
|
||||
}
|
||||
public AnimationSavePacket() { }
|
||||
public AnimationSavePacket(){}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
@@ -54,8 +54,12 @@ public final class AnimationSavePacket extends AbstractPacket {
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
|
||||
NBTTagCompound compound = ByteBufUtils.readNBT(in);
|
||||
Animation animation = new Animation();
|
||||
animation.readFromNBT(compound);
|
||||
|
||||
+5
-2
@@ -36,8 +36,11 @@ public final class AnimationsGetPacket extends AbstractPacket {
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP)) return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return;
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
|
||||
NoppesUtilServer.sendAnimationDataAll((EntityPlayerMP) player);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package kamkeel.npcs.network.packets.request;
|
||||
package kamkeel.npcs.network.packets.request.quest;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -15,6 +15,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -22,16 +23,15 @@ import java.io.IOException;
|
||||
public final class QuestOpenGuiPacket extends AbstractPacket {
|
||||
public static String packetName = "Request|QuestOpenGui";
|
||||
|
||||
private int guiId;
|
||||
private EnumGuiType guiType;
|
||||
private NBTTagCompound questNBT;
|
||||
|
||||
public QuestOpenGuiPacket(int guiId, NBTTagCompound questNBT) {
|
||||
this.guiId = guiId;
|
||||
public QuestOpenGuiPacket(EnumGuiType guiType, NBTTagCompound questNBT) {
|
||||
this.guiType = guiType;
|
||||
this.questNBT = questNBT;
|
||||
}
|
||||
|
||||
public QuestOpenGuiPacket() {
|
||||
}
|
||||
public QuestOpenGuiPacket() {}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
@@ -46,7 +46,7 @@ public final class QuestOpenGuiPacket extends AbstractPacket {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
out.writeInt(guiId);
|
||||
out.writeInt(guiType.ordinal());
|
||||
ByteBufUtils.writeNBT(out, questNBT);
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ public final class QuestOpenGuiPacket extends AbstractPacket {
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player))
|
||||
return;
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package kamkeel.npcs.network.packets.request;
|
||||
package kamkeel.npcs.network.packets.request.quest;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
+6
-1
@@ -1,4 +1,4 @@
|
||||
package kamkeel.npcs.network.packets.request;
|
||||
package kamkeel.npcs.network.packets.request.tags;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -6,6 +6,8 @@ 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;
|
||||
@@ -36,6 +38,9 @@ public final class TagsGetPacket extends AbstractPacket {
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!PacketUtil.verifyItemPacket(player, EnumItemPacketType.WAND, EnumItemPacketType.CLONER))
|
||||
return;
|
||||
|
||||
NoppesUtilServer.sendTagDataAll((EntityPlayerMP) player);
|
||||
}
|
||||
|
||||
+7
-3
@@ -1,4 +1,4 @@
|
||||
package kamkeel.npcs.network.packets.request;
|
||||
package kamkeel.npcs.network.packets.request.tags;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -6,6 +6,8 @@ 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;
|
||||
@@ -22,8 +24,7 @@ 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() {
|
||||
@@ -47,6 +48,9 @@ public final class TagsNpcGetPacket extends AbstractPacket {
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
if (!PacketUtil.verifyItemPacket(player, EnumItemPacketType.WAND, EnumItemPacketType.CLONER))
|
||||
return;
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
for (UUID uuid : npc.advanced.tagUUIDs) {
|
||||
@@ -365,16 +365,7 @@ public class PacketHandlerServer{
|
||||
}
|
||||
|
||||
private void blockPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException {
|
||||
if (type == EnumPacketServer.SaveTileEntity) {
|
||||
NoppesUtilServer.saveTileEntity(player, ByteBufUtils.readNBT(buffer));
|
||||
}
|
||||
else if(type == EnumPacketServer.GetTileEntity){
|
||||
TileEntity tile = player.worldObj.getTileEntity(buffer.readInt(), buffer.readInt(), buffer.readInt());
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
tile.writeToNBT(compound);
|
||||
GuiDataPacket.sendGuiData(player, compound);
|
||||
}
|
||||
else if(type == EnumPacketServer.DialogCategoriesGet){
|
||||
if(type == EnumPacketServer.DialogCategoriesGet){
|
||||
ScrollDataPacket.sendScrollData(player, DialogController.Instance.getScroll());
|
||||
}
|
||||
else if(type == EnumPacketServer.DialogsGetFromDialog){
|
||||
@@ -449,48 +440,7 @@ public class PacketHandlerServer{
|
||||
}
|
||||
|
||||
private void wandPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player, EntityNPCInterface npc) throws IOException{
|
||||
if(type == EnumPacketServer.QuestOpenGui){
|
||||
Quest quest = new Quest();
|
||||
int gui = buffer.readInt();
|
||||
quest.readNBT(ByteBufUtils.readNBT(buffer));
|
||||
NoppesUtilServer.setEditingQuest(player,quest);
|
||||
player.openGui(CustomNpcs.instance, gui , player.worldObj, 0, 0, 0);
|
||||
}
|
||||
else if(type == EnumPacketServer.TraderMarketSave){
|
||||
String market = ByteBufUtils.readString(buffer);
|
||||
if(market == null)
|
||||
return;
|
||||
boolean bo = buffer.readBoolean();
|
||||
if(npc.roleInterface instanceof RoleTrader){
|
||||
if(bo)
|
||||
Market.setMarket(npc, market);
|
||||
else
|
||||
Market.save((RoleTrader)npc.roleInterface, market);
|
||||
}
|
||||
}
|
||||
else if(type == EnumPacketServer.AnimationsGet){
|
||||
NoppesUtilServer.sendAnimationDataAll(player);
|
||||
}
|
||||
else if(type == EnumPacketServer.AnimationGet){
|
||||
Animation animation = (Animation) AnimationController.getInstance().get(buffer.readInt());
|
||||
NBTTagCompound compound = animation.writeToNBT();
|
||||
GuiDataPacket.sendGuiData(player, compound);
|
||||
}
|
||||
else if(type == EnumPacketServer.AnimationRemove){
|
||||
AnimationController.getInstance().delete(buffer.readInt());
|
||||
NoppesUtilServer.sendAnimationDataAll(player);
|
||||
NBTTagCompound compound = (new Animation()).writeToNBT();
|
||||
GuiDataPacket.sendGuiData(player, compound);
|
||||
}
|
||||
else if(type == EnumPacketServer.AnimationSave){
|
||||
Animation animation = new Animation();
|
||||
animation.readFromNBT(ByteBufUtils.readNBT(buffer));
|
||||
AnimationController.getInstance().saveAnimation(animation);
|
||||
NoppesUtilServer.sendAnimationDataAll(player);
|
||||
GuiDataPacket.sendGuiData(player, animation.writeToNBT());
|
||||
}
|
||||
else
|
||||
blockPackets(type, buffer, player);
|
||||
blockPackets(type, buffer, player);
|
||||
}
|
||||
private void mountPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException{
|
||||
if(type == EnumPacketServer.SpawnRider){
|
||||
@@ -652,19 +602,6 @@ public class PacketHandlerServer{
|
||||
compound.setTag("ShortTags", validTagList);
|
||||
GuiDataPacket.sendGuiData(player, compound);
|
||||
}
|
||||
else if (type != EnumPacketServer.NpcTagsGet && type != EnumPacketServer.TagsGet) {
|
||||
warn(player, "WE 2 tried todo something with the wrong tool, probably a hacker");
|
||||
}
|
||||
}
|
||||
|
||||
private void setTags(EntityNPCInterface npc, ByteBuf buffer) throws IOException {
|
||||
npc.advanced.tagUUIDs.removeIf(uuid -> TagController.getInstance().getTagFromUUID(uuid) != null);
|
||||
NBTTagCompound compound = ByteBufUtils.readNBT(buffer);
|
||||
NBTTagList list = compound.getTagList("TagNames",8);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
String tagName = list.getStringTagAt(i);
|
||||
npc.advanced.tagUUIDs.add(((Tag)TagController.getInstance().getTagFromName(tagName)).uuid);
|
||||
}
|
||||
}
|
||||
|
||||
private void warn(EntityPlayer player, String warning){
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.TileEntityGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.TileEntitySavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.blocks.tiles.TileBorder;
|
||||
@@ -10,27 +13,27 @@ import noppes.npcs.constants.EnumPacketServer;
|
||||
public class GuiBorderBlock extends GuiNPCInterface implements IGuiData{
|
||||
|
||||
private TileBorder tile;
|
||||
|
||||
|
||||
public GuiBorderBlock(int x, int y, int z) {
|
||||
super();
|
||||
tile = (TileBorder) player.worldObj.getTileEntity(x, y, z);
|
||||
|
||||
Client.sendData(EnumPacketServer.GetTileEntity, x, y, z);
|
||||
|
||||
PacketClient.sendClient(new TileEntityGetPacket(x, y, z));
|
||||
}
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 40, guiTop + 40, 120, 20, "Availability Options"));
|
||||
|
||||
addLabel(new GuiNpcLabel(0,"Height", guiLeft+ 1, guiTop + 76, 0xffffff));
|
||||
|
||||
addLabel(new GuiNpcLabel(0,"Height", guiLeft+ 1, guiTop + 76, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft+ 60, guiTop + 71,40,20, tile.height + ""));
|
||||
getTextField(0).integersOnly = true;
|
||||
getTextField(0).setMinMaxDefault(0, 500, 6);
|
||||
getTextField(0).setMinMaxDefault(0, 500, 6);
|
||||
|
||||
addLabel(new GuiNpcLabel(1,"Message", guiLeft+ 1, guiTop + 100, 0xffffff));
|
||||
addLabel(new GuiNpcLabel(1,"Message", guiLeft+ 1, guiTop + 100, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft+ 60, guiTop + 95,200,20, tile.message));
|
||||
|
||||
|
||||
addButton(new GuiNpcButton(0, guiLeft + 40, guiTop + 190,120,20, "Done"));
|
||||
}
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
@@ -48,10 +51,10 @@ public class GuiBorderBlock extends GuiNPCInterface implements IGuiData{
|
||||
return;
|
||||
tile.height = getTextField(0).getInteger();
|
||||
tile.message = getTextField(1).getText();
|
||||
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
tile.writeToNBT(compound);
|
||||
Client.sendData(EnumPacketServer.SaveTileEntity, compound);
|
||||
PacketClient.sendClient(new TileEntitySavePacket(compound));
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.TileEntitySavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
@@ -14,58 +16,58 @@ import noppes.npcs.constants.EnumPacketServer;
|
||||
public class GuiNpcRedstoneBlock extends GuiNPCInterface{
|
||||
|
||||
private TileRedstoneBlock tile;
|
||||
|
||||
|
||||
public GuiNpcRedstoneBlock(int x, int y, int z) {
|
||||
super();
|
||||
tile = (TileRedstoneBlock) player.worldObj.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 40, guiTop + 20, 120, 20, "availability.options"));
|
||||
|
||||
addLabel(new GuiNpcLabel(11,"gui.detailed", guiLeft+ 40, guiTop + 47, 0xffffff));
|
||||
addLabel(new GuiNpcLabel(11,"gui.detailed", guiLeft+ 40, guiTop + 47, 0xffffff));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 110, guiTop + 42, 50, 20, new String[]{"gui.no", "gui.yes"},tile.isDetailed?1:0));
|
||||
|
||||
|
||||
if(tile.isDetailed){
|
||||
addLabel(new GuiNpcLabel(0,StatCollector.translateToLocal("bard.ondistance") + " X:", guiLeft+ 1, guiTop + 76, 0xffffff));
|
||||
addLabel(new GuiNpcLabel(0,StatCollector.translateToLocal("bard.ondistance") + " X:", guiLeft+ 1, guiTop + 76, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft+ 80, guiTop + 71,30,20, tile.onRangeX + ""));
|
||||
getTextField(0).integersOnly = true;
|
||||
getTextField(0).setMinMaxDefault(0, 50, 6);
|
||||
addLabel(new GuiNpcLabel(1,"Y:", guiLeft+ 113, guiTop + 76, 0xffffff));
|
||||
getTextField(0).setMinMaxDefault(0, 50, 6);
|
||||
addLabel(new GuiNpcLabel(1,"Y:", guiLeft+ 113, guiTop + 76, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft+ 122, guiTop + 71,30,20, tile.onRangeY + ""));
|
||||
getTextField(1).integersOnly = true;
|
||||
getTextField(1).setMinMaxDefault(0, 50, 6);
|
||||
addLabel(new GuiNpcLabel(2,"Z:", guiLeft+ 155, guiTop + 76, 0xffffff));
|
||||
getTextField(1).setMinMaxDefault(0, 50, 6);
|
||||
addLabel(new GuiNpcLabel(2,"Z:", guiLeft+ 155, guiTop + 76, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft+ 164, guiTop + 71,30,20, tile.onRangeZ + ""));
|
||||
getTextField(2).integersOnly = true;
|
||||
getTextField(2).setMinMaxDefault(0, 50, 6);
|
||||
|
||||
addLabel(new GuiNpcLabel(3,StatCollector.translateToLocal("bard.offdistance") + " X:", guiLeft - 3, guiTop + 99, 0xffffff));
|
||||
|
||||
addLabel(new GuiNpcLabel(3,StatCollector.translateToLocal("bard.offdistance") + " X:", guiLeft - 3, guiTop + 99, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(3, this, fontRendererObj, guiLeft+ 80, guiTop + 94,30,20, tile.offRangeX + ""));
|
||||
getTextField(3).integersOnly = true;
|
||||
getTextField(3).setMinMaxDefault(0, 50, 10);
|
||||
addLabel(new GuiNpcLabel(4,"Y:", guiLeft+ 113, guiTop + 99, 0xffffff));
|
||||
getTextField(3).setMinMaxDefault(0, 50, 10);
|
||||
addLabel(new GuiNpcLabel(4,"Y:", guiLeft+ 113, guiTop + 99, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(4, this, fontRendererObj, guiLeft+ 122, guiTop + 94,30,20, tile.offRangeY + ""));
|
||||
getTextField(4).integersOnly = true;
|
||||
getTextField(4).setMinMaxDefault(0, 50, 10);
|
||||
addLabel(new GuiNpcLabel(5,"Z:", guiLeft+ 155, guiTop + 99, 0xffffff));
|
||||
getTextField(4).setMinMaxDefault(0, 50, 10);
|
||||
addLabel(new GuiNpcLabel(5,"Z:", guiLeft+ 155, guiTop + 99, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(5, this, fontRendererObj, guiLeft+ 164, guiTop + 94,30,20, tile.offRangeZ + ""));
|
||||
getTextField(5).integersOnly = true;
|
||||
getTextField(5).setMinMaxDefault(0, 50, 10);
|
||||
}
|
||||
else{
|
||||
addLabel(new GuiNpcLabel(0,"bard.ondistance", guiLeft+ 1, guiTop + 76, 0xffffff));
|
||||
addLabel(new GuiNpcLabel(0,"bard.ondistance", guiLeft+ 1, guiTop + 76, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft+ 80, guiTop + 71,30,20, tile.onRange + ""));
|
||||
getTextField(0).integersOnly = true;
|
||||
getTextField(0).setMinMaxDefault(0, 50, 6);
|
||||
|
||||
addLabel(new GuiNpcLabel(3,"bard.offdistance", guiLeft - 3, guiTop + 99, 0xffffff));
|
||||
getTextField(0).setMinMaxDefault(0, 50, 6);
|
||||
|
||||
addLabel(new GuiNpcLabel(3,"bard.offdistance", guiLeft - 3, guiTop + 99, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(3, this, fontRendererObj, guiLeft+ 80, guiTop + 94,30,20, tile.offRange + ""));
|
||||
getTextField(3).integersOnly = true;
|
||||
getTextField(3).setMinMaxDefault(0, 50, 10);
|
||||
getTextField(3).setMinMaxDefault(0, 50, 10);
|
||||
}
|
||||
addButton(new GuiNpcButton(0, guiLeft + 40, guiTop + 190,120,20, "Done"));
|
||||
}
|
||||
@@ -96,7 +98,7 @@ public class GuiNpcRedstoneBlock extends GuiNPCInterface{
|
||||
tile.offRangeX = getTextField(3).getInteger();
|
||||
tile.offRangeY = getTextField(4).getInteger();
|
||||
tile.offRangeZ = getTextField(5).getInteger();
|
||||
|
||||
|
||||
if(tile.onRangeX > tile.offRangeX)
|
||||
tile.offRangeX = tile.onRangeX;
|
||||
if(tile.onRangeY > tile.offRangeY)
|
||||
@@ -111,10 +113,10 @@ public class GuiNpcRedstoneBlock extends GuiNPCInterface{
|
||||
tile.offRange = tile.onRange;
|
||||
}
|
||||
tile.isActivated = false;
|
||||
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
tile.writeToNBT(compound);
|
||||
Client.sendData(EnumPacketServer.SaveTileEntity, compound);
|
||||
PacketClient.sendClient(new TileEntitySavePacket(compound));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.TileEntitySavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.blocks.tiles.TileWaypoint;
|
||||
@@ -13,7 +15,7 @@ import noppes.npcs.constants.EnumPacketServer;
|
||||
public class GuiNpcWaypoint extends GuiNPCInterface{
|
||||
|
||||
private TileWaypoint tile;
|
||||
|
||||
|
||||
public GuiNpcWaypoint(int x, int y, int z) {
|
||||
super();
|
||||
tile = (TileWaypoint) player.worldObj.getTileEntity(x, y, z);
|
||||
@@ -23,11 +25,11 @@ public class GuiNpcWaypoint extends GuiNPCInterface{
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
|
||||
addLabel(new GuiNpcLabel(0,"gui.name", guiLeft+ 1, guiTop + 76, 0xffffff));
|
||||
|
||||
addLabel(new GuiNpcLabel(0,"gui.name", guiLeft+ 1, guiTop + 76, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft+ 60, guiTop + 71,200,20, tile.name));
|
||||
|
||||
addLabel(new GuiNpcLabel(1,"gui.range", guiLeft+ 1, guiTop + 97, 0xffffff));
|
||||
|
||||
addLabel(new GuiNpcLabel(1,"gui.range", guiLeft+ 1, guiTop + 97, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft+ 60, guiTop + 92,200,20, tile.range + ""));
|
||||
getTextField(1).integersOnly = true;
|
||||
getTextField(1).setMinMaxDefault(2, 60, 10);
|
||||
@@ -43,10 +45,10 @@ public class GuiNpcWaypoint extends GuiNPCInterface{
|
||||
public void save() {
|
||||
tile.name = getTextField(0).getText();
|
||||
tile.range = getTextField(1).getInteger();
|
||||
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
tile.writeToNBT(compound);
|
||||
Client.sendData(EnumPacketServer.SaveTileEntity, compound);
|
||||
PacketClient.sendClient(new TileEntitySavePacket(compound));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,18 +1,15 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagsGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagsNpcGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagSetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.TagController;
|
||||
import noppes.npcs.controllers.data.Tag;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -33,8 +30,8 @@ public class SubGuiClonerNPCTags extends SubGuiInterface implements IGuiData,ISc
|
||||
{
|
||||
this.parent = guiNpcMobSpawnerAdd;
|
||||
this.mobSpawnerAdd = guiNpcMobSpawnerAdd;
|
||||
Client.sendData(EnumPacketServer.TagsGet);
|
||||
Client.sendData(EnumPacketServer.NpcTagsGet);
|
||||
PacketClient.sendClient(new TagsGetPacket());
|
||||
PacketClient.sendClient(new TagsNpcGetPacket());
|
||||
setBackground("menubg.png");
|
||||
xSize = 305;
|
||||
ySize = 220;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.quest.QuestOpenGuiPacket;
|
||||
import kamkeel.npcs.network.packets.request.quest.QuestSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -103,7 +104,7 @@ public class SubGuiNpcQuest extends SubGuiInterface implements ISubGuiListener,
|
||||
setSubGui(new SubGuiNpcTextArea(quest.logText));
|
||||
}
|
||||
if(button.id == 5 && quest.id >= 0){
|
||||
Client.sendData(EnumPacketServer.QuestOpenGui, EnumGuiType.QuestReward, quest.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new QuestOpenGuiPacket(EnumGuiType.QuestReward, quest.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
if(button.id == 6 && quest.id >= 0){
|
||||
quest.setType(EnumQuestType.values()[button.getValue()]);
|
||||
@@ -111,7 +112,7 @@ public class SubGuiNpcQuest extends SubGuiInterface implements ISubGuiListener,
|
||||
if(button.id == 7)
|
||||
{
|
||||
if(quest.type == EnumQuestType.Item)
|
||||
Client.sendData(EnumPacketServer.QuestOpenGui, EnumGuiType.QuestItem, quest.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new QuestOpenGuiPacket(EnumGuiType.QuestItem, quest.writeToNBT(new NBTTagCompound())));
|
||||
|
||||
if(quest.type == EnumQuestType.Dialog)
|
||||
setSubGui(new GuiNpcQuestTypeDialog(npc, quest, this));
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package noppes.npcs.client.gui.advanced;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagsGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagsNpcGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagSetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -28,8 +28,8 @@ public class GuiNPCTagSetup extends GuiNPCInterface2 implements IScrollData,ICus
|
||||
public GuiNPCTagSetup(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
Client.sendData(EnumPacketServer.TagsGet);
|
||||
Client.sendData(EnumPacketServer.NpcTagsGet);
|
||||
PacketClient.sendClient(new TagsGetPacket());
|
||||
PacketClient.sendClient(new TagsNpcGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.animation.AnimationSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import noppes.npcs.client.Client;
|
||||
@@ -585,7 +587,7 @@ public class GuiNPCEditAnimation extends GuiModelInterface implements ITextfield
|
||||
public void close() {
|
||||
if (!this.hasSubGui()) {
|
||||
if (animation != null) {
|
||||
Client.sendData(EnumPacketServer.AnimationSave, animation.writeToNBT());
|
||||
PacketClient.sendClient(new AnimationSavePacket(animation.writeToNBT()));
|
||||
}
|
||||
displayGuiScreen(parent);
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.animation.AnimationGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.animation.AnimationRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.animation.AnimationSavePacket;
|
||||
import kamkeel.npcs.network.packets.request.animation.AnimationsGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
@@ -33,7 +38,7 @@ public class GuiNPCManageAnimations extends GuiModelInterface2 implements IScrol
|
||||
this.setSave(save);
|
||||
this.xOffset = -148 + 70;
|
||||
this.yOffset = -170 + 137;
|
||||
Client.sendData(EnumPacketServer.AnimationsGet);
|
||||
PacketClient.sendClient(new AnimationsGetPacket());
|
||||
|
||||
AnimationData data = npc.display.animationData;
|
||||
data.setEnabled(true);
|
||||
@@ -164,7 +169,7 @@ public class GuiNPCManageAnimations extends GuiModelInterface2 implements IScrol
|
||||
while(data.containsKey(name))
|
||||
name += "_";
|
||||
Animation animation = new Animation(-1, name);
|
||||
Client.sendData(EnumPacketServer.AnimationSave, animation.writeToNBT());
|
||||
PacketClient.sendClient(new AnimationSavePacket(animation.writeToNBT()));
|
||||
}
|
||||
if(button.id == 1){
|
||||
if(data.containsKey(scrollAnimations.getSelected())) {
|
||||
@@ -234,13 +239,13 @@ public class GuiNPCManageAnimations extends GuiModelInterface2 implements IScrol
|
||||
if(guiCustomScroll.id == 0)
|
||||
{
|
||||
selected = scrollAnimations.getSelected();
|
||||
Client.sendData(EnumPacketServer.AnimationGet, data.get(selected));
|
||||
PacketClient.sendClient(new AnimationGetPacket(data.get(selected)));
|
||||
}
|
||||
}
|
||||
|
||||
public void save() {
|
||||
if(selected != null && data.containsKey(selected) && animation != null){
|
||||
Client.sendData(EnumPacketServer.AnimationSave, animation.writeToNBT());
|
||||
PacketClient.sendClient(new AnimationSavePacket(animation.writeToNBT()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,7 +277,7 @@ public class GuiNPCManageAnimations extends GuiModelInterface2 implements IScrol
|
||||
return;
|
||||
if(id == 1) {
|
||||
if(data.containsKey(scrollAnimations.getSelected())) {
|
||||
Client.sendData(EnumPacketServer.AnimationRemove, data.get(selected));
|
||||
PacketClient.sendClient(new AnimationRemovePacket(data.get(selected)));
|
||||
scrollAnimations.clear();
|
||||
animation = new Animation();
|
||||
initGui();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagsGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
@@ -28,7 +29,7 @@ public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,IC
|
||||
public GuiNPCManageTags(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
Client.sendData(EnumPacketServer.TagsGet);
|
||||
PacketClient.sendClient(new TagsGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package noppes.npcs.client.gui.roles;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.TraderMarketSavePacket;
|
||||
import kamkeel.npcs.network.packets.request.role.RoleSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -87,7 +88,7 @@ public class GuiNpcTraderSetup extends GuiContainerNPCInterface2 implements ITex
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
Client.sendData(EnumPacketServer.TraderMarketSave, role.marketName, false);
|
||||
PacketClient.sendClient(new TraderMarketSavePacket(role.marketName, false));
|
||||
PacketClient.sendClient(new RoleSavePacket(role.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
|
||||
@@ -96,8 +97,7 @@ public class GuiNpcTraderSetup extends GuiContainerNPCInterface2 implements ITex
|
||||
String name = guiNpcTextField.getText();
|
||||
if(!name.equalsIgnoreCase(role.marketName)){
|
||||
role.marketName = name;
|
||||
Client.sendData(EnumPacketServer.TraderMarketSave, role.marketName, true);
|
||||
}
|
||||
|
||||
PacketClient.sendClient(new TraderMarketSavePacket(role.marketName, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,9 +44,7 @@ public enum EnumPacketServer {
|
||||
|
||||
FactionsGet,
|
||||
FactionGet,
|
||||
TagsGet,
|
||||
TagGet,
|
||||
NpcTagsGet,
|
||||
QuestCategoriesGet,
|
||||
QuestRemove(CustomNpcsPermissions.GLOBAL_QUEST),
|
||||
QuestRewardSave(CustomNpcsPermissions.GLOBAL_QUEST),
|
||||
@@ -56,14 +54,14 @@ public enum EnumPacketServer {
|
||||
SpawnRider(CustomNpcsPermissions.TOOL_MOUNTER),
|
||||
MovingPathSave(CustomNpcsPermissions.TOOL_PATHER,true), MovingPathGet(true),
|
||||
|
||||
AnimationsGet, AnimationGet,
|
||||
AnimationRemove(CustomNpcsPermissions.GLOBAL_ANIMATION), AnimationSave(CustomNpcsPermissions.GLOBAL_ANIMATION),
|
||||
|
||||
QuestOpenGui, QuestLogToServer, PartyLogToServer, UntrackQuest,
|
||||
QuestLogToServer,
|
||||
PartyLogToServer,
|
||||
UntrackQuest,
|
||||
|
||||
QuestGet,
|
||||
SaveTileEntity,
|
||||
DimensionTeleport, GetTileEntity, IsGuiOpen,
|
||||
DimensionTeleport,
|
||||
GetTileEntity,
|
||||
IsGuiOpen,
|
||||
|
||||
SavePartyData, CreateParty, GetPartyData, DisbandParty, KickPlayer, LeavePlayer, PartyInvite, GetPartyInviteList, AcceptInvite,
|
||||
IgnoreInvite, SetPartyLeader, SetPartyQuest,
|
||||
|
||||
Reference in new issue
Block a user