mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 17:19:05 +00:00
Complete Block & Wand Packets
This commit is contained in:
1 parent
f314d9d826
commit
b0e4d555ce
13 files changed
+267
-64
No files matched your search
@@ -80,8 +80,6 @@ public class PacketHandlerServer{
|
||||
clonePackets(type, in, player);
|
||||
else if (item.getItem() == CustomItems.teleporter)
|
||||
featherPackets(type, in, player);
|
||||
else if (item.getItem() == Item.getItemFromBlock(CustomItems.waypoint) || item.getItem() == Item.getItemFromBlock(CustomItems.border) || item.getItem() == Item.getItemFromBlock(CustomItems.redstoneBlock))
|
||||
blockPackets(type, in, player);
|
||||
else if (ConfigScript.canScript(player, CustomNpcsPermissions.SCRIPT)) {
|
||||
if (type == EnumPacketServer.EventScriptDataGet || type == EnumPacketServer.EventScriptDataSave)
|
||||
npcEventScriptPackets(type, in, player, npc);
|
||||
@@ -362,37 +360,6 @@ public class PacketHandlerServer{
|
||||
}
|
||||
}
|
||||
|
||||
private void blockPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException {
|
||||
if(type == EnumPacketServer.QuestsGetFromQuest){
|
||||
Quest quest = QuestController.Instance.quests.get(buffer.readInt());
|
||||
if(quest == null)
|
||||
return;
|
||||
NoppesUtilServer.sendQuestData(player,quest.category);
|
||||
}
|
||||
else if(type == EnumPacketServer.QuestCategoriesGet){
|
||||
NoppesUtilServer.sendQuestCategoryData(player);
|
||||
}
|
||||
else if(type == EnumPacketServer.QuestsGet){
|
||||
QuestCategory category = QuestController.Instance.categories.get(buffer.readInt());
|
||||
boolean sendGroup = buffer.readBoolean();
|
||||
if(sendGroup){
|
||||
NoppesUtilServer.sendQuestGroup(player,category);
|
||||
}
|
||||
else {
|
||||
NoppesUtilServer.sendQuestData(player,category);
|
||||
}
|
||||
}
|
||||
else if(type == EnumPacketServer.FactionsGet){
|
||||
NoppesUtilServer.sendFactionDataAll(player);
|
||||
}
|
||||
else if(type == EnumPacketServer.FactionGet){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
Faction faction = FactionController.getInstance().get(buffer.readInt());
|
||||
faction.writeNBT(compound);
|
||||
GuiDataPacket.sendGuiData(player, compound);
|
||||
}
|
||||
}
|
||||
|
||||
private void mountPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException{
|
||||
if(type == EnumPacketServer.SpawnRider){
|
||||
Entity entity = EntityList.createEntityFromNBT(ByteBufUtils.readNBT(buffer), player.worldObj);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.faction.FactionsGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import noppes.npcs.client.Client;
|
||||
@@ -28,7 +30,7 @@ public class GuiNPCFactionSelection extends GuiNPCInterface implements IScrollDa
|
||||
this.parent = parent;
|
||||
this.factionId = dialog;
|
||||
|
||||
Client.sendData(EnumPacketServer.FactionsGet);
|
||||
PacketClient.sendClient(new FactionsGetPacket());
|
||||
|
||||
if(parent instanceof GuiSelectionListener){
|
||||
listener = (GuiSelectionListener) parent;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.packets.request.faction.FactionGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
@@ -11,11 +12,11 @@ import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.data.Availability;
|
||||
import noppes.npcs.controllers.data.Faction;
|
||||
|
||||
public class SubGuiNpcAvailability extends SubGuiInterface implements ITextfieldListener, GuiSelectionListener, IGuiData
|
||||
public class SubGuiNpcAvailability extends SubGuiInterface implements ITextfieldListener, GuiSelectionListener, IGuiData
|
||||
{
|
||||
private Availability availabitily;
|
||||
private int slot = 0;
|
||||
|
||||
|
||||
public SubGuiNpcAvailability(Availability availabitily)
|
||||
{
|
||||
this.availabitily = availabitily;
|
||||
@@ -34,14 +35,14 @@ public class SubGuiNpcAvailability extends SubGuiInterface implements ITextfield
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 34, guiTop + 12, 180, 20, "availability.selectdialog"));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 34, guiTop + 35, 180, 20, "availability.selectquest"));
|
||||
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(20, guiLeft + 4, guiTop + 104, 50, 20, new String[]{"availability.always","availability.is","availability.isnot"},availabitily.factionAvailable.ordinal()));
|
||||
this.addButton(new GuiNpcButton(22, guiLeft + 56, guiTop + 104, 60, 20, new String[]{"faction.friendly","faction.neutral","faction.unfriendly"},availabitily.factionStance.ordinal()));
|
||||
this.addButton(new GuiNpcButton(21, guiLeft + 118, guiTop + 104, 110, 20, "availability.selectfaction"));
|
||||
getButton(21).setEnabled(availabitily.factionAvailable != EnumAvailabilityFactionType.Always);
|
||||
getButton(22).setEnabled(availabitily.factionAvailable != EnumAvailabilityFactionType.Always);
|
||||
this.addButton(new GuiNpcButton(23, guiLeft + 230, guiTop + 104,20, 20, "X"));
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(24, guiLeft + 4, guiTop + 126, 50, 20, new String[]{"availability.always","availability.is","availability.isnot"},availabitily.faction2Available.ordinal()));
|
||||
this.addButton(new GuiNpcButton(27, guiLeft + 56, guiTop + 126, 60, 20, new String[]{"faction.friendly","faction.neutral","faction.unfriendly"},availabitily.faction2Stance.ordinal()));
|
||||
this.addButton(new GuiNpcButton(25, guiLeft + 118, guiTop + 126, 110, 20, "availability.selectfaction"));
|
||||
@@ -56,19 +57,19 @@ public class SubGuiNpcAvailability extends SubGuiInterface implements ITextfield
|
||||
this.addTextField(new GuiNpcTextField(51, this, fontRendererObj, guiLeft + 50, guiTop + 170,90, 20, availabitily.minPlayerLevel + ""));
|
||||
this.getTextField(51).integersOnly = true;
|
||||
this.getTextField(51).setMinMaxDefault(0, Integer.MAX_VALUE, 0);
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 192,98, 20, "gui.done"));
|
||||
|
||||
|
||||
updateGuiButtons();
|
||||
}
|
||||
|
||||
|
||||
private void updateGuiButtons() {
|
||||
if(availabitily.factionId >= 0){
|
||||
Client.sendData(EnumPacketServer.FactionGet, availabitily.factionId);
|
||||
FactionGetPacket.getFaction(availabitily.factionId);
|
||||
}
|
||||
if(availabitily.faction2Id >= 0){
|
||||
Client.sendData(EnumPacketServer.FactionGet, availabitily.faction2Id);
|
||||
FactionGetPacket.getFaction(availabitily.faction2Id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.faction.FactionsGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.Client;
|
||||
@@ -15,9 +17,9 @@ public class SubGuiNpcFactionOptions extends SubGuiInterface implements IScrollD
|
||||
private FactionOptions options;
|
||||
private HashMap<String,Integer> data = new HashMap<String,Integer>();
|
||||
private GuiCustomScroll scrollFactions;
|
||||
|
||||
|
||||
private int selected = -1;
|
||||
|
||||
|
||||
public SubGuiNpcFactionOptions(FactionOptions options)
|
||||
{
|
||||
this.options = options;
|
||||
@@ -25,7 +27,7 @@ public class SubGuiNpcFactionOptions extends SubGuiInterface implements IScrollD
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
Client.sendData(EnumPacketServer.FactionsGet);
|
||||
PacketClient.sendClient(new FactionsGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
@@ -42,7 +44,7 @@ public class SubGuiNpcFactionOptions extends SubGuiInterface implements IScrollD
|
||||
addLabel(new GuiNpcLabel(0, "1: ", guiLeft + 4, guiTop + 12));
|
||||
if(data.containsValue(options.factionId)){
|
||||
addLabel(new GuiNpcLabel(1, getFactionName(options.factionId), guiLeft + 12, guiTop + 8));
|
||||
|
||||
|
||||
String label = "";
|
||||
if(options.decreaseFactionPoints)
|
||||
label += StatCollector.translateToLocal("gui.decrease");
|
||||
@@ -69,14 +71,14 @@ public class SubGuiNpcFactionOptions extends SubGuiInterface implements IScrollD
|
||||
addButton(new GuiNpcButton(1, guiLeft + 110, guiTop + 35, 20, 20, "X"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(selected >= 0 && (!data.containsValue(options.faction2Id) || !data.containsValue(options.factionId)) && !options.hasFaction(selected)){
|
||||
addButton(new GuiNpcButton(2, guiLeft + 4, guiTop + 60, 90, 20, new String[]{"gui.increase","gui.decrease"},0));
|
||||
|
||||
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 4, guiTop + 82, 110, 20, "10"));
|
||||
getTextField(1).integersOnly = true;
|
||||
getTextField(1).setMinMaxDefault(1, 100000, 10);
|
||||
|
||||
|
||||
addButton(new GuiNpcButton(3, guiLeft + 4, guiTop + 104, 60, 20, "gui.add"));
|
||||
}
|
||||
|
||||
@@ -88,7 +90,7 @@ public class SubGuiNpcFactionOptions extends SubGuiInterface implements IScrollD
|
||||
return s;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
@@ -135,16 +137,16 @@ public class SubGuiNpcFactionOptions extends SubGuiInterface implements IScrollD
|
||||
String name = scroll.getSelected();
|
||||
this.data = data;
|
||||
scroll.setList(list);
|
||||
|
||||
|
||||
if(name != null)
|
||||
scroll.setSelected(name);
|
||||
|
||||
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package noppes.npcs.client.gui.advanced;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.faction.FactionSetPacket;
|
||||
import kamkeel.npcs.network.packets.request.faction.FactionsGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -22,7 +23,7 @@ public class GuiNPCFactionSetup extends GuiNPCInterface2 implements IScrollData,
|
||||
public GuiNPCFactionSetup(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
Client.sendData(EnumPacketServer.FactionsGet);
|
||||
PacketClient.sendClient(new FactionsGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.faction.FactionGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.faction.FactionRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.faction.FactionSavePacket;
|
||||
import kamkeel.npcs.network.packets.request.faction.FactionsGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
@@ -31,7 +33,7 @@ public class GuiNPCManageFactions extends GuiNPCInterface2 implements IScrollDat
|
||||
public GuiNPCManageFactions(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
Client.sendData(EnumPacketServer.FactionsGet);
|
||||
PacketClient.sendClient(new FactionsGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
@@ -189,7 +191,7 @@ public class GuiNPCManageFactions extends GuiNPCInterface2 implements IScrollDat
|
||||
{
|
||||
save();
|
||||
selected = scrollFactions.getSelected();
|
||||
Client.sendData(EnumPacketServer.FactionGet, data.get(selected));
|
||||
FactionGetPacket.getFaction(data.get(selected));
|
||||
}
|
||||
else if(guiCustomScroll.id == 1)
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollGroup,
|
||||
super(npc);
|
||||
Instance = this;
|
||||
quest = new Quest();
|
||||
Client.sendData(EnumPacketServer.QuestCategoriesGet);
|
||||
PacketClient.sendClient(new QuestCategoriesGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
@@ -283,7 +283,7 @@ public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollGroup,
|
||||
else {
|
||||
category.readNBT(compound);
|
||||
setPrevCatName(category.title);
|
||||
Client.sendData(EnumPacketServer.QuestsGet, category.id, true);
|
||||
PacketClient.sendClient(new QuestsGetPacket(category.id, true));
|
||||
resetQuestList();
|
||||
}
|
||||
initGui();
|
||||
|
||||
@@ -39,9 +39,6 @@ public enum EnumPacketServer {
|
||||
|
||||
FactionsGet,
|
||||
FactionGet,
|
||||
QuestCategoriesGet,
|
||||
QuestsGetFromQuest,
|
||||
QuestsGet,
|
||||
PlayerRider(CustomNpcsPermissions.TOOL_MOUNTER),
|
||||
SpawnRider(CustomNpcsPermissions.TOOL_MOUNTER),
|
||||
MovingPathSave(CustomNpcsPermissions.TOOL_PATHER,true),
|
||||
|
||||
Reference in new issue
Block a user