From 41ce7d6f8daff2f8268ac1550fb2e28e802ad158 Mon Sep 17 00:00:00 2001 From: winterflyt <36+winterflyt@noreply.skidsolutions.xyz> Date: Mon, 30 Nov 2026 06:02:49 +0200 Subject: [PATCH] Upload files to "src/openonyx/interaction/internal" --- .../interaction/internal/CenterAimPoint.java | 17 +++ .../interaction/internal/EyePosition.java | 40 +++++++ .../internal/InteractionSupport_011.java | 59 ++++++++++ .../internal/InteractionSupport_016.java | 17 +++ .../interaction/internal/PlacementOffset.java | 109 ++++++++++++++++++ 5 files changed, 242 insertions(+) create mode 100644 src/openonyx/interaction/internal/CenterAimPoint.java create mode 100644 src/openonyx/interaction/internal/EyePosition.java create mode 100644 src/openonyx/interaction/internal/InteractionSupport_011.java create mode 100644 src/openonyx/interaction/internal/InteractionSupport_016.java create mode 100644 src/openonyx/interaction/internal/PlacementOffset.java diff --git a/src/openonyx/interaction/internal/CenterAimPoint.java b/src/openonyx/interaction/internal/CenterAimPoint.java new file mode 100644 index 0000000..71ba542 --- /dev/null +++ b/src/openonyx/interaction/internal/CenterAimPoint.java @@ -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() { + } +} diff --git a/src/openonyx/interaction/internal/EyePosition.java b/src/openonyx/interaction/internal/EyePosition.java new file mode 100644 index 0000000..58800f7 --- /dev/null +++ b/src/openonyx/interaction/internal/EyePosition.java @@ -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()); + } +} diff --git a/src/openonyx/interaction/internal/InteractionSupport_011.java b/src/openonyx/interaction/internal/InteractionSupport_011.java new file mode 100644 index 0000000..770a982 --- /dev/null +++ b/src/openonyx/interaction/internal/InteractionSupport_011.java @@ -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; + } +} diff --git a/src/openonyx/interaction/internal/InteractionSupport_016.java b/src/openonyx/interaction/internal/InteractionSupport_016.java new file mode 100644 index 0000000..1bd8378 --- /dev/null +++ b/src/openonyx/interaction/internal/InteractionSupport_016.java @@ -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(); + } +} diff --git a/src/openonyx/interaction/internal/PlacementOffset.java b/src/openonyx/interaction/internal/PlacementOffset.java new file mode 100644 index 0000000..234647f --- /dev/null +++ b/src/openonyx/interaction/internal/PlacementOffset.java @@ -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 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 getBlockPosList() { + return this.blockPosList; + } + + private static List 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 list) { + this.blockPosList = list; + } +}