mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-28 02:05:39 +00:00
ScreenSize packet
This commit is contained in:
1 parent
e6e860b895
commit
021989aa79
6 files changed
+62
-12
No files matched your search
@@ -352,6 +352,8 @@ public class PacketHandler {
|
||||
PLAYER_PACKET.registerPacket(new MailActionPacket.MailSendPacket());
|
||||
|
||||
PLAYER_PACKET.registerPacket(new InputDevicePacket());
|
||||
|
||||
PLAYER_PACKET.registerPacket(new ScreenSizePacket());
|
||||
}
|
||||
|
||||
private void registerChannels() {
|
||||
|
||||
@@ -9,15 +9,12 @@ public enum EnumPlayerPacket {
|
||||
TrackedQuest, // TODO
|
||||
CheckQuestCompletion, // TODO
|
||||
FactionsGet, // TODO
|
||||
MailBoxAction, // TODO: Get, Delete, Send, Read, OpenMail
|
||||
MailBoxAction,
|
||||
MailSend,
|
||||
SaveSign, // TODO
|
||||
SaveBook, // TODO
|
||||
Companion, // TODO: OpenInv, TalentExp
|
||||
RoleGet, // TODO
|
||||
InputDevice,
|
||||
ScreenSize; // TODO
|
||||
|
||||
|
||||
|
||||
ScreenSize
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package kamkeel.npcs.network.packets.player;
|
||||
|
||||
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.EnumPlayerPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ScreenSizePacket extends AbstractPacket {
|
||||
public static final String packetName = "Player|ScreenSize";
|
||||
private int width, height;
|
||||
|
||||
public ScreenSizePacket() {
|
||||
}
|
||||
|
||||
public ScreenSizePacket(int width, int height){
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getType() {
|
||||
return EnumPlayerPacket.ScreenSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketChannel getChannel() {
|
||||
return PacketHandler.PLAYER_PACKET;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void sendData(ByteBuf out) throws IOException {
|
||||
out.writeInt(width);
|
||||
out.writeInt(height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
|
||||
int width = in.readInt(), height = in.readInt();
|
||||
PlayerDataController.Instance.getPlayerData(player).screenSize.setSize(width,height);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user