Functional Bow, Damage and Fire!
Dieser Commit ist enthalten in:
Ursprung
11d3d8ff08
Commit
2aad8cba58
@ -305,8 +305,12 @@ class PacketProcessor {
|
||||
packetCounter.clear();
|
||||
}
|
||||
|
||||
private void bow() {
|
||||
//TODO implement Bow
|
||||
private void bow() throws IOException {
|
||||
int entityId = source.rInt();
|
||||
boolean drawn = source.rBoolean();
|
||||
int hand = source.rInt();
|
||||
|
||||
execSync(() -> REntity.getEntity(entityId).setBowDrawn(drawn, hand));
|
||||
}
|
||||
|
||||
private void damage() throws IOException {
|
||||
@ -317,8 +321,9 @@ class PacketProcessor {
|
||||
|
||||
private void fireTick() throws IOException {
|
||||
int entityId = source.rInt();
|
||||
boolean perma = source.rBoolean();
|
||||
|
||||
execSync(() -> REntity.getEntity(entityId).setOnFire());
|
||||
execSync(() -> REntity.getEntity(entityId).setOnFire(perma));
|
||||
}
|
||||
|
||||
private void process(){
|
||||
@ -360,10 +365,14 @@ class PacketProcessor {
|
||||
fireballSpawn();
|
||||
break;
|
||||
case 0x0A:
|
||||
bow();
|
||||
break;
|
||||
case 0x0B:
|
||||
damage();
|
||||
break;
|
||||
case 0x0C:
|
||||
fireTick();
|
||||
break;
|
||||
case 0x30:
|
||||
block();
|
||||
break;
|
||||
|
@ -119,8 +119,9 @@ public abstract class REntity {
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnFire() {
|
||||
entity.setOnFire(21, false);
|
||||
public void setOnFire(boolean perma) {
|
||||
if(!perma)
|
||||
entity.setOnFire(21, false);
|
||||
|
||||
DataWatcher dataWatcher = new DataWatcher(null);
|
||||
|
||||
@ -135,6 +136,20 @@ public abstract class REntity {
|
||||
}
|
||||
}
|
||||
|
||||
public void setBowDrawn(boolean drawn, int hand) {
|
||||
DataWatcher dataWatcher = new DataWatcher(null);
|
||||
|
||||
DataWatcherObject<Byte> dataWatcherObject = new DataWatcherObject<>(7, DataWatcherRegistry.a);
|
||||
dataWatcher.register(dataWatcherObject, (byte) ((drawn?1:0) + (hand * 2)));
|
||||
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);
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren