Moar Packets
Dieser Commit ist enthalten in:
Ursprung
1e425e700e
Commit
11d3d8ff08
@ -305,6 +305,22 @@ class PacketProcessor {
|
|||||||
packetCounter.clear();
|
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(){
|
private void process(){
|
||||||
|
|
||||||
try{
|
try{
|
||||||
@ -343,6 +359,11 @@ class PacketProcessor {
|
|||||||
case 0x09:
|
case 0x09:
|
||||||
fireballSpawn();
|
fireballSpawn();
|
||||||
break;
|
break;
|
||||||
|
case 0x0A:
|
||||||
|
case 0x0B:
|
||||||
|
damage();
|
||||||
|
case 0x0C:
|
||||||
|
fireTick();
|
||||||
case 0x30:
|
case 0x30:
|
||||||
block();
|
block();
|
||||||
break;
|
break;
|
||||||
@ -392,7 +413,7 @@ class PacketProcessor {
|
|||||||
tickFinished = true;
|
tickFinished = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Unknown packet recieved, closing");
|
Bukkit.getLogger().log(Level.SEVERE, "Unknown packet recieved, closing: " + packetType);
|
||||||
source.close();
|
source.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,8 @@ public abstract class REntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void sneak(boolean sneaking) {
|
public void sneak(boolean sneaking) {
|
||||||
|
entity.setSneaking(sneaking);
|
||||||
|
|
||||||
DataWatcher dataWatcher = new DataWatcher(null);
|
DataWatcher dataWatcher = new DataWatcher(null);
|
||||||
|
|
||||||
DataWatcherObject<EntityPose> dataWatcherObject = new DataWatcherObject<>(6, DataWatcherRegistry.s);
|
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) {
|
public void animation(byte animation) {
|
||||||
PacketPlayOutAnimation packet = new PacketPlayOutAnimation(entity, animation);
|
PacketPlayOutAnimation packet = new PacketPlayOutAnimation(entity, animation);
|
||||||
for(Player player : Bukkit.getOnlinePlayers()){
|
for(Player player : Bukkit.getOnlinePlayers()){
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren