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
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
protected InteractiveTag testMobInteraction(@Nonnull GeyserItemStack itemInHand) {
|
protected InteractiveTag testMobInteraction(@Nonnull GeyserItemStack itemInHand) {
|
||||||
|
return testHorseInteraction(itemInHand);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
protected InteractiveTag testHorseInteraction(@Nonnull GeyserItemStack itemInHand) {
|
||||||
boolean isBaby = isBaby();
|
boolean isBaby = isBaby();
|
||||||
if (!isBaby) {
|
if (!isBaby) {
|
||||||
if (getFlag(EntityFlag.TAMED) && session.isSneaking()) {
|
if (getFlag(EntityFlag.TAMED) && session.isSneaking()) {
|
||||||
|
@ -175,6 +180,11 @@ public class AbstractHorseEntity extends AnimalEntity {
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
protected InteractionResult mobInteract(@Nonnull GeyserItemStack itemInHand) {
|
protected InteractionResult mobInteract(@Nonnull GeyserItemStack itemInHand) {
|
||||||
|
return mobHorseInteract(itemInHand);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
protected final InteractionResult mobHorseInteract(@Nonnull GeyserItemStack itemInHand) {
|
||||||
boolean isBaby = isBaby();
|
boolean isBaby = isBaby();
|
||||||
if (!isBaby) {
|
if (!isBaby) {
|
||||||
if (getFlag(EntityFlag.TAMED) && session.isSneaking()) {
|
if (getFlag(EntityFlag.TAMED) && session.isSneaking()) {
|
||||||
|
@ -243,11 +253,11 @@ public class AbstractHorseEntity extends AnimalEntity {
|
||||||
if (!getFlag(EntityFlag.TAMED)) {
|
if (!getFlag(EntityFlag.TAMED)) {
|
||||||
return InteractiveTag.NONE;
|
return InteractiveTag.NONE;
|
||||||
} else if (isBaby()) {
|
} else if (isBaby()) {
|
||||||
return testMobInteraction(itemInHand);
|
return testHorseInteraction(itemInHand);
|
||||||
} else if (session.isSneaking()) {
|
} else if (session.isSneaking()) {
|
||||||
return InteractiveTag.OPEN_CONTAINER;
|
return InteractiveTag.OPEN_CONTAINER;
|
||||||
} else if (!passengers.isEmpty()) {
|
} else if (!passengers.isEmpty()) {
|
||||||
return testMobInteraction(itemInHand);
|
return testHorseInteraction(itemInHand);
|
||||||
} else {
|
} else {
|
||||||
if (session.getItemMappings().getStoredItems().saddle() == itemInHand.getJavaId()) {
|
if (session.getItemMappings().getStoredItems().saddle() == itemInHand.getJavaId()) {
|
||||||
return InteractiveTag.OPEN_CONTAINER;
|
return InteractiveTag.OPEN_CONTAINER;
|
||||||
|
@ -265,12 +275,12 @@ public class AbstractHorseEntity extends AnimalEntity {
|
||||||
if (!getFlag(EntityFlag.TAMED)) {
|
if (!getFlag(EntityFlag.TAMED)) {
|
||||||
return InteractionResult.PASS;
|
return InteractionResult.PASS;
|
||||||
} else if (isBaby()) {
|
} else if (isBaby()) {
|
||||||
return mobInteract(itemInHand);
|
return mobHorseInteract(itemInHand);
|
||||||
} else if (session.isSneaking()) {
|
} else if (session.isSneaking()) {
|
||||||
// Opens inventory
|
// Opens inventory
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
} else if (!passengers.isEmpty()) {
|
} else if (!passengers.isEmpty()) {
|
||||||
return mobInteract(itemInHand);
|
return mobHorseInteract(itemInHand);
|
||||||
} else {
|
} else {
|
||||||
// The client tests for saddle but it doesn't matter for us at this point.
|
// The client tests for saddle but it doesn't matter for us at this point.
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
|
|
Loading…
Reference in a new issue