From a9fe1fcaab1d780418fb4fe496295e3d192786ef Mon Sep 17 00:00:00 2001 From: brainsynder Date: Mon, 26 Jun 2023 09:08:32 -0400 Subject: [PATCH] [+] Config option to toggle weather pets can match their owners visibility status --- .../brainsynder/api/plugin/config/ConfigOption.java | 5 +++++ .../java/simplepets/brainsynder/nms/entity/EntityPet.java | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/API/src/main/java/simplepets/brainsynder/api/plugin/config/ConfigOption.java b/API/src/main/java/simplepets/brainsynder/api/plugin/config/ConfigOption.java index 753271fb..86ee4325 100644 --- a/API/src/main/java/simplepets/brainsynder/api/plugin/config/ConfigOption.java +++ b/API/src/main/java/simplepets/brainsynder/api/plugin/config/ConfigOption.java @@ -314,6 +314,11 @@ This option allows for the removal of the placeholder items (The glass panes) Should pet owners be able to open their pets data menu when right clicking the pet. Default: {default}"""); + public final ConfigEntry MISC_TOGGLES_PET_VANISHING = createOption("misc-toggles.enable-pet-vanishing", true, + """ + Should pets turn invisible when their owner is not visible (either via Spectator or Invisibility potions) + + Default: {default}"""); // Pet Toggles diff --git a/NMS_Master/src/main/java/simplepets/brainsynder/nms/entity/EntityPet.java b/NMS_Master/src/main/java/simplepets/brainsynder/nms/entity/EntityPet.java index 8e24323b..4185ceec 100644 --- a/NMS_Master/src/main/java/simplepets/brainsynder/nms/entity/EntityPet.java +++ b/NMS_Master/src/main/java/simplepets/brainsynder/nms/entity/EntityPet.java @@ -491,7 +491,9 @@ public void tick() { if (displayName && hideNameShifting) getEntity().setCustomNameVisible((!shifting)); - if (!canIgnoreVanish()) { + // Checks if the pet can actually be toggled to match their owners + // player visibility status + if ((!canIgnoreVanish()) && ConfigOption.INSTANCE.MISC_TOGGLES_PET_VANISHING.getValue()) { boolean ownerVanish = (VersionTranslator.getEntityHandle(player).isInvisible() // Added this check for SuperVanish and PremiumVanish since they recommend using this method to check || SimplePets.getPetUtilities().isVanished(player)