Upload files to "src/openonyx/interaction/internal"
This commit is contained in:
1 parent
3d1216db1b
commit
41ce7d6f8d
5 files changed
+242
No files matched your search
@@ -0,0 +1,17 @@
|
|||||||
|
package openonyx.interaction.internal;
|
||||||
|
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
import openonyx.utilities.internal.Box3;
|
||||||
|
|
||||||
|
public final class CenterAimPoint extends AimPointStrategy {
|
||||||
|
public static final CenterAimPoint INSTANCE = new CenterAimPoint();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Vec3 L(Box3 box3, BlockPos blockPos) {
|
||||||
|
return box3.d();
|
||||||
|
}
|
||||||
|
|
||||||
|
private CenterAimPoint() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package openonyx.interaction.internal;
|
||||||
|
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
import openonyx.core.MinecraftAccess;
|
||||||
|
|
||||||
|
public class EyePosition implements MinecraftAccess {
|
||||||
|
private final boolean i;
|
||||||
|
private static final float f = 1.54F;
|
||||||
|
private static final float H = 1.62F;
|
||||||
|
private final Vec3 vec3;
|
||||||
|
|
||||||
|
public boolean L() {
|
||||||
|
return this.i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float L() {
|
||||||
|
return L(this.i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vec3 getVec3() {
|
||||||
|
return this.vec3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EyePosition(Vec3 vec3, boolean bl) {
|
||||||
|
this.vec3 = vec3x;
|
||||||
|
this.i = bl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vec3 L() {
|
||||||
|
return this.vec3.add(0.0, this.L(), 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float L(boolean bl) {
|
||||||
|
return bl ? 1.54F : 1.62F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EyePosition(Vec3 vec3) {
|
||||||
|
this(vec3x, mc.thePlayer != null && mc.thePlayer.isSneaking());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package openonyx.interaction.internal;
|
||||||
|
|
||||||
|
import net.minecraft.client.entity.EntityPlayerSP;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
import openonyx.utilities.PlayerUtils;
|
||||||
|
import openonyx.utilities.internal.Box3;
|
||||||
|
import openonyx.utilities.internal.Line3;
|
||||||
|
|
||||||
|
public class InteractionSupport_011 extends AimPointStrategy {
|
||||||
|
private final AimContext aimContext;
|
||||||
|
private final Line3 line3;
|
||||||
|
|
||||||
|
public Line3 getLine3() {
|
||||||
|
return this.line3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Vec3 L(Box3 box3, BlockPos blockPos) {
|
||||||
|
box3 = this.L(box3).L(blockPos);
|
||||||
|
Box3 box31;
|
||||||
|
if ((box31 = this.L(mc.thePlayer, box3)) == null) {
|
||||||
|
box31 = box3;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new RandomAimPoint(this.aimContext).L(blockPos, box31.L(new Vec3(-blockPos.getX(), -blockPos.getY(), -blockPos.getZ())));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Box3 L(EntityPlayerSP entityPlayerSP, Box3 box3) {
|
||||||
|
if (this.line3 == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vec3 vec31 = PlayerUtils.D((Entity)entityPlayerSP);
|
||||||
|
Vec3 vec3 = this.line3.L(vec31);
|
||||||
|
vec3 = vec31.subtract(vec3).normalize();
|
||||||
|
Line3 line3x = new Line3(this.aimContext.eyePos(), this.line3.direction());
|
||||||
|
Vec3 vec32;
|
||||||
|
if ((vec32 = box3.L().L(line3x)) == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 = vec31.add(vec3.scale(2.0));
|
||||||
|
AxisAlignedBB axisAlignedBB = new AxisAlignedBB(vec32.xCoord, vec31.yCoord - 2.0, vec32.zCoord, vec3.xCoord, vec31.yCoord + 1.0, vec3.zCoord);
|
||||||
|
Box3 box31;
|
||||||
|
return (box31 = box3.L(axisAlignedBB)).L() < 1.0E-4 ? null : box31;
|
||||||
|
}
|
||||||
|
|
||||||
|
public InteractionSupport_011(AimContext aimContext, Line3 line3) {
|
||||||
|
this.aimContext = aimContextx;
|
||||||
|
this.line3 = line3x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AimContext getAimContext() {
|
||||||
|
return this.aimContext;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package openonyx.interaction.internal;
|
||||||
|
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
import openonyx.utilities.internal.Box3;
|
||||||
|
|
||||||
|
public final class InteractionSupport_016 extends AimPointStrategy {
|
||||||
|
public static final InteractionSupport_016 INSTANCE = new InteractionSupport_016();
|
||||||
|
|
||||||
|
private InteractionSupport_016() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Vec3 L(Box3 box3, BlockPos blockPos) {
|
||||||
|
return this.L(box3).I();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
package openonyx.interaction.internal;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
|
||||||
|
public enum PlacementOffset {
|
||||||
|
NORMAL,
|
||||||
|
NO_OFFSET(List.of(BlockPos.ORIGIN)),
|
||||||
|
DOWN,
|
||||||
|
FULL;
|
||||||
|
|
||||||
|
private final List<BlockPos> blockPosList;
|
||||||
|
|
||||||
|
private static PlacementOffset[] L() {
|
||||||
|
PlacementOffset[] placementOffsets = new PlacementOffset[4];
|
||||||
|
boolean bl = true;
|
||||||
|
placementOffsets[0] = NO_OFFSET;
|
||||||
|
placementOffsets[1] = NORMAL;
|
||||||
|
placementOffsets[2] = DOWN;
|
||||||
|
placementOffsets[3] = FULL;
|
||||||
|
return placementOffsets;
|
||||||
|
}
|
||||||
|
|
||||||
|
// $VF: Failed to inline enum fields
|
||||||
|
// Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!)
|
||||||
|
static {
|
||||||
|
int[] i = new int[3];
|
||||||
|
boolean bl = true;
|
||||||
|
i[0] = 0;
|
||||||
|
i[1] = -1;
|
||||||
|
i[2] = 1;
|
||||||
|
NORMAL = new PlacementOffset(L(i));
|
||||||
|
i = new int[5];
|
||||||
|
bl = true;
|
||||||
|
i[0] = 0;
|
||||||
|
i[1] = -1;
|
||||||
|
i[2] = 1;
|
||||||
|
i[3] = -2;
|
||||||
|
i[4] = 2;
|
||||||
|
DOWN = new PlacementOffset(L(i));
|
||||||
|
i = new int[9];
|
||||||
|
bl = true;
|
||||||
|
i[0] = 0;
|
||||||
|
i[1] = -1;
|
||||||
|
i[2] = 1;
|
||||||
|
i[3] = -2;
|
||||||
|
i[4] = 2;
|
||||||
|
i[5] = -3;
|
||||||
|
i[6] = 3;
|
||||||
|
i[7] = -4;
|
||||||
|
i[8] = 4;
|
||||||
|
FULL = new PlacementOffset(L(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean L(int i, int j, int k) {
|
||||||
|
return this.blockPosList.contains(new BlockPos(i, j, k));
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BlockPos> getBlockPosList() {
|
||||||
|
return this.blockPosList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<BlockPos> L(int... i) {
|
||||||
|
int[] j = i;
|
||||||
|
ArrayList arrayList = new ArrayList(j.length * j.length * 2);
|
||||||
|
int[] k = j;
|
||||||
|
int l = j.length;
|
||||||
|
|
||||||
|
int m;
|
||||||
|
for (int w = m = 0; w < l; w = ++m) {
|
||||||
|
int n = k[m];
|
||||||
|
int[] o = j;
|
||||||
|
int p = j.length;
|
||||||
|
|
||||||
|
int q;
|
||||||
|
for (int v = q = 0; v < p; v = ++q) {
|
||||||
|
int r = o[q];
|
||||||
|
long s = new BlockPos(n, 0, r).toLong();
|
||||||
|
long t = new BlockPos(n, -1, r).toLong();
|
||||||
|
if (!arrayList.contains(s)) {
|
||||||
|
arrayList.add(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!arrayList.contains(t)) {
|
||||||
|
arrayList.add(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList arrayList1 = new ArrayList(arrayList.size());
|
||||||
|
Iterator iterator;
|
||||||
|
Iterator iterator1 = iterator = arrayList.iterator();
|
||||||
|
|
||||||
|
while (iterator1.hasNext()) {
|
||||||
|
long u = (Long)iterator.next();
|
||||||
|
iterator1 = iterator;
|
||||||
|
arrayList1.add(BlockPos.fromLong(u));
|
||||||
|
}
|
||||||
|
|
||||||
|
arrayList1.sort(PlacementOffsetPart.COMPARATOR);
|
||||||
|
return List.copyOf(arrayList1);
|
||||||
|
}
|
||||||
|
|
||||||
|
PlacementOffset(List<BlockPos> list) {
|
||||||
|
this.blockPosList = list;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user