From 7841b17d0343e930f5047b0ceaa7675326a823c7 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sat, 22 Aug 2015 00:38:37 +1200 Subject: [PATCH] Add PacketPlayOutCamera for locking view to entity --- .../core/packethandler/PacketHandler.java | 3 +- .../packethandler/PacketPlayOutCamera.java | 44 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayOutCamera.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java index 008aa8f1f..056b75877 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java @@ -50,7 +50,8 @@ public class PacketHandler extends MiniPlugin Method method = ProtocolInjector.class.getDeclaredMethod("addPacket", EnumProtocol.class,boolean.class, int.class, Class.class); method.setAccessible(true); - + + method.invoke(null, EnumProtocol.PLAY, true, 67, PacketPlayOutCamera.class); method.invoke(null, EnumProtocol.PLAY, true, 68, PacketPlayOutWorldBorder.class); // EnumProtocol.PLAY.b().put(68, PacketPlayOutWorldBorder.class); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayOutCamera.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayOutCamera.java new file mode 100644 index 000000000..11dd54051 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayOutCamera.java @@ -0,0 +1,44 @@ +package mineplex.core.packethandler; + +import org.bukkit.entity.Entity; + +import net.minecraft.server.v1_7_R4.Packet; +import net.minecraft.server.v1_7_R4.PacketDataSerializer; +import net.minecraft.server.v1_7_R4.PacketListener; + +public class PacketPlayOutCamera extends Packet +{ + public int a; + + public PacketPlayOutCamera() + { + } + + public PacketPlayOutCamera(int id) + { + a = id; + } + + public PacketPlayOutCamera(Entity paramEntity) + { + this.a = paramEntity.getEntityId(); + } + + public void a(PacketDataSerializer paramPacketDataSerializer) + { + } + + public void b(PacketDataSerializer paramPacketDataSerializer) + { + paramPacketDataSerializer.b(this.a); + } + + public void a(PacketListener paramPacketListenerPlayOut) + { + } + + @Override + public void handle(PacketListener arg0) + { + } +} \ No newline at end of file