package com.thebrokenrail.reliccraft.mixin; import com.thebrokenrail.reliccraft.block.TeleportationRestrictorBlock; import net.minecraft.entity.LivingEntity; 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; @SuppressWarnings("unused") @Mixin(LivingEntity.class) public abstract class MixinLivingEntity { @Inject(at = @At("HEAD"), method = "teleport", cancellable = true) public void teleport(double x, double y, double z, boolean particleEffects, CallbackInfoReturnable info) { if (((TeleportationRestrictorBlock.TeleportingEntity) this).cannotTeleport()) { info.setReturnValue(false); } } }