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.
RelicCraft/src/main/java/com/thebrokenrail/reliccraft/mixin/MixinLivingEntity.java
TheBrokenRail 5167a1319d
All checks were successful
RelicCraft/pipeline/head This commit looks good
1.0.27
Use DataTracker
2020-04-18 21:16:30 -04:00

20 lines
816 B
Java

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<Boolean> info) {
if (((TeleportationRestrictorBlock.TeleportingEntity) this).cannotTeleport()) {
info.setReturnValue(false);
}
}
}