Merge remote-tracking branch 'upstream/packet' into packet

This commit is contained in:
somehussar committed 2025-02-03 03:23:54 +01:00
commit a2a3d94de6
10 files changed
+394 -115

No files matched your search

@@ -1,5 +1,9 @@
package noppes.npcs.client.gui;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.clone.CloneListPacket;
import kamkeel.npcs.network.packets.request.clone.MobSpawnerPacket;
import kamkeel.npcs.network.packets.request.clone.SpawnMobPacket;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.Entity;
@@ -188,7 +192,7 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData {
private void showClones() {
if(showingClones == 2){
Client.sendData(EnumPacketServer.CloneTagList, activeTab);
Client.sendData(EnumPacketServer.CloneList, activeTab);
PacketClient.sendClient(new CloneListPacket(activeTab));
return;
}
@@ -377,14 +381,14 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData {
String sel = scroll.getSelected();
if(sel == null)
return;
Client.sendData(EnumPacketServer.SpawnMob, true, posX, posY, posZ, sel, activeTab);
SpawnMobPacket.Server(posX, posY, posZ, sel, activeTab);
close();
}
else{
NBTTagCompound compound = getCompound();
if(compound == null)
return;
Client.sendData(EnumPacketServer.SpawnMob, false, posX, posY, posZ, compound);
SpawnMobPacket.Client(posX, posY, posZ, compound);
close();
}
}
@@ -393,14 +397,14 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData {
String sel = scroll.getSelected();
if(sel == null)
return;
Client.sendData(EnumPacketServer.MobSpawner, true, posX, posY, posZ, sel, activeTab);
MobSpawnerPacket.Server(posX, posY, posZ, sel, activeTab);
close();
}
else{
NBTTagCompound compound = getCompound();
if(compound == null)
return;
Client.sendData(EnumPacketServer.MobSpawner, false, posX, posY, posZ, compound);
MobSpawnerPacket.Client(posX, posY, posZ, compound);
close();
}
@@ -534,4 +538,4 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData {
}
}
}
}
@@ -1,6 +1,8 @@
package noppes.npcs.client.gui;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.MountPacket;
import kamkeel.npcs.network.packets.request.clone.CloneListPacket;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.Entity;
@@ -117,7 +119,7 @@ public class GuiNpcMobSpawnerMounter extends GuiNPCInterface implements IGuiData
private void showClones() {
if(showingClones == 2){
Client.sendData(EnumPacketServer.CloneList, activeTab);
PacketClient.sendClient(new CloneListPacket(activeTab));
return;
}
@@ -1,5 +1,7 @@
package noppes.npcs.client.gui;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.clone.CloneListPacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagDouble;
@@ -13,24 +15,24 @@ import java.util.ArrayList;
import java.util.List;
public class GuiNpcMobSpawnerSelector extends SubGuiInterface implements IGuiData{
private GuiCustomScroll scroll;
private List<String> list;
private static String search = "";
public int activeTab = 1;
public boolean isServer = false;
public GuiNpcMobSpawnerSelector() {
super();
xSize = 256;
this.closeOnEsc = true;
setBackground("menubg.png");
}
public void initGui(){
super.initGui();
super.initGui();
if(scroll == null){
scroll = new GuiCustomScroll(this,0);
scroll.setSize(165, 188);
@@ -40,7 +42,7 @@ public class GuiNpcMobSpawnerSelector extends SubGuiInterface implements IGuiDat
scroll.guiLeft = guiLeft + 4;
scroll.guiTop = guiTop + 26;
addScroll(scroll);
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 4, guiTop + 4, 165, 20, search));
addButton(new GuiNpcButton(0, guiLeft + 171, guiTop + 80, 80, 20, "gui.done"));
@@ -61,30 +63,30 @@ public class GuiNpcMobSpawnerSelector extends SubGuiInterface implements IGuiDat
addSideButton(new GuiMenuSideButton(33,guiLeft - 90, this.guiTop + 170, 45,22, "13"));
addSideButton(new GuiMenuSideButton(34,guiLeft - 45, this.guiTop + 191, 45,22, "14"));
addSideButton(new GuiMenuSideButton(35,guiLeft - 90, this.guiTop + 191, 45,22, "15"));
getSideButton(20 + activeTab).active = true;
showClones();
}
public String getSelected(){
return scroll.getSelected();
}
private void showClones() {
if(isServer){
Client.sendData(EnumPacketServer.CloneList, activeTab);
PacketClient.sendClient(new CloneListPacket(activeTab));
return;
}
ArrayList<String> list = new ArrayList<String>();
this.list = new ArrayList<String>(ClientCloneController.Instance.getClones(activeTab));
scroll.setList(getSearchList());
}
public void keyTyped(char c, int i)
{
super.keyTyped(c, i);
if(search.equals(getTextField(1).getText()))
return;
search = getTextField(1).getText().toLowerCase();
@@ -109,7 +111,7 @@ public class GuiNpcMobSpawnerSelector extends SubGuiInterface implements IGuiDat
compound.setString("ClonedName", sel);
return compound;
}
public void buttonEvent(GuiButton guibutton)
{
int id = guibutton.id;
@@ -139,11 +141,11 @@ public class GuiNpcMobSpawnerSelector extends SubGuiInterface implements IGuiDat
return nbttaglist;
}
@Override
public void save() {
// TODO Auto-generated method stub
}