Upload files to "src/openonyx/interaction/internal"
This commit is contained in:
1 parent
8f7c0de72a
commit
4e9d2d1f5d
4 files changed
+137
No files matched your search
@@ -0,0 +1,14 @@
|
|||||||
|
package openonyx.interaction.internal;
|
||||||
|
|
||||||
|
public enum PlacementSolverMode {
|
||||||
|
PLACE_AT_NEIGHBOR,
|
||||||
|
REPLACE_EXISTING_BLOCK;
|
||||||
|
|
||||||
|
private static PlacementSolverMode[] L() {
|
||||||
|
PlacementSolverMode[] placementSolverModes = new PlacementSolverMode[2];
|
||||||
|
boolean bl = true;
|
||||||
|
placementSolverModes[0] = PLACE_AT_NEIGHBOR;
|
||||||
|
placementSolverModes[1] = REPLACE_EXISTING_BLOCK;
|
||||||
|
return placementSolverModes;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package openonyx.interaction.internal;
|
||||||
|
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
import openonyx.utilities.BoxUtils;
|
||||||
|
|
||||||
|
final class PlacementSolverPart {
|
||||||
|
private final Vec3 vec3;
|
||||||
|
private final EnumFacing enumFacing;
|
||||||
|
private final BlockPos blockPos;
|
||||||
|
|
||||||
|
private double L(Vec3 vec3) {
|
||||||
|
vec3x = vec3x.subtract(this.vec3);
|
||||||
|
return vec3x.dotProduct(new Vec3(this.enumFacing.getDirectionVec())) / vec3x.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
private PlacementSolverPart(BlockPos blockPos, EnumFacing enumFacing) {
|
||||||
|
this.blockPos = blockPosx;
|
||||||
|
this.enumFacing = enumFacingx;
|
||||||
|
this.vec3 = BoxUtils.L(
|
||||||
|
new AxisAlignedBB(blockPosx.getX(), blockPosx.getY(), blockPosx.getZ(), blockPosx.getX() + 1.0, blockPosx.getY() + 1.0, blockPosx.getZ() + 1.0),
|
||||||
|
enumFacingx
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package openonyx.interaction.internal;
|
||||||
|
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
import openonyx.protocol.RotationHandler;
|
||||||
|
import openonyx.protocol.group_m.Angles;
|
||||||
|
import openonyx.utilities.internal.Box3;
|
||||||
|
import openonyx.utilities.internal.Line3;
|
||||||
|
import openonyx.utilities.internal.LinearShape;
|
||||||
|
|
||||||
|
public class RandomAimPoint extends AimPointStrategy {
|
||||||
|
private final AimContext aimContext;
|
||||||
|
|
||||||
|
public RandomAimPoint(AimContext aimContext) {
|
||||||
|
this.aimContext = aimContextx;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AimContext getAimContext() {
|
||||||
|
return this.aimContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vec3 L(BlockPos blockPos, Box3 box3) {
|
||||||
|
if (LinearShape.L(box3.L(), 0.0)) {
|
||||||
|
return box3.getVec32();
|
||||||
|
}
|
||||||
|
|
||||||
|
Angles angles = RotationHandler.INSTANCE.getAngles5();
|
||||||
|
Line3 line3 = new Line3(this.aimContext.eyePos().subtract(blockPos.getX(), blockPos.getY(), blockPos.getZ()), angles.L());
|
||||||
|
return box3.L(line3);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Vec3 L(Box3 box3, BlockPos blockPos) {
|
||||||
|
return this.L(blockPos, this.L(box3));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package openonyx.interaction.internal;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
import openonyx.utilities.BoxUtils;
|
||||||
|
import openonyx.utilities.InputFlagUtils;
|
||||||
|
import openonyx.utilities.PlayerUtils;
|
||||||
|
import openonyx.utilities.internal.Box3;
|
||||||
|
|
||||||
|
public class StabilizedAimPoint extends AimPointStrategy {
|
||||||
|
private final AimContext aimContext;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Vec3 L(Box3 box3, BlockPos blockPos) {
|
||||||
|
box3 = this.L(box3);
|
||||||
|
if (!InputFlagUtils.L(PlayerUtils.L(mc.thePlayer))) {
|
||||||
|
return this.L(blockPos, box3);
|
||||||
|
}
|
||||||
|
|
||||||
|
Vec3 vec3;
|
||||||
|
return (vec3 = this.d(blockPos, box3)) != null ? vec3 : this.L(blockPos, box3);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Vec3 d(BlockPos blockPos, Box3 box3) {
|
||||||
|
Vec3 vec33 = box3.getVec32();
|
||||||
|
Vec3 vec3 = box3.getVec3();
|
||||||
|
AxisAlignedBB axisAlignedBB = new AxisAlignedBB(vec33.xCoord, vec33.yCoord, vec33.zCoord, vec3.xCoord, vec3.yCoord, vec3.zCoord);
|
||||||
|
Vec3 vec32 = PlayerUtils.D((Entity)mc.thePlayer).subtract(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||||
|
vec3 = null;
|
||||||
|
double d = Double.NEGATIVE_INFINITY;
|
||||||
|
Vec3[] vec3s;
|
||||||
|
int i = (vec3s = BoxUtils.L(axisAlignedBB)).length;
|
||||||
|
|
||||||
|
int j;
|
||||||
|
for (int k = j = 0; k < i; k = ++j) {
|
||||||
|
Vec3 vec31;
|
||||||
|
double e;
|
||||||
|
if ((e = (vec31 = vec3s[j]).distanceToSqr(vec32)) > d) {
|
||||||
|
d = e;
|
||||||
|
vec3 = vec31;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return vec3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StabilizedAimPoint(AimContext aimContext) {
|
||||||
|
this.aimContext = aimContextx;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Vec3 L(BlockPos blockPos, Box3 box3) {
|
||||||
|
return new RandomAimPoint(this.aimContext).L(blockPos, box3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AimContext getAimContext() {
|
||||||
|
return this.aimContext;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user