Skip to content

Commit

Permalink
Fixed arch lamp sounds, added sprinting pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
miyucomics committed Mar 1, 2024
1 parent 0379e8b commit 8c26c80
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package miyucomics.hexical.casting.patterns.operators.lamp

import at.petrak.hexcasting.api.spell.ConstMediaAction
import at.petrak.hexcasting.api.spell.casting.CastingContext
import at.petrak.hexcasting.api.spell.getPlayer
import at.petrak.hexcasting.api.spell.iota.BooleanIota
import at.petrak.hexcasting.api.spell.iota.Iota

class OpGetPlayerSprinting : ConstMediaAction {
override val argc = 1

override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
return listOf(BooleanIota(args.getPlayer(0, argc).isSprinting()))
}
}
11 changes: 7 additions & 4 deletions common/src/main/java/miyucomics/hexical/items/ArchLampItem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,21 @@ class ArchLampItem : ItemPackagedHex(Settings().maxCount(1)) {
override fun use(world: World, user: PlayerEntity, usedHand: Hand): TypedActionResult<ItemStack> {
val stack = user.getStackInHand(usedHand)
if (!hasHex(stack)) return TypedActionResult.fail(stack)
if (world.isClient) return TypedActionResult.success(stack)

val state = PersistentStateHandler.getPlayerState(user)

val stackNbt = stack.orCreateNbt
if (!stackNbt.contains("active"))
stackNbt.putBoolean("active", false)

if (world.isClient) {
world.playSound(user.x, user.y, user.z, if (stackNbt.getBoolean("active")) HexicalSounds.LAMP_DEACTIVATE_SOUND_EVENT else HexicalSounds.LAMP_ACTIVATE_SOUND_EVENT, SoundCategory.MASTER, 1f, 1f, true)
return TypedActionResult.success(stack)
}

val currentlyUsingArchLamp = CastingUtils.doesPlayerHaveActiveArchLamp(user as ServerPlayerEntity)
if (currentlyUsingArchLamp) {
if (stackNbt.getBoolean("active")) {
stackNbt.putBoolean("active", false)
world.playSound(user.x, user.y, user.z, HexicalSounds.LAMP_DEACTIVATE_SOUND_EVENT, SoundCategory.MASTER, 1f, 1f, true)
return TypedActionResult.success(stack)
} else {
for (slot in user.inventory.main)
Expand All @@ -43,8 +46,8 @@ class ArchLampItem : ItemPackagedHex(Settings().maxCount(1)) {
}
}

world.playSound(user.x, user.y, user.z, HexicalSounds.LAMP_ACTIVATE_SOUND_EVENT, SoundCategory.MASTER, 1f, 1f, true)
stackNbt.putBoolean("active", true)
val state = PersistentStateHandler.getPlayerState(user)
state.position = user.eyePos
state.rotation = user.rotationVector
state.velocity = user.velocity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import miyucomics.hexical.Hexical
import miyucomics.hexical.casting.patterns.operators.eval.OpNephthys
import miyucomics.hexical.casting.patterns.operators.lamp.OpGetArchLampData
import miyucomics.hexical.casting.patterns.operators.lamp.OpGetLampData
import miyucomics.hexical.casting.patterns.operators.lamp.OpGetPlayerSprinting
import miyucomics.hexical.casting.patterns.operators.lamp.OpIsUsingArchLamp
import miyucomics.hexical.casting.patterns.spells.*
import net.minecraft.util.Identifier
Expand All @@ -29,6 +30,7 @@ object HexicalPatterns {
var PROGRAM_LAMP: HexPattern = register(HexPattern.fromAngles("wwqqqqq", HexDir.EAST), "program_lamp", OpProgramLamp())

var CONJURE_STAFF: HexPattern = register(HexPattern.fromAngles("wweeeed", HexDir.NORTH_EAST), "conjure_staff", OpConjureStaff())
var PLAYER_SPRINTING: HexPattern = register(HexPattern.fromAngles("eaq", HexDir.WEST), "is_sprinting", OpGetPlayerSprinting())

var LAMP_POSITION: HexPattern = register(HexPattern.fromAngles("qwddedqdd", HexDir.SOUTH_WEST), "get_lamp_position", OpGetLampData(0))
var LAMP_ROTATION: HexPattern = register(HexPattern.fromAngles("qwddedadw", HexDir.SOUTH_WEST), "get_lamp_rotation", OpGetLampData(1))
Expand Down
6 changes: 5 additions & 1 deletion common/src/main/resources/assets/hexical/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"hexcasting.spell.hexical:modify_block_replaceable": "Modify Block: Replaceable",
"hexcasting.spell.hexical:modify_block_volatile": "Modify Block: Volatile",
"hexcasting.spell.hexical:surveil_sentinel": "Surveil Sentinel",
"hexcasting.spell.hexical:is_sprinting": "Sprinter's Purification",
"hexcasting.spell.hexical:nephthys": "Nephthys Gambit",

"hexcasting.mishap.bad_block.advanced_conjured_block": "an advanced conjured block",
Expand All @@ -44,7 +45,7 @@

"hexical.page.mysterious_lamp.title": "Mysterious Lamp",
"hexical.page.mysterious_lamp.0": "At last I've discovered the subject of a thousand years of rumor! To think a mere wandering trader was in possession of such a strong artifact. The lamp emanates a vague residue of media, vacuous in feeling... it reminds me of the $(o)hollow media structure$() of a focus that enables it to store iota, but there is also a presence inside with spellcasting capabilities similar to my own.",
"hexical.page.mysterious_lamp.1": "I've developed a pattern to educate the entity inside of my intentions. Because I am teaching an entity my will rather than inherently etching a casting device with it, I believe I should be able to freely overwrite the hex inside at any time.",
"hexical.page.mysterious_lamp.1": "I've developed a pattern to educate the presence of my intentions. Because I am teaching my will rather than etching a casting device with it, I should be able to freely revise the hex at any time without losing media.",

"hexical.page.new_possibilities.title": "New Possibilities",
"hexical.page.new_possibilities.0": "It casts $(o)$(l)EVERY INSTANT$(). After writing a spell into it, I was treated to a splendid gush of media. I estimate the casting speed must be around twenty times every second. The presence inside the lamp performs the casting on my behalf with extraordinary efficiency, not producing the sound and particles that accompany other casting methods.",
Expand Down Expand Up @@ -90,6 +91,9 @@
"hexical.page.chorus_blink.0": "Between Blink, Greater Teleport, ender pearls, and chorus fruit, this spell serves a harmonious midpoint for safe, precise, and cheap teleportation.",
"hexical.page.chorus_blink.1": "It consumes a chorus fruit from my inventory and teleports me up to 16 blocks using an offset vector. The cost is constant whether I teleport the full 16 blocks or less, and has no penalty for multiple casts in one hex. With a lot of chorus fruit, it can be a significantly cheaper Greater Teleport.",

"hexical.page.entity_purifications": "Entity Purifications",
"hexical.page.is_sprinting": "Pushes whether the entity is sprinting. Interestingly, that includes swimming and if I start sprinting before lifting off the ground.",

"hexical.page.conjure_staff.0": "Conjures a staff at the location with the amount of media, rank, and hex respectively.",
"hexical.page.conjure_staff.1": "A conjured staff is not unlike a cypher. It has a media bank that it relies on for casting and breaks when it runs out, unable to consume my health or my inventory's media. It is not rechargable or programmable. Using erase item on it simply destroys it. However, its true power is $(o)input interception$().",
"hexical.page.conjure_staff.2": "When I use my primary or secondary use keys with a staff in my main hand, it intercepts my click. Depending on the rank I assigned during creation, after that many clicks, it will cast the hex I gave it, starting the stack with false and true, corresponding to my left and right clicks respectively.",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "hexical.page.entity_purifications",
"icon": "minecraft:spyglass",
"category": "hexcasting:patterns",
"pages": [
{
"type": "hexcasting:pattern",
"op_id": "hexical:is_sprinting",
"anchor": "hexical:is_sprinting",
"input": "entity",
"output": "boolean",
"text": "hexical.page.is_sprinting"
}
]
}

0 comments on commit 8c26c80

Please sign in to comment.