Entitys now face the right way when spawning
This commit is contained in:
parent
9ea389eaf8
commit
7ff7558809
@ -44,7 +44,7 @@ public class Disguise {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PacketContainer[] constructPacket(org.bukkit.entity.Entity e) {
|
public PacketContainer[] constructPacket(org.bukkit.entity.Entity e) {
|
||||||
PacketContainer[] spawnPackets = new PacketContainer[1];
|
PacketContainer[] spawnPackets = new PacketContainer[2];
|
||||||
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
|
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
|
||||||
Entity entity = ((CraftEntity) e).getHandle();
|
Entity entity = ((CraftEntity) e).getHandle();
|
||||||
Location loc = e.getLocation();
|
Location loc = e.getLocation();
|
||||||
@ -60,7 +60,6 @@ public class Disguise {
|
|||||||
mods.write(4, 1);
|
mods.write(4, 1);
|
||||||
|
|
||||||
} else if (getType() == DisguiseType.PAINTING) {
|
} else if (getType() == DisguiseType.PAINTING) {
|
||||||
spawnPackets = new PacketContainer[2];
|
|
||||||
spawnPackets[0] = manager.createPacket(Packets.Server.ENTITY_PAINTING);
|
spawnPackets[0] = manager.createPacket(Packets.Server.ENTITY_PAINTING);
|
||||||
StructureModifier<Object> mods = spawnPackets[0].getModifier();
|
StructureModifier<Object> mods = spawnPackets[0].getModifier();
|
||||||
mods.write(0, e.getEntityId());
|
mods.write(0, e.getEntityId());
|
||||||
@ -229,7 +228,13 @@ public class Disguise {
|
|||||||
mods.write(8, entity.getDataWatcher());
|
mods.write(8, entity.getDataWatcher());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (spawnPackets[1] == null) {
|
||||||
|
// Make a packet to turn his head!
|
||||||
|
spawnPackets[1] = manager.createPacket(Packets.Server.ENTITY_HEAD_ROTATION);
|
||||||
|
StructureModifier<Object> mods = spawnPackets[1].getModifier();
|
||||||
|
mods.write(0, e.getEntityId());
|
||||||
|
mods.write(1, (byte) (int) Math.floor(loc.getYaw() * 256.0F / 360.0F));
|
||||||
|
}
|
||||||
return spawnPackets;
|
return spawnPackets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ public class ArrowWatcher extends FlagWatcher {
|
|||||||
|
|
||||||
public ArrowWatcher(int entityId) {
|
public ArrowWatcher(int entityId) {
|
||||||
super(entityId);
|
super(entityId);
|
||||||
|
setValue(16, (byte) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMoving() {
|
public boolean isMoving() {
|
||||||
|
@ -143,7 +143,7 @@ public class LibsDisguises extends JavaPlugin implements Listener {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}, 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -159,7 +159,7 @@ public class LibsDisguises extends JavaPlugin implements Listener {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}, 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (event.getPacketID() == Packets.Server.MOB_SPAWN
|
} else if (event.getPacketID() == Packets.Server.MOB_SPAWN
|
||||||
@ -178,7 +178,7 @@ public class LibsDisguises extends JavaPlugin implements Listener {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}, 5);
|
||||||
}
|
}
|
||||||
} else if (event.getPacketID() == Packets.Server.ARM_ANIMATION
|
} else if (event.getPacketID() == Packets.Server.ARM_ANIMATION
|
||||||
|| event.getPacketID() == Packets.Server.COLLECT) {
|
|| event.getPacketID() == Packets.Server.COLLECT) {
|
||||||
@ -195,10 +195,10 @@ public class LibsDisguises extends JavaPlugin implements Listener {
|
|||||||
mods.write(4, (byte) (value - 128));
|
mods.write(4, (byte) (value - 128));
|
||||||
} else if (disguise.getType().isMisc()) {
|
} else if (disguise.getType().isMisc()) {
|
||||||
byte value = (Byte) mods.read(4);
|
byte value = (Byte) mods.read(4);
|
||||||
if (disguise.getType() == DisguiseType.ITEM_FRAME) {
|
if (disguise.getType() == DisguiseType.ITEM_FRAME || disguise.getType() == DisguiseType.ARROW) {
|
||||||
mods.write(4, -value);
|
mods.write(4, (byte) -value);
|
||||||
} else if (disguise.getType() == DisguiseType.PAINTING) {
|
} else if (disguise.getType() == DisguiseType.PAINTING) {
|
||||||
mods.write(4, -(value + 128));
|
mods.write(4, (byte) -(value + 128));
|
||||||
} else if (disguise.getType().isMisc())
|
} else if (disguise.getType().isMisc())
|
||||||
mods.write(4, (byte) (value - 64));
|
mods.write(4, (byte) (value - 64));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user