From 039e97a104b98e26d270e59460e5cdb7e9613f8b Mon Sep 17 00:00:00 2001 From: Aurora Dawn <131844170+StellarWitch7@users.noreply.github.com> Date: Sat, 21 Sep 2024 18:47:26 -0400 Subject: [PATCH] It has come --- CHANGELOG.md | 4 +++- build.gradle | 20 +------------------ gradle.properties | 14 +++---------- .../ram/cca/world/CellsComponent.kt | 17 +++++++++++++--- .../blunder/CellNotWithinWorldBlunder.kt | 4 ++-- .../blunder/ImmutableCellBlunder.kt | 4 ++-- .../blunder/NotWithinRAMBoundsBlunder.kt | 4 ++-- .../{trick => }/blunder/OutOfRAMBlunder.kt | 4 ++-- .../blunder/RAMNotSupportedBlunder.kt | 6 +++--- .../stellarwitch7/ram/spell/cell/Cell.kt | 16 --------------- .../ram/spell/mind/DefaultRAM.kt | 4 ++-- .../ram/spell/trick/cell/WriteCellTrick.kt | 2 +- .../ram/spell/trick/mind/RAMAllocTrick.kt | 2 +- .../ram/spell/trick/mind/RAMFreeTrick.kt | 2 +- .../ram/spell/trick/mind/RAMReadTrick.kt | 2 +- .../ram/spell/trick/mind/RAMWriteTrick.kt | 2 +- src/main/resources/fabric.mod.json | 2 +- 17 files changed, 40 insertions(+), 69 deletions(-) rename src/main/kotlin/stellarwitch7/ram/spell/{trick => }/blunder/CellNotWithinWorldBlunder.kt (72%) rename src/main/kotlin/stellarwitch7/ram/spell/{trick => }/blunder/ImmutableCellBlunder.kt (73%) rename src/main/kotlin/stellarwitch7/ram/spell/{trick => }/blunder/NotWithinRAMBoundsBlunder.kt (78%) rename src/main/kotlin/stellarwitch7/ram/spell/{trick => }/blunder/OutOfRAMBlunder.kt (73%) rename src/main/kotlin/stellarwitch7/ram/spell/{trick => }/blunder/RAMNotSupportedBlunder.kt (71%) delete mode 100644 src/main/kotlin/stellarwitch7/ram/spell/cell/Cell.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 5392b31..90ea9dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,3 @@ -- Updated to Trickster 2.0.0-alpha.36 and marked as compatible with all versions above as stability is less of a concern now \ No newline at end of file +- Updated to Trickster 2.0.0-alpha.37 +- Added a way to store values globally in the world +- Added a handful of patterns for meta-programming diff --git a/build.gradle b/build.gradle index 74ff36b..be46e69 100644 --- a/build.gradle +++ b/build.gradle @@ -35,23 +35,10 @@ repositories { url "https://maven.enjarai.dev/mirrors" } - maven { - url 'https://maven.wispforest.io' - } - - maven { - name = "Ladysnake Mods" - url = 'https://maven.ladysnake.org/releases' - } - maven { name "Terraformers Maven" url 'https://maven.terraformersmc.com' } - - maven { - url 'https://maven.shedaniel.me/' - } } loom { @@ -77,12 +64,7 @@ dependencies { modImplementation "net.fabricmc:fabric-language-kotlin:${property('deps.kotlin')}" modImplementation "stellarwitch7:libstellar:${property('deps.libstellar')}" - - modImplementation "io.wispforest:lavender:${property('deps.lavender')}" - include modLocalRuntime("io.wispforest.lavender-md:owo-ui:0.1.2+1.21") - modImplementation "dev.enjarai:trickster:${property('deps.trickster')}" - modImplementation "io.wispforest:accessories-fabric:${property('deps.accessories')}" modImplementation "com.terraformersmc:modmenu:${property('deps.modmenu')}" } @@ -155,7 +137,7 @@ publishMods { displayName = "Random Access Mind ${property('mod_version')} for Trickster ${property('deps.trickster')}" version = project.version changelog = getRootProject().file("CHANGELOG.md").text - type = STABLE + type = ALPHA modLoaders.add("fabric") def min = property('publish_target_min') diff --git a/gradle.properties b/gradle.properties index 5be00e9..7d89c8b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G org.gradle.parallel=true # Mod Properties -mod_version=1.0.13-todo-dont-forget-to-update-the-thing-so-cells-dont-write-ephemerals +mod_version=2.0.0-alpha.1 maven_group=stellarwitch7 archives_base_name=ram @@ -24,13 +24,5 @@ deps.kotlin=1.11.0+kotlin.2.0.0 # Dependencies deps.fabric-api=0.100.1+1.21 deps.libstellar=1.2.1 -deps.owo-lib=0.12.10+1.21 -deps.lavender=0.1.11+1.21 -deps.cardinal-components-api=6.1.1 -deps.cicada=0.8.3+1.21-and-above -deps.trickster=2.0.0-alpha.36 -deps.accessories=1.0.0-beta.11+1.21 -deps.modmenu=11.0.1 - -# Optional -deps.sodium=mc1.21-0.5.11 +deps.trickster=2.0.0-alpha.37 +deps.modmenu=11.0.1 \ No newline at end of file diff --git a/src/main/kotlin/stellarwitch7/ram/cca/world/CellsComponent.kt b/src/main/kotlin/stellarwitch7/ram/cca/world/CellsComponent.kt index dba938b..468fb91 100644 --- a/src/main/kotlin/stellarwitch7/ram/cca/world/CellsComponent.kt +++ b/src/main/kotlin/stellarwitch7/ram/cca/world/CellsComponent.kt @@ -5,15 +5,16 @@ import dev.enjarai.trickster.spell.Fragment import dev.enjarai.trickster.spell.fragment.VoidFragment import dev.enjarai.trickster.spell.trick.Trick import io.wispforest.endec.Endec +import io.wispforest.endec.StructEndec import io.wispforest.endec.impl.KeyedEndec +import io.wispforest.endec.impl.StructEndecBuilder import net.minecraft.nbt.NbtCompound import net.minecraft.registry.RegistryWrapper import net.minecraft.world.World import org.ladysnake.cca.api.v3.component.Component -import stellarwitch7.ram.spell.cell.Cell import stellarwitch7.ram.spell.fragment.CellFragment -import stellarwitch7.ram.spell.trick.blunder.CellNotWithinWorldBlunder -import stellarwitch7.ram.spell.trick.blunder.ImmutableCellBlunder +import stellarwitch7.ram.spell.blunder.CellNotWithinWorldBlunder +import stellarwitch7.ram.spell.blunder.ImmutableCellBlunder import java.util.* import kotlin.collections.HashMap @@ -54,4 +55,14 @@ class CellsComponent(private val world: World) : Component { companion object { val endec: KeyedEndec> = KeyedEndec("cells", Endec.map(EndecTomfoolery.UUID, Cell.endec), HashMap()) } + + data class Cell(var locked: Boolean, var value: Fragment) { + companion object { + val endec: StructEndec = StructEndecBuilder.of( + Endec.BOOLEAN.fieldOf("locked", Cell::locked), + Fragment.ENDEC.fieldOf("value", Cell::value), + ::Cell + ) + } + } } \ No newline at end of file diff --git a/src/main/kotlin/stellarwitch7/ram/spell/trick/blunder/CellNotWithinWorldBlunder.kt b/src/main/kotlin/stellarwitch7/ram/spell/blunder/CellNotWithinWorldBlunder.kt similarity index 72% rename from src/main/kotlin/stellarwitch7/ram/spell/trick/blunder/CellNotWithinWorldBlunder.kt rename to src/main/kotlin/stellarwitch7/ram/spell/blunder/CellNotWithinWorldBlunder.kt index 06205ef..2f0f821 100644 --- a/src/main/kotlin/stellarwitch7/ram/spell/trick/blunder/CellNotWithinWorldBlunder.kt +++ b/src/main/kotlin/stellarwitch7/ram/spell/blunder/CellNotWithinWorldBlunder.kt @@ -1,7 +1,7 @@ -package stellarwitch7.ram.spell.trick.blunder +package stellarwitch7.ram.spell.blunder import dev.enjarai.trickster.spell.trick.Trick -import dev.enjarai.trickster.spell.trick.blunder.TrickBlunderException +import dev.enjarai.trickster.spell.blunder.TrickBlunderException import net.minecraft.text.MutableText class CellNotWithinWorldBlunder(source: Trick) : TrickBlunderException(source) { diff --git a/src/main/kotlin/stellarwitch7/ram/spell/trick/blunder/ImmutableCellBlunder.kt b/src/main/kotlin/stellarwitch7/ram/spell/blunder/ImmutableCellBlunder.kt similarity index 73% rename from src/main/kotlin/stellarwitch7/ram/spell/trick/blunder/ImmutableCellBlunder.kt rename to src/main/kotlin/stellarwitch7/ram/spell/blunder/ImmutableCellBlunder.kt index 50d9c5e..7123809 100644 --- a/src/main/kotlin/stellarwitch7/ram/spell/trick/blunder/ImmutableCellBlunder.kt +++ b/src/main/kotlin/stellarwitch7/ram/spell/blunder/ImmutableCellBlunder.kt @@ -1,7 +1,7 @@ -package stellarwitch7.ram.spell.trick.blunder +package stellarwitch7.ram.spell.blunder import dev.enjarai.trickster.spell.trick.Trick -import dev.enjarai.trickster.spell.trick.blunder.TrickBlunderException +import dev.enjarai.trickster.spell.blunder.TrickBlunderException import net.minecraft.text.MutableText class ImmutableCellBlunder(source: Trick) : TrickBlunderException(source) { diff --git a/src/main/kotlin/stellarwitch7/ram/spell/trick/blunder/NotWithinRAMBoundsBlunder.kt b/src/main/kotlin/stellarwitch7/ram/spell/blunder/NotWithinRAMBoundsBlunder.kt similarity index 78% rename from src/main/kotlin/stellarwitch7/ram/spell/trick/blunder/NotWithinRAMBoundsBlunder.kt rename to src/main/kotlin/stellarwitch7/ram/spell/blunder/NotWithinRAMBoundsBlunder.kt index 3bdac71..2b867fa 100644 --- a/src/main/kotlin/stellarwitch7/ram/spell/trick/blunder/NotWithinRAMBoundsBlunder.kt +++ b/src/main/kotlin/stellarwitch7/ram/spell/blunder/NotWithinRAMBoundsBlunder.kt @@ -1,7 +1,7 @@ -package stellarwitch7.ram.spell.trick.blunder +package stellarwitch7.ram.spell.blunder import dev.enjarai.trickster.spell.trick.Trick -import dev.enjarai.trickster.spell.trick.blunder.TrickBlunderException +import dev.enjarai.trickster.spell.blunder.TrickBlunderException import net.minecraft.text.MutableText class NotWithinRAMBoundsBlunder(source: Trick, private val size: UInt, private val given: Int) : TrickBlunderException(source) { diff --git a/src/main/kotlin/stellarwitch7/ram/spell/trick/blunder/OutOfRAMBlunder.kt b/src/main/kotlin/stellarwitch7/ram/spell/blunder/OutOfRAMBlunder.kt similarity index 73% rename from src/main/kotlin/stellarwitch7/ram/spell/trick/blunder/OutOfRAMBlunder.kt rename to src/main/kotlin/stellarwitch7/ram/spell/blunder/OutOfRAMBlunder.kt index 0778db9..3447f1e 100644 --- a/src/main/kotlin/stellarwitch7/ram/spell/trick/blunder/OutOfRAMBlunder.kt +++ b/src/main/kotlin/stellarwitch7/ram/spell/blunder/OutOfRAMBlunder.kt @@ -1,7 +1,7 @@ -package stellarwitch7.ram.spell.trick.blunder +package stellarwitch7.ram.spell.blunder import dev.enjarai.trickster.spell.trick.Trick -import dev.enjarai.trickster.spell.trick.blunder.TrickBlunderException +import dev.enjarai.trickster.spell.blunder.TrickBlunderException import net.minecraft.text.MutableText class OutOfRAMBlunder(source: Trick) : TrickBlunderException(source) { diff --git a/src/main/kotlin/stellarwitch7/ram/spell/trick/blunder/RAMNotSupportedBlunder.kt b/src/main/kotlin/stellarwitch7/ram/spell/blunder/RAMNotSupportedBlunder.kt similarity index 71% rename from src/main/kotlin/stellarwitch7/ram/spell/trick/blunder/RAMNotSupportedBlunder.kt rename to src/main/kotlin/stellarwitch7/ram/spell/blunder/RAMNotSupportedBlunder.kt index 03957f9..79c0abc 100644 --- a/src/main/kotlin/stellarwitch7/ram/spell/trick/blunder/RAMNotSupportedBlunder.kt +++ b/src/main/kotlin/stellarwitch7/ram/spell/blunder/RAMNotSupportedBlunder.kt @@ -1,11 +1,11 @@ -package stellarwitch7.ram.spell.trick.blunder +package stellarwitch7.ram.spell.blunder import dev.enjarai.trickster.spell.trick.Trick -import dev.enjarai.trickster.spell.trick.blunder.TrickBlunderException +import dev.enjarai.trickster.spell.blunder.TrickBlunderException import net.minecraft.text.MutableText class RAMNotSupportedBlunder(source: Trick) : TrickBlunderException(source) { override fun createMessage(): MutableText { return super.createMessage().append("Caster does not support RAM") } -} \ No newline at end of file +} diff --git a/src/main/kotlin/stellarwitch7/ram/spell/cell/Cell.kt b/src/main/kotlin/stellarwitch7/ram/spell/cell/Cell.kt deleted file mode 100644 index 60aabdd..0000000 --- a/src/main/kotlin/stellarwitch7/ram/spell/cell/Cell.kt +++ /dev/null @@ -1,16 +0,0 @@ -package stellarwitch7.ram.spell.cell - -import dev.enjarai.trickster.spell.Fragment -import io.wispforest.endec.Endec -import io.wispforest.endec.StructEndec -import io.wispforest.endec.impl.StructEndecBuilder - -data class Cell(var locked: Boolean, var value: Fragment) { - companion object { - val endec: StructEndec = StructEndecBuilder.of( - Endec.BOOLEAN.fieldOf("locked", Cell::locked), - Fragment.ENDEC.fieldOf("value", Cell::value), - ::Cell - ) - } -} diff --git a/src/main/kotlin/stellarwitch7/ram/spell/mind/DefaultRAM.kt b/src/main/kotlin/stellarwitch7/ram/spell/mind/DefaultRAM.kt index 6b5032d..9808cff 100644 --- a/src/main/kotlin/stellarwitch7/ram/spell/mind/DefaultRAM.kt +++ b/src/main/kotlin/stellarwitch7/ram/spell/mind/DefaultRAM.kt @@ -7,8 +7,8 @@ import dev.enjarai.trickster.spell.fragment.VoidFragment import dev.enjarai.trickster.spell.trick.Trick import stellarwitch7.libstellar.registry.codec.CodecType import stellarwitch7.libstellar.utils.KCodecUtils -import stellarwitch7.ram.spell.trick.blunder.NotWithinRAMBoundsBlunder -import stellarwitch7.ram.spell.trick.blunder.OutOfRAMBlunder +import stellarwitch7.ram.spell.blunder.NotWithinRAMBoundsBlunder +import stellarwitch7.ram.spell.blunder.OutOfRAMBlunder open class DefaultRAM(val size: UInt) : RAM { override val type: CodecType = RAM.default diff --git a/src/main/kotlin/stellarwitch7/ram/spell/trick/cell/WriteCellTrick.kt b/src/main/kotlin/stellarwitch7/ram/spell/trick/cell/WriteCellTrick.kt index 53fb449..0c90033 100644 --- a/src/main/kotlin/stellarwitch7/ram/spell/trick/cell/WriteCellTrick.kt +++ b/src/main/kotlin/stellarwitch7/ram/spell/trick/cell/WriteCellTrick.kt @@ -10,7 +10,7 @@ class WriteCellTrick : Trick(Pattern.of(4, 6, 0, 4, 8)) { override fun activate(ctx: SpellContext, fragments: List): Fragment { val cell = expectInput(fragments, ModFragmentTypes.cell, 0) val value = expectInput(fragments, 1) - cell.set(this, ctx.source.world, value/*TODO: make this kill ephemerals*/) + cell.set(this, ctx.source.world, value.applyEphemeral()) return cell } } \ No newline at end of file diff --git a/src/main/kotlin/stellarwitch7/ram/spell/trick/mind/RAMAllocTrick.kt b/src/main/kotlin/stellarwitch7/ram/spell/trick/mind/RAMAllocTrick.kt index 051280c..c522c75 100644 --- a/src/main/kotlin/stellarwitch7/ram/spell/trick/mind/RAMAllocTrick.kt +++ b/src/main/kotlin/stellarwitch7/ram/spell/trick/mind/RAMAllocTrick.kt @@ -6,7 +6,7 @@ import dev.enjarai.trickster.spell.SpellContext import dev.enjarai.trickster.spell.fragment.NumberFragment import dev.enjarai.trickster.spell.trick.Trick import stellarwitch7.ram.cca.entity.ModEntityComponents -import stellarwitch7.ram.spell.trick.blunder.RAMNotSupportedBlunder +import stellarwitch7.ram.spell.blunder.RAMNotSupportedBlunder class RAMAllocTrick : Trick(Pattern.of(1, 4, 0, 6, 4, 8, 2, 4)) { override fun activate(ctx: SpellContext, fragments: List): Fragment { diff --git a/src/main/kotlin/stellarwitch7/ram/spell/trick/mind/RAMFreeTrick.kt b/src/main/kotlin/stellarwitch7/ram/spell/trick/mind/RAMFreeTrick.kt index 8a669c0..743a6e0 100644 --- a/src/main/kotlin/stellarwitch7/ram/spell/trick/mind/RAMFreeTrick.kt +++ b/src/main/kotlin/stellarwitch7/ram/spell/trick/mind/RAMFreeTrick.kt @@ -7,7 +7,7 @@ import dev.enjarai.trickster.spell.fragment.FragmentType import dev.enjarai.trickster.spell.fragment.VoidFragment import dev.enjarai.trickster.spell.trick.Trick import stellarwitch7.ram.cca.entity.ModEntityComponents -import stellarwitch7.ram.spell.trick.blunder.RAMNotSupportedBlunder +import stellarwitch7.ram.spell.blunder.RAMNotSupportedBlunder class RAMFreeTrick : Trick(Pattern.of(1, 4, 6, 8, 4)) { override fun activate(ctx: SpellContext, fragments: List): Fragment { diff --git a/src/main/kotlin/stellarwitch7/ram/spell/trick/mind/RAMReadTrick.kt b/src/main/kotlin/stellarwitch7/ram/spell/trick/mind/RAMReadTrick.kt index 6b1435c..5247d33 100644 --- a/src/main/kotlin/stellarwitch7/ram/spell/trick/mind/RAMReadTrick.kt +++ b/src/main/kotlin/stellarwitch7/ram/spell/trick/mind/RAMReadTrick.kt @@ -6,7 +6,7 @@ import dev.enjarai.trickster.spell.SpellContext import dev.enjarai.trickster.spell.fragment.FragmentType import dev.enjarai.trickster.spell.trick.Trick import stellarwitch7.ram.cca.entity.ModEntityComponents -import stellarwitch7.ram.spell.trick.blunder.RAMNotSupportedBlunder +import stellarwitch7.ram.spell.blunder.RAMNotSupportedBlunder class RAMReadTrick : Trick(Pattern.of(1, 4, 3, 6, 8, 5)) { override fun activate(ctx: SpellContext, fragments: List): Fragment { diff --git a/src/main/kotlin/stellarwitch7/ram/spell/trick/mind/RAMWriteTrick.kt b/src/main/kotlin/stellarwitch7/ram/spell/trick/mind/RAMWriteTrick.kt index d1ed541..e93df44 100644 --- a/src/main/kotlin/stellarwitch7/ram/spell/trick/mind/RAMWriteTrick.kt +++ b/src/main/kotlin/stellarwitch7/ram/spell/trick/mind/RAMWriteTrick.kt @@ -7,7 +7,7 @@ import dev.enjarai.trickster.spell.fragment.FragmentType import dev.enjarai.trickster.spell.fragment.VoidFragment import dev.enjarai.trickster.spell.trick.Trick import stellarwitch7.ram.cca.entity.ModEntityComponents -import stellarwitch7.ram.spell.trick.blunder.RAMNotSupportedBlunder +import stellarwitch7.ram.spell.blunder.RAMNotSupportedBlunder class RAMWriteTrick : Trick(Pattern.of(1, 4, 5, 8, 6, 3)) { override fun activate(ctx: SpellContext, fragments: List): Fragment { diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 26cf6bc..4399073 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -66,7 +66,7 @@ "fabric-api": "*", "fabric-language-kotlin": "*", "libstellar": ">=1.1.8", - "trickster": ">=2.0.0-alpha.36" + "trickster": ">=2.0.0-alpha.37" }, "suggests": { }