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;
|
|
|
|
|
|
|
|
import com.thebrokenrail.reliccraft.block.TeleportationRestrictorBlock;
|
2020-06-28 16:38:49 +00:00
|
|
|
import net.minecraft.entity.projectile.thrown.EnderPearlEntity;
|
2020-04-04 02:32:34 +00:00
|
|
|
import net.minecraft.util.hit.HitResult;
|
|
|
|
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.CallbackInfo;
|
|
|
|
|
|
|
|
@SuppressWarnings("unused")
|
2020-06-28 16:38:49 +00:00
|
|
|
@Mixin(EnderPearlEntity.class)
|
2020-04-04 02:32:34 +00:00
|
|
|
public class MixinThrownEnderpearlEntity {
|
|
|
|
@Inject(at = @At("HEAD"), method = "onCollision", cancellable = true)
|
|
|
|
public void onCollision(HitResult hitResult, CallbackInfo info) {
|
2020-04-18 20:09:27 +00:00
|
|
|
if (((TeleportationRestrictorBlock.TeleportingEntity) this).cannotTeleport()) {
|
2020-06-28 16:38:49 +00:00
|
|
|
((EnderPearlEntity) (Object) this).remove();
|
2020-04-04 02:32:34 +00:00
|
|
|
info.cancel();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|