This repository has been archived on 2023-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
2020-04-04 02:32:34 +00:00
|
|
|
package com.thebrokenrail.reliccraft.mixin;
|
|
|
|
|
2020-04-19 01:16:30 +00:00
|
|
|
import com.thebrokenrail.reliccraft.block.TeleportationRestrictorBlock;
|
2020-04-04 02:32:34 +00:00
|
|
|
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)
|
2020-04-19 01:16:30 +00:00
|
|
|
public abstract class MixinLivingEntity {
|
2020-04-04 02:32:34 +00:00
|
|
|
@Inject(at = @At("HEAD"), method = "teleport", cancellable = true)
|
|
|
|
public void teleport(double x, double y, double z, boolean particleEffects, CallbackInfoReturnable<Boolean> info) {
|
2020-04-19 01:16:30 +00:00
|
|
|
if (((TeleportationRestrictorBlock.TeleportingEntity) this).cannotTeleport()) {
|
2020-04-04 02:32:34 +00:00
|
|
|
info.setReturnValue(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|