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