Skip to content

Commit

Permalink
Prevent trial spawner / vault detection
Browse files Browse the repository at this point in the history
fixes #41
  • Loading branch information
DrexHD committed Jun 20, 2024
1 parent 71254b6 commit 6318fe5
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Boolean> 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<Boolean> original) {
boolean cancel = ConfigManager.vanish().interaction.blocks && VanishAPI.isVanished(player);
return original.call(player) || cancel;
}
}
1 change: 1 addition & 0 deletions src/main/resources/vanish.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"interaction.FallOnBlockMixin",
"interaction.InsideBlockMixin",
"interaction.LivingEntityMixin",
"interaction.PlayerDetectorMixin",
"interaction.PlayerMixin",
"interaction.SimpleCriterionTriggerMixin",
"interaction.StepOnBlockMixin",
Expand Down

0 comments on commit 6318fe5

Please sign in to comment.