diff --git a/CHANGELOG.md b/CHANGELOG.md index af792b2..8e53b0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added - Prevent advancement progress config option +- Prevent trial spawner detection +- Prevent vault detection ## [1.5.5] - 2024-05-31 ### Added diff --git a/README.md b/README.md index 87af2c6..4ce2cb6 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,8 @@ - Prevents special mob spawning (spawners, skeleton traps, zombie reinforcements, raids) - Prevents sweeping edge attacking players - Prevents dispensers equipping armor +- Prevents trial spawner detection +- Prevents vault detection - Hide traceable entities (arrows, firework rockets, fishing rod...) ## Config @@ -42,10 +44,14 @@ The config file is located at `./config/vanish.hocon`. Use `/vanish reload` to r action-bar=true # Prevents vanished players from using chat disable-chat=true +# Prevents vanished players from using /msg +disable-msg=true # Hide vanished players from entities, prevents hostile entities from targeting players, and more hide-from-entities=true # Prevent vanished player world interactions interaction { + # Prevent progressing advancements + advancement-progress=false # Prevent block interactions (pressure plates, dripleaf, tripwire, farmland, redstone ore, sculk sensor/shrieker and turtle egg blocks=true # Prevent chunk loading / generation diff --git a/src/main/java/me/drex/vanish/mixin/interaction/PlayerDetectorMixin.java b/src/main/java/me/drex/vanish/mixin/interaction/PlayerDetectorMixin.java new file mode 100644 index 0000000..f6be6a8 --- /dev/null +++ b/src/main/java/me/drex/vanish/mixin/interaction/PlayerDetectorMixin.java @@ -0,0 +1,27 @@ +package me.drex.vanish.mixin.interaction; + +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import me.drex.vanish.api.VanishAPI; +import me.drex.vanish.config.ConfigManager; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.block.entity.trialspawner.PlayerDetector; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(PlayerDetector.class) +public interface PlayerDetectorMixin { + // NO_CREATIVE_PLAYERS + @WrapOperation(method = "method_56723", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/player/Player;isSpectator()Z")) + private static boolean vanish_preventTrialSpawning(Player player, Operation original) { + boolean cancel = ConfigManager.vanish().interaction.mobSpawning && VanishAPI.isVanished(player); + return original.call(player) || cancel; + } + + // INCLUDING_CREATIVE_PLAYERS + @WrapOperation(method = "method_56721", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/player/Player;isSpectator()Z")) + private static boolean vanish_preventVaultOpening(Player player, Operation original) { + boolean cancel = ConfigManager.vanish().interaction.blocks && VanishAPI.isVanished(player); + return original.call(player) || cancel; + } +} diff --git a/src/main/resources/vanish.mixins.json b/src/main/resources/vanish.mixins.json index abf9748..855e279 100644 --- a/src/main/resources/vanish.mixins.json +++ b/src/main/resources/vanish.mixins.json @@ -33,6 +33,7 @@ "interaction.FallOnBlockMixin", "interaction.InsideBlockMixin", "interaction.LivingEntityMixin", + "interaction.PlayerDetectorMixin", "interaction.PlayerMixin", "interaction.SimpleCriterionTriggerMixin", "interaction.StepOnBlockMixin",