From e67c61a23e1356f8f5deed7bffbf20c43be5772d Mon Sep 17 00:00:00 2001 From: Talia-12 Date: Wed, 31 May 2023 18:40:44 +1000 Subject: [PATCH] started making list ops, about to come up with new patterns for things --- .../api/casting/arithmetic/Arithmetic.java | 8 ++++ .../arithmetic/impls/ListArithmetic.java | 37 +++++++++++++++++++ .../operator/OperatorVec3Delegating.java | 2 +- 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/impls/ListArithmetic.java diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/Arithmetic.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/Arithmetic.java index d345f492..7e2ee6d5 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/Arithmetic.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/Arithmetic.java @@ -22,4 +22,12 @@ public interface Arithmetic { HexPattern MOD = HexPattern.fromAngles("addwaad", HexDir.NORTH_EAST); HexPattern PACK = HexPattern.fromAngles("eqqqqq", HexDir.EAST); HexPattern UNPACK = HexPattern.fromAngles("qeeeee", HexDir.EAST); + + // Lists + HexPattern INDEX = HexPattern.fromAngles("deeed", HexDir.NORTH_WEST); + HexPattern SLICE = HexPattern.fromAngles("qaeaqwded", HexDir.NORTH_WEST); + HexPattern REV = HexPattern.fromAngles("qqqaede", HexDir.EAST); + HexPattern INDEX_OF = HexPattern.fromAngles("dedqde", HexDir.EAST); + HexPattern REMOVE = HexPattern.fromAngles("edqdewaqa", HexDir.SOUTH_WEST); + HexPattern REPLACE = HexPattern.fromAngles("wqaeaqw", HexDir.NORTH_WEST); } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/impls/ListArithmetic.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/impls/ListArithmetic.java new file mode 100644 index 00000000..0d9549b2 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/impls/ListArithmetic.java @@ -0,0 +1,37 @@ +package at.petrak.hexcasting.api.casting.arithmetic.impls; + +import at.petrak.hexcasting.api.casting.arithmetic.Arithmetic; +import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator; +import at.petrak.hexcasting.api.casting.math.HexPattern; + +import java.util.List; + +public enum ListArithmetic implements Arithmetic { + INSTANCE; + + public static final List OPS = List.of( + INDEX, + SLICE, + ADD, + ABS, + REV, + INDEX_OF, + REMOVE, + REPLACE + ); + + @Override + public String arithName() { + return null; + } + + @Override + public Iterable opTypes() { + return null; + } + + @Override + public Operator getOperator(HexPattern pattern) { + return null; + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/OperatorVec3Delegating.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/OperatorVec3Delegating.java index 54cb332e..511f05e2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/OperatorVec3Delegating.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/OperatorVec3Delegating.java @@ -41,7 +41,7 @@ public class OperatorVec3Delegating extends Operator { fb.apply(new IterPair<>(new DoubleIota(lh.x()), new DoubleIota(rh.x()))), fb.apply(new IterPair<>(new DoubleIota(lh.y()), new DoubleIota(rh.y()))), fb.apply(new IterPair<>(new DoubleIota(lh.z()), new DoubleIota(rh.z()))), - (x, y, z) -> new Vec3Iota(new Vec3(downcast(x, DOUBLE).getDouble(), downcast(y, DOUBLE).getDouble(), downcast(y, DOUBLE).getDouble())) + (x, y, z) -> new Vec3Iota(new Vec3(downcast(x, DOUBLE).getDouble(), downcast(y, DOUBLE).getDouble(), downcast(z, DOUBLE).getDouble())) ); }