3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-27 16:40:14 +01:00

Add goat horn count

Dieser Commit ist enthalten in:
Camotoy 2022-06-06 21:06:02 -04:00
Ursprung 378aa6ed99
Commit a397f55e8b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F
2 geänderte Dateien mit 19 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -772,6 +772,8 @@ public final class EntityDefinitions {
.type(EntityType.GOAT) .type(EntityType.GOAT)
.height(1.3f).width(0.9f) .height(1.3f).width(0.9f)
.addTranslator(MetadataType.BOOLEAN, GoatEntity::setScreamer) .addTranslator(MetadataType.BOOLEAN, GoatEntity::setScreamer)
.addTranslator(MetadataType.BOOLEAN, GoatEntity::setHasLeftHorn)
.addTranslator(MetadataType.BOOLEAN, GoatEntity::setHasRightHorn)
.build(); .build();
MOOSHROOM = EntityDefinition.inherited(MooshroomEntity::new, ageableEntityBase) MOOSHROOM = EntityDefinition.inherited(MooshroomEntity::new, ageableEntityBase)
.type(EntityType.MOOSHROOM) .type(EntityType.MOOSHROOM)

Datei anzeigen

@ -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.github.steveice10.mc.protocol.data.game.entity.player.Hand;
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.SoundEvent;
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 org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; 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 static final float LONG_JUMPING_WIDTH = 0.9f * 0.7f;
private boolean isScreamer; 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) { 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); 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); 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));
}
} }