From 05e4114b97446d1badeccb39e52ce8c9bc80dbae Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sat, 21 Jan 2023 15:49:20 -0600 Subject: [PATCH] fully make greatness a tag --- .../petrak/hexcasting/api/casting/Action.kt | 41 ------------ .../hexcasting/api/casting/SpellAction.kt | 16 ++--- .../api/casting/eval/CastingHarness.kt | 64 +++++++++---------- .../at/petrak/hexcasting/api/mod/HexTags.java | 5 ++ .../operators/akashic/OpAkashicWrite.kt | 6 +- .../casting/operators/math/OpNumberLiteral.kt | 23 ------- .../casting/operators/spells/OpCreateFluid.kt | 2 +- .../casting/operators/spells/OpMakeBattery.kt | 6 +- .../operators/spells/OpPotionEffect.kt | 1 - .../operators/spells/great/OpBrainsweep.kt | 4 +- .../operators/spells/great/OpFlight.kt | 5 +- .../operators/spells/great/OpLightning.kt | 3 +- .../operators/spells/great/OpTeleport.kt | 7 +- .../operators/spells/great/OpWeather.kt | 5 +- .../spells/sentinel/OpCreateSentinel.kt | 5 +- .../hexcasting/common/lib/hex/HexActions.java | 24 +++---- .../datagen/tag/HexActionTagProvider.java | 10 +-- .../03e4de26f1265135874f8cdcaebc09d9c08eb42b | 2 +- .../67cce32b1c3cbbcb1f646605f4914e3f196986c2 | 2 +- .../75bcd4dba6ca7d365462b0ec45e291d1056349c4 | 2 +- .../844611d4af49e23072b8a888c8e73c6c5d8c0768 | 5 +- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 2 +- .../tags/action/can_start_enlighten.json | 13 ++++ .../tags/action/requires_enlightenment.json | 3 +- .../844611d4af49e23072b8a888c8e73c6c5d8c0768 | 5 +- .../action/can_start_enlighten.json | 12 ++++ .../action/requires_enlightenment.json | 3 +- 27 files changed, 109 insertions(+), 167 deletions(-) delete mode 100644 Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpNumberLiteral.kt create mode 100644 Fabric/src/generated/resources/data/hexcasting/tags/action/can_start_enlighten.json create mode 100644 Forge/src/generated/resources/data/hexcasting/tags/hexcasting/action/can_start_enlighten.json diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/Action.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/Action.kt index b6430fa2..710f9cd6 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/Action.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/Action.kt @@ -3,10 +3,6 @@ package at.petrak.hexcasting.api.casting import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation import at.petrak.hexcasting.api.casting.iota.Iota -import at.petrak.hexcasting.api.utils.asTranslatedComponent -import at.petrak.hexcasting.api.utils.lightPurple -import net.minecraft.network.chat.Component -import net.minecraft.resources.ResourceLocation import net.minecraft.world.phys.Vec3 import java.text.DecimalFormat @@ -38,30 +34,6 @@ interface Action { ctx: CastingContext ): OperationResult - /** - * Do you need to be enlightened to use this operator? (i.e. is this operator a Great Pattern) - */ - val isGreat: Boolean get() = false - - /** - * Should this Great Pattern process and have side effects, even if its user isn't enlightened? - * - * The pattern itself may modify its effects based on whether the user is enlightened or not, regardless of what this value is. - */ - val alwaysProcessGreatSpell: Boolean get() = this is SpellAction - - /** - * Can this Great Pattern give you Blind Diversion? - */ - val causesBlindDiversion: Boolean get() = this is SpellAction - - /** - * The component for displaying this pattern's name. Override for dynamic patterns. - */ - fun getDisplayName(resLoc: ResourceLocation): Component { - return "hexcasting.spell.${resLoc.toString()}".asTranslatedComponent.lightPurple - } - companion object { // I see why vzakii did this: you can't raycast out to infinity! const val MAX_DISTANCE: Double = 32.0 @@ -81,19 +53,6 @@ interface Action { } public val DOUBLE_FORMATTER = DecimalFormat("####.####") - - @JvmStatic - fun makeConstantOp(x: Double, key: ResourceLocation): Action = object : ConstMediaAction { - override val argc: Int - get() = 0 - - override fun execute(args: List, ctx: CastingContext): List = - x.asActionResult - - override fun getDisplayName(resLoc: ResourceLocation): Component { - return "hexcasting.spell.$key".asTranslatedComponent(DOUBLE_FORMATTER.format(x)).lightPurple - } - } } } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/SpellAction.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/SpellAction.kt index 8335f0e0..c630b7d4 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/SpellAction.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/SpellAction.kt @@ -1,8 +1,8 @@ package at.petrak.hexcasting.api.casting import at.petrak.hexcasting.api.casting.eval.CastingContext -import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation import at.petrak.hexcasting.api.casting.eval.sideeffects.OperatorSideEffect +import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapNotEnoughArgs @@ -36,15 +36,13 @@ interface SpellAction : Action { if (media > 0) sideEffects.add(OperatorSideEffect.ConsumeMedia(media)) - // Don't have an effect if the caster isn't enlightened, even if processing other side effects - if (!isGreat || ctx.isCasterEnlightened) - sideEffects.add( - OperatorSideEffect.AttemptSpell( - spell, - this.hasCastingSound(ctx), - this.awardsCastingStat(ctx) - ) + sideEffects.add( + OperatorSideEffect.AttemptSpell( + spell, + this.hasCastingSound(ctx), + this.awardsCastingStat(ctx) ) + ) for (spray in particles) sideEffects.add(OperatorSideEffect.Particles(spray)) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingHarness.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingHarness.kt index b58c8e70..324a7f89 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingHarness.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingHarness.kt @@ -3,6 +3,7 @@ package at.petrak.hexcasting.api.casting.eval import at.petrak.hexcasting.api.HexAPI import at.petrak.hexcasting.api.advancements.HexAdvancementTriggers import at.petrak.hexcasting.api.block.circle.BlockEntityAbstractImpetus +import at.petrak.hexcasting.api.casting.Action import at.petrak.hexcasting.api.casting.ParticleSpray import at.petrak.hexcasting.api.casting.PatternShapeMatch import at.petrak.hexcasting.api.casting.PatternShapeMatch.* @@ -29,6 +30,7 @@ import at.petrak.hexcasting.common.casting.PatternRegistryManifest import at.petrak.hexcasting.common.lib.hex.HexEvalSounds import at.petrak.hexcasting.common.lib.hex.HexIotaTypes import at.petrak.hexcasting.xplat.IXplatAbstractions +import com.mojang.datafixers.util.Either import net.minecraft.nbt.CompoundTag import net.minecraft.nbt.Tag import net.minecraft.network.chat.Component @@ -209,50 +211,46 @@ class CastingHarness private constructor( * When the server gets a packet from the client with a new pattern, * handle it functionally. */ - fun updateWithPattern(newPat: HexPattern, world: ServerLevel, continuation: SpellContinuation): CastResult { + private fun updateWithPattern(newPat: HexPattern, world: ServerLevel, continuation: SpellContinuation): CastResult { var castedName: Component? = null try { - // Don't catch this one val lookup = PatternRegistryManifest.matchPattern(newPat, world, false) - val actionNamePair = when (lookup) { - is Normal -> { - val action = IXplatAbstractions.INSTANCE.actionRegistry.get(lookup.key) - val i18n = HexAPI.instance().getActionI18nKey(lookup.key) - action!!.action to i18n.asTranslatedComponent.lightPurple + val lookupResult: Either> = if (lookup is Normal || lookup is PerWorld) { + val key = when (lookup) { + is Normal -> lookup.key + is PerWorld -> lookup.key + else -> throw IllegalStateException() } - is PerWorld -> { - // it will always be exact match here. - // TODO add non-exact checking as a hint to the player? - val action = IXplatAbstractions.INSTANCE.actionRegistry.get(lookup.key) - val i18n = HexAPI.instance().getActionI18nKey(lookup.key) - // what the hey let's make great spells golden - action!!.action to i18n.asTranslatedComponent.gold + val reqsEnlightenment = isOfTag(IXplatAbstractions.INSTANCE.actionRegistry, key, HexTags.Actions.REQUIRES_ENLIGHTENMENT) + val canEnlighten = isOfTag(IXplatAbstractions.INSTANCE.actionRegistry, key, HexTags.Actions.CAN_START_ENLIGHTEN) + + castedName = HexAPI.instance().getActionI18(key.location(), reqsEnlightenment) + + if (!ctx.isCasterEnlightened && reqsEnlightenment) { + Either.right(listOf(OperatorSideEffect.RequiredEnlightenment(canEnlighten))) + } else { + val regiEntry = IXplatAbstractions.INSTANCE.actionRegistry.get(key)!! + Either.left(regiEntry.action) } - - is Special -> { - lookup.handler.act() to lookup.handler.name - } - - is PatternShapeMatch.Nothing -> throw MishapInvalidPattern() - - else -> throw IllegalStateException() + } else if (lookup is Special) { + castedName = lookup.handler.name + Either.left(lookup.handler.act()) + } else if (lookup is PatternShapeMatch.Nothing) { + throw MishapInvalidPattern() + } else { + throw IllegalStateException() } - castedName = actionNamePair.second - val action = actionNamePair.first - // TODO: the config denylist should be handled per VM type. // I just removed it for now, should re-add it... - // TODO need to check for enlightenment on VM - val requiresAndFailedEnlightenment = action.isGreat && !ctx.isCasterEnlightened - val sideEffects = mutableListOf() var stack2: List? = null var cont2 = continuation var ravenmind2: Iota? = null - if (!requiresAndFailedEnlightenment || action.alwaysProcessGreatSpell) { + if (lookupResult.left().isPresent) { + val action = lookupResult.left().get() displayPatternDebug(false, 0, castedName) val result = action.operate( continuation, @@ -265,13 +263,13 @@ class CastingHarness private constructor( ravenmind2 = result.newRavenmind // TODO parens also break prescience sideEffects.addAll(result.sideEffects) - } - - if (requiresAndFailedEnlightenment) { - sideEffects.add(OperatorSideEffect.RequiredEnlightenment(action.causesBlindDiversion)) + } else { + val problems = lookupResult.right().get() + sideEffects.addAll(problems) } // Stick a poofy particle effect at the caster position + // TODO again this should be on the VM lalala if (this.ctx.spellCircle == null) sideEffects.add( OperatorSideEffect.Particles( diff --git a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexTags.java b/Common/src/main/java/at/petrak/hexcasting/api/mod/HexTags.java index 2e6b1180..711ac07d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexTags.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/mod/HexTags.java @@ -57,6 +57,11 @@ public class HexTags { */ public static final TagKey PER_WORLD_PATTERN = create("per_world_pattern"); + /** + * Actions that can cause Blind Diversion + */ + public static final TagKey CAN_START_ENLIGHTEN = create("can_start_enlighten"); + public static TagKey create(String name) { return TagKey.create(IXplatAbstractions.INSTANCE.getActionRegistry().key(), modLoc(name)); } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/akashic/OpAkashicWrite.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/akashic/OpAkashicWrite.kt index c1d678b6..899d3035 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/akashic/OpAkashicWrite.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/akashic/OpAkashicWrite.kt @@ -1,12 +1,12 @@ package at.petrak.hexcasting.common.casting.operators.akashic -import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.casting.* import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.math.HexPattern import at.petrak.hexcasting.api.casting.mishaps.MishapNoAkashicRecord import at.petrak.hexcasting.api.casting.mishaps.MishapOthersName +import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.common.blocks.akashic.BlockAkashicRecord import at.petrak.hexcasting.common.lib.HexSounds import net.minecraft.core.BlockPos @@ -15,10 +15,6 @@ import net.minecraft.sounds.SoundSource object OpAkashicWrite : SpellAction { override val argc = 3 - override val isGreat = true - override val alwaysProcessGreatSpell = false - override val causesBlindDiversion = false - override fun execute( args: List, ctx: CastingContext diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpNumberLiteral.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpNumberLiteral.kt deleted file mode 100644 index 8fd6fc20..00000000 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpNumberLiteral.kt +++ /dev/null @@ -1,23 +0,0 @@ -package at.petrak.hexcasting.common.casting.operators.math - -import at.petrak.hexcasting.api.casting.Action -import at.petrak.hexcasting.api.casting.ConstMediaAction -import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext -import at.petrak.hexcasting.api.casting.iota.Iota -import at.petrak.hexcasting.api.utils.asTranslatedComponent -import at.petrak.hexcasting.api.utils.lightPurple -import net.minecraft.network.chat.Component -import net.minecraft.resources.ResourceLocation - -class OpNumberLiteral(val x: Double) : ConstMediaAction { - override val argc: Int = 0 - - override fun execute(args: List, ctx: CastingContext): List { - return this.x.asActionResult - } - - override fun getDisplayName(resLoc: ResourceLocation): Component { - return "hexcasting.spell.${resLoc.toString()}".asTranslatedComponent(Action.DOUBLE_FORMATTER.format(x)).lightPurple - } -} \ No newline at end of file diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpCreateFluid.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpCreateFluid.kt index 20181419..6281c7d3 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpCreateFluid.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpCreateFluid.kt @@ -16,7 +16,7 @@ import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.material.Fluid import net.minecraft.world.phys.Vec3 -class OpCreateFluid(override val isGreat: Boolean, val cost: Int, val bucket: Item, val cauldron: BlockState, val fluid: Fluid) : SpellAction { +class OpCreateFluid(val cost: Int, val bucket: Item, val cauldron: BlockState, val fluid: Fluid) : SpellAction { override val argc = 1 override fun execute( args: List, diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpMakeBattery.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpMakeBattery.kt index 1bfc5af8..ce8a668d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpMakeBattery.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpMakeBattery.kt @@ -1,7 +1,5 @@ package at.petrak.hexcasting.common.casting.operators.spells -import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.mod.HexTags import at.petrak.hexcasting.api.casting.ParticleSpray import at.petrak.hexcasting.api.casting.RenderedSpell import at.petrak.hexcasting.api.casting.SpellAction @@ -10,6 +8,8 @@ import at.petrak.hexcasting.api.casting.getItemEntity import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapBadItem import at.petrak.hexcasting.api.casting.mishaps.MishapBadOffhandItem +import at.petrak.hexcasting.api.misc.MediaConstants +import at.petrak.hexcasting.api.mod.HexTags import at.petrak.hexcasting.api.utils.extractMedia import at.petrak.hexcasting.api.utils.isMediaItem import at.petrak.hexcasting.common.items.magic.ItemMediaHolder @@ -21,8 +21,6 @@ import net.minecraft.world.item.ItemStack object OpMakeBattery : SpellAction { override val argc = 1 - override val isGreat = true - override fun execute( args: List, ctx: CastingContext diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPotionEffect.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPotionEffect.kt index f52a3d82..254b677a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPotionEffect.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPotionEffect.kt @@ -12,7 +12,6 @@ class OpPotionEffect( val baseCost: Int, val allowPotency: Boolean, val potencyCubic: Boolean, - override val isGreat: Boolean, ) : SpellAction { override val argc: Int get() = if (this.allowPotency) 3 else 2 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpBrainsweep.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpBrainsweep.kt index 8906eafa..bbef2007 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpBrainsweep.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpBrainsweep.kt @@ -1,11 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.spells.great -import at.petrak.hexcasting.api.mod.HexConfig import at.petrak.hexcasting.api.casting.* import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapAlreadyBrainswept import at.petrak.hexcasting.api.casting.mishaps.MishapBadBrainsweep +import at.petrak.hexcasting.api.mod.HexConfig import at.petrak.hexcasting.common.recipe.BrainsweepRecipe import at.petrak.hexcasting.common.recipe.HexRecipeStuffRegistry import at.petrak.hexcasting.ktxt.tellWitnessesThatIWasMurdered @@ -22,8 +22,6 @@ import net.minecraft.world.phys.Vec3 object OpBrainsweep : SpellAction { override val argc = 2 - override val isGreat = true - // this way you can hear the villager dying more : ) override fun hasCastingSound(ctx: CastingContext) = false diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpFlight.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpFlight.kt index cf588d88..62523ef9 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpFlight.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpFlight.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.spells.great -import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.player.FlightAbility import at.petrak.hexcasting.api.casting.* import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.misc.MediaConstants +import at.petrak.hexcasting.api.player.FlightAbility import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.server.level.ServerLevel import net.minecraft.server.level.ServerPlayer @@ -14,7 +14,6 @@ import kotlin.math.roundToInt object OpFlight : SpellAction { override val argc = 3 - override val isGreat = true override fun execute( args: List, ctx: CastingContext diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpLightning.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpLightning.kt index 6bd53a24..9972cdc6 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpLightning.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpLightning.kt @@ -1,12 +1,12 @@ package at.petrak.hexcasting.common.casting.operators.spells.great -import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.casting.ParticleSpray import at.petrak.hexcasting.api.casting.RenderedSpell import at.petrak.hexcasting.api.casting.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getVec3 import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.misc.MediaConstants import net.minecraft.core.BlockPos import net.minecraft.world.entity.EntityType import net.minecraft.world.entity.LightningBolt @@ -14,7 +14,6 @@ import net.minecraft.world.phys.Vec3 object OpLightning : SpellAction { override val argc = 1 - override val isGreat = true override fun execute( args: List, diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpTeleport.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpTeleport.kt index add6032f..7b613754 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpTeleport.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpTeleport.kt @@ -1,13 +1,13 @@ package at.petrak.hexcasting.common.casting.operators.spells.great -import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.mod.HexConfig -import at.petrak.hexcasting.api.mod.HexTags import at.petrak.hexcasting.api.casting.* import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapImmuneEntity import at.petrak.hexcasting.api.casting.mishaps.MishapLocationTooFarAway +import at.petrak.hexcasting.api.misc.MediaConstants +import at.petrak.hexcasting.api.mod.HexConfig +import at.petrak.hexcasting.api.mod.HexTags import at.petrak.hexcasting.common.network.MsgBlinkAck import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.core.BlockPos @@ -23,7 +23,6 @@ import net.minecraft.world.phys.Vec3 // WRT its look vector object OpTeleport : SpellAction { override val argc = 2 - override val isGreat = true override fun execute( args: List, ctx: CastingContext diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpWeather.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpWeather.kt index 73273c32..6ad3c9eb 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpWeather.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpWeather.kt @@ -1,15 +1,14 @@ package at.petrak.hexcasting.common.casting.operators.spells.great -import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.casting.ParticleSpray import at.petrak.hexcasting.api.casting.RenderedSpell -import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.misc.MediaConstants class OpWeather(val rain: Boolean) : SpellAction { override val argc = 0 - override val isGreat = true override fun execute( args: List, diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpCreateSentinel.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpCreateSentinel.kt index 72062551..325c0e88 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpCreateSentinel.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpCreateSentinel.kt @@ -1,19 +1,18 @@ package at.petrak.hexcasting.common.casting.operators.spells.sentinel -import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.player.Sentinel import at.petrak.hexcasting.api.casting.ParticleSpray import at.petrak.hexcasting.api.casting.RenderedSpell import at.petrak.hexcasting.api.casting.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getVec3 import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.misc.MediaConstants +import at.petrak.hexcasting.api.player.Sentinel import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.world.phys.Vec3 class OpCreateSentinel(val extendsRange: Boolean) : SpellAction { override val argc = 1 - override val isGreat = this.extendsRange override fun execute( args: List, diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActions.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActions.java index 78fa78a3..9bb54cf1 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActions.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActions.java @@ -241,7 +241,7 @@ public class HexActions { public static final ActionRegistryEntry COLORIZE = make("colorize", new ActionRegistryEntry(HexPattern.fromAngles("awddwqawqwawq", HexDir.EAST), OpColorize.INSTANCE)); public static final ActionRegistryEntry CREATE_WATER = make("create_water", - new ActionRegistryEntry(HexPattern.fromAngles("aqawqadaq", HexDir.SOUTH_EAST), new OpCreateFluid(false, + new ActionRegistryEntry(HexPattern.fromAngles("aqawqadaq", HexDir.SOUTH_EAST), new OpCreateFluid( MediaConstants.DUST_UNIT, Items.WATER_BUCKET, Blocks.WATER_CAULDRON.defaultBlockState() @@ -287,44 +287,44 @@ public class HexActions { public static final ActionRegistryEntry POTION$WEAKNESS = make("potion/weakness", new ActionRegistryEntry( HexPattern.fromAngles("qqqqqaqwawaw", HexDir.NORTH_WEST), new OpPotionEffect(MobEffects.WEAKNESS, - MediaConstants.DUST_UNIT / 10, true, false, false) + MediaConstants.DUST_UNIT / 10, true, false) )); public static final ActionRegistryEntry POTION$LEVITATION = make("potion/levitation", new ActionRegistryEntry( HexPattern.fromAngles("qqqqqawwawawd", HexDir.WEST), new OpPotionEffect(MobEffects.LEVITATION, - MediaConstants.DUST_UNIT / 5, false, false, false) + MediaConstants.DUST_UNIT / 5, false, false) )); public static final ActionRegistryEntry POTION$WITHER = make("potion/wither", new ActionRegistryEntry( HexPattern.fromAngles("qqqqqaewawawe", HexDir.SOUTH_WEST), new OpPotionEffect(MobEffects.WITHER, - MediaConstants.DUST_UNIT, true, false, false) + MediaConstants.DUST_UNIT, true, false) )); public static final ActionRegistryEntry POTION$POISON = make("potion/poison", new ActionRegistryEntry( HexPattern.fromAngles("qqqqqadwawaww", HexDir.SOUTH_EAST), new OpPotionEffect(MobEffects.POISON, - MediaConstants.DUST_UNIT / 3, true, false, false) + MediaConstants.DUST_UNIT / 3, true, false) )); public static final ActionRegistryEntry POTION$SLOWNESS = make("potion/slowness", new ActionRegistryEntry( HexPattern.fromAngles("qqqqqadwawaw", HexDir.SOUTH_EAST), new OpPotionEffect(MobEffects.MOVEMENT_SLOWDOWN, - MediaConstants.DUST_UNIT / 3, true, false, false) + MediaConstants.DUST_UNIT / 3, true, false) )); public static final ActionRegistryEntry POTION$REGENERATION = make("potion/regeneration", new ActionRegistryEntry( HexPattern.fromAngles("qqqqaawawaedd", HexDir.NORTH_WEST), new OpPotionEffect(MobEffects.REGENERATION, - MediaConstants.DUST_UNIT, true, true, true) + MediaConstants.DUST_UNIT, true, true) )); public static final ActionRegistryEntry POTION$NIGHT_VISION = make("potion/night_vision", new ActionRegistryEntry( HexPattern.fromAngles("qqqaawawaeqdd", HexDir.WEST), new OpPotionEffect(MobEffects.NIGHT_VISION, - MediaConstants.DUST_UNIT / 5, false, true, true) + MediaConstants.DUST_UNIT / 5, false, true) )); public static final ActionRegistryEntry POTION$ABSORPTION = make("potion/absorption", new ActionRegistryEntry( HexPattern.fromAngles("qqaawawaeqqdd", HexDir.SOUTH_WEST), new OpPotionEffect(MobEffects.ABSORPTION, - MediaConstants.DUST_UNIT, true, true, true) + MediaConstants.DUST_UNIT, true, true) )); public static final ActionRegistryEntry POTION$HASTE = make("potion/haste", new ActionRegistryEntry( HexPattern.fromAngles("qaawawaeqqqdd", HexDir.SOUTH_EAST), new OpPotionEffect(MobEffects.DIG_SPEED, - MediaConstants.DUST_UNIT / 3, true, true, true) + MediaConstants.DUST_UNIT / 3, true, true) )); public static final ActionRegistryEntry POTION$STRENGTH = make("potion/strength", new ActionRegistryEntry( HexPattern.fromAngles("aawawaeqqqqdd", HexDir.EAST), new OpPotionEffect(MobEffects.DAMAGE_BOOST, - MediaConstants.DUST_UNIT / 3, true, true, true) + MediaConstants.DUST_UNIT / 3, true, true) )); public static final ActionRegistryEntry SENTINEL$CREATE = make("sentinel/create", @@ -341,7 +341,7 @@ public class HexActions { public static final ActionRegistryEntry FLIGHT = make("flight", new ActionRegistryEntry(HexPattern.fromAngles("eawwaeawawaa", HexDir.NORTH_WEST), OpFlight.INSTANCE)); public static final ActionRegistryEntry CREATE_LAVA = make("create_lava", - new ActionRegistryEntry(HexPattern.fromAngles("eaqawqadaqd", HexDir.EAST), new OpCreateFluid(true, + new ActionRegistryEntry(HexPattern.fromAngles("eaqawqadaqd", HexDir.EAST), new OpCreateFluid( MediaConstants.CRYSTAL_UNIT, Items.LAVA_BUCKET, Blocks.LAVA_CAULDRON.defaultBlockState(), diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexActionTagProvider.java b/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexActionTagProvider.java index aa1eedbd..5b1d8d00 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexActionTagProvider.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexActionTagProvider.java @@ -24,15 +24,9 @@ public class HexActionTagProvider extends TagsProvider { var loc = modLoc(normalGreat); var key = ResourceKey.create(IXplatAbstractions.INSTANCE.getActionRegistry().key(), loc); tag(HexTags.Actions.REQUIRES_ENLIGHTENMENT).add(key); + tag(HexTags.Actions.CAN_START_ENLIGHTEN).add(key); tag(HexTags.Actions.PER_WORLD_PATTERN).add(key); } - - for (var onlyEnlighten : new String[]{ - "akashic/write", - }) { - var loc = modLoc(onlyEnlighten); - var key = ResourceKey.create(IXplatAbstractions.INSTANCE.getActionRegistry().key(), loc); - tag(HexTags.Actions.REQUIRES_ENLIGHTENMENT).add(key); - } + // deciding that akashic write can be just a normal spell (as a treat) } } diff --git a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b index 43d3daa8..141c0654 100644 --- a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b +++ b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-21T14:45:49.102988105 Tags for minecraft:item +// 1.19.2 2023-01-21T15:43:08.87507582 Tags for minecraft:item 5928bad07d3872bb60f29ef4f3c885c8e1967c20 data/hexcasting/tags/items/phial_base.json fdb48f194d7937ab6b423fa4b90a4d438bf6dd90 data/minecraft/tags/items/wooden_doors.json e5df19a1dc6eadf14cd9b0f0fe45a74330b745e9 data/hexcasting/tags/items/edified_planks.json diff --git a/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 b/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 index 2344bfbc..bb8ba8b2 100644 --- a/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 +++ b/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-21T14:45:49.133731101 LootTables +// 1.19.2 2023-01-21T15:43:08.837666395 LootTables 01a50f557196c705c275722015cf893e0abe6425 data/hexcasting/loot_tables/inject/scroll_loot_many.json dec1d3592e82f99d9e059d9c771530f103b2bda5 data/hexcasting/loot_tables/blocks/empty_directrix.json 2c42fc5d8c74c98ad15b8bd50f56541fccbef750 data/hexcasting/loot_tables/blocks/edified_tile.json diff --git a/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 b/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 index f671e6ab..a228aeb4 100644 --- a/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 +++ b/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-21T14:45:49.143179079 Tags for minecraft:block +// 1.19.2 2023-01-21T15:43:08.873838666 Tags for minecraft:block 20183cd61968ff6548df2dde1100b6378d68d64b data/minecraft/tags/blocks/wooden_buttons.json 357eddf3cee6f16725bed0701d57b2ca3097d74d data/minecraft/tags/blocks/mineable/shovel.json 5216ba5c57db29b8dee9aebc63a2e3b17c97dc17 data/minecraft/tags/blocks/wooden_trapdoors.json diff --git a/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 b/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 index db33488f..a3f20e0e 100644 --- a/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 +++ b/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 @@ -1,3 +1,4 @@ -// 1.19.2 2023-01-21T14:45:49.142544446 Tags for hexcasting:action +// 1.19.2 2023-01-21T15:43:08.846211098 Tags for hexcasting:action e5afc567ea17f035e4eb1d1d48825100b7f6ad68 data/hexcasting/tags/action/per_world_pattern.json -e0464372b1bfe00bb9e9fdaa9889f88c31080cc4 data/hexcasting/tags/action/requires_enlightenment.json +e5afc567ea17f035e4eb1d1d48825100b7f6ad68 data/hexcasting/tags/action/requires_enlightenment.json +e5afc567ea17f035e4eb1d1d48825100b7f6ad68 data/hexcasting/tags/action/can_start_enlighten.json diff --git a/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index 5d9065de..32b686cd 100644 --- a/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-21T14:45:49.119742079 Recipes +// 1.19.2 2023-01-21T15:43:08.846955947 Recipes 858dada9c41974f5aa80c66423bf371c9e176a53 data/hexcasting/recipes/pride_colorizer_demigirl.json bb0f91c534c888d1cff8793b49986dce236c7b2d data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_white.json 9f75d3e93ecbbbf3ed9a92b2943397e09dcae1a9 data/hexcasting/recipes/dye_colorizer_light_blue.json diff --git a/Fabric/src/generated/resources/data/hexcasting/tags/action/can_start_enlighten.json b/Fabric/src/generated/resources/data/hexcasting/tags/action/can_start_enlighten.json new file mode 100644 index 00000000..2417e4d5 --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/tags/action/can_start_enlighten.json @@ -0,0 +1,13 @@ +{ + "replace": false, + "values": [ + "hexcasting:lightning", + "hexcasting:flight", + "hexcasting:create_lava", + "hexcasting:teleport", + "hexcasting:sentinel/create/great", + "hexcasting:dispel_rain", + "hexcasting:summon_rain", + "hexcasting:brainsweep" + ] +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/tags/action/requires_enlightenment.json b/Fabric/src/generated/resources/data/hexcasting/tags/action/requires_enlightenment.json index bbfcb9b7..2417e4d5 100644 --- a/Fabric/src/generated/resources/data/hexcasting/tags/action/requires_enlightenment.json +++ b/Fabric/src/generated/resources/data/hexcasting/tags/action/requires_enlightenment.json @@ -8,7 +8,6 @@ "hexcasting:sentinel/create/great", "hexcasting:dispel_rain", "hexcasting:summon_rain", - "hexcasting:brainsweep", - "hexcasting:akashic/write" + "hexcasting:brainsweep" ] } \ No newline at end of file diff --git a/Forge/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 b/Forge/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 index 6914e485..dcf3d7c0 100644 --- a/Forge/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 +++ b/Forge/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 @@ -1,3 +1,4 @@ -// 1.19.2 2023-01-21T14:47:29.414121689 Tags for hexcasting:action +// 1.19.2 2023-01-21T15:44:11.307837433 Tags for hexcasting:action +7684713a5311ad151b5591d22757988c8462d647 data/hexcasting/tags/hexcasting/action/can_start_enlighten.json 7684713a5311ad151b5591d22757988c8462d647 data/hexcasting/tags/hexcasting/action/per_world_pattern.json -9eb0b98603394a44b9202d1ff6778a539edfdfa4 data/hexcasting/tags/hexcasting/action/requires_enlightenment.json +7684713a5311ad151b5591d22757988c8462d647 data/hexcasting/tags/hexcasting/action/requires_enlightenment.json diff --git a/Forge/src/generated/resources/data/hexcasting/tags/hexcasting/action/can_start_enlighten.json b/Forge/src/generated/resources/data/hexcasting/tags/hexcasting/action/can_start_enlighten.json new file mode 100644 index 00000000..fb547c1a --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/tags/hexcasting/action/can_start_enlighten.json @@ -0,0 +1,12 @@ +{ + "values": [ + "hexcasting:lightning", + "hexcasting:flight", + "hexcasting:create_lava", + "hexcasting:teleport", + "hexcasting:sentinel/create/great", + "hexcasting:dispel_rain", + "hexcasting:summon_rain", + "hexcasting:brainsweep" + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/tags/hexcasting/action/requires_enlightenment.json b/Forge/src/generated/resources/data/hexcasting/tags/hexcasting/action/requires_enlightenment.json index 75caecfe..fb547c1a 100644 --- a/Forge/src/generated/resources/data/hexcasting/tags/hexcasting/action/requires_enlightenment.json +++ b/Forge/src/generated/resources/data/hexcasting/tags/hexcasting/action/requires_enlightenment.json @@ -7,7 +7,6 @@ "hexcasting:sentinel/create/great", "hexcasting:dispel_rain", "hexcasting:summon_rain", - "hexcasting:brainsweep", - "hexcasting:akashic/write" + "hexcasting:brainsweep" ] } \ No newline at end of file