diff --git a/Common/src/generated/resources/assets/hexcasting/blockstates/edified_fence_gate.json b/Common/src/generated/resources/assets/hexcasting/blockstates/edified_fence_gate.json new file mode 100644 index 000000000..f925ddfdd --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/blockstates/edified_fence_gate.json @@ -0,0 +1,80 @@ +{ + "variants": { + "facing=east,in_wall=false,open=false": { + "model": "hexcasting:block/edified_fence_gate", + "uvlock": true, + "y": 270 + }, + "facing=east,in_wall=false,open=true": { + "model": "hexcasting:block/edified_fence_gate_open", + "uvlock": true, + "y": 270 + }, + "facing=east,in_wall=true,open=false": { + "model": "hexcasting:block/edified_fence_gate_wall", + "uvlock": true, + "y": 270 + }, + "facing=east,in_wall=true,open=true": { + "model": "hexcasting:block/edified_fence_gate_wall_open", + "uvlock": true, + "y": 270 + }, + "facing=north,in_wall=false,open=false": { + "model": "hexcasting:block/edified_fence_gate", + "uvlock": true, + "y": 180 + }, + "facing=north,in_wall=false,open=true": { + "model": "hexcasting:block/edified_fence_gate_open", + "uvlock": true, + "y": 180 + }, + "facing=north,in_wall=true,open=false": { + "model": "hexcasting:block/edified_fence_gate_wall", + "uvlock": true, + "y": 180 + }, + "facing=north,in_wall=true,open=true": { + "model": "hexcasting:block/edified_fence_gate_wall_open", + "uvlock": true, + "y": 180 + }, + "facing=south,in_wall=false,open=false": { + "model": "hexcasting:block/edified_fence_gate", + "uvlock": true + }, + "facing=south,in_wall=false,open=true": { + "model": "hexcasting:block/edified_fence_gate_open", + "uvlock": true + }, + "facing=south,in_wall=true,open=false": { + "model": "hexcasting:block/edified_fence_gate_wall", + "uvlock": true + }, + "facing=south,in_wall=true,open=true": { + "model": "hexcasting:block/edified_fence_gate_wall_open", + "uvlock": true + }, + "facing=west,in_wall=false,open=false": { + "model": "hexcasting:block/edified_fence_gate", + "uvlock": true, + "y": 90 + }, + "facing=west,in_wall=false,open=true": { + "model": "hexcasting:block/edified_fence_gate_open", + "uvlock": true, + "y": 90 + }, + "facing=west,in_wall=true,open=false": { + "model": "hexcasting:block/edified_fence_gate_wall", + "uvlock": true, + "y": 90 + }, + "facing=west,in_wall=true,open=true": { + "model": "hexcasting:block/edified_fence_gate_wall_open", + "uvlock": true, + "y": 90 + } + } +} \ No newline at end of file diff --git a/Common/src/generated/resources/assets/hexcasting/models/block/edified_fence_gate.json b/Common/src/generated/resources/assets/hexcasting/models/block/edified_fence_gate.json new file mode 100644 index 000000000..c3015ca6d --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/block/edified_fence_gate.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_fence_gate", + "textures": { + "texture": "hexcasting:block/edified_planks" + } +} \ No newline at end of file diff --git a/Common/src/generated/resources/assets/hexcasting/models/block/edified_fence_gate_open.json b/Common/src/generated/resources/assets/hexcasting/models/block/edified_fence_gate_open.json new file mode 100644 index 000000000..ac141eb40 --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/block/edified_fence_gate_open.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_fence_gate_open", + "textures": { + "texture": "hexcasting:block/edified_planks" + } +} \ No newline at end of file diff --git a/Common/src/generated/resources/assets/hexcasting/models/block/edified_fence_gate_wall.json b/Common/src/generated/resources/assets/hexcasting/models/block/edified_fence_gate_wall.json new file mode 100644 index 000000000..ea98b1674 --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/block/edified_fence_gate_wall.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_fence_gate_wall", + "textures": { + "texture": "hexcasting:block/edified_planks" + } +} \ No newline at end of file diff --git a/Common/src/generated/resources/assets/hexcasting/models/block/edified_fence_gate_wall_open.json b/Common/src/generated/resources/assets/hexcasting/models/block/edified_fence_gate_wall_open.json new file mode 100644 index 000000000..86d82ca2f --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/block/edified_fence_gate_wall_open.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_fence_gate_wall_open", + "textures": { + "texture": "hexcasting:block/edified_planks" + } +} \ No newline at end of file diff --git a/Common/src/generated/resources/assets/hexcasting/models/item/edified_fence_gate.json b/Common/src/generated/resources/assets/hexcasting/models/item/edified_fence_gate.json new file mode 100644 index 000000000..3dfe52119 --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/item/edified_fence_gate.json @@ -0,0 +1,3 @@ +{ + "parent": "hexcasting:block/edified_fence_gate" +} \ No newline at end of file diff --git a/Common/src/generated/resources/assets/hexcasting/models/item/staff/bamboo.json b/Common/src/generated/resources/assets/hexcasting/models/item/staff/bamboo.json new file mode 100644 index 000000000..cb0018898 --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/item/staff/bamboo.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld_rod", + "textures": { + "layer0": "hexcasting:item/staff/bamboo" + } +} \ No newline at end of file diff --git a/Common/src/generated/resources/assets/hexcasting/models/item/staff/cherry.json b/Common/src/generated/resources/assets/hexcasting/models/item/staff/cherry.json new file mode 100644 index 000000000..1fb639851 --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/item/staff/cherry.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld_rod", + "textures": { + "layer0": "hexcasting:item/staff/cherry" + } +} \ No newline at end of file diff --git a/Common/src/generated/resources/assets/hexcasting/models/staff/bamboo.json b/Common/src/generated/resources/assets/hexcasting/models/staff/bamboo.json new file mode 100644 index 000000000..c0f063051 --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/staff/bamboo.json @@ -0,0 +1,16 @@ +{ + "overrides": [ + { + "model": "hexcasting:item/bamboo_staff", + "predicate": { + "hexcasting:funny_level": 0.0 + } + }, + { + "model": "hexcasting:item/cherry_staff", + "predicate": { + "hexcasting:funny_level": 2.0 + } + } + ] +} \ No newline at end of file diff --git a/Common/src/generated/resources/assets/hexcasting/models/staff/cherry.json b/Common/src/generated/resources/assets/hexcasting/models/staff/cherry.json new file mode 100644 index 000000000..9a663a248 --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/staff/cherry.json @@ -0,0 +1,16 @@ +{ + "overrides": [ + { + "model": "hexcasting:item/cherry_staff", + "predicate": { + "hexcasting:funny_level": 0.0 + } + }, + { + "model": "hexcasting:item/cherry_staff", + "predicate": { + "hexcasting:funny_level": 2.0 + } + } + ] +} \ No newline at end of file diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/engine/ArithmeticEngine.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/engine/ArithmeticEngine.java index 28e2912ce..2f7e1fe7d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/engine/ArithmeticEngine.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/engine/ArithmeticEngine.java @@ -3,6 +3,9 @@ import at.petrak.hexcasting.api.casting.arithmetic.Arithmetic; import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator; import at.petrak.hexcasting.api.casting.eval.CastingEnvironment; +import at.petrak.hexcasting.api.casting.eval.OperationResult; +import at.petrak.hexcasting.api.casting.eval.vm.CastingImage; +import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation; import at.petrak.hexcasting.api.casting.iota.Iota; import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.api.casting.mishaps.Mishap; @@ -64,29 +67,34 @@ public Iterable operatorSyms() { /** * Runs one of the contained Operators assigned to the given pattern, modifying the passed stack of iotas. * @param pattern The pattern that was drawn, used to determine which operators are candidates. - * @param iotas The current stack. - * @param startingLength The length of the stack before the operator executes (used for errors). * @param env The casting environment. + * @param image The casting image. + * @param continuation The current continuation. * @return The iotas to be added to the stack. * @throws Mishap mishaps if invalid input to the operators is given by the caster. */ - public Iterable run(HexPattern pattern, Stack iotas, int startingLength, CastingEnvironment env) throws Mishap { + public OperationResult run(HexPattern pattern, CastingEnvironment env, CastingImage image, SpellContinuation continuation) throws Mishap { + var stackList = image.getStack(); + var stack = new Stack(); + stack.addAll(stackList); + var startingLength = stackList.size(); + var candidates = operators.get(pattern); if (candidates == null) throw new InvalidOperatorException("the pattern " + pattern + " is not an operator."); // HashCons hash = new HashCons.Pattern(pattern); var args = new ArrayList(candidates.arity()); for (var i = 0; i < candidates.arity(); i++) { - if (iotas.isEmpty()) { + if (stack.isEmpty()) { throw new MishapNotEnoughArgs(candidates.arity, startingLength); } - var iota = iotas.pop(); + var iota = stack.pop(); hash = new HashCons.Pair(iota.getType(), hash); args.add(iota); } Collections.reverse(args); var op = resolveCandidates(args, hash, candidates); - return op.apply(args, env); + return op.operate(env, image, continuation); } private Operator resolveCandidates(List args, HashCons hash, OpCandidates candidates) { diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/Operator.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/Operator.java deleted file mode 100644 index a94ab7583..000000000 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/Operator.java +++ /dev/null @@ -1,55 +0,0 @@ -package at.petrak.hexcasting.api.casting.arithmetic.operator; - -import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaMultiPredicate; -import at.petrak.hexcasting.api.casting.eval.CastingEnvironment; -import at.petrak.hexcasting.api.casting.iota.Iota; -import at.petrak.hexcasting.api.casting.iota.IotaType; -import at.petrak.hexcasting.api.casting.mishaps.Mishap; -import org.jetbrains.annotations.NotNull; - -/** - * Represents an Operator, similar to Action except that it also has a defined set of IotaTypes that it accepts, and - * there can be multiple Operators 'assigned' to the same pattern in different Arithmetics as long as they don't have - * overlapping matched types. (Overlapping matched types is not checked for, but will have undefined behaviour). - */ -public abstract class Operator { - /** - * The number of arguments from the stack that this Operator requires; all Operators with the same pattern must have - * the same arity. - */ - public final int arity; - - /** - * A function that should return true if the passed list of Iotas satisfies this Operator's type constraints, and false otherwise. - */ - public final IotaMultiPredicate accepts; - - /** - * @param arity The number of arguments from the stack that this Operator requires; all Operators with the same pattern must have arity. - * @param accepts A function that should return true if the passed list of Iotas satisfies this Operator's type constraints, and false otherwise. - */ - public Operator(int arity, IotaMultiPredicate accepts) { - this.arity = arity; - this.accepts = accepts; - } - - /** - /** - * The method called when this Operator is actually acting on the stack, for real. - * @param iotas An iterable of iotas with {@link Operator#arity} elements that satisfied {@link Operator#accepts}. - * @param env The casting environment, to make use of if this operator needs it. - * @return the iotas that this operator will return to the stack (with the first element of the returned iterable being placed deepest into the stack, and the last element on top of the stack). - * @throws Mishap if the Operator mishaps for any reason it will be passed up the chain. - */ - public abstract @NotNull Iterable apply(@NotNull Iterable iotas, @NotNull CastingEnvironment env) throws Mishap; - - /** - * A helper method to take an iota that you know is of iotaType and returning it as an iota of that type. - */ - @SuppressWarnings("unchecked") - public static T downcast(Iota iota, IotaType iotaType) { - if (iota.getType() != iotaType) - throw new IllegalStateException("Attempting to downcast " + iota + " to type: " + iotaType); - return (T) iota; - } -} diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/Operator.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/Operator.kt new file mode 100644 index 000000000..8804e0d62 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/Operator.kt @@ -0,0 +1,43 @@ +package at.petrak.hexcasting.api.casting.arithmetic.operator + +import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaMultiPredicate +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment +import at.petrak.hexcasting.api.casting.eval.OperationResult +import at.petrak.hexcasting.api.casting.eval.vm.CastingImage +import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.iota.IotaType +import at.petrak.hexcasting.api.casting.mishaps.Mishap +import at.petrak.hexcasting.common.lib.hex.HexEvalSounds +import java.util.function.Consumer + +abstract class Operator +/** + * @param arity The number of arguments from the stack that this Operator requires; all Operators with the same pattern must have arity. + * @param accepts A function that should return true if the passed list of Iotas satisfies this Operator's type constraints, and false otherwise. + */ + ( + @JvmField + val arity: Int, + @JvmField + val accepts: IotaMultiPredicate +) { + + /** + * Functionally update the image. Return the image and any side effects. + */ + @Throws(Mishap::class) + abstract fun operate(env: CastingEnvironment, image: CastingImage, continuation: SpellContinuation): OperationResult + + + companion object { + /** + * A helper method to take an iota that you know is of iotaType and returning it as an iota of that type. + */ + @JvmStatic + fun downcast(iota: Iota, iotaType: IotaType): T { + check(iota.type === iotaType) { "Attempting to downcast $iota to type: $iotaType" } + return iota as T + } + } +} \ No newline at end of file diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/OperatorBasic.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/OperatorBasic.kt new file mode 100644 index 000000000..1d43c890c --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/OperatorBasic.kt @@ -0,0 +1,39 @@ +package at.petrak.hexcasting.api.casting.arithmetic.operator + +import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaMultiPredicate +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment +import at.petrak.hexcasting.api.casting.eval.OperationResult +import at.petrak.hexcasting.api.casting.eval.vm.CastingImage +import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.Mishap +import at.petrak.hexcasting.common.lib.hex.HexEvalSounds +import java.util.function.Consumer + +abstract class OperatorBasic(arity: Int, accepts: IotaMultiPredicate) : Operator(arity, accepts) { + + @Throws(Mishap::class) + override fun operate(env: CastingEnvironment, image: CastingImage, continuation: SpellContinuation): OperationResult { + val stack = image.stack.toMutableList() + val args = stack.takeLast(arity) + repeat(arity) { stack.removeLast() } + + val ret = apply(args, env) + ret.forEach(Consumer { e: Iota -> stack.add(e) }) + + val image2 = image.copy(stack = stack, opsConsumed = image.opsConsumed + 1) + return OperationResult(image2, listOf(), continuation, HexEvalSounds.NORMAL_EXECUTE) + } + + /** + * / ** + * The method called when this Operator is actually acting on the stack, for real. + * @param iotas An iterable of iotas with [Operator.arity] elements that satisfied [Operator.accepts]. + * @param env The casting environment, to make use of if this operator needs it. + * @return the iotas that this operator will return to the stack (with the first element of the returned iterable being placed deepest into the stack, and the last element on top of the stack). + * @throws Mishap if the Operator mishaps for any reason it will be passed up the chain. + */ + @Throws(Mishap::class) + abstract fun apply(iotas: Iterable, env: CastingEnvironment): Iterable + +} \ No newline at end of file diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/OperatorBinary.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/OperatorBinary.java index 5c3c46a2a..02914dc4d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/OperatorBinary.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/OperatorBinary.java @@ -12,7 +12,7 @@ /** * A helper class for defining {@link Operator}s of two iotas. */ -public class OperatorBinary extends Operator { +public class OperatorBinary extends OperatorBasic { public BinaryOperator inner; public OperatorBinary(IotaMultiPredicate accepts, BinaryOperator inner) { @@ -21,7 +21,7 @@ public OperatorBinary(IotaMultiPredicate accepts, BinaryOperator inner) { } @Override - public @NotNull Iterable apply(@NotNull Iterable iotas, @NotNull CastingEnvironment env) { + public @NotNull Iterable apply(Iterable iotas, @NotNull CastingEnvironment env) { var it = iotas.iterator(); return List.of(inner.apply(it.next(), it.next())); } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/OperatorUnary.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/OperatorUnary.java index a6dbbdf0f..9797b83b1 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/OperatorUnary.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/OperatorUnary.java @@ -12,7 +12,7 @@ /** * A helper class for defining {@link Operator}s of one iota. */ -public class OperatorUnary extends Operator { +public class OperatorUnary extends OperatorBasic { public UnaryOperator inner; public OperatorUnary(IotaMultiPredicate accepts, UnaryOperator inner) { @@ -21,7 +21,7 @@ public OperatorUnary(IotaMultiPredicate accepts, UnaryOperator inner) { } @Override - public @NotNull Iterable apply(@NotNull Iterable iotas, @NotNull CastingEnvironment env) { + public @NotNull Iterable apply(Iterable iotas, @NotNull CastingEnvironment env) { return List.of(inner.apply(iotas.iterator().next())); } } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/OperationAction.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/OperationAction.kt index 0032d6cec..c2c5b06ee 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/OperationAction.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/OperationAction.kt @@ -5,13 +5,9 @@ import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.eval.OperationResult import at.petrak.hexcasting.api.casting.eval.vm.CastingImage import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation -import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.math.HexPattern import at.petrak.hexcasting.api.casting.mishaps.MishapInvalidOperatorArgs import at.petrak.hexcasting.common.lib.hex.HexArithmetics -import at.petrak.hexcasting.common.lib.hex.HexEvalSounds -import java.util.* -import java.util.function.Consumer /** * Represents an Operator with the give pattern as its identifier, a special type of Action that calls a different function depending on the type of its arguments. @@ -19,15 +15,8 @@ import java.util.function.Consumer */ data class OperationAction(val pattern: HexPattern) : Action { override fun operate(env: CastingEnvironment, image: CastingImage, continuation: SpellContinuation): OperationResult { - val stackList = image.stack - val stack = Stack() - stack.addAll(stackList) - val startingLength = stackList.size return try { - val ret: Iterable = HexArithmetics.getEngine().run(pattern, stack, startingLength, env) - ret.forEach(Consumer { e: Iota -> stack.add(e) }) - val image2 = image.copy(stack = stack, opsConsumed = image.opsConsumed + 1) // TODO: maybe let operators figure out how many ops to consume? - OperationResult(image2, listOf(), continuation, HexEvalSounds.NORMAL_EXECUTE) + HexArithmetics.getEngine().run(pattern, env, image, continuation) } catch (e: NoOperatorCandidatesException) { throw MishapInvalidOperatorArgs(e.args, e.pattern) } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/blocks/decoration/BlockHexFence.java b/Common/src/main/java/at/petrak/hexcasting/common/blocks/decoration/BlockHexFence.java new file mode 100644 index 000000000..ec7ac9518 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/blocks/decoration/BlockHexFence.java @@ -0,0 +1,30 @@ +package at.petrak.hexcasting.common.blocks.decoration; + +import at.petrak.hexcasting.annotations.SoftImplement; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.FenceBlock; +import net.minecraft.world.level.block.state.BlockState; + +public class BlockHexFence extends FenceBlock { + + public BlockHexFence(Properties $$0) { + super($$0); + } + + @SoftImplement("forge") + public boolean isFlammable(BlockState state, BlockGetter level, BlockPos pos, Direction direction) { + return true; + } + + @SoftImplement("forge") + public int getFlammability(BlockState state, BlockGetter level, BlockPos pos, Direction direction) { + return 20; + } + + @SoftImplement("forge") + public int getFireSpreadSpeed(BlockState state, BlockGetter level, BlockPos pos, Direction direction) { + return 5; + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/blocks/decoration/BlockHexFenceGate.java b/Common/src/main/java/at/petrak/hexcasting/common/blocks/decoration/BlockHexFenceGate.java new file mode 100644 index 000000000..10fc89230 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/blocks/decoration/BlockHexFenceGate.java @@ -0,0 +1,32 @@ +package at.petrak.hexcasting.common.blocks.decoration; + +import at.petrak.hexcasting.annotations.SoftImplement; +import at.petrak.hexcasting.common.lib.HexBlockSetTypes; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.FenceGateBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.WoodType; + +public class BlockHexFenceGate extends FenceGateBlock { + + public BlockHexFenceGate(Properties $$0) { + super($$0, WoodType.DARK_OAK); + } + + @SoftImplement("forge") + public boolean isFlammable(BlockState state, BlockGetter level, BlockPos pos, Direction direction) { + return true; + } + + @SoftImplement("forge") + public int getFlammability(BlockState state, BlockGetter level, BlockPos pos, Direction direction) { + return 20; + } + + @SoftImplement("forge") + public int getFireSpreadSpeed(BlockState state, BlockGetter level, BlockPos pos, Direction direction) { + return 5; + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/BitwiseSetArithmetic.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/BitwiseSetArithmetic.kt index 1063f2984..715297a05 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/BitwiseSetArithmetic.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/BitwiseSetArithmetic.kt @@ -4,7 +4,7 @@ import at.petrak.hexcasting.api.casting.arithmetic.Arithmetic import at.petrak.hexcasting.api.casting.arithmetic.Arithmetic.* import at.petrak.hexcasting.api.casting.arithmetic.engine.InvalidOperatorException import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator -import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator.downcast +import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator.Companion.downcast import at.petrak.hexcasting.api.casting.arithmetic.operator.OperatorBinary import at.petrak.hexcasting.api.casting.arithmetic.operator.OperatorUnary import at.petrak.hexcasting.api.casting.iota.DoubleIota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/ListArithmetic.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/ListArithmetic.kt index ddfb3a409..35a34e61e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/ListArithmetic.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/ListArithmetic.kt @@ -5,7 +5,7 @@ import at.petrak.hexcasting.api.casting.arithmetic.Arithmetic import at.petrak.hexcasting.api.casting.arithmetic.Arithmetic.* import at.petrak.hexcasting.api.casting.arithmetic.engine.InvalidOperatorException import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator -import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator.downcast +import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator.Companion.downcast import at.petrak.hexcasting.api.casting.arithmetic.operator.OperatorBinary import at.petrak.hexcasting.api.casting.arithmetic.operator.OperatorUnary import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaMultiPredicate.all diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/ListSetArithmetic.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/ListSetArithmetic.kt index 4209952b6..d412c6665 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/ListSetArithmetic.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/ListSetArithmetic.kt @@ -4,7 +4,7 @@ import at.petrak.hexcasting.api.casting.arithmetic.Arithmetic import at.petrak.hexcasting.api.casting.arithmetic.Arithmetic.* import at.petrak.hexcasting.api.casting.arithmetic.engine.InvalidOperatorException import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator -import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator.* +import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator.Companion.downcast import at.petrak.hexcasting.api.casting.arithmetic.operator.OperatorBinary import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaMultiPredicate.* import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaPredicate diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/OperatorLog.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/OperatorLog.kt index 4cd8bcd50..0a36d8ac1 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/OperatorLog.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/OperatorLog.kt @@ -1,6 +1,7 @@ package at.petrak.hexcasting.common.casting.arithmetic.operator import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator +import at.petrak.hexcasting.api.casting.arithmetic.operator.OperatorBasic import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaMultiPredicate import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaPredicate import at.petrak.hexcasting.api.casting.asActionResult @@ -10,7 +11,7 @@ import at.petrak.hexcasting.api.casting.mishaps.MishapDivideByZero import at.petrak.hexcasting.common.lib.hex.HexIotaTypes.DOUBLE import kotlin.math.log -object OperatorLog : Operator(2, IotaMultiPredicate.all(IotaPredicate.ofType(DOUBLE))) { +object OperatorLog : OperatorBasic(2, IotaMultiPredicate.all(IotaPredicate.ofType(DOUBLE))) { override fun apply(iotas: Iterable, env : CastingEnvironment): Iterable { val it = iotas.iterator().withIndex() val value = it.nextDouble(arity) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorAppend.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorAppend.kt index c593b5d15..724e5f674 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorAppend.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorAppend.kt @@ -1,6 +1,7 @@ package at.petrak.hexcasting.common.casting.arithmetic.operator.list import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator +import at.petrak.hexcasting.api.casting.arithmetic.operator.OperatorBasic import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaMultiPredicate import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaPredicate import at.petrak.hexcasting.api.casting.asActionResult @@ -9,7 +10,7 @@ import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.common.casting.arithmetic.operator.nextList import at.petrak.hexcasting.common.lib.hex.HexIotaTypes.* -object OperatorAppend : Operator(2, IotaMultiPredicate.pair(IotaPredicate.ofType(LIST), IotaPredicate.TRUE)) { +object OperatorAppend : OperatorBasic(2, IotaMultiPredicate.pair(IotaPredicate.ofType(LIST), IotaPredicate.TRUE)) { override fun apply(iotas: Iterable, env: CastingEnvironment): Iterable { val it = iotas.iterator().withIndex() val list = it.nextList(arity).toMutableList() diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorIndex.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorIndex.kt index 59a00c23d..2ecb5fc14 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorIndex.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorIndex.kt @@ -3,13 +3,14 @@ package at.petrak.hexcasting.common.casting.arithmetic.operator.list import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaMultiPredicate import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaPredicate import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator +import at.petrak.hexcasting.api.casting.arithmetic.operator.OperatorBasic import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.iota.NullIota import at.petrak.hexcasting.common.lib.hex.HexIotaTypes.* import kotlin.math.roundToInt -object OperatorIndex : Operator(2, IotaMultiPredicate.pair(IotaPredicate.ofType(LIST), IotaPredicate.ofType(DOUBLE))) { +object OperatorIndex : OperatorBasic(2, IotaMultiPredicate.pair(IotaPredicate.ofType(LIST), IotaPredicate.ofType(DOUBLE))) { override fun apply(iotas: Iterable, env: CastingEnvironment): Iterable { val it = iotas.iterator() val list = downcast(it.next(), LIST).list.toMutableList() diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorIndexOf.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorIndexOf.kt index a69a4d986..a3d711d57 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorIndexOf.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorIndexOf.kt @@ -1,6 +1,7 @@ package at.petrak.hexcasting.common.casting.arithmetic.operator.list import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator +import at.petrak.hexcasting.api.casting.arithmetic.operator.OperatorBasic import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaMultiPredicate import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaPredicate import at.petrak.hexcasting.api.casting.asActionResult @@ -9,7 +10,7 @@ import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.common.casting.arithmetic.operator.nextList import at.petrak.hexcasting.common.lib.hex.HexIotaTypes.* -object OperatorIndexOf : Operator(2, IotaMultiPredicate.pair(IotaPredicate.ofType(LIST), IotaPredicate.TRUE)) { +object OperatorIndexOf : OperatorBasic(2, IotaMultiPredicate.pair(IotaPredicate.ofType(LIST), IotaPredicate.TRUE)) { override fun apply(iotas: Iterable, env: CastingEnvironment): Iterable { val it = iotas.iterator().withIndex() val list = it.nextList(arity).toList() diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorRemove.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorRemove.kt index 804fe9b54..1a1af53cf 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorRemove.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorRemove.kt @@ -1,6 +1,7 @@ package at.petrak.hexcasting.common.casting.arithmetic.operator.list import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator +import at.petrak.hexcasting.api.casting.arithmetic.operator.OperatorBasic import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaMultiPredicate import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaPredicate import at.petrak.hexcasting.api.casting.asActionResult @@ -10,7 +11,7 @@ import at.petrak.hexcasting.common.casting.arithmetic.operator.nextInt import at.petrak.hexcasting.common.casting.arithmetic.operator.nextList import at.petrak.hexcasting.common.lib.hex.HexIotaTypes.* -object OperatorRemove : Operator(2, IotaMultiPredicate.pair(IotaPredicate.ofType(LIST), IotaPredicate.ofType(DOUBLE))) { +object OperatorRemove : OperatorBasic(2, IotaMultiPredicate.pair(IotaPredicate.ofType(LIST), IotaPredicate.ofType(DOUBLE))) { override fun apply(iotas: Iterable, env: CastingEnvironment): Iterable { val it = iotas.iterator().withIndex() val list = it.nextList(arity).toMutableList() diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorReplace.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorReplace.kt index 4773d3673..ca976369c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorReplace.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorReplace.kt @@ -2,6 +2,7 @@ package at.petrak.hexcasting.common.casting.arithmetic.operator.list import at.petrak.hexcasting.api.casting.SpellList import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator +import at.petrak.hexcasting.api.casting.arithmetic.operator.OperatorBasic import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaMultiPredicate import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaPredicate import at.petrak.hexcasting.api.casting.asActionResult @@ -11,7 +12,7 @@ import at.petrak.hexcasting.common.casting.arithmetic.operator.nextList import at.petrak.hexcasting.common.casting.arithmetic.operator.nextPositiveIntUnder import at.petrak.hexcasting.common.lib.hex.HexIotaTypes.* -object OperatorReplace : Operator(3, IotaMultiPredicate.triple(IotaPredicate.ofType(LIST), IotaPredicate.ofType(DOUBLE), IotaPredicate.TRUE)) { +object OperatorReplace : OperatorBasic(3, IotaMultiPredicate.triple(IotaPredicate.ofType(LIST), IotaPredicate.ofType(DOUBLE), IotaPredicate.TRUE)) { override fun apply(iotas: Iterable, env: CastingEnvironment): Iterable { val it = iotas.iterator().withIndex() val list = it.nextList(arity) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorSlice.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorSlice.kt index 32f48b452..d4e8c5f8e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorSlice.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorSlice.kt @@ -3,6 +3,7 @@ package at.petrak.hexcasting.common.casting.arithmetic.operator.list import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaMultiPredicate import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaPredicate import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator +import at.petrak.hexcasting.api.casting.arithmetic.operator.OperatorBasic import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota @@ -12,7 +13,7 @@ import at.petrak.hexcasting.common.lib.hex.HexIotaTypes.* import kotlin.math.max import kotlin.math.min -object OperatorSlice : Operator(3, IotaMultiPredicate.triple(IotaPredicate.ofType(LIST), IotaPredicate.ofType(DOUBLE), IotaPredicate.ofType(DOUBLE))) { +object OperatorSlice : OperatorBasic(3, IotaMultiPredicate.triple(IotaPredicate.ofType(LIST), IotaPredicate.ofType(DOUBLE), IotaPredicate.ofType(DOUBLE))) { override fun apply(iotas: Iterable, env: CastingEnvironment): Iterable { val it = iotas.iterator().withIndex() val list = it.nextList(arity).toList() diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorUnCons.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorUnCons.kt index 336e9ff89..54f0de69c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorUnCons.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorUnCons.kt @@ -1,6 +1,7 @@ package at.petrak.hexcasting.common.casting.arithmetic.operator.list import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator +import at.petrak.hexcasting.api.casting.arithmetic.operator.OperatorBasic import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaMultiPredicate import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaPredicate import at.petrak.hexcasting.api.casting.eval.CastingEnvironment @@ -10,7 +11,7 @@ import at.petrak.hexcasting.api.casting.iota.NullIota import at.petrak.hexcasting.common.casting.arithmetic.operator.nextList import at.petrak.hexcasting.common.lib.hex.HexIotaTypes.LIST -object OperatorUnCons : Operator(1, IotaMultiPredicate.all(IotaPredicate.ofType(LIST))) { +object OperatorUnCons : OperatorBasic(1, IotaMultiPredicate.all(IotaPredicate.ofType(LIST))) { override fun apply(iotas: Iterable, env: CastingEnvironment): Iterable { val it = iotas.iterator().withIndex() val list = it.nextList(arity) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorUnappend.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorUnappend.kt index 5ca944723..6d60362b0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorUnappend.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorUnappend.kt @@ -1,6 +1,7 @@ package at.petrak.hexcasting.common.casting.arithmetic.operator.list import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator +import at.petrak.hexcasting.api.casting.arithmetic.operator.OperatorBasic import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaMultiPredicate import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaPredicate import at.petrak.hexcasting.api.casting.eval.CastingEnvironment @@ -10,7 +11,7 @@ import at.petrak.hexcasting.api.casting.iota.NullIota import at.petrak.hexcasting.common.casting.arithmetic.operator.nextList import at.petrak.hexcasting.common.lib.hex.HexIotaTypes.* -object OperatorUnappend : Operator(1, IotaMultiPredicate.all(IotaPredicate.ofType(LIST))) { +object OperatorUnappend : OperatorBasic(1, IotaMultiPredicate.all(IotaPredicate.ofType(LIST))) { override fun apply(iotas: Iterable, env: CastingEnvironment): Iterable { val it = iotas.iterator().withIndex() val list = it.nextList(arity).toMutableList() diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorUnique.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorUnique.kt index 27d88da09..b3cb19ec2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorUnique.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/list/OperatorUnique.kt @@ -1,6 +1,7 @@ package at.petrak.hexcasting.common.casting.arithmetic.operator.list import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator +import at.petrak.hexcasting.api.casting.arithmetic.operator.OperatorBasic import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaMultiPredicate import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaPredicate import at.petrak.hexcasting.api.casting.asActionResult @@ -10,7 +11,7 @@ import at.petrak.hexcasting.common.casting.arithmetic.operator.nextList import at.petrak.hexcasting.common.casting.actions.math.bit.OpToSet import at.petrak.hexcasting.common.lib.hex.HexIotaTypes.LIST -object OperatorUnique : Operator(1, IotaMultiPredicate.all(IotaPredicate.ofType(LIST))) { +object OperatorUnique : OperatorBasic(1, IotaMultiPredicate.all(IotaPredicate.ofType(LIST))) { override fun apply(iotas: Iterable, env: CastingEnvironment): Iterable { val it = iotas.iterator().withIndex() val list = it.nextList(OpToSet.argc) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/vec/OperatorPack.java b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/vec/OperatorPack.java index f6621468c..d30b8edcb 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/vec/OperatorPack.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/vec/OperatorPack.java @@ -1,9 +1,10 @@ package at.petrak.hexcasting.common.casting.arithmetic.operator.vec; +import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator; +import at.petrak.hexcasting.api.casting.arithmetic.operator.OperatorBasic; import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaMultiPredicate; import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaPredicate; -import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator; import at.petrak.hexcasting.api.casting.eval.CastingEnvironment; import at.petrak.hexcasting.api.casting.iota.Iota; import at.petrak.hexcasting.api.casting.iota.Vec3Iota; @@ -13,7 +14,7 @@ import java.util.List; -public class OperatorPack extends Operator { +public class OperatorPack extends OperatorBasic { private OperatorPack() { super(3, IotaMultiPredicate.all(IotaPredicate.ofType(HexIotaTypes.DOUBLE))); } @@ -21,7 +22,7 @@ private OperatorPack() { public static OperatorPack INSTANCE = new OperatorPack(); @Override - public @NotNull Iterable apply(@NotNull Iterable iotas, @NotNull CastingEnvironment env) { + public @NotNull Iterable apply(Iterable iotas, @NotNull CastingEnvironment env) { var it = iotas.iterator(); return List.of(new Vec3Iota(new Vec3( downcast(it.next(), HexIotaTypes.DOUBLE).getDouble(), diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/vec/OperatorUnpack.java b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/vec/OperatorUnpack.java index 9a51d6d71..adaeed698 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/vec/OperatorUnpack.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/vec/OperatorUnpack.java @@ -1,9 +1,10 @@ package at.petrak.hexcasting.common.casting.arithmetic.operator.vec; +import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator; +import at.petrak.hexcasting.api.casting.arithmetic.operator.OperatorBasic; import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaMultiPredicate; import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaPredicate; -import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator; import at.petrak.hexcasting.api.casting.eval.CastingEnvironment; import at.petrak.hexcasting.api.casting.iota.DoubleIota; import at.petrak.hexcasting.api.casting.iota.Iota; @@ -14,7 +15,7 @@ import static at.petrak.hexcasting.common.lib.hex.HexIotaTypes.VEC3; -public class OperatorUnpack extends Operator { +public class OperatorUnpack extends OperatorBasic { private OperatorUnpack() { super(1, IotaMultiPredicate.all(IotaPredicate.ofType(HexIotaTypes.VEC3))); } @@ -22,7 +23,7 @@ private OperatorUnpack() { public static OperatorUnpack INSTANCE = new OperatorUnpack(); @Override - public @NotNull Iterable apply(@NotNull Iterable iotas, @NotNull CastingEnvironment env) { + public @NotNull Iterable apply(Iterable iotas, @NotNull CastingEnvironment env) { var it = iotas.iterator(); var vec = downcast(it.next(), VEC3).getVec3(); return List.of(new DoubleIota(vec.x), new DoubleIota(vec.y), new DoubleIota(vec.z)); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/vec/OperatorVec3Delegating.java b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/vec/OperatorVec3Delegating.java index fdce8c958..25e543dfb 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/vec/OperatorVec3Delegating.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/operator/vec/OperatorVec3Delegating.java @@ -1,10 +1,11 @@ package at.petrak.hexcasting.common.casting.arithmetic.operator.vec; +import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator; +import at.petrak.hexcasting.api.casting.arithmetic.operator.OperatorBasic; import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaMultiPredicate; import at.petrak.hexcasting.api.casting.arithmetic.predicates.IotaPredicate; import at.petrak.hexcasting.api.casting.arithmetic.IterPair; import at.petrak.hexcasting.api.casting.arithmetic.TripleIterable; -import at.petrak.hexcasting.api.casting.arithmetic.operator.Operator; import at.petrak.hexcasting.api.casting.eval.CastingEnvironment; import at.petrak.hexcasting.api.casting.mishaps.Mishap; import at.petrak.hexcasting.api.casting.mishaps.MishapDivideByZero; @@ -23,17 +24,17 @@ import static at.petrak.hexcasting.common.lib.hex.HexIotaTypes.DOUBLE; import static at.petrak.hexcasting.common.lib.hex.HexIotaTypes.VEC3; -public class OperatorVec3Delegating extends Operator { +public class OperatorVec3Delegating extends OperatorBasic { private final BiFunction op; - private final Operator fb; + private final OperatorBasic fb; public OperatorVec3Delegating(BiFunction core, HexPattern fallback) { super(2, IotaMultiPredicate.any(IotaPredicate.ofType(VEC3), IotaPredicate.ofType(DOUBLE))); op = core; - fb = Objects.requireNonNull(DoubleArithmetic.INSTANCE.getOperator(fallback)); + fb = (OperatorBasic) Objects.requireNonNull(DoubleArithmetic.INSTANCE.getOperator(fallback)); } @Override - public @NotNull Iterable apply(@NotNull Iterable iotas, @NotNull CastingEnvironment env) throws Mishap { + public @NotNull Iterable apply(Iterable iotas, @NotNull CastingEnvironment env) throws Mishap { var it = iotas.iterator(); var left = it.next(); var right = it.next(); @@ -57,4 +58,4 @@ public OperatorVec3Delegating(BiFunction core, HexPattern fall public static Vec3 triplicate(double in) { return new Vec3(in, in, in); } -} +} \ No newline at end of file diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/HexBlocks.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/HexBlocks.java index 908e3f139..97e58a75e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/HexBlocks.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/HexBlocks.java @@ -264,6 +264,12 @@ private static BlockBehaviour.Properties quenched() { new BlockHexTrapdoor(edifiedWoody().noOcclusion())); public static final StairBlock EDIFIED_STAIRS = blockItem("edified_stairs", new BlockHexStairs(EDIFIED_PLANKS.defaultBlockState(), edifiedWoody().noOcclusion())); + + public static final FenceBlock EDIFIED_FENCE = blockItem("edified_fence", + new BlockHexFence(edifiedWoody().noOcclusion())); + public static final FenceGateBlock EDIFIED_FENCE_GATE = blockItem("edified_fence_gate", + new BlockHexFenceGate(edifiedWoody().noOcclusion())); + public static final SlabBlock EDIFIED_SLAB = blockItem("edified_slab", new BlockHexSlab(edifiedWoody().noOcclusion())); public static final ButtonBlock EDIFIED_BUTTON = blockItem("edified_button", diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/HexItems.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/HexItems.java index d6b90adf3..a85889e10 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/HexItems.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/HexItems.java @@ -58,6 +58,8 @@ public static void registerItemCreativeTab(CreativeModeTab.Output r, CreativeMod public static final ItemStaff STAFF_CRIMSON = make("staff/crimson", new ItemStaff(unstackable())); public static final ItemStaff STAFF_WARPED = make("staff/warped", new ItemStaff(unstackable())); public static final ItemStaff STAFF_MANGROVE = make("staff/mangrove", new ItemStaff(unstackable())); + public static final ItemStaff STAFF_CHERRY = make("staff/cherry", new ItemStaff(unstackable())); + public static final ItemStaff STAFF_BAMBOO = make("staff/bamboo", new ItemStaff(unstackable())); public static final ItemStaff STAFF_EDIFIED = make("staff/edified", new ItemStaff(unstackable())); public static final ItemStaff STAFF_QUENCHED = make("staff/quenched", new ItemStaff(unstackable())); // mindsplice staffaratus diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/HexLootTables.java b/Common/src/main/java/at/petrak/hexcasting/datagen/HexLootTables.java index b52a65d2f..386320703 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/HexLootTables.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/HexLootTables.java @@ -58,7 +58,7 @@ protected void makeLootTables(Map blockTables, HexBlocks.EDIFIED_LOG_CITRINE, HexBlocks.EDIFIED_LOG_PURPLE, HexBlocks.STRIPPED_EDIFIED_LOG, HexBlocks.EDIFIED_WOOD, HexBlocks.STRIPPED_EDIFIED_WOOD, HexBlocks.EDIFIED_PLANKS, HexBlocks.EDIFIED_TILE, HexBlocks.EDIFIED_PANEL, - HexBlocks.EDIFIED_TRAPDOOR, HexBlocks.EDIFIED_STAIRS, HexBlocks.EDIFIED_PRESSURE_PLATE, + HexBlocks.EDIFIED_TRAPDOOR, HexBlocks.EDIFIED_STAIRS, HexBlocks.EDIFIED_FENCE, HexBlocks.EDIFIED_FENCE_GATE, HexBlocks.EDIFIED_PRESSURE_PLATE, HexBlocks.EDIFIED_BUTTON); makeSlabTable(blockTables, HexBlocks.EDIFIED_SLAB); diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java index 66860103f..811df1d45 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java @@ -82,6 +82,8 @@ public void buildRecipes(Consumer recipes) { staffRecipe(recipes, HexItems.STAFF_CRIMSON, Items.CRIMSON_PLANKS); staffRecipe(recipes, HexItems.STAFF_WARPED, Items.WARPED_PLANKS); staffRecipe(recipes, HexItems.STAFF_MANGROVE, Items.MANGROVE_PLANKS); + staffRecipe(recipes, HexItems.STAFF_CHERRY, Items.CHERRY_PLANKS); + staffRecipe(recipes, HexItems.STAFF_BAMBOO, Items.BAMBOO_PLANKS); staffRecipe(recipes, HexItems.STAFF_EDIFIED, HexBlocks.EDIFIED_PLANKS.asItem()); staffRecipe(recipes, HexItems.STAFF_QUENCHED, HexItems.QUENCHED_SHARD); staffRecipe(recipes, HexItems.STAFF_MINDSPLICE, Ingredient.of(HexTags.Items.MINDFLAYED_CIRCLE_COMPONENTS)); @@ -355,6 +357,21 @@ public void buildRecipes(Consumer recipes) { .pattern("WWW") .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, HexBlocks.EDIFIED_FENCE, 3) + .define('W', HexTags.Items.EDIFIED_PLANKS) + .define('S', Items.STICK) + .pattern("WSW") + .pattern("WSW") + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, HexBlocks.EDIFIED_FENCE_GATE, 1) + .define('W', HexTags.Items.EDIFIED_PLANKS) + .define('S', Items.STICK) + .pattern("SWS") + .pattern("SWS") + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, HexBlocks.EDIFIED_SLAB, 6) .define('W', HexTags.Items.EDIFIED_PLANKS) .pattern("WWW") diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexBlockTagProvider.java b/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexBlockTagProvider.java index 6818632f6..75b043523 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexBlockTagProvider.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexBlockTagProvider.java @@ -54,7 +54,7 @@ protected void addTags(HolderLookup.Provider provider) { HexBlocks.EDIFIED_WOOD, HexBlocks.STRIPPED_EDIFIED_WOOD, HexBlocks.EDIFIED_PLANKS, HexBlocks.EDIFIED_PANEL, HexBlocks.EDIFIED_TILE, HexBlocks.EDIFIED_DOOR, HexBlocks.EDIFIED_TRAPDOOR, HexBlocks.EDIFIED_SLAB, - HexBlocks.EDIFIED_BUTTON, HexBlocks.EDIFIED_STAIRS); + HexBlocks.EDIFIED_BUTTON, HexBlocks.EDIFIED_STAIRS, HexBlocks.EDIFIED_FENCE, HexBlocks.EDIFIED_FENCE_GATE); add(tag(BlockTags.MINEABLE_WITH_HOE), HexBlocks.AMETHYST_EDIFIED_LEAVES, HexBlocks.AVENTURINE_EDIFIED_LEAVES, @@ -93,6 +93,19 @@ protected void addTags(HolderLookup.Provider provider) { HexBlocks.EDIFIED_SLAB); add(tag(BlockTags.STAIRS), HexBlocks.EDIFIED_STAIRS); + add(tag(BlockTags.FENCES), + HexBlocks.EDIFIED_FENCE); + add(tag(BlockTags.WOODEN_FENCES), + HexBlocks.EDIFIED_FENCE); + add(tag(BlockTags.FENCE_GATES), + HexBlocks.EDIFIED_FENCE_GATE); + add(tag(BlockTags.UNSTABLE_BOTTOM_CENTER), + HexBlocks.EDIFIED_FENCE_GATE); + + + + add(tag(BlockTags.WOODEN_FENCES), + HexBlocks.EDIFIED_FENCE); add(tag(BlockTags.WOODEN_STAIRS), HexBlocks.EDIFIED_STAIRS); add(tag(BlockTags.DOORS), diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexItemTagProvider.java b/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexItemTagProvider.java index cf2877a44..e6ecbf58d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexItemTagProvider.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexItemTagProvider.java @@ -40,6 +40,7 @@ protected void addTags(HolderLookup.Provider provider) { HexItems.STAFF_OAK, HexItems.STAFF_SPRUCE, HexItems.STAFF_BIRCH, HexItems.STAFF_JUNGLE, HexItems.STAFF_ACACIA, HexItems.STAFF_DARK_OAK, HexItems.STAFF_CRIMSON, HexItems.STAFF_WARPED, HexItems.STAFF_MANGROVE, + HexItems.STAFF_CHERRY,HexItems.STAFF_BAMBOO, HexItems.STAFF_QUENCHED, HexItems.STAFF_MINDSPLICE); add(tag(HexTags.Items.PHIAL_BASE), diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 b/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 index 28e3e7333..7c3b96547 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 @@ -13,6 +13,8 @@ "crimson": "Crimson Staff", "warped": "Warped Staff", "mangrove": "Mangrove Staff", + "cherry": "Cherry Staff", + "bamboo": "Bamboo Staff", "edified": "Edified Staff", "quenched": "Quenched Shard Staff", "mindsplice": "Mindsplice Staff" @@ -149,6 +151,8 @@ "edified_door": "Edified Door", "edified_trapdoor": "Edified Trapdoor", "edified_stairs": "Edified Stairs", + "edified_fence": "Edified Fence", + "edified_fence_gate": "Edified Fence Gate", "edified_slab": "Edified Slab", "edified_button": "Edified Button", "edified_pressure_plate": "Edified Pressure Plate", diff --git a/Common/src/main/resources/assets/hexcasting/models/block/edified_fence_inventory.json b/Common/src/main/resources/assets/hexcasting/models/block/edified_fence_inventory.json new file mode 100644 index 000000000..d62247299 --- /dev/null +++ b/Common/src/main/resources/assets/hexcasting/models/block/edified_fence_inventory.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/fence_inventory", + "textures": { + "texture": "hexcasting:block/edified_planks" + } +} diff --git a/Common/src/main/resources/assets/hexcasting/textures/entity/signs/edified.png b/Common/src/main/resources/assets/hexcasting/textures/entity/signs/edified.png new file mode 100644 index 000000000..9da2cde14 Binary files /dev/null and b/Common/src/main/resources/assets/hexcasting/textures/entity/signs/edified.png differ diff --git a/Common/src/main/resources/assets/hexcasting/textures/entity/signs/hanging/edified.png b/Common/src/main/resources/assets/hexcasting/textures/entity/signs/hanging/edified.png new file mode 100644 index 000000000..c8af29fde Binary files /dev/null and b/Common/src/main/resources/assets/hexcasting/textures/entity/signs/hanging/edified.png differ diff --git a/Common/src/main/resources/assets/hexcasting/textures/item/edified_sign.png b/Common/src/main/resources/assets/hexcasting/textures/item/edified_sign.png new file mode 100644 index 000000000..9973e36ed Binary files /dev/null and b/Common/src/main/resources/assets/hexcasting/textures/item/edified_sign.png differ diff --git a/Common/src/main/resources/assets/hexcasting/textures/item/hanging_edified_sign.png b/Common/src/main/resources/assets/hexcasting/textures/item/hanging_edified_sign.png new file mode 100644 index 000000000..2de0b7173 Binary files /dev/null and b/Common/src/main/resources/assets/hexcasting/textures/item/hanging_edified_sign.png differ diff --git a/Common/src/main/resources/assets/hexcasting/textures/item/staff/bamboo.png b/Common/src/main/resources/assets/hexcasting/textures/item/staff/bamboo.png new file mode 100644 index 000000000..ce4890494 Binary files /dev/null and b/Common/src/main/resources/assets/hexcasting/textures/item/staff/bamboo.png differ diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/building_blocks/edified_fence_gate.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/building_blocks/edified_fence_gate.json new file mode 100644 index 000000000..aa49266e0 --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/building_blocks/edified_fence_gate.json @@ -0,0 +1,33 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "tag": "hexcasting:edified_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "hexcasting:edified_fence_gate" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_item", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "hexcasting:edified_fence_gate" + ] + }, + "sends_telemetry_event": false +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/loot_tables/blocks/edified_fence_gate.json b/Fabric/src/generated/resources/data/hexcasting/loot_tables/blocks/edified_fence_gate.json new file mode 100644 index 000000000..01cbf2a5e --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/loot_tables/blocks/edified_fence_gate.json @@ -0,0 +1,15 @@ +{ + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "hexcasting:edified_fence_gate" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "hexcasting:blocks/edified_fence_gate" +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/edified_fence_gate.json b/Fabric/src/generated/resources/data/hexcasting/recipes/edified_fence_gate.json new file mode 100644 index 000000000..799b582fb --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/edified_fence_gate.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "building", + "key": { + "S": { + "item": "minecraft:stick" + }, + "W": { + "tag": "hexcasting:edified_planks" + } + }, + "pattern": [ + "SWS", + "SWS" + ], + "result": { + "item": "hexcasting:edified_fence_gate" + }, + "show_notification": true +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/minecraft/tags/blocks/fence_gates.json b/Fabric/src/generated/resources/data/minecraft/tags/blocks/fence_gates.json new file mode 100644 index 000000000..4dff358b0 --- /dev/null +++ b/Fabric/src/generated/resources/data/minecraft/tags/blocks/fence_gates.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "hexcasting:edified_fence_gate" + ] +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/minecraft/tags/blocks/unstable_bottom_center.json b/Fabric/src/generated/resources/data/minecraft/tags/blocks/unstable_bottom_center.json new file mode 100644 index 000000000..4dff358b0 --- /dev/null +++ b/Fabric/src/generated/resources/data/minecraft/tags/blocks/unstable_bottom_center.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "hexcasting:edified_fence_gate" + ] +} \ No newline at end of file diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt index 8cc7a00ff..e7d316345 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt @@ -191,7 +191,8 @@ object FabricHexInitializer : ModInitializer { HexBlocks.EDIFIED_TRAPDOOR, HexBlocks.EDIFIED_STAIRS, HexBlocks.EDIFIED_SLAB, - HexBlocks.EDIFIED_STAIRS, + HexBlocks.EDIFIED_FENCE, + HexBlocks.EDIFIED_FENCE_GATE, HexBlocks.EDIFIED_SLAB, HexBlocks.EDIFIED_BUTTON, HexBlocks.EDIFIED_PRESSURE_PLATE, diff --git a/Fabric/src/main/resources/fabric.mod.json b/Fabric/src/main/resources/fabric.mod.json index 051105004..5bb5abee1 100644 --- a/Fabric/src/main/resources/fabric.mod.json +++ b/Fabric/src/main/resources/fabric.mod.json @@ -55,7 +55,7 @@ "cardinal-components-entity": "~5.2.1", "cardinal-components-item": "~5.2.1", "cardinal-components-block": "~5.2.1", - "paucal": "0.6.*", + "paucal": "0.6.x", "cloth-config": "11.1.*", "patchouli": ">=1.20.1-80" }, diff --git a/Forge/build.gradle b/Forge/build.gradle index 426300957..9cd4e8e1d 100644 --- a/Forge/build.gradle +++ b/Forge/build.gradle @@ -142,6 +142,11 @@ minecraft { property 'mixin.env.remapRefMap', 'true' property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" property 'hexcasting.xplat_datagen', 'true' + + // disable the System.exit(0) at the end of the ForgeGradle datagen so Gradle stops thinking it failed + // see: https://github.com/MinecraftForge/ForgeGradle/pull/686 + forceExit false + mods { create(modID) { source sourceSets.main @@ -159,6 +164,7 @@ minecraft { property 'mixin.env.remapRefMap', 'true' property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" property 'hexcasting.forge_datagen', 'true' + forceExit false mods { create(modID) { source sourceSets.main diff --git a/Forge/gradle.properties b/Forge/gradle.properties index 6ba5b71f6..57a5c0f48 100644 --- a/Forge/gradle.properties +++ b/Forge/gradle.properties @@ -1,4 +1,4 @@ -forgeVersion=47.2.0 +forgeVersion=47.1.47 kotlinForForgeVersion=4.3.0 diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/building_blocks/edified_fence_gate.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/building_blocks/edified_fence_gate.json new file mode 100644 index 000000000..aa49266e0 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/building_blocks/edified_fence_gate.json @@ -0,0 +1,33 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "tag": "hexcasting:edified_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "hexcasting:edified_fence_gate" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_item", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "hexcasting:edified_fence_gate" + ] + }, + "sends_telemetry_event": false +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/tools/staff/bamboo.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/tools/staff/bamboo.json new file mode 100644 index 000000000..a6fa449db --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/tools/staff/bamboo.json @@ -0,0 +1,35 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": [ + "hexcasting:charged_amethyst" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "hexcasting:staff/bamboo" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_item", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "hexcasting:staff/bamboo" + ] + }, + "sends_telemetry_event": false +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/tools/staff/cherry.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/tools/staff/cherry.json new file mode 100644 index 000000000..a28e8cbc5 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/tools/staff/cherry.json @@ -0,0 +1,35 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": [ + "hexcasting:charged_amethyst" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "hexcasting:staff/cherry" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_item", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "hexcasting:staff/cherry" + ] + }, + "sends_telemetry_event": false +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_tables/blocks/edified_fence_gate.json b/Forge/src/generated/resources/data/hexcasting/loot_tables/blocks/edified_fence_gate.json new file mode 100644 index 000000000..01cbf2a5e --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_tables/blocks/edified_fence_gate.json @@ -0,0 +1,15 @@ +{ + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "hexcasting:edified_fence_gate" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "hexcasting:blocks/edified_fence_gate" +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/edified_fence_gate.json b/Forge/src/generated/resources/data/hexcasting/recipes/edified_fence_gate.json new file mode 100644 index 000000000..799b582fb --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/recipes/edified_fence_gate.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "building", + "key": { + "S": { + "item": "minecraft:stick" + }, + "W": { + "tag": "hexcasting:edified_planks" + } + }, + "pattern": [ + "SWS", + "SWS" + ], + "result": { + "item": "hexcasting:edified_fence_gate" + }, + "show_notification": true +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/staff/bamboo.json b/Forge/src/generated/resources/data/hexcasting/recipes/staff/bamboo.json new file mode 100644 index 000000000..2796a8b04 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/recipes/staff/bamboo.json @@ -0,0 +1,24 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "equipment", + "key": { + "A": { + "item": "hexcasting:charged_amethyst" + }, + "S": { + "item": "minecraft:stick" + }, + "W": { + "item": "minecraft:bamboo_planks" + } + }, + "pattern": [ + " SA", + " WS", + "S " + ], + "result": { + "item": "hexcasting:staff/bamboo" + }, + "show_notification": true +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/staff/cherry.json b/Forge/src/generated/resources/data/hexcasting/recipes/staff/cherry.json new file mode 100644 index 000000000..36a96851b --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/recipes/staff/cherry.json @@ -0,0 +1,24 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "equipment", + "key": { + "A": { + "item": "hexcasting:charged_amethyst" + }, + "S": { + "item": "minecraft:stick" + }, + "W": { + "item": "minecraft:cherry_planks" + } + }, + "pattern": [ + " SA", + " WS", + "S " + ], + "result": { + "item": "hexcasting:staff/cherry" + }, + "show_notification": true +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/tags/items/staves.json b/Forge/src/generated/resources/data/hexcasting/tags/items/staves.json new file mode 100644 index 000000000..29f4595c6 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/tags/items/staves.json @@ -0,0 +1,18 @@ +{ + "values": [ + "hexcasting:staff/edified", + "hexcasting:staff/oak", + "hexcasting:staff/spruce", + "hexcasting:staff/birch", + "hexcasting:staff/jungle", + "hexcasting:staff/acacia", + "hexcasting:staff/dark_oak", + "hexcasting:staff/crimson", + "hexcasting:staff/warped", + "hexcasting:staff/mangrove", + "hexcasting:staff/cherry", + "hexcasting:staff/bamboo", + "hexcasting:staff/quenched", + "hexcasting:staff/mindsplice" + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/minecraft/tags/blocks/fence_gates.json b/Forge/src/generated/resources/data/minecraft/tags/blocks/fence_gates.json new file mode 100644 index 000000000..f27c95c78 --- /dev/null +++ b/Forge/src/generated/resources/data/minecraft/tags/blocks/fence_gates.json @@ -0,0 +1,5 @@ +{ + "values": [ + "hexcasting:edified_fence_gate" + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/minecraft/tags/blocks/unstable_bottom_center.json b/Forge/src/generated/resources/data/minecraft/tags/blocks/unstable_bottom_center.json new file mode 100644 index 000000000..f27c95c78 --- /dev/null +++ b/Forge/src/generated/resources/data/minecraft/tags/blocks/unstable_bottom_center.json @@ -0,0 +1,5 @@ +{ + "values": [ + "hexcasting:edified_fence_gate" + ] +} \ No newline at end of file diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/cap/adimpl/CapClientCastingStack.java b/Forge/src/main/java/at/petrak/hexcasting/forge/cap/adimpl/CapClientCastingStack.java index 998c4833d..5263011a8 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/cap/adimpl/CapClientCastingStack.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/cap/adimpl/CapClientCastingStack.java @@ -17,7 +17,7 @@ public ClientCastingStack get() { @SubscribeEvent public static void tickClientPlayer(TickEvent.PlayerTickEvent evt) { - if (evt.side == LogicalSide.CLIENT) + if (evt.side == LogicalSide.CLIENT && !evt.player.isDeadOrDying()) evt.player.getCapability(HexCapabilities.CLIENT_CASTING_STACK).resolve() .get().get().tick(); } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexBlockStatesAndModels.java b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexBlockStatesAndModels.java index 0a1fa55b0..f4e30e8a4 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexBlockStatesAndModels.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexBlockStatesAndModels.java @@ -219,6 +219,8 @@ protected void registerStatesAndModels() { simpleBlockItem(HexBlocks.EDIFIED_PLANKS, planksModel); stairsBlock(HexBlocks.EDIFIED_STAIRS, planks1); + fenceBlock(HexBlocks.EDIFIED_FENCE, planks1); + fenceGateBlock(HexBlocks.EDIFIED_FENCE_GATE, planks1); slabBlock(HexBlocks.EDIFIED_SLAB, planks1, planks1); buttonBlock(HexBlocks.EDIFIED_BUTTON, planks1); pressurePlateBlock(HexBlocks.EDIFIED_PRESSURE_PLATE, planks1); diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexItemModels.java b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexItemModels.java index 8ca595eae..7def15a4e 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexItemModels.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexItemModels.java @@ -92,6 +92,8 @@ protected void registerModels() { buildStaff(HexItems.STAFF_CRIMSON, "crimson"); buildStaff(HexItems.STAFF_WARPED, "warped"); buildStaff(HexItems.STAFF_MANGROVE, "mangrove"); + buildStaff(HexItems.STAFF_CHERRY, "cherry"); + buildStaff(HexItems.STAFF_BAMBOO, "bamboo"); buildStaff(HexItems.STAFF_EDIFIED, "edified"); buildStaff(HexItems.STAFF_MINDSPLICE, "mindsplice"); @@ -195,6 +197,10 @@ protected void registerModels() { new ModelFile.UncheckedModelFile(modLoc("block/stripped_edified_wood"))); getBuilder(getPath(HexBlocks.EDIFIED_STAIRS)).parent( new ModelFile.UncheckedModelFile(modLoc("block/edified_stairs"))); + getBuilder(getPath(HexBlocks.EDIFIED_FENCE)).parent( + new ModelFile.UncheckedModelFile(modLoc("block/edified_fence_inventory"))); + getBuilder(getPath(HexBlocks.EDIFIED_FENCE_GATE)).parent( + new ModelFile.UncheckedModelFile(modLoc("block/edified_fence_gate"))); getBuilder(getPath(HexBlocks.EDIFIED_SLAB)).parent( new ModelFile.UncheckedModelFile(modLoc("block/edified_slab"))); getBuilder(getPath(HexBlocks.EDIFIED_BUTTON)).parent( diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/HexJEIPlugin.java b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/HexJEIPlugin.java index aa2f11cc5..32572ba10 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/HexJEIPlugin.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/HexJEIPlugin.java @@ -79,6 +79,8 @@ public void registerRecipeCatalysts(IRecipeCatalystRegistration registration) { HexItems.STAFF_CRIMSON, HexItems.STAFF_WARPED, HexItems.STAFF_MANGROVE, + HexItems.STAFF_CHERRY, + HexItems.STAFF_BAMBOO, HexItems.STAFF_EDIFIED, }) { registration.addRecipeCatalyst(new ItemStack(staff), BRAINSWEEPING, PHIAL, EDIFY); diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeClientXplatImpl.java b/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeClientXplatImpl.java index 75a36fc32..d33c2654b 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeClientXplatImpl.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeClientXplatImpl.java @@ -50,6 +50,8 @@ public void registerItemProperty(Item item, ResourceLocation id, ItemPropertyFun @Override public ClientCastingStack getClientCastingStack(Player player) { var maybeCap = player.getCapability(HexCapabilities.CLIENT_CASTING_STACK).resolve(); + if (maybeCap.isEmpty()) + return new ClientCastingStack(); // lie return maybeCap.get().get(); } diff --git a/Jenkinsfile b/Jenkinsfile index 5acae7592..5c470c0fd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,6 +24,22 @@ pipeline { sh './gradlew build' } } + stage('Run Datagen') { + steps { + echo 'Running datagen tasks' + sh './gradlew runAllDatagen' + } + } + stage('Check Datagen') { + steps { + echo 'Checking for modified files' + // also fail if there are new untracked files + sh 'git add --intent-to-add .' + // cache isn't reproducible, so ignore modifications to it + // https://stackoverflow.com/a/71878316 + sh 'git diff --name-only --exit-code -- ":!:*/src/generated/resources/.cache/*"' + } + } stage('Publish') { when { anyOf { diff --git a/build.gradle b/build.gradle index 4caf6f5f1..4c93acbdc 100644 --- a/build.gradle +++ b/build.gradle @@ -86,3 +86,9 @@ compileTestKotlin { jvmTarget = "17" } } + +tasks.register("runAllDatagen") { + dependsOn ":Forge:runXplatDatagen" + dependsOn ":Forge:runForgeDatagen" + dependsOn ":Fabric:runDatagen" +} diff --git a/gradle.properties b/gradle.properties index 79efc457a..d8828e7c1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ kotlinVersion=1.7.20 modVersion=0.11.1-7 paucalVersion=0.6.0 -patchouliVersion=82 +patchouliVersion=83 jeiVersion=15.0.0.12 pehkuiVersion=3.7.7