13
0

Sneaking in SpectateSystem #19

Manuell gemergt
Lixfel hat 3 Commits von sneaking_like_a_god nach master 2021-04-11 20:18:14 +02:00 zusammengeführt

Datei anzeigen

@ -48,6 +48,7 @@ public abstract class REntity {
for(Player player : Bukkit.getOnlinePlayers()){
sendToPlayer(player);
}
sneak(false);
}
public static void playerJoins(Player player){
@ -104,16 +105,17 @@ public abstract class REntity {
}
public void sneak(boolean sneaking) {
entity.setSneaking(sneaking);
DataWatcher dataWatcher = new DataWatcher(null);
DataWatcherObject<EntityPose> dataWatcherObject = new DataWatcherObject<>(6, DataWatcherRegistry.s);
dataWatcher.register(dataWatcherObject, sneaking?EntityPose.CROUCHING:EntityPose.STANDING);
dataWatcher.markDirty(dataWatcherObject);
/*DataWatcher dataWatcher = new DataWatcher(entity);
System.out.println("Let " + entity.getName() + " sneak " + sneaking);
dataWatcher.register(new DataWatcherObject<>(0, DataWatcherRegistry.a), sneaking ? (byte)0x02 : (byte)0x40);
PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(entity.getId(), dataWatcher, false);
for(Player player : Bukkit.getOnlinePlayers()){
((CraftPlayer)player).getHandle().playerConnection.sendPacket(packet);
}*/
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
}
public void animation(byte animation) {