-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
75 changed files
with
743 additions
and
109 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
Common/src/generated/resources/assets/hexcasting/blockstates/edified_fence_gate.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
Common/src/generated/resources/assets/hexcasting/models/block/edified_fence_gate.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "minecraft:block/template_fence_gate", | ||
"textures": { | ||
"texture": "hexcasting:block/edified_planks" | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
Common/src/generated/resources/assets/hexcasting/models/block/edified_fence_gate_open.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "minecraft:block/template_fence_gate_open", | ||
"textures": { | ||
"texture": "hexcasting:block/edified_planks" | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
Common/src/generated/resources/assets/hexcasting/models/block/edified_fence_gate_wall.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "minecraft:block/template_fence_gate_wall", | ||
"textures": { | ||
"texture": "hexcasting:block/edified_planks" | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
.../src/generated/resources/assets/hexcasting/models/block/edified_fence_gate_wall_open.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "minecraft:block/template_fence_gate_wall_open", | ||
"textures": { | ||
"texture": "hexcasting:block/edified_planks" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Common/src/generated/resources/assets/hexcasting/models/item/edified_fence_gate.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"parent": "hexcasting:block/edified_fence_gate" | ||
} |
6 changes: 6 additions & 0 deletions
6
Common/src/generated/resources/assets/hexcasting/models/item/staff/bamboo.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "minecraft:item/handheld_rod", | ||
"textures": { | ||
"layer0": "hexcasting:item/staff/bamboo" | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
Common/src/generated/resources/assets/hexcasting/models/item/staff/cherry.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "minecraft:item/handheld_rod", | ||
"textures": { | ||
"layer0": "hexcasting:item/staff/cherry" | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
Common/src/generated/resources/assets/hexcasting/models/staff/bamboo.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} | ||
] | ||
} |
16 changes: 16 additions & 0 deletions
16
Common/src/generated/resources/assets/hexcasting/models/staff/cherry.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 0 additions & 55 deletions
55
Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/Operator.java
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/Operator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <T : Iota?> downcast(iota: Iota, iotaType: IotaType<T>): T { | ||
check(iota.type === iotaType) { "Attempting to downcast $iota to type: $iotaType" } | ||
return iota as T | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
Common/src/main/java/at/petrak/hexcasting/api/casting/arithmetic/operator/OperatorBasic.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Iota>, env: CastingEnvironment): Iterable<Iota> | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.