39 lines
1.3 KiB
Java
39 lines
1.3 KiB
Java
package openonyx.interaction.internal;
|
|
|
|
import java.util.Comparator;
|
|
import java.util.List;
|
|
import net.minecraft.entity.Entity;
|
|
import net.minecraft.util.BlockPos;
|
|
import net.minecraft.util.Vec3;
|
|
import net.minecraft.util.Vec3i;
|
|
import openonyx.core.MinecraftAccess;
|
|
import openonyx.interaction.BlockUtils;
|
|
import openonyx.utilities.BoxUtils;
|
|
import openonyx.utilities.PlayerUtils;
|
|
|
|
public class PlacementSearchPattern implements MinecraftAccess {
|
|
private final List<? extends Vec3i> vec3is;
|
|
private final Comparator<BlockPos> comparator;
|
|
|
|
public static PlacementSearchPattern L() {
|
|
return new PlacementSearchPattern(PlacementOffset.NO_OFFSET.getBlockPosList(), Comparator.comparingDouble(blockPos -> {
|
|
BlockPos blockPos1 = blockPos;
|
|
Vec3 vec3 = PlayerUtils.D((Entity)mc.thePlayer);
|
|
return -BoxUtils.L(BlockUtils.L(blockPos1).offset(blockPos1.getX(), blockPos1.getY(), blockPos1.getZ()), vec3);
|
|
}));
|
|
}
|
|
|
|
public List<? extends Vec3i> getVec3is() {
|
|
return this.vec3is;
|
|
}
|
|
|
|
public Comparator<BlockPos> getComparator() {
|
|
return this.comparator;
|
|
}
|
|
|
|
public PlacementSearchPattern(List<? extends Vec3i> list, Comparator<BlockPos> comparator) {
|
|
this.vec3is = list;
|
|
this.comparator = comparatorx;
|
|
}
|
|
}
|