Skip to content

Commit

Permalink
Advancements
Browse files Browse the repository at this point in the history
  • Loading branch information
miyucomics committed Jul 26, 2024
1 parent c28870c commit 5493e7e
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package miyucomics.hexical.casting.patterns.colors

import at.petrak.hexcasting.api.misc.MediaConstants
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.getVec3
import at.petrak.hexcasting.api.spell.iota.Iota
import at.petrak.hexcasting.common.particles.ConjureParticleOptions
import net.minecraft.util.math.Vec3d

class OpConjureParticle : SpellAction {
override val argc = 3
override fun execute(args: List<Iota>, ctx: CastingContext): Triple<RenderedSpell, Int, List<ParticleSpray>> {
val pos = args.getVec3(0, argc)
ctx.assertVecInRange(pos)
val color = args.getVec3(1, argc)
val velocity = args.getVec3(2, argc)
return Triple(Spell(pos, color.multiply(255.0), velocity), MediaConstants.DUST_UNIT, listOf())
}

private data class Spell(val position: Vec3d, val color: Vec3d, val velocity: Vec3d) : RenderedSpell {
override fun cast(ctx: CastingContext) {
ctx.world.addParticle(
ConjureParticleOptions(color.x.toInt() shl 16 or color.y.toInt() shl 8 or color.z.toInt(), false),
position.x, position.y, position.z,
velocity.x, velocity.y, velocity.z
)
}
}
}
4 changes: 3 additions & 1 deletion src/main/resources/assets/hexical/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
"advancements.hexical.augmented_reality.description": "Conjure a speck.",
"advancements.hexical.diy_conjuring.title": "DIY Conjuring!",
"advancements.hexical.diy_conjuring.description": "Add a custom modifier to a mage block.",
"advancements.hexical.hallucinate.title": "Only in my Head",
"advancements.hexical.hallucinate.title": "Only In My Head",
"advancements.hexical.hallucinate.description": "Play a sound only you can hear!",
"advancements.hexical.shader.title": "Rose-Tinted Glasses",
"advancements.hexical.shader.description": "Alter your vision magically with shader spells.",
"advancements.hexical.media_slurp.title": "Tripping",
"advancements.hexical.media_slurp.description": "\"You sense that something is off.\"",

"block.hexical.hex_candle": "Hex Candle",
"block.hexical.mage_block": "Mage Block",
Expand Down
33 changes: 33 additions & 0 deletions src/main/resources/data/hexical/advancements/media_slurp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"parent": "hexcasting:root",
"criteria": {
"sip": {
"trigger": "minecraft:item_used_on_block",
"conditions": {
"location": {
"block": {
"blocks": [
"hexical:media_jar"
]
}
}
}
}
},
"display": {
"announce_to_chat": true,
"title": {
"translate": "advancements.hexical.media_slurp.title"
},
"description": {
"translate": "advancements.hexical.media_slurp.description"
},
"frame": "task",
"hidden": true,
"icon": {
"item": "hexical:media_jar"
},
"show_toast": true
},
"requirements": [["sip"]]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "hexical.page.shaders.title",
"icon": "hexcasting:lens",
"category": "hexcasting:patterns/spells",
"advancement": "hexcasting:root",
"advancement": "hexical:media_slurp",
"sortnum": 5,
"pages": [
{
Expand Down

0 comments on commit 5493e7e

Please sign in to comment.