3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-09 17:50:20 +01:00

Allow enderman to make provoked sound when angry (#1763)

Dieser Commit ist enthalten in:
Camotoy 2021-01-01 16:55:04 -05:00 committet von GitHub
Ursprung 186d94917a
Commit eccb48844e
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -27,8 +27,10 @@ package org.geysermc.connector.entity.living.monster;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.SoundEvent;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.packet.LevelSoundEvent2Packet;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.world.block.BlockTranslator; import org.geysermc.connector.network.translators.world.block.BlockTranslator;
@ -45,11 +47,21 @@ public class EndermanEntity extends MonsterEntity {
if (entityMetadata.getId() == 15) { if (entityMetadata.getId() == 15) {
metadata.put(EntityData.CARRIED_BLOCK, BlockTranslator.getBedrockBlockId((int) entityMetadata.getValue())); metadata.put(EntityData.CARRIED_BLOCK, BlockTranslator.getBedrockBlockId((int) entityMetadata.getValue()));
} }
// 'Angry' - mouth open // "Is screaming" - controls sound
if (entityMetadata.getId() == 16) { if (entityMetadata.getId() == 16) {
if ((boolean) entityMetadata.getValue()) {
LevelSoundEvent2Packet packet = new LevelSoundEvent2Packet();
packet.setSound(SoundEvent.STARE);
packet.setPosition(this.position);
packet.setExtraData(-1);
packet.setIdentifier("minecraft:enderman");
session.sendUpstreamPacket(packet);
}
}
// "Is staring/provoked" - controls visuals
if (entityMetadata.getId() == 17) {
metadata.getFlags().setFlag(EntityFlag.ANGRY, (boolean) entityMetadata.getValue()); metadata.getFlags().setFlag(EntityFlag.ANGRY, (boolean) entityMetadata.getValue());
} }
// TODO: ID 17 is stared at but I don't believe it's used - maybe only for the sound effect. Check after particle merge
super.updateBedrockMetadata(entityMetadata, session); super.updateBedrockMetadata(entityMetadata, session);
} }
} }