-
Notifications
You must be signed in to change notification settings - Fork 5
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
1 parent
7b284db
commit c291dd4
Showing
39 changed files
with
328 additions
and
211 deletions.
There are no files selected for viewing
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
27 changes: 27 additions & 0 deletions
27
src/main/java/miyucomics/hexical/casting/patterns/OpAgeScroll.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,27 @@ | ||
package miyucomics.hexical.casting.patterns | ||
|
||
import at.petrak.hexcasting.api.spell.ParticleSpray | ||
import at.petrak.hexcasting.api.spell.RenderedSpell | ||
import at.petrak.hexcasting.api.spell.SpellAction | ||
import at.petrak.hexcasting.api.spell.casting.CastingContext | ||
import at.petrak.hexcasting.api.spell.getEntity | ||
import at.petrak.hexcasting.api.spell.iota.Iota | ||
import at.petrak.hexcasting.api.spell.mishaps.MishapBadEntity | ||
import miyucomics.hexical.entities.LivingScrollEntity | ||
|
||
class OpAgeScroll : SpellAction { | ||
override val argc = 1 | ||
override fun execute(args: List<Iota>, ctx: CastingContext): Triple<RenderedSpell, Int, List<ParticleSpray>> { | ||
val scroll = args.getEntity(0, argc) | ||
ctx.assertEntityInRange(scroll) | ||
if (scroll !is LivingScrollEntity) | ||
throw MishapBadEntity.of(scroll, "living_scroll") | ||
return Triple(Spell(scroll), 0, listOf()) | ||
} | ||
|
||
private data class Spell(val scroll: LivingScrollEntity) : RenderedSpell { | ||
override fun cast(ctx: CastingContext) { | ||
scroll.toggleAged() | ||
} | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
src/main/java/miyucomics/hexical/casting/patterns/basic/OpCongruentPattern.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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
package miyucomics.hexical.casting.patterns.basic | ||
|
||
import at.petrak.hexcasting.api.spell.ConstMediaAction | ||
import at.petrak.hexcasting.api.spell.asActionResult | ||
import at.petrak.hexcasting.api.spell.casting.CastingContext | ||
import at.petrak.hexcasting.api.spell.getPattern | ||
import at.petrak.hexcasting.api.spell.iota.BooleanIota | ||
import at.petrak.hexcasting.api.spell.iota.Iota | ||
|
||
class OpCongruentPattern : ConstMediaAction { | ||
override val argc = 2 | ||
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> { | ||
val a = args.getPattern(0, argc) | ||
val b = args.getPattern(1, argc) | ||
return listOf(BooleanIota(a.anglesSignature() == b.anglesSignature())) | ||
return (a.anglesSignature() == b.anglesSignature()).asActionResult | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/miyucomics/hexical/casting/patterns/basic/OpFluidAxisRaycast.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,33 @@ | ||
package miyucomics.hexical.casting.patterns.basic | ||
|
||
import at.petrak.hexcasting.api.misc.MediaConstants | ||
import at.petrak.hexcasting.api.spell.* | ||
import at.petrak.hexcasting.api.spell.casting.CastingContext | ||
import at.petrak.hexcasting.api.spell.iota.Iota | ||
import at.petrak.hexcasting.api.spell.iota.NullIota | ||
import net.minecraft.util.hit.HitResult | ||
import net.minecraft.util.math.Vec3d | ||
import net.minecraft.world.RaycastContext | ||
|
||
object OpFluidAxisRaycast : ConstMediaAction { | ||
override val argc = 2 | ||
override val mediaCost = MediaConstants.DUST_UNIT / 100 | ||
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> { | ||
val origin = args.getVec3(0, argc) | ||
val look = args.getVec3(1, argc) | ||
ctx.assertVecInRange(origin) | ||
val blockHitResult = ctx.world.raycast( | ||
RaycastContext( | ||
origin, | ||
Action.raycastEnd(origin, look), | ||
RaycastContext.ShapeType.COLLIDER, | ||
RaycastContext.FluidHandling.ANY, | ||
ctx.caster | ||
) | ||
) | ||
|
||
if (blockHitResult.type == HitResult.Type.BLOCK && ctx.isVecInRange(Vec3d.ofCenter(blockHitResult.blockPos))) | ||
return blockHitResult.side.unitVector.asActionResult | ||
return listOf(NullIota()) | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/miyucomics/hexical/casting/patterns/basic/OpFluidRaycast.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,33 @@ | ||
package miyucomics.hexical.casting.patterns.basic | ||
|
||
import at.petrak.hexcasting.api.misc.MediaConstants | ||
import at.petrak.hexcasting.api.spell.* | ||
import at.petrak.hexcasting.api.spell.casting.CastingContext | ||
import at.petrak.hexcasting.api.spell.iota.Iota | ||
import at.petrak.hexcasting.api.spell.iota.NullIota | ||
import net.minecraft.util.hit.HitResult | ||
import net.minecraft.util.math.Vec3d | ||
import net.minecraft.world.RaycastContext | ||
|
||
object OpFluidRaycast : ConstMediaAction { | ||
override val argc = 2 | ||
override val mediaCost = MediaConstants.DUST_UNIT / 100 | ||
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> { | ||
val origin = args.getVec3(0, argc) | ||
val look = args.getVec3(1, argc) | ||
ctx.assertVecInRange(origin) | ||
val blockHitResult = ctx.world.raycast( | ||
RaycastContext( | ||
origin, | ||
Action.raycastEnd(origin, look), | ||
RaycastContext.ShapeType.COLLIDER, | ||
RaycastContext.FluidHandling.ANY, | ||
ctx.caster | ||
) | ||
) | ||
|
||
if (blockHitResult.type == HitResult.Type.BLOCK && ctx.isVecInRange(Vec3d.ofCenter(blockHitResult.blockPos))) | ||
return blockHitResult.blockPos.asActionResult | ||
return listOf(NullIota()) | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
src/main/java/miyucomics/hexical/casting/patterns/basic/OpShufflePattern.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 |
---|---|---|
@@ -1,18 +1,18 @@ | ||
package miyucomics.hexical.casting.patterns.basic | ||
|
||
import at.petrak.hexcasting.api.spell.ConstMediaAction | ||
import at.petrak.hexcasting.api.spell.asActionResult | ||
import at.petrak.hexcasting.api.spell.casting.CastingContext | ||
import at.petrak.hexcasting.api.spell.getInt | ||
import at.petrak.hexcasting.api.spell.getPattern | ||
import at.petrak.hexcasting.api.spell.iota.Iota | ||
import at.petrak.hexcasting.api.spell.iota.PatternIota | ||
import at.petrak.hexcasting.api.spell.math.EulerPathFinder | ||
|
||
class OpShufflePattern : ConstMediaAction { | ||
override val argc = 2 | ||
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> { | ||
val pattern = args.getPattern(0, argc) | ||
val seed = args.getInt(1, argc) | ||
return listOf(PatternIota(EulerPathFinder.findAltDrawing(pattern, seed.toLong()))) | ||
return EulerPathFinder.findAltDrawing(pattern, seed.toLong()).asActionResult | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
src/main/java/miyucomics/hexical/casting/patterns/basic/OpSimilar.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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
package miyucomics.hexical.casting.patterns.basic | ||
|
||
import at.petrak.hexcasting.api.spell.ConstMediaAction | ||
import at.petrak.hexcasting.api.spell.asActionResult | ||
import at.petrak.hexcasting.api.spell.casting.CastingContext | ||
import at.petrak.hexcasting.api.spell.iota.BooleanIota | ||
import at.petrak.hexcasting.api.spell.iota.Iota | ||
|
||
class OpSimilar : ConstMediaAction { | ||
override val argc = 2 | ||
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> { | ||
val a = args[0] | ||
val b = args[1] | ||
return listOf(BooleanIota(a.type == b.type)) | ||
return (a.type == b.type).asActionResult | ||
} | ||
} |
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
17 changes: 7 additions & 10 deletions
17
src/main/java/miyucomics/hexical/casting/patterns/getters/OpGetEntityData.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 |
---|---|---|
@@ -1,23 +1,20 @@ | ||
package miyucomics.hexical.casting.patterns.getters | ||
|
||
import at.petrak.hexcasting.api.spell.ConstMediaAction | ||
import at.petrak.hexcasting.api.spell.asActionResult | ||
import at.petrak.hexcasting.api.spell.casting.CastingContext | ||
import at.petrak.hexcasting.api.spell.getEntity | ||
import at.petrak.hexcasting.api.spell.iota.BooleanIota | ||
import at.petrak.hexcasting.api.spell.iota.DoubleIota | ||
import at.petrak.hexcasting.api.spell.iota.Iota | ||
|
||
class OpGetEntityData(private val mode: Int) : ConstMediaAction { | ||
override val argc = 1 | ||
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> { | ||
val entity = args.getEntity(0, argc) | ||
return listOf( | ||
when (mode) { | ||
0 -> BooleanIota(entity.isOnFire) | ||
1 -> DoubleIota(entity.fireTicks.toDouble() / 20) | ||
2 -> BooleanIota(entity.isWet) | ||
else -> throw IllegalStateException() | ||
} | ||
) | ||
return when (mode) { | ||
0 -> entity.isOnFire.asActionResult | ||
1 -> (entity.fireTicks.toDouble() / 20).asActionResult | ||
2 -> entity.isWet.asActionResult | ||
else -> throw IllegalStateException() | ||
} | ||
} | ||
} |
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
6 changes: 3 additions & 3 deletions
6
src/main/java/miyucomics/hexical/casting/patterns/getters/OpGetKeybind.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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
package miyucomics.hexical.casting.patterns.getters | ||
|
||
import at.petrak.hexcasting.api.spell.ConstMediaAction | ||
import at.petrak.hexcasting.api.spell.asActionResult | ||
import at.petrak.hexcasting.api.spell.casting.CastingContext | ||
import at.petrak.hexcasting.api.spell.iota.DoubleIota | ||
import at.petrak.hexcasting.api.spell.iota.Iota | ||
import miyucomics.hexical.state.KeybindData | ||
|
||
class OpGetKeybind(private val key: String) : ConstMediaAction { | ||
override val argc = 0 | ||
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> { | ||
if (!KeybindData.active.containsKey(ctx.caster.uuid)) | ||
return listOf(DoubleIota(0.0)) | ||
return listOf(DoubleIota(KeybindData.duration[ctx.caster.uuid]!!.getOrDefault(key, 0.0).toDouble())) | ||
return (0).asActionResult | ||
return KeybindData.duration[ctx.caster.uuid]!!.getOrDefault(key, 0.0).asActionResult | ||
} | ||
} |
Oops, something went wrong.