Create teleport packet manually, return ID without checking in

getIdNMS(), update version info.
This commit is contained in:
filoghost 2015-08-21 12:35:53 +02:00
parent 9b539eb625
commit 28c5f3062e
8 changed files with 74 additions and 18 deletions

View File

@ -133,7 +133,7 @@ public class HolographicDisplays extends JavaPlugin {
"******************************************************",
" This version of HolographicDisplays can",
" only work on these server versions:",
" from 1.6.4 to 1.8.4.",
" from 1.6.4 to 1.8.7.",
" The plugin will be disabled.",
"******************************************************"
);

View File

@ -11,6 +11,7 @@ import net.minecraft.server.v1_7_R1.NBTTagCompound;
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_7_R1.World;
import net.minecraft.server.v1_7_R1.EntityPlayer;
import net.minecraft.server.v1_7_R1.MathHelper;
public class EntityNMSWitherSkull extends EntityWitherSkull implements NMSWitherSkull {
@ -120,7 +121,14 @@ public class EntityNMSWitherSkull extends EntityWitherSkull implements NMSWither
super.setPosition(x, y, z);
// Send a packet near to update the position.
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(
getIdNMS(),
MathHelper.floor(this.locX * 32.0D),
MathHelper.floor(this.locY * 32.0D),
MathHelper.floor(this.locZ * 32.0D),
(byte) (int) (this.yaw * 256.0F / 360.0F),
(byte) (int) (this.pitch * 256.0F / 360.0F)
);
for (Object obj : this.world.players) {
if (obj instanceof EntityPlayer) {
@ -141,7 +149,7 @@ public class EntityNMSWitherSkull extends EntityWitherSkull implements NMSWither
@Override
public int getIdNMS() {
return this.getId();
return super.getId(); // Return the real ID without checking the stack trace.
}
@Override

View File

@ -5,6 +5,7 @@ import net.minecraft.server.v1_7_R2.EntityWitherSkull;
import net.minecraft.server.v1_7_R2.NBTTagCompound;
import net.minecraft.server.v1_7_R2.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_7_R2.World;
import net.minecraft.server.v1_7_R2.MathHelper;
import org.bukkit.craftbukkit.v1_7_R2.entity.CraftEntity;
@ -122,7 +123,14 @@ public class EntityNMSWitherSkull extends EntityWitherSkull implements NMSWither
super.setPosition(x, y, z);
// Send a packet near to update the position.
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(
getIdNMS(),
MathHelper.floor(this.locX * 32.0D),
MathHelper.floor(this.locY * 32.0D),
MathHelper.floor(this.locZ * 32.0D),
(byte) (int) (this.yaw * 256.0F / 360.0F),
(byte) (int) (this.pitch * 256.0F / 360.0F)
);
for (Object obj : this.world.players) {
if (obj instanceof EntityPlayer) {
@ -143,7 +151,7 @@ public class EntityNMSWitherSkull extends EntityWitherSkull implements NMSWither
@Override
public int getIdNMS() {
return this.getId();
return super.getId(); // Return the real ID without checking the stack trace.
}
@Override

View File

@ -11,6 +11,7 @@ import net.minecraft.server.v1_7_R3.NBTTagCompound;
import net.minecraft.server.v1_7_R3.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_7_R3.World;
import net.minecraft.server.v1_7_R3.EntityPlayer;
import net.minecraft.server.v1_7_R3.MathHelper;
public class EntityNMSWitherSkull extends EntityWitherSkull implements NMSWitherSkull {
@ -120,7 +121,14 @@ public class EntityNMSWitherSkull extends EntityWitherSkull implements NMSWither
super.setPosition(x, y, z);
// Send a packet near to update the position.
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(
getIdNMS(),
MathHelper.floor(this.locX * 32.0D),
MathHelper.floor(this.locY * 32.0D),
MathHelper.floor(this.locZ * 32.0D),
(byte) (int) (this.yaw * 256.0F / 360.0F),
(byte) (int) (this.pitch * 256.0F / 360.0F)
);
for (Object obj : this.world.players) {
if (obj instanceof EntityPlayer) {
@ -141,7 +149,7 @@ public class EntityNMSWitherSkull extends EntityWitherSkull implements NMSWither
@Override
public int getIdNMS() {
return this.getId();
return super.getId(); // Return the real ID without checking the stack trace.
}
@Override

View File

@ -11,6 +11,7 @@ import net.minecraft.server.v1_7_R4.NBTTagCompound;
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_7_R4.World;
import net.minecraft.server.v1_7_R4.EntityPlayer;
import net.minecraft.server.v1_7_R4.MathHelper;
public class EntityNMSWitherSkull extends EntityWitherSkull implements NMSWitherSkull {
@ -121,7 +122,14 @@ public class EntityNMSWitherSkull extends EntityWitherSkull implements NMSWither
super.setPosition(x, y, z);
// Send a packet near to update the position.
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(
getIdNMS(),
MathHelper.floor(this.locX * 32.0D),
MathHelper.floor(this.locY * 32.0D),
MathHelper.floor(this.locZ * 32.0D),
(byte) (int) (this.yaw * 256.0F / 360.0F),
(byte) (int) (this.pitch * 256.0F / 360.0F)
);
for (Object obj : this.world.players) {
if (obj instanceof EntityPlayer) {
@ -142,7 +150,7 @@ public class EntityNMSWitherSkull extends EntityWitherSkull implements NMSWither
@Override
public int getIdNMS() {
return this.getId();
return super.getId(); // Return the real ID without checking the stack trace.
}
@Override

View File

@ -10,6 +10,7 @@ import net.minecraft.server.v1_8_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R1.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_8_R1.Vec3D;
import net.minecraft.server.v1_8_R1.World;
import net.minecraft.server.v1_8_R1.MathHelper;
import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
@ -180,9 +181,16 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
public void setLocationNMS(double x, double y, double z) {
super.setPosition(x, y, z);
// Send a packet near to update the position.
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(
getIdNMS(),
MathHelper.floor(this.locX * 32.0D),
MathHelper.floor(this.locY * 32.0D),
MathHelper.floor(this.locZ * 32.0D),
(byte) (int) (this.yaw * 256.0F / 360.0F),
(byte) (int) (this.pitch * 256.0F / 360.0F),
this.onGround
);
for (Object obj : this.world.players) {
if (obj instanceof EntityPlayer) {
@ -203,7 +211,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
@Override
public int getIdNMS() {
return this.getId();
return super.getId(); // Return the real ID without checking the stack trace.
}
@Override

View File

@ -10,6 +10,7 @@ import net.minecraft.server.v1_8_R2.NBTTagCompound;
import net.minecraft.server.v1_8_R2.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_8_R2.Vec3D;
import net.minecraft.server.v1_8_R2.World;
import net.minecraft.server.v1_8_R2.MathHelper;
import org.bukkit.craftbukkit.v1_8_R2.entity.CraftEntity;
@ -180,9 +181,16 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
public void setLocationNMS(double x, double y, double z) {
super.setPosition(x, y, z);
// Send a packet near to update the position.
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(
getIdNMS(),
MathHelper.floor(this.locX * 32.0D),
MathHelper.floor(this.locY * 32.0D),
MathHelper.floor(this.locZ * 32.0D),
(byte) (int) (this.yaw * 256.0F / 360.0F),
(byte) (int) (this.pitch * 256.0F / 360.0F),
this.onGround
);
for (Object obj : this.world.players) {
if (obj instanceof EntityPlayer) {
@ -203,7 +211,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
@Override
public int getIdNMS() {
return this.getId();
return super.getId(); // Return the real ID without checking the stack trace.
}
@Override

View File

@ -6,6 +6,7 @@ import net.minecraft.server.v1_8_R3.EntityArmorStand;
import net.minecraft.server.v1_8_R3.EntityHuman;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.ItemStack;
import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_8_R3.Vec3D;
@ -180,9 +181,16 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
public void setLocationNMS(double x, double y, double z) {
super.setPosition(x, y, z);
// Send a packet near to update the position.
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(
getIdNMS(),
MathHelper.floor(this.locX * 32.0D),
MathHelper.floor(this.locY * 32.0D),
MathHelper.floor(this.locZ * 32.0D),
(byte) (int) (this.yaw * 256.0F / 360.0F),
(byte) (int) (this.pitch * 256.0F / 360.0F),
this.onGround
);
for (Object obj : this.world.players) {
if (obj instanceof EntityPlayer) {
@ -203,7 +211,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
@Override
public int getIdNMS() {
return this.getId();
return super.getId(); // Return the real ID without checking the stack trace.
}
@Override