3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-10-08 10:50:11 +02:00

Translate Warden sonic boom event

Bump Protocol to fix Sonic boom flag
Dieser Commit ist enthalten in:
davchoo 2022-05-31 14:58:40 -04:00
Ursprung eb23a46887
Commit 365f8cf7e3
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: A0168C8E45799B7D
4 geänderte Dateien mit 22 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -121,7 +121,7 @@
<dependency> <dependency>
<groupId>com.github.CloudburstMC.Protocol</groupId> <groupId>com.github.CloudburstMC.Protocol</groupId>
<artifactId>bedrock-beta</artifactId> <artifactId>bedrock-beta</artifactId>
<version>51d4fce</version> <version>be0cc73</version>
<scope>compile</scope> <scope>compile</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>

Datei anzeigen

@ -44,6 +44,8 @@ public class WardenEntity extends MonsterEntity implements Tickable {
private int heartBeatDelay; private int heartBeatDelay;
private int tickCount; private int tickCount;
private int sonicBoomTickDuration;
public WardenEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public WardenEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }
@ -77,5 +79,17 @@ public class WardenEntity extends MonsterEntity implements Tickable {
packet.setVolume((random.nextFloat() - random.nextFloat()) * 0.2f + 1.0f); packet.setVolume((random.nextFloat() - random.nextFloat()) * 0.2f + 1.0f);
session.sendUpstreamPacket(packet); session.sendUpstreamPacket(packet);
} }
if (--sonicBoomTickDuration == 0) {
setFlag(EntityFlag.SONIC_BOOM, false);
updateBedrockMetadata();
}
}
public void onSonicBoom() {
setFlag(EntityFlag.SONIC_BOOM, true);
updateBedrockMetadata();
sonicBoomTickDuration = 3 * 20;
} }
} }

Datei anzeigen

@ -37,6 +37,7 @@ import org.geysermc.geyser.entity.type.Entity;
import org.geysermc.geyser.entity.type.EvokerFangsEntity; import org.geysermc.geyser.entity.type.EvokerFangsEntity;
import org.geysermc.geyser.entity.type.FishingHookEntity; import org.geysermc.geyser.entity.type.FishingHookEntity;
import org.geysermc.geyser.entity.type.LivingEntity; import org.geysermc.geyser.entity.type.LivingEntity;
import org.geysermc.geyser.entity.type.living.monster.WardenEntity;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.protocol.Translator;
@ -245,6 +246,11 @@ public class JavaEntityEventTranslator extends PacketTranslator<ClientboundEntit
entityEventPacket.setType(EntityEventType.VIBRATION_DETECTED); entityEventPacket.setType(EntityEventType.VIBRATION_DETECTED);
} }
break; break;
case WARDEN_SONIC_BOOM:
if (entity instanceof WardenEntity wardenEntity) {
wardenEntity.onSonicBoom();
}
break;
} }
if (entityEventPacket.getType() != null) { if (entityEventPacket.getType() != null) {

@ -1 +1 @@
Subproject commit 7fc4ac178901f2ba2989645d0da44dcfb95575db Subproject commit e13611fd97b1801d4c4b914cd409351a49d19537