Skip to content

Commit

Permalink
Further adding of pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
miyucomics committed Feb 21, 2024
1 parent 848301c commit a64ca2b
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
package miyucomics.hexical.casting.mishaps

class MishapNeedLamp {
import at.petrak.hexcasting.api.misc.FrozenColorizer
import at.petrak.hexcasting.api.spell.ParticleSpray
import at.petrak.hexcasting.api.spell.casting.CastingContext
import at.petrak.hexcasting.api.spell.iota.Iota
import at.petrak.hexcasting.api.spell.mishaps.Mishap
import miyucomics.hexical.Hexical
import net.minecraft.text.Text
import net.minecraft.util.DyeColor
import net.minecraft.util.Hand

class MishapNeedLamp() : Mishap() {
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.RED)
override fun particleSpray(ctx: CastingContext) = ParticleSpray.burst(ctx.caster.pos, 1.0)
override fun errorMessage(ctx: CastingContext, errorCtx: Context): Text = error(Hexical.MOD_ID + ":needs_lamp")

override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
yeetHeldItem(ctx, Hand.MAIN_HAND)
yeetHeldItem(ctx, Hand.OFF_HAND)
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package miyucomics.hexical.casting.patterns.operators.lamp

import at.petrak.hexcasting.api.spell.ConstMediaAction
import at.petrak.hexcasting.api.spell.iota.Iota
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 at.petrak.hexcasting.api.spell.iota.NullIota
import at.petrak.hexcasting.api.spell.iota.Vec3Iota
import at.petrak.hexcasting.api.utils.vecFromNBT
import miyucomics.hexical.casting.mishaps.MishapNeedLamp
import miyucomics.hexical.registry.HexicalItems
import at.petrak.hexcasting.api.utils.vecFromNBT

class OpGetLampStartData(private val mode: Int) : ConstMediaAction {
class OpGetLampData(private val mode: Int) : ConstMediaAction {
override val argc = 0

override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
Expand All @@ -19,9 +19,9 @@ class OpGetLampStartData(private val mode: Int) : ConstMediaAction {

val rodNbt = ctx.caster.activeItem.nbt ?: return listOf(NullIota())
when (mode) {
1 -> return listOf(Vec3Iota(vecFromNBT(rodNbt.getLongArray("startPosition"))))
2 -> return listOf(Vec3Iota(vecFromNBT(rodNbt.getLongArray("startRotation"))))
3 -> return listOf(DoubleIota(ctx.world.time - rodNbt.getDouble("startTime")))
0 -> return listOf(Vec3Iota(vecFromNBT(rodNbt.getLongArray("startPosition"))))
1 -> return listOf(Vec3Iota(vecFromNBT(rodNbt.getLongArray("startRotation"))))
2 -> return listOf(DoubleIota(ctx.world.time - rodNbt.getDouble("startTime")))
}

return listOf(NullIota())
Expand Down
1 change: 0 additions & 1 deletion common/src/main/java/miyucomics/hexical/items/LampItem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import net.minecraft.util.TypedActionResult
import net.minecraft.util.UseAction
import net.minecraft.world.World


class LampItem : ItemPackagedHex(Settings()) {
override fun use(world: World, player: PlayerEntity, usedHand: Hand): TypedActionResult<ItemStack> {
val stack = player.getStackInHand(usedHand)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import at.petrak.hexcasting.api.spell.math.HexDir
import at.petrak.hexcasting.api.spell.math.HexPattern
import miyucomics.hexical.Hexical
import miyucomics.hexical.casting.patterns.operators.eval.OpNephthys
import miyucomics.hexical.casting.patterns.operators.lamp.OpGetLampData
import miyucomics.hexical.casting.patterns.spells.OpChorusBlink
import miyucomics.hexical.casting.patterns.spells.OpConjureBouncyBlock
import miyucomics.hexical.casting.patterns.spells.OpPing
import miyucomics.hexical.casting.patterns.spells.OpProgramLamp
import net.minecraft.util.Identifier


object HexicalPatterns {
private var PATTERNS: MutableList<Triple<HexPattern, Identifier, Action>> = ArrayList()
private var PER_WORLD_PATTERNS: MutableList<Triple<HexPattern, Identifier, Action>> = ArrayList()
Expand All @@ -24,6 +24,10 @@ object HexicalPatterns {
var PROGRAM_LAMP: HexPattern = register(HexPattern.fromAngles("wwqqqqq", HexDir.EAST), "program_lamp", OpProgramLamp())
var PING: HexPattern = register(HexPattern.fromAngles("eweeewedqdeqqqqqwaeeee", HexDir.NORTH_EAST), "ping", OpPing())

var ROD_LOOK: HexPattern = register(HexPattern.fromAngles("qwddeda", HexDir.SOUTH_WEST), "get_lamp_start_position", OpGetLampData(0))
var ROD_POS: HexPattern = register(HexPattern.fromAngles("qwddedq", HexDir.SOUTH_WEST), "get_lamp_start_rotation", OpGetLampData(1))
var ROD_STAMP: HexPattern = register(HexPattern.fromAngles("qwddedw", HexDir.SOUTH_WEST), "get_lamp_use_time", OpGetLampData(2))

@JvmStatic
fun init() {
try {
Expand Down
10 changes: 6 additions & 4 deletions common/src/main/resources/assets/hexical/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
"item.hexical.lamp": "Genieless Lamp",
"block.hexical.conjured_bouncy_block": "Conjured Bouncy Block",

"pattern.hexical.chorus_blink": "Chorus Blink",
"pattern.hexical.surveil_sentinel": "Surveil Sentinel",
"pattern.hexical.ping": "Ping",
"hexcasting.mishap.hexical:lamp_needed": "Expected to be cast by Genieless Lamp.",

"hexical.page.hexical_metaevals": "Hexical Metaevaluations",
"hexcasting.spell.hexical:get_lamp_start_position": "Genie Reflection: Spatial",
"hexcasting.spell.hexical:get_lamp_start_rotation": "Genie Reflection: Rotational",
"hexcasting.spell.hexical:get_lamp_use_time": "Genie Reflection: Temporal",

"hexical.page.hexical_metaevals": "Hexical Meta-evaluations",
"hexcasting.spell.hexical:nephthys": "Nephthys Gambit",
"hexical.page.nephthys.1": "Pops a pattern list and a number from the stack and dives down n iota to casts the pattern list. Useful for surgery-like operations.",
"hexical.page.nephthys.2": "It's extremely versatile and I can mend almost any error in my stack using Bookkeeper's Gambit, pushing iota after a dive, and transforming surfaced iota. It was named after a goddess of mourning and rivers, lending to how it buries/dives down into the stack.",
Expand Down

0 comments on commit a64ca2b

Please sign in to comment.