1.0.17
All checks were successful
RelicCraft/pipeline/head This commit looks good

The Teleportation Restrictor now blocks Portal Teleportation
This commit is contained in:
TheBrokenRail 2020-04-15 16:35:03 -04:00
parent 56d88ebcb2
commit 61732c4cd6
3 changed files with 12 additions and 1 deletions

View File

@ -1,5 +1,8 @@
# Changelog # Changelog
**1.0.17**
* The Teleportation Restrictor now blocks Portal Teleportation
**1.0.16** **1.0.16**
* Register Loot Function * Register Loot Function

View File

@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G
fabric_loader_version = 0.7.10+build.191 fabric_loader_version = 0.7.10+build.191
# Mod Properties # Mod Properties
mod_version = 1.0.16 mod_version = 1.0.17
maven_group = com.thebrokenrail maven_group = com.thebrokenrail
archives_base_name = reliccraft archives_base_name = reliccraft

View File

@ -7,6 +7,7 @@ import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Mixin(Entity.class) @Mixin(Entity.class)
@ -26,6 +27,13 @@ public class MixinEntity implements TeleportationRestrictorBlock.TeleportingEnti
} }
} }
@Inject(at = @At("HEAD"), method = "canUsePortals", cancellable = true)
public void canUsePortals(CallbackInfoReturnable<Boolean> info) {
if (cannotTeleport()) {
info.setReturnValue(false);
}
}
@Override @Override
public boolean cannotTeleport() { public boolean cannotTeleport() {
return teleportCooldown > 0; return teleportCooldown > 0;