From 9bb3bc44b5201124879836739c976a772cab7403 Mon Sep 17 00:00:00 2001 From: anhgelus Date: Sun, 25 Aug 2024 14:19:09 +0000 Subject: feat(game): disable portals close #7 --- .../java/world/anhgelus/molehunt/mixin/NoPortals.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/main/java/world/anhgelus/molehunt/mixin/NoPortals.java (limited to 'src/main/java') diff --git a/src/main/java/world/anhgelus/molehunt/mixin/NoPortals.java b/src/main/java/world/anhgelus/molehunt/mixin/NoPortals.java new file mode 100644 index 0000000..8ab8f14 --- /dev/null +++ b/src/main/java/world/anhgelus/molehunt/mixin/NoPortals.java @@ -0,0 +1,17 @@ +package world.anhgelus.molehunt.mixin; + +import net.minecraft.entity.Entity; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.world.dimension.PortalManager; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(PortalManager.class) +public class NoPortals { + @Inject(at = @At("HEAD"), method = "tick", cancellable = true) + public void disableTick(ServerWorld world, Entity entity, boolean canUsePortals, CallbackInfoReturnable cir) { + cir.setReturnValue(false); + } +} -- cgit v1.2.3