aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/world
diff options
context:
space:
mode:
authoranhgelus <anhgelus.morhtuuzh@proton.me>2024-08-25 14:19:09 +0000
committeranhgelus <anhgelus.morhtuuzh@proton.me>2024-08-25 14:19:09 +0000
commit9bb3bc44b5201124879836739c976a772cab7403 (patch)
tree97426044597e62ba85f39245a88d3ccbe9a445f6 /src/main/java/world
parent5c0617cd3de4e786b3643e67bf610d5349164243 (diff)
feat(game): disable portals
close #7
Diffstat (limited to 'src/main/java/world')
-rw-r--r--src/main/java/world/anhgelus/molehunt/mixin/NoPortals.java17
1 files changed, 17 insertions, 0 deletions
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<Boolean> cir) {
+ cir.setReturnValue(false);
+ }
+}