mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix StackOverflow possibility with undead horses
This commit is contained in:
parent
0fd903e0a0
commit
e163301d23
1 changed files with 14 additions and 4 deletions
|
@ -130,6 +130,11 @@ public class AbstractHorseEntity extends AnimalEntity {
|
|||
@Nonnull
|
||||
@Override
|
||||
protected InteractiveTag testMobInteraction(@Nonnull GeyserItemStack itemInHand) {
|
||||
return testHorseInteraction(itemInHand);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
protected InteractiveTag testHorseInteraction(@Nonnull GeyserItemStack itemInHand) {
|
||||
boolean isBaby = isBaby();
|
||||
if (!isBaby) {
|
||||
if (getFlag(EntityFlag.TAMED) && session.isSneaking()) {
|
||||
|
@ -175,6 +180,11 @@ public class AbstractHorseEntity extends AnimalEntity {
|
|||
@Nonnull
|
||||
@Override
|
||||
protected InteractionResult mobInteract(@Nonnull GeyserItemStack itemInHand) {
|
||||
return mobHorseInteract(itemInHand);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
protected final InteractionResult mobHorseInteract(@Nonnull GeyserItemStack itemInHand) {
|
||||
boolean isBaby = isBaby();
|
||||
if (!isBaby) {
|
||||
if (getFlag(EntityFlag.TAMED) && session.isSneaking()) {
|
||||
|
@ -243,11 +253,11 @@ public class AbstractHorseEntity extends AnimalEntity {
|
|||
if (!getFlag(EntityFlag.TAMED)) {
|
||||
return InteractiveTag.NONE;
|
||||
} else if (isBaby()) {
|
||||
return testMobInteraction(itemInHand);
|
||||
return testHorseInteraction(itemInHand);
|
||||
} else if (session.isSneaking()) {
|
||||
return InteractiveTag.OPEN_CONTAINER;
|
||||
} else if (!passengers.isEmpty()) {
|
||||
return testMobInteraction(itemInHand);
|
||||
return testHorseInteraction(itemInHand);
|
||||
} else {
|
||||
if (session.getItemMappings().getStoredItems().saddle() == itemInHand.getJavaId()) {
|
||||
return InteractiveTag.OPEN_CONTAINER;
|
||||
|
@ -265,12 +275,12 @@ public class AbstractHorseEntity extends AnimalEntity {
|
|||
if (!getFlag(EntityFlag.TAMED)) {
|
||||
return InteractionResult.PASS;
|
||||
} else if (isBaby()) {
|
||||
return mobInteract(itemInHand);
|
||||
return mobHorseInteract(itemInHand);
|
||||
} else if (session.isSneaking()) {
|
||||
// Opens inventory
|
||||
return InteractionResult.SUCCESS;
|
||||
} else if (!passengers.isEmpty()) {
|
||||
return mobInteract(itemInHand);
|
||||
return mobHorseInteract(itemInHand);
|
||||
} else {
|
||||
// The client tests for saddle but it doesn't matter for us at this point.
|
||||
return InteractionResult.SUCCESS;
|
||||
|
|
Loading…
Reference in a new issue