Upload files to "src/openonyx/interaction/internal"
This commit is contained in:
1 parent
23c280f210
commit
3d1216db1b
5 files changed
+201
No files matched your search
@@ -0,0 +1,6 @@
|
|||||||
|
package openonyx.interaction.internal;
|
||||||
|
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
|
||||||
|
public record AimContext(Vec3 eyePos, double randomNumber) {
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package openonyx.interaction.internal;
|
||||||
|
|
||||||
|
import openonyx.history.DisplayNamed;
|
||||||
|
|
||||||
|
public enum AimPointMode implements DisplayNamed {
|
||||||
|
RANDOM("Random"),
|
||||||
|
CENTER("Center"),
|
||||||
|
STABILIZED("Stabilized"),
|
||||||
|
EDGE_POINT("EdgePoint"),
|
||||||
|
NEAREST_ROTATION("NearestRotation");
|
||||||
|
|
||||||
|
private final String f;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDisplayName() {
|
||||||
|
return this.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
AimPointMode(String string1) {
|
||||||
|
this.f = string1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static AimPointMode[] L() {
|
||||||
|
AimPointMode[] aimPointModes = new AimPointMode[5];
|
||||||
|
boolean bl = true;
|
||||||
|
aimPointModes[0] = CENTER;
|
||||||
|
aimPointModes[1] = RANDOM;
|
||||||
|
aimPointModes[2] = STABILIZED;
|
||||||
|
aimPointModes[3] = NEAREST_ROTATION;
|
||||||
|
aimPointModes[4] = EDGE_POINT;
|
||||||
|
return aimPointModes;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package openonyx.interaction.internal;
|
||||||
|
|
||||||
|
public class AimPointOption {
|
||||||
|
private final AimPointStrategy aimPointStrategy;
|
||||||
|
private final boolean e;
|
||||||
|
|
||||||
|
public AimPointOption(AimPointStrategy aimPointStrategy) {
|
||||||
|
this(aimPointStrategyx, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AimPointOption(AimPointStrategy aimPointStrategy, boolean bl) {
|
||||||
|
this.aimPointStrategy = aimPointStrategyx;
|
||||||
|
this.e = bl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AimPointStrategy getAimPointStrategy() {
|
||||||
|
return this.aimPointStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean L() {
|
||||||
|
return this.e;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package openonyx.interaction.internal;
|
||||||
|
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
import openonyx.core.MinecraftAccess;
|
||||||
|
import openonyx.utilities.internal.Box3;
|
||||||
|
|
||||||
|
public abstract class AimPointStrategy implements MinecraftAccess {
|
||||||
|
protected Box3 L(Box3 box3) {
|
||||||
|
Vec3 vec33 = box3.L().scale(0.15);
|
||||||
|
Vec3 vec3 = box3.getVec32();
|
||||||
|
Vec3 vec31 = box3.getVec3();
|
||||||
|
Vec3 vec32 = box3.d();
|
||||||
|
double d = vec3.xCoord + vec33.xCoord;
|
||||||
|
double e = vec31.xCoord - vec33.xCoord;
|
||||||
|
double f = vec3.yCoord + vec33.yCoord;
|
||||||
|
double g = vec31.yCoord - vec33.yCoord;
|
||||||
|
double h = vec3.zCoord + vec33.zCoord;
|
||||||
|
double i = vec31.zCoord - vec33.zCoord;
|
||||||
|
if (d > e) {
|
||||||
|
d = vec32.xCoord;
|
||||||
|
e = vec32.xCoord;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f > g) {
|
||||||
|
f = vec32.yCoord;
|
||||||
|
g = vec32.yCoord;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (h > i) {
|
||||||
|
h = vec32.zCoord;
|
||||||
|
i = vec32.zCoord;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Box3(
|
||||||
|
new Vec3(L(vec3.xCoord, d, e), L(vec3.yCoord, f, g), L(vec3.zCoord, h, i)),
|
||||||
|
new Vec3(L(vec31.xCoord, d, e), L(vec31.yCoord, f, g), L(vec31.zCoord, h, i))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double L(double d, double e, double f) {
|
||||||
|
if (d < e) {
|
||||||
|
return e;
|
||||||
|
} else {
|
||||||
|
return d > f ? f : d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract Vec3 L(Box3 box3, BlockPos blockPos);
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
package openonyx.interaction.internal;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
import openonyx.interaction.BlockUtils;
|
||||||
|
import openonyx.utilities.BoxUtils;
|
||||||
|
import openonyx.utilities.internal.ClosestPoint;
|
||||||
|
import openonyx.utilities.internal.Line3;
|
||||||
|
|
||||||
|
public class BlockPlacementContext {
|
||||||
|
private final PlacementSearchPattern placementSearchPattern;
|
||||||
|
private final EyePosition eyePosition;
|
||||||
|
private final AimPointOption aimPointOption;
|
||||||
|
private final ItemStack itemStack;
|
||||||
|
|
||||||
|
private static AxisAlignedBB L(BlockPos blockPos) {
|
||||||
|
return BlockUtils.L(blockPos).offset(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlacementSearchPattern getPlacementSearchPattern() {
|
||||||
|
return this.placementSearchPattern;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Comparator<BlockPos> L(Line3 line3) {
|
||||||
|
return Comparator.comparingDouble(blockPos -> {
|
||||||
|
AxisAlignedBB axisAlignedBB = L(blockPos);
|
||||||
|
ClosestPoint closestPoint;
|
||||||
|
return -((closestPoint = line3.L(axisAlignedBB)) != null ? closestPoint.distanceSquared() : Double.POSITIVE_INFINITY);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Comparator<BlockPos> L(Vec3 vec3) {
|
||||||
|
return Comparator.comparingDouble(blockPos -> -BoxUtils.L(L(blockPos), vec3));
|
||||||
|
}
|
||||||
|
|
||||||
|
public AimPointOption getAimPointOption() {
|
||||||
|
return this.aimPointOption;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EyePosition getEyePosition() {
|
||||||
|
return this.eyePosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getItemStack() {
|
||||||
|
return this.itemStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BlockPlacementContext(PlacementSearchPattern placementSearchPattern, AimPointOption aimPointOption, ItemStack itemStack, EyePosition eyePosition) {
|
||||||
|
this.placementSearchPattern = placementSearchPatternx;
|
||||||
|
this.aimPointOption = aimPointOptionx;
|
||||||
|
this.itemStack = itemStackx;
|
||||||
|
this.eyePosition = eyePositionx;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String decrypt(String string) {
|
||||||
|
String string1 = string;
|
||||||
|
int l = (--3 ^ 5) << 3 ^ 2;
|
||||||
|
int m = 3 << 3 ^ 4;
|
||||||
|
String string2;
|
||||||
|
int o = (string2 = string1).length();
|
||||||
|
char[] d = new char[o];
|
||||||
|
boolean bl = true;
|
||||||
|
int j;
|
||||||
|
int n = j = o - 1;
|
||||||
|
char[] c = d;
|
||||||
|
byte b = 83;
|
||||||
|
l = n;
|
||||||
|
int i = m;
|
||||||
|
|
||||||
|
while (l >= 0) {
|
||||||
|
m = j;
|
||||||
|
int k = string2.charAt(j);
|
||||||
|
j--;
|
||||||
|
c[m] = (char)(k ^ i);
|
||||||
|
if (j < 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
k = j--;
|
||||||
|
c[k] = (char)(string2.charAt(k) ^ b);
|
||||||
|
l = j;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new String(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user