1
0
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:
onebeastchris
2025-03-29 02:40:04 +01:00
parent 1103474fa2
commit 37d04a2c6f
4 changed files with 12 additions and 10 deletions

View File

@@ -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();

View File

@@ -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();

View File

@@ -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);

View File

@@ -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;