2025-11-24 22:52:51 +03:00

74 lines
2.3 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package net.minecraft.world.phys;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
public class BlockHitResult
extends HitResult {
private final Direction direction;
private final BlockPos blockPos;
private final boolean miss;
private final boolean inside;
private final boolean worldBorderHit;
public static BlockHitResult miss(Vec3 location, Direction direction, BlockPos pos) {
return new BlockHitResult(true, location, direction, pos, false, false);
}
public BlockHitResult(Vec3 location, Direction direction, BlockPos pos, boolean inside) {
this(false, location, direction, pos, inside, false);
}
public BlockHitResult(Vec3 location, Direction direction, BlockPos pos, boolean inside, boolean worldBorderHit) {
this(false, location, direction, pos, inside, worldBorderHit);
}
private BlockHitResult(boolean miss, Vec3 location, Direction direction, BlockPos blockPos, boolean inside, boolean worldBorderHit) {
super(location);
this.miss = miss;
this.direction = direction;
this.blockPos = blockPos;
this.inside = inside;
this.worldBorderHit = worldBorderHit;
}
public BlockHitResult withDirection(Direction direction) {
return new BlockHitResult(this.miss, this.location, direction, this.blockPos, this.inside, this.worldBorderHit);
}
public BlockHitResult withPosition(BlockPos blockPos) {
return new BlockHitResult(this.miss, this.location, this.direction, blockPos, this.inside, this.worldBorderHit);
}
public BlockHitResult hitBorder() {
return new BlockHitResult(this.miss, this.location, this.direction, this.blockPos, this.inside, true);
}
public BlockPos getBlockPos() {
return this.blockPos;
}
public Direction getDirection() {
return this.direction;
}
@Override
public HitResult.Type getType() {
return this.miss ? HitResult.Type.MISS : HitResult.Type.BLOCK;
}
public boolean isInside() {
return this.inside;
}
public boolean isWorldBorderHit() {
return this.worldBorderHit;
}
}