Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 16:12:46 +01:00
Add goat horn count
Dieser Commit ist enthalten in:
Ursprung
378aa6ed99
Commit
a397f55e8b
@ -772,6 +772,8 @@ public final class EntityDefinitions {
|
||||
.type(EntityType.GOAT)
|
||||
.height(1.3f).width(0.9f)
|
||||
.addTranslator(MetadataType.BOOLEAN, GoatEntity::setScreamer)
|
||||
.addTranslator(MetadataType.BOOLEAN, GoatEntity::setHasLeftHorn)
|
||||
.addTranslator(MetadataType.BOOLEAN, GoatEntity::setHasRightHorn)
|
||||
.build();
|
||||
MOOSHROOM = EntityDefinition.inherited(MooshroomEntity::new, ageableEntityBase)
|
||||
.type(EntityType.MOOSHROOM)
|
||||
|
@ -30,6 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
|
||||
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 org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
@ -44,6 +45,8 @@ public class GoatEntity extends AnimalEntity {
|
||||
private static final float LONG_JUMPING_WIDTH = 0.9f * 0.7f;
|
||||
|
||||
private boolean isScreamer;
|
||||
private boolean hasLeftHorn;
|
||||
private boolean hasRightHorn;
|
||||
|
||||
public GoatEntity(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);
|
||||
@ -74,4 +77,18 @@ public class GoatEntity extends AnimalEntity {
|
||||
return super.mobInteract(hand, itemInHand);
|
||||
}
|
||||
}
|
||||
|
||||
public void setHasLeftHorn(BooleanEntityMetadata entityMetadata) {
|
||||
hasLeftHorn = entityMetadata.getPrimitiveValue();
|
||||
setHornCount();
|
||||
}
|
||||
|
||||
public void setHasRightHorn(BooleanEntityMetadata entityMetadata) {
|
||||
hasRightHorn = entityMetadata.getPrimitiveValue();
|
||||
setHornCount();
|
||||
}
|
||||
|
||||
private void setHornCount() {
|
||||
dirtyMetadata.put(EntityData.GOAT_HORN_COUNT, (hasLeftHorn ? 1 : 0) + (hasRightHorn ? 1 : 0));
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren