-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent trial spawner / vault detection
fixes #41
- Loading branch information
Showing
4 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/java/me/drex/vanish/mixin/interaction/PlayerDetectorMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters