From 1dbec07458b436dd38172cf91bb116bc088cd778 Mon Sep 17 00:00:00 2001 From: Hexugory Date: Mon, 13 Mar 2023 21:05:01 -0500 Subject: [PATCH] made it better --- .../hexucasting/common/casting/Patterns.kt | 3 - .../actions/spells/OpDaylightAction.kt | 17 +++--- .../actions/spells/OpStarlightAction.kt | 59 ------------------- .../assets/hexucasting/lang/en_us.json | 3 +- .../patterns/spells/daytime_manip.json | 10 +--- gradle.properties | 2 +- 6 files changed, 11 insertions(+), 83 deletions(-) delete mode 100644 Common/src/main/java/net/touhoudiscord/hexucasting/common/casting/actions/spells/OpStarlightAction.kt diff --git a/Common/src/main/java/net/touhoudiscord/hexucasting/common/casting/Patterns.kt b/Common/src/main/java/net/touhoudiscord/hexucasting/common/casting/Patterns.kt index d440781..0a08b43 100644 --- a/Common/src/main/java/net/touhoudiscord/hexucasting/common/casting/Patterns.kt +++ b/Common/src/main/java/net/touhoudiscord/hexucasting/common/casting/Patterns.kt @@ -11,7 +11,6 @@ import at.petrak.hexcasting.common.casting.operators.selectors.* import net.minecraft.resources.ResourceLocation import net.touhoudiscord.hexucasting.api.HexucastingAPI.modLoc import net.touhoudiscord.hexucasting.common.casting.actions.spells.OpDaylightAction -import net.touhoudiscord.hexucasting.common.casting.actions.spells.OpStarlightAction object Patterns { @@ -40,8 +39,6 @@ object Patterns { @JvmField val DAYLIGHT = make(HexPattern.fromAngles("wewewewewewaaweedeewedeewedeewedeewedeee", HexDir.EAST), modLoc("spells/daylight"), OpDaylightAction, true) - @JvmField - val STARLIGHT = make(HexPattern.fromAngles("wwwwwdwewwwewaqaeewaqddqaweeaqwadqwwqda", HexDir.EAST), modLoc("spells/starlight"), OpStarlightAction, true) private fun make (pattern: HexPattern, location: ResourceLocation, operator: Action, isPerWorld: Boolean = false): PatternIota { val triple = Triple(pattern, location, operator) diff --git a/Common/src/main/java/net/touhoudiscord/hexucasting/common/casting/actions/spells/OpDaylightAction.kt b/Common/src/main/java/net/touhoudiscord/hexucasting/common/casting/actions/spells/OpDaylightAction.kt index 4d00751..806fd0c 100644 --- a/Common/src/main/java/net/touhoudiscord/hexucasting/common/casting/actions/spells/OpDaylightAction.kt +++ b/Common/src/main/java/net/touhoudiscord/hexucasting/common/casting/actions/spells/OpDaylightAction.kt @@ -1,11 +1,8 @@ package net.touhoudiscord.hexucasting.common.casting.actions.spells 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.* 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.xplat.IXplatAbstractions import net.minecraft.core.BlockPos @@ -18,7 +15,7 @@ object OpDaylightAction : SpellAction { /** * The number of arguments from the stack that this action requires. */ - override val argc = 0 + override val argc = 1 /** * The method called when this Action is actually executed. Accepts the [args] @@ -34,8 +31,10 @@ object OpDaylightAction : SpellAction { * etc.) should be in the private [Spell] data class below. */ override fun execute(args: List, ctx: CastingContext): Triple> { + val time = minOf(args.getPositiveInt(0, argc), 24000) + return Triple( - Spell(), + Spell(time), MediaConstants.CRYSTAL_UNIT*2, listOf() ) @@ -46,14 +45,14 @@ object OpDaylightAction : SpellAction { * define where/what it should affect (for this example the parameter is [vec]), and the * [cast] method within is responsible for using that data to alter the world. */ - private data class Spell(val thisisgivingmeanerrorifidontputsomethinghere: Int = 0) : RenderedSpell { + private data class Spell(val time: Int) : RenderedSpell { override fun cast(ctx: CastingContext) { val w = ctx.world val relativeTime = w.dayTime%24000 - if (relativeTime > 23459) { + if (relativeTime > time) { w.dayTime += 24000 } - w.dayTime = w.dayTime-relativeTime+23459 + w.dayTime = w.dayTime-relativeTime+time } } } \ No newline at end of file diff --git a/Common/src/main/java/net/touhoudiscord/hexucasting/common/casting/actions/spells/OpStarlightAction.kt b/Common/src/main/java/net/touhoudiscord/hexucasting/common/casting/actions/spells/OpStarlightAction.kt deleted file mode 100644 index 2dae58f..0000000 --- a/Common/src/main/java/net/touhoudiscord/hexucasting/common/casting/actions/spells/OpStarlightAction.kt +++ /dev/null @@ -1,59 +0,0 @@ -package net.touhoudiscord.hexucasting.common.casting.actions.spells - -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.xplat.IXplatAbstractions -import net.minecraft.core.BlockPos -import net.minecraft.world.level.block.Blocks -import net.minecraft.world.phys.Vec3 -import net.touhoudiscord.hexucasting.api.config.HexucastingConfig -import net.touhoudiscord.hexucasting.common.casting.actions.OpExampleConstMediaAction.argc - -object OpStarlightAction : SpellAction { - /** - * The number of arguments from the stack that this action requires. - */ - override val argc = 0 - - /** - * The method called when this Action is actually executed. Accepts the [args] - * that were on the stack (there will be [argc] of them), and the [ctx], - * which contains things like references to the caster, the ServerLevel, - * methods to determine whether locations and entities are in ambit, etc. - * Returns a triple of things. The [RenderedSpell] is responsible for the spell actually - * doing things in the world, the [Int] is how much media the spell should cost, - * and the [List] of [ParticleSpray] renders particle effects for the result of the SpellAction. - * - * The [execute] method should only contain code to find the targets of the spell and validate - * them. All the code that actually makes changes to the world (breaking blocks, teleporting things, - * etc.) should be in the private [Spell] data class below. - */ - override fun execute(args: List, ctx: CastingContext): Triple> { - return Triple( - Spell(), - MediaConstants.CRYSTAL_UNIT, - listOf() - ) - } - - /** - * This class is responsible for actually making changes to the world. It accepts parameters to - * define where/what it should affect (for this example the parameter is [vec]), and the - * [cast] method within is responsible for using that data to alter the world. - */ - private data class Spell(val thisisgivingmeanerrorifidontputsomethinghere: Int = 0) : RenderedSpell { - override fun cast(ctx: CastingContext) { - val w = ctx.world - val relativeTime = w.dayTime%24000 - if (relativeTime > 12542) { - w.dayTime += 24000 - } - w.dayTime = w.dayTime-relativeTime+12542 - } - } -} \ No newline at end of file diff --git a/Common/src/main/resources/assets/hexucasting/lang/en_us.json b/Common/src/main/resources/assets/hexucasting/lang/en_us.json index 3ebdda8..a41f619 100644 --- a/Common/src/main/resources/assets/hexucasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexucasting/lang/en_us.json @@ -6,8 +6,7 @@ "hexcasting.spell.book.hexucasting:spells/starlight": "Starlight", "hexucasting.entry.daytime_manip": "Daytime Manipulation", - "hexucasting.page.daytime_manip.spells/daylight": "This spell will cast time forward to day in the world I cast it upon. Costs two $(l:items/amethyst)$(item)Charged Amethyst/$", - "hexucasting.page.daytime_manip.spells/starlight": "This spell will cast time forward to night in the world I cast it upon. Costs two $(l:items/amethyst)$(item)Charged Amethyst/$", + "hexucasting.page.daytime_manip.spells/daylight": "This spell will cast time forward to the relative time given in ticks in the world I cast it upon. Costs two $(l:items/amethyst)$(item)Charged Amethyst/$", "_comment": "Config Entries", "text.autoconfig.hexucasting.title": "Your Mod Configs", diff --git a/Common/src/main/resources/data/hexucasting/patchouli_books/hexubook/en_us/entries/patterns/spells/daytime_manip.json b/Common/src/main/resources/data/hexucasting/patchouli_books/hexubook/en_us/entries/patterns/spells/daytime_manip.json index dcae480..651405f 100644 --- a/Common/src/main/resources/data/hexucasting/patchouli_books/hexubook/en_us/entries/patterns/spells/daytime_manip.json +++ b/Common/src/main/resources/data/hexucasting/patchouli_books/hexubook/en_us/entries/patterns/spells/daytime_manip.json @@ -10,17 +10,9 @@ "type": "hexcasting:pattern", "op_id": "hexucasting:spells/daylight", "anchor": "hexucasting:spells/daylight", - "input": "", + "input": "number", "output": "", "text": "hexucasting.page.daytime_manip.spells/daylight" - }, - { - "type": "hexcasting:pattern", - "op_id": "hexucasting:spells/starlight", - "anchor": "hexucasting:spells/starlight", - "input": "", - "output": "", - "text": "hexucasting.page.daytime_manip.spells/starlight" } ] } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 952d59f..611544f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ jetbrainsAnnotationsVersion=23.0.0 minecraftVersion=1.19.2 kotlinVersion=1.7.20 -modVersion=1.0.0 +modVersion=1.1.0 paucalVersion=0.5.0 hexcastingVersion=0.10.3