mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Wolf interactions
This commit is contained in:
parent
687d299ff5
commit
bbaffb2ab3
2 changed files with 23 additions and 7 deletions
|
@ -133,17 +133,30 @@ public class WolfEntity extends TameableEntity {
|
|||
if (itemInHand.asItem() == Items.BONE && !getFlag(EntityFlag.TAMED)) {
|
||||
// Bone and untamed - can tame
|
||||
return InteractiveTag.TAME;
|
||||
} else {
|
||||
if (itemInHand.asItem() instanceof DyeItem item) {
|
||||
// If this fails, as of Java Edition 1.18.1, you cannot toggle sit/stand
|
||||
if (item.dyeColor() != this.collarColor) {
|
||||
return InteractiveTag.DYE;
|
||||
}
|
||||
} else if (getFlag(EntityFlag.TAMED) && ownerBedrockId == session.getPlayerEntity().getGeyserId()) {
|
||||
if (getFlag(EntityFlag.TAMED) && ownerBedrockId == session.getPlayerEntity().getGeyserId()) {
|
||||
if (itemInHand.asItem() instanceof DyeItem dyeItem) {
|
||||
// If this fails, as of Java Edition 1.18.1, you cannot toggle sit/stand
|
||||
if (dyeItem.dyeColor() != this.collarColor) {
|
||||
return InteractiveTag.DYE;
|
||||
} else {
|
||||
return super.testMobInteraction(hand, itemInHand);
|
||||
}
|
||||
}
|
||||
if (itemInHand.asItem() == Items.WOLF_ARMOR && !this.chestplate.isValid() && !getFlag(EntityFlag.BABY)) {
|
||||
return InteractiveTag.EQUIP_WOLF_ARMOR;
|
||||
}
|
||||
if (itemInHand.asItem() == Items.SHEARS && this.chestplate.isValid()) { // TODO: check curse of binding
|
||||
return InteractiveTag.REMOVE_WOLF_ARMOR;
|
||||
}
|
||||
if (Items.WOLF_ARMOR.isValidRepairItem(itemInHand.asItem()) && getFlag(EntityFlag.SITTING) &&
|
||||
this.chestplate.isValid() && this.chestplate.getTag() != null &&
|
||||
this.chestplate.getTag().getInt("Damage") > 0) {
|
||||
return InteractiveTag.REPAIR_WOLF_ARMOR;
|
||||
}
|
||||
// Tamed and owned by player - can sit/stand
|
||||
return getFlag(EntityFlag.SITTING) ? InteractiveTag.STAND : InteractiveTag.SIT;
|
||||
}
|
||||
}
|
||||
return super.testMobInteraction(hand, itemInHand);
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,10 @@ public enum InteractiveTag {
|
|||
READ,
|
||||
WAKE_VILLAGER("wakevillager"),
|
||||
BARTER,
|
||||
GIVE_ITEM_TO_ALLAY("allay");
|
||||
GIVE_ITEM_TO_ALLAY("allay"),
|
||||
EQUIP_WOLF_ARMOR("equipwolfarmor"),
|
||||
REMOVE_WOLF_ARMOR("removewolfarmor"),
|
||||
REPAIR_WOLF_ARMOR("repairwolfarmor");
|
||||
|
||||
/**
|
||||
* The full string that should be passed on to the client.
|
||||
|
|
Loading…
Reference in a new issue