blob: 75b8ec38722d3e8ab6eff86f9fc8ae5c7e88e6c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package com.anthonyhilyard.iceberg.mixin;
import com.anthonyhilyard.iceberg.util.EntityCollector;
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;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
@Mixin(value = Item.class, priority = 100)
public class ItemMixin
{
@Inject(method = "getPlayerPOVHitResult", at = @At(value = "HEAD"), cancellable = true)
private static void icebergGetPlayerPOVHitResult(Level level, Player player, ClipContext.Fluid clipContext, CallbackInfoReturnable<HitResult> info)
{
// If the level is an entity collector, always return a valid hit result.
if (level instanceof EntityCollector)
{
info.setReturnValue(new BlockHitResult(Vec3.ZERO, Direction.DOWN, BlockPos.ZERO, false));
}
}
}
|