mirror of
https://github.com/GeyserMC/Geyser.git
synced 2025-12-30 20:29:19 +00:00
Fix saddle inventory slot setting
This commit is contained in:
@@ -482,7 +482,7 @@ public final class EntityDefinitions {
|
||||
.identifier("minecraft:splash_potion")
|
||||
.build();
|
||||
LINGERING_POTION = EntityDefinition.inherited(ThrownPotionEntity::new, throwableItemBase)
|
||||
.type(EntityType.SPLASH_POTION)
|
||||
.type(EntityType.LINGERING_POTION)
|
||||
.heightAndWidth(0.25f)
|
||||
.identifier("minecraft:splash_potion")
|
||||
.build();
|
||||
|
||||
@@ -136,15 +136,17 @@ public class LivingEntity extends Entity {
|
||||
this.body = ItemTranslator.translateToBedrock(session, stack);
|
||||
}
|
||||
|
||||
public void setSaddle(ItemStack stack) {
|
||||
public void setSaddle(@Nullable ItemStack stack) {
|
||||
this.saddle = ItemTranslator.translateToBedrock(session, stack);
|
||||
|
||||
boolean saddled = false;
|
||||
Item item = Registries.JAVA_ITEMS.get(stack.getId());
|
||||
if (item != null) {
|
||||
DataComponents components = item.gatherComponents(stack.getDataComponentsPatch());
|
||||
Equippable equippable = components.get(DataComponentTypes.EQUIPPABLE);
|
||||
saddled = equippable != null && equippable.slot() == EquipmentSlot.SADDLE;
|
||||
if (stack != null) {
|
||||
Item item = Registries.JAVA_ITEMS.get(stack.getId());
|
||||
if (item != null) {
|
||||
DataComponents components = item.gatherComponents(stack.getDataComponentsPatch());
|
||||
Equippable equippable = components.get(DataComponentTypes.EQUIPPABLE);
|
||||
saddled = equippable != null && equippable.slot() == EquipmentSlot.SADDLE;
|
||||
}
|
||||
}
|
||||
|
||||
updateSaddled(saddled);
|
||||
@@ -163,7 +165,6 @@ public class LivingEntity extends Entity {
|
||||
updateBedrockMetadata();
|
||||
|
||||
// Update the interactive tag, if necessary
|
||||
// TODO 1.21.5 retest
|
||||
Entity mouseoverEntity = session.getMouseoverEntity();
|
||||
if (mouseoverEntity != null && mouseoverEntity.getEntityId() == entityId) {
|
||||
mouseoverEntity.updateInteractiveTag();
|
||||
|
||||
@@ -86,11 +86,9 @@ public class AbstractHorseEntity extends AnimalEntity {
|
||||
super.updateSaddled(saddled);
|
||||
}
|
||||
|
||||
// TODO 1.21.5 saddled flag doesnt exist anymore
|
||||
public void setHorseFlags(ByteEntityMetadata entityMetadata) {
|
||||
byte xd = entityMetadata.getPrimitiveValue();
|
||||
boolean tamed = (xd & 0x02) == 0x02;
|
||||
boolean saddled = (xd & 0x04) == 0x04;
|
||||
setFlag(EntityFlag.TAMED, tamed);
|
||||
setFlag(EntityFlag.EATING, (xd & 0x10) == 0x10);
|
||||
setFlag(EntityFlag.STANDING, (xd & 0x20) == 0x20);
|
||||
|
||||
@@ -92,6 +92,9 @@ public class JavaSetEquipmentTranslator extends PacketTranslator<ClientboundSetE
|
||||
livingEntity.setBoots(stack);
|
||||
armorUpdated = true;
|
||||
}
|
||||
case SADDLE -> {
|
||||
livingEntity.setSaddle(stack);
|
||||
}
|
||||
case MAIN_HAND -> {
|
||||
livingEntity.setHand(stack);
|
||||
mainHandUpdated = true;
|
||||
|
||||
Reference in New Issue
Block a user