-
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
2062563
commit de9c0ab
Showing
5 changed files
with
59 additions
and
10 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/main/java/miyucomics/hexical/casting/patterns/lamp/OpActivateArchLamp.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,37 @@ | ||
package miyucomics.hexical.casting.patterns.lamp | ||
|
||
import at.petrak.hexcasting.api.misc.DiscoveryHandlers | ||
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.iota.Iota | ||
import miyucomics.hexical.registry.HexicalItems | ||
import net.minecraft.item.ItemStack | ||
|
||
class OpActivateArchLamp : SpellAction { | ||
override val argc = 0 | ||
override fun execute(args: List<Iota>, ctx: CastingContext): Triple<RenderedSpell, Int, List<ParticleSpray>> { | ||
for (stack in DiscoveryHandlers.collectItemSlots(ctx)) { | ||
if (stack.isEmpty) | ||
continue | ||
if (!stack.isOf(HexicalItems.ARCH_LAMP_ITEM)) | ||
continue | ||
if (!stack.orCreateNbt.getBoolean("active")) | ||
return Triple(Spell(stack), MediaConstants.DUST_UNIT, listOf()) | ||
} | ||
return Triple(Spell(null), 0, listOf()) | ||
} | ||
|
||
private class Spell(val stack: ItemStack?) : RenderedSpell { | ||
override fun cast(ctx: CastingContext) { | ||
for (slot in ctx.caster.inventory.main) | ||
if (slot.item == HexicalItems.ARCH_LAMP_ITEM) | ||
slot.orCreateNbt.putBoolean("active", false) | ||
if (stack == null) | ||
return | ||
stack.orCreateNbt.putBoolean("active", true) | ||
} | ||
} | ||
} |
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
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