13
0
Dieser Commit ist enthalten in:
Chaoscaot 2021-04-12 18:14:46 +02:00
Ursprung 1e425e700e
Commit 11d3d8ff08
2 geänderte Dateien mit 48 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -305,6 +305,22 @@ class PacketProcessor {
packetCounter.clear();
}
private void bow() {
//TODO implement Bow
}
private void damage() throws IOException {
int entityId = source.rInt();
execSync(() -> REntity.getEntity(entityId).damage());
}
private void fireTick() throws IOException {
int entityId = source.rInt();
execSync(() -> REntity.getEntity(entityId).setOnFire());
}
private void process(){
try{
@ -343,6 +359,11 @@ class PacketProcessor {
case 0x09:
fireballSpawn();
break;
case 0x0A:
case 0x0B:
damage();
case 0x0C:
fireTick();
case 0x30:
block();
break;
@ -392,7 +413,7 @@ class PacketProcessor {
tickFinished = true;
break;
default:
Bukkit.getLogger().log(Level.SEVERE, "Unknown packet recieved, closing");
Bukkit.getLogger().log(Level.SEVERE, "Unknown packet recieved, closing: " + packetType);
source.close();
}
}

Datei anzeigen

@ -104,6 +104,8 @@ 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);
@ -117,6 +119,30 @@ public abstract class REntity {
}
}
public void setOnFire() {
entity.setOnFire(21, false);
DataWatcher dataWatcher = new DataWatcher(null);
DataWatcherObject<Byte> dataWatcherObject = new DataWatcherObject<>(0, DataWatcherRegistry.a);
dataWatcher.register(dataWatcherObject, (byte) 1);
dataWatcher.markDirty(dataWatcherObject);
PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(entity.getId(), dataWatcher, false);
for(Player player : Bukkit.getOnlinePlayers()){
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
}
public void damage() {
PacketPlayOutEntityStatus packet = new PacketPlayOutEntityStatus(entity, (byte) 2);
for(Player player : Bukkit.getOnlinePlayers()){
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
}
public void animation(byte animation) {
PacketPlayOutAnimation packet = new PacketPlayOutAnimation(entity, animation);
for(Player player : Bukkit.getOnlinePlayers()){