forked from GeyserMC/Geyser
		
	Allow enderman to make provoked sound when angry (#1763)
This commit is contained in:
		
							parent
							
								
									186d94917a
								
							
						
					
					
						commit
						eccb48844e
					
				
					 1 changed files with 14 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -27,8 +27,10 @@ package org.geysermc.connector.entity.living.monster;
 | 
			
		|||
 | 
			
		||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
 | 
			
		||||
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.EntityFlag;
 | 
			
		||||
import com.nukkitx.protocol.bedrock.packet.LevelSoundEvent2Packet;
 | 
			
		||||
import org.geysermc.connector.entity.type.EntityType;
 | 
			
		||||
import org.geysermc.connector.network.session.GeyserSession;
 | 
			
		||||
import org.geysermc.connector.network.translators.world.block.BlockTranslator;
 | 
			
		||||
| 
						 | 
				
			
			@ -45,11 +47,21 @@ public class EndermanEntity extends MonsterEntity {
 | 
			
		|||
        if (entityMetadata.getId() == 15) {
 | 
			
		||||
            metadata.put(EntityData.CARRIED_BLOCK, BlockTranslator.getBedrockBlockId((int) entityMetadata.getValue()));
 | 
			
		||||
        }
 | 
			
		||||
        // 'Angry' - mouth open
 | 
			
		||||
        // "Is screaming" - controls sound
 | 
			
		||||
        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());
 | 
			
		||||
        }
 | 
			
		||||
        // 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);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue